|
|
@ -199,15 +199,16 @@ angular.module('izhukov.mtproto', ['izhukov.utils']) |
|
|
|
|
|
|
|
|
|
|
|
return $http.post('http://' + MtpDcConfigurator.chooseServer(dcID) + '/apiw1', resultArray, { |
|
|
|
return $http.post('http://' + MtpDcConfigurator.chooseServer(dcID) + '/apiw1', resultArray, { |
|
|
|
responseType: 'arraybuffer', |
|
|
|
responseType: 'arraybuffer', |
|
|
|
transformRequest: null, |
|
|
|
transformRequest: null |
|
|
|
transformResponse: function (responseBuffer) { |
|
|
|
}).then( |
|
|
|
if (!responseBuffer || !responseBuffer.byteLength) { |
|
|
|
function (result) { |
|
|
|
|
|
|
|
if (!result.data || !result.data.byteLength) { |
|
|
|
return $q.reject({code: 406, type: 'NETWORK_BAD_RESPONSE'}); |
|
|
|
return $q.reject({code: 406, type: 'NETWORK_BAD_RESPONSE'}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
var deserializer = new TLDeserialization(responseBuffer, {mtproto: true}); |
|
|
|
var deserializer = new TLDeserialization(result.data, {mtproto: true}); |
|
|
|
var auth_key_id = deserializer.fetchLong('auth_key_id'); |
|
|
|
var auth_key_id = deserializer.fetchLong('auth_key_id'); |
|
|
|
var msg_id = deserializer.fetchLong('msg_id'); |
|
|
|
var msg_id = deserializer.fetchLong('msg_id'); |
|
|
|
var msg_len = deserializer.fetchInt('msg_len'); |
|
|
|
var msg_len = deserializer.fetchInt('msg_len'); |
|
|
@ -219,13 +220,14 @@ angular.module('izhukov.mtproto', ['izhukov.utils']) |
|
|
|
rng_seed_time(); |
|
|
|
rng_seed_time(); |
|
|
|
|
|
|
|
|
|
|
|
return deserializer; |
|
|
|
return deserializer; |
|
|
|
} |
|
|
|
}, |
|
|
|
})['catch'](function (error) { |
|
|
|
function (error) { |
|
|
|
if (!error.message && !error.type) { |
|
|
|
if (!error.message && !error.type) { |
|
|
|
error = {code: 406, type: 'NETWORK_BAD_REQUEST'}; |
|
|
|
error = {code: 406, type: 'NETWORK_BAD_REQUEST'}; |
|
|
|
} |
|
|
|
} |
|
|
|
return $q.reject(error); |
|
|
|
return $q.reject(error); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function mtpSendReqPQ (auth) { |
|
|
|
function mtpSendReqPQ (auth) { |
|
|
|