github danog/MadelineProto 8.9.0

3 hours ago

MadelineProto 8.9.0 makes the thumbnails of every media downloadable, sandboxes the files served to browsers, hides the secrets typed in the CLI login, and fixes clicking keyboard buttons, the forum topic methods, the phar updates on php-fpm and several session, update loop and IPC issues.

Features:

  • Thumbnails are media: Media::$thumbs and Media::$videoThumbs now hold Thumbnail and VideoThumbnail objects, which can be downloaded, streamed, linked with getDownloadLink() and reused as upload sources or as thumb:, with bot API file IDs, by @mtalaeii in #1594 and @danog. The stripped or cached size of a media, and the thumbnail of secret chat media, is an InlineThumbnail in $thumbs too, served from memory without contacting Telegram (it replaces $thumb, $thumbWidth and $thumbHeight). Photos get width and height, and sticker thumbnails are WEBP.
  • New Files::setSandboxDownloads() setting, to turn off the sandboxing of the files served to browsers (see below), for websites serving trusted files that must be shown as their pages (HTML, SVG, PDF...).
  • The CLI login hides the bot token, API hash, 2FA password and login code as they're typed (bot tokens only show their bot ID), like the web login, which now also hides the token, the code and the API hash.

Fixes:

  • Files served to browsers can't run as pages of the website serving them: the download script (getDownloadLink()) and downloadToResponse() used the MIME type and the name given by whoever sent the file on Telegram, or by the query string of the download script, so a link could serve HTML with scripts from the website hosting the download script, and a quote in the name broke out of the Content-Disposition header. Every file is now served with Content-Security-Policy: sandbox, X-Content-Type-Options: nosniff and a normalized MIME type; only media (images but SVG, video, audio) and plain text are shown inline, everything else is downloaded as an attachment, and the name is escaped.
  • Clicking the buttons of received keyboards works again: since layer 229 (8.8.8), buttons carry their action in their type, and Button::click() did nothing.
  • Bot API keyboards are converted correctly by @xcgu in #1759 and @danog: games, poll requests without a type, forward_text, the rows after the first one, and inline buttons without an action (now refused with an explicit error).
  • createTopic(), editTopic(), openTopic(), closeTopic() and deleteTopic() of group messages always failed: they called forum methods that left the layer. Calls of the old channels.* forum methods are now sent as the messages.* ones. DialogSetChatWallPaper gets the right $same and a new $forBoth, and the peer of help.promoData is extracted.
  • Phar updates on php-fpm with opcache.validate_timestamps=0: once a new release was downloaded, opcache kept running the code of the previous one, which saw that an update was required on every request, until php-fpm was restarted. Every phar build now has its own alias, and madeline.php is invalidated in opcache once rewritten.
  • The phar no longer waits up to 18 seconds at startup when phar.madelineproto.xyz can't be reached.
  • The web request that starts a bot is ended even when something was output before (an echo in onStart(), a warning with display_errors=On): the client waited for as long as the bot ran, in #1765.
  • A timeout of help.getCdnConfig in the update loops no longer ends the process.
  • Sessions saved while waiting for the state of a connection failed after loading with "Typed property AsyncWaiter::$waitFor must not be accessed before initialization", and a state reached twice during a wait threw "Operation is no longer pending".
  • The properties removed since a session was saved are dropped when loading it, instead of being kept forever as dynamic properties (deprecated since PHP 8.2): every private call carried the state of the old libtgvoip engine. Private calls restored as running from those versions are ended.
  • Copying the authorization to another DC exports it again when the import fails with AUTH_BYTES_INVALID (another process of the same account exporting at the same time).
  • IPC: a callback returning after its call returned no longer logs "The channel was already closed!" as an error.
  • Plugins referenced more than once no longer cause "Undefined array key" errors, by @junwei-qu in #1769
  • No empty hint in the 2FA password prompt when the account has none.

Internal:

  • CI: the session tests run in parallel lanes, each with its own authorizations; the phar is built at once with the tests and released once all of them passed; the bot logs in with an exported authorization instead of its token (the build of 8.8.9 hit a FLOOD_WAIT).

What's Changed

Features

Fixes

  • Fix Bot API keyboard markup conversion for MTProto Layer 231 by @xcgu in #1759
  • Phar: give every build its own alias, so php-fpm's opcache can't run the previous release by @danog in #1760
  • Web: end the request that starts a bot even after output was sent by @danog in #1765
  • Drop the state of removed properties when unserializing old sessions by @danog in #1762
  • EventHandler: plugin's internalStart returns empty array by @junwei-qu in #1769
  • MTProto: unserialize with the default format again, so the objects of the session see it when they wake up by @danog in #1768

New Contributors

Full Changelog: 8.8.9...8.9.0

Don't miss a new MadelineProto release

NewReleases is sending notifications on new releases.