This commit is contained in:
Daniil Gentili 2017-04-23 16:30:11 +02:00
parent 290c17b76a
commit cb59c006aa
2 changed files with 9 additions and 2 deletions

View File

@ -138,6 +138,7 @@ class MTProto
if (method_exists($elem, 'wakeup')) $this->datacenter->sockets[$key] = $elem->wakeup();
}
*/
$this->getting_state = false;
$this->bigint = PHP_INT_SIZE < 8;
$this->reset_session();
if (!isset($this->v) || $this->v !== $this->getV()) {
@ -295,8 +296,8 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
],
],
'app_info' => [ // obtained in https://my.telegram.org
'api_id' => 65536,
'api_hash' => '4251a2777e179232705e2462706f4143',
'api_id' => 2496,
'api_hash' => '8da85b0d5bfe62527e5b244c209159c3',
'device_model' => $device_model,
'system_version' => $system_version,
'app_version' => 'Unicorn', // 🌚

View File

@ -266,6 +266,9 @@ trait Files
$theend = false;
$cdn = false;
while (true) {
if ($resto = $offset % $part_size) {
$offset -= $resto;
}
try {
$res = $cdn ? $this->method_call('upload.getCdnFile', ['file_token' => $info['file_token'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'datacenter' => $datacenter]) : $this->method_call('upload.getFile', ['location' => $info['InputFileLocation'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'datacenter' => $datacenter]);
} catch (\danog\MadelineProto\RPCErrorException $e) {
@ -303,6 +306,9 @@ trait Files
if (isset($info['key'])) {
$res['bytes'] = $ige->decrypt($res['bytes']);
}
if ($resto) {
$res['bytes'] = substr($res['bytes'], $resto);
}
if ($end !== -1 && strlen($res['bytes']) + $downloaded_size >= $size) {
$res['bytes'] = substr($res['bytes'], 0, $size - $downloaded_size);
$theend = true;