Skip to content

Releases: xtrime-ru/TelegramApiServer

Authorization refactoring

13 Jan 21:30
Compare
Choose a tag to compare

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

12 Jan 20:08
Compare
Choose a tag to compare

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

11 Jan 23:14
Compare
Choose a tag to compare

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

11 Jan 21:02
Compare
Choose a tag to compare

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

05 Jan 22:37
Compare
Choose a tag to compare

Using latest versions: MadelineProto v5, Amp Http-Server v2 and PhpDotEnv v4

Added custom method getHistoryHtml

22 Nov 22:59
Compare
Choose a tag to compare

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

22 Jul 22:10
Compare
Choose a tag to compare

Fixed bug in getMedia.

New method getMessagesHTML

22 Jul 21:57
Compare
Choose a tag to compare

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.

17 Jul 21:39
Compare
Choose a tag to compare

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.