Releases: xtrime-ru/TelegramApiServer
Authorization refactoring
Authorization system was rewritten and now relies on middleware interface of amp http-server. Websocket events endpoint now protected in same way as api endpoint.
Websocket EventHandler
TelegramApiSever now supports MadelineProto EventHandler.
Connect to ws://127.0.0.1:9503/events
to subscribe to all events from running MadelineProto. Each event stored inside object, where key is name of session which created event.
When using CombinedAPI (multiple account) name of session can be added to path of websocket endpoint: ws://127.0.0.1:9503/events/session_name
. This endpoint will emmit events only from given session.
PHP websocket client example: websocket-events.php
Multiple session update
If running with multiple sessions use include 'session' in path, before method, to define which session to use for request.
Examples
- Run server:
php server.php --session=session --session=bot --session=xtrime
- Use
xtrime.madeline
session:http://127.0.0.1:9503/api/xtrime/getSelf
- Use
bot.madeline
session:http://127.0.0.1:9503/api/bot/getSelf
- Use
session.madeline
session:http://127.0.0.1:9503/api/session/getSelf
Multiple sessions support
Now TelegramApiServer supports MadelineProto CombinedAPI.
You can use one server instance to access multiple MadelineProto sessions via one port. Start server with multiple --session
options and add to every request 'session' parameter to specify, which session to use for command execution.
If you running server with one session (default mode) no additional parameters needed.
Examples:
php server.php --session=user1 --session=bot --session=user2
http://127.0.0.1:9503/api/getSelf/?session=user1
http://127.0.0.1:9503/api/getSelf/?session=bot
http://127.0.0.1:9503/api/getInfo/?id=@xtrime&session=user2
http://127.0.0.1:9503/api/getHistory?data[peer]=@breakingmash&session= user1
Updated requirements
Using latest versions: MadelineProto v5, Amp Http-Server v2 and PhpDotEnv v4
Added custom method getHistoryHtml
New method has same interface as standard getHistory, except there is HTML instead of messages texts. Html is generated from entities.
Method getMessagesHTML was removed.
getMedia fix
Fixed bug in getMedia.
New method getMessagesHTML
Changes sinse 1.0.0:
- Added new method to generate HTML from message with entities (thanks to @tioffs);
- renamed 'channel' to 'peer' in getMedia and getMediaPreview input;
- fixed copyMessages and searchGlobal methods
All features ready.
This release includes following features:
- amphp http server;
- full support of latest madelineProto (TL_Layer 103), including async mode;
- download of media files via streams directly to browser/client;
- all known bugs are fixed.