1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 19:24:42 +01:00

Secret chat fixes

This commit is contained in:
Daniil Gentili 2023-09-06 17:45:58 +02:00
parent 4d9987538c
commit 3abf8b5101
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
7 changed files with 18 additions and 30 deletions

@ -1 +1 @@
Subproject commit 5ac5e7a012be37cf4931c1edc0d516a72793ac16
Subproject commit 09cdf1a2424fd117585c5d21eca3e5dcdf2a484f

View File

@ -36,7 +36,7 @@ class Exception extends \Exception
{
return $this->file === 'MadelineProto' ? $this->message : '\\danog\\MadelineProto\\Exception'.($this->message !== '' ? ': ' : '').$this->message.' in '.$this->file.':'.$this->line.PHP_EOL.Magic::$revision.PHP_EOL.'TL Trace:'.PHP_EOL.$this->getTLTrace();
}
public function __construct($message = null, $code = 0, ?self $previous = null, $file = null, $line = null)
public function __construct($message = null, $code = 0, ?\Throwable $previous = null, $file = null, $line = null)
{
$this->prettifyTL();
if ($file !== null) {

View File

@ -79,11 +79,11 @@ final class GarbageCollector
return;
}
$client = HttpClientBuilder::buildDefault();
$request = new Request(MADELINE_RELEASE_URL);
$id = null;
$cb = function () use ($client, $request, &$id): void {
$cb = function () use ($client, &$id): void {
try {
$request = new Request(MADELINE_RELEASE_URL);
$latest = $client->request($request);
Magic::$latest_release = \trim($latest->getBody()->buffer());
if (API::RELEASE !== Magic::$latest_release) {

View File

@ -20,6 +20,7 @@ declare(strict_types=1);
namespace danog\MadelineProto\Ipc;
use Amp\CompositeException;
use Amp\DeferredFuture;
use Amp\Future;
use Amp\Ipc\IpcServer;
@ -101,6 +102,7 @@ class Server extends Loop
{
$id = Tools::randomInt(2000000000);
$started = false;
$e = null;
try {
Logger::log("Starting IPC server $session (process)");
ProcessRunner::start((string) $session, $id);
@ -115,15 +117,20 @@ class Server extends Loop
if (WebRunner::start((string) $session, $id)) {
$started = true;
}
} catch (Throwable $e) {
Logger::log($e);
} catch (Throwable $e2) {
Logger::log($e2);
if ($e) {
$e = new CompositeException([$e, $e2]);
} else {
$e = $e2;
}
}
return async(self::monitor(...), $session, $id, $started);
return async(self::monitor(...), $session, $id, $started, $e);
}
/**
* Monitor session.
*/
private static function monitor(SessionPaths $session, int $id, bool $started): bool|Throwable
private static function monitor(SessionPaths $session, int $id, bool $started, ?\Throwable $e): bool|Throwable
{
if (!$started) {
Logger::log("It looks like the server couldn't be started, trying to connect anyway...");
@ -139,7 +146,7 @@ class Server extends Loop
Logger::log('IPC server started successfully!');
return true;
} elseif (!$started && $count > 0 && $count > 2*($state ? 3 : 1)) {
return new Exception("We couldn't start the IPC server, please check the logs!");
return new Exception("We couldn't start the IPC server, please check the logs!", previous: $e);
}
delay(0.5);
$count++;

View File

@ -1,19 +0,0 @@
bot_thumbnail#0 dc_id:int id:long access_hash:long volume_id:long = File;
bot_profile_photo#1 dc_id:int id:long access_hash:long volume_id:long = File;
bot_photo#2 dc_id:int id:long access_hash:long volume_id:long = File;
bot_voice#3 dc_id:int id:long access_hash:long = File;
bot_video#4 dc_id:int id:long access_hash:long = File;
bot_document#5 dc_id:int id:long access_hash:long = File;
bot_encrypted#6 dc_id:int id:long access_hash:long = File;
bot_temp#7 dc_id:int id:long access_hash:long = File;
bot_sticker#8 dc_id:int id:long access_hash:long = File;
bot_audio#9 dc_id:int id:long access_hash:long = File;
bot_gif#A dc_id:int id:long access_hash:long = File;
bot_encrypted_thumbnail#B dc_id:int id:long access_hash:long = File;
bot_wallpaper#C dc_id:int id:long access_hash:long = File;
bot_video_note#D dc_id:int id:long access_hash:long = File;
bot_secure_raw#F dc_id:int id:long access_hash:long = File;
bot_secure#10 dc_id:int id:long access_hash:long = File;
bot_background#11 dc_id:int id:long access_hash:long = File;
bot_size#12 dc_id:int id:long access_hash:long = File;

View File

@ -95,7 +95,7 @@ messageEntityStrike#bf0693d4 offset:int length:int = MessageEntity;
messageEntityBlockquote#20df5d0 offset:int length:int = MessageEntity;
===143===
decryptedMessageMediaDocument#8e4c064c thumb:bytes thumb_w:int thumb_h:int mime_type:string size:long key:bytes iv:bytes attributes:Vector<DocumentAttribute> caption:string = DecryptedMessageMedia;
decryptedMessageMediaDocument#6abd9782 thumb:bytes thumb_w:int thumb_h:int mime_type:string size:long key:bytes iv:bytes attributes:Vector<DocumentAttribute> caption:string = DecryptedMessageMedia;
===144===
messageEntitySpoiler#32ca960f offset:int length:int = MessageEntity;

View File

@ -13,7 +13,7 @@ function layerUpgrade(int $layer): void
file_put_contents('docs/docs/docs/USING_METHODS.md', $doc);
array_map(unlink::class, glob('src/*.tl'));
foreach (['TL_mtproto_v1', "TL_telegram_v$layer", 'TL_secret', 'TL_botAPI'] as $schema) {
foreach (['TL_mtproto_v1', "TL_telegram_v$layer", 'TL_secret'] as $schema) {
copy("schemas/$schema.tl", "src/$schema.tl");
}