Possibly the most exciting thing to work on in this version of MadelineProto was the new update management system: I whipped it up in merely two days a few weeks ago, and it has absolutely improved the overall reliability of MadelineProto.
Huge thanks to Aliaksei Levin, the developer of tdlib, for explaining to me how exactly does the MTProto update API work: he saved me a lot of time, and was really nice <3<3<3.
While thinking of an easy way I could implement the new update system, I had an inspiration:
I created a unique, reliable, fast and extremely simple update handling system based on MadelineProto's loop API, not present in any other MTProto client, not even tdlib.
Instead of messing around with various synchronization locks, checks and cluttered update receivers, I implemented three simple feed loops.
Updates are fed to the first update loop, where some simple duplicate/hole checks are done.
Updates are then fed to a second update loop, where secondary duplicate/hole checks are done.
A third loop type takes care of eventual holes and periodically fetches updates for all supergroups, channels.
All of this is implemented without any kind of additional synchronization or locking due to the nature of the MadelineProto loop APIs, with 1% of the complexity of the official clients (which means less bugs and more pony time for me).
Naturally, async is not the only feature present in MadelineProto 4.0: to implement async in MadelineProto, I rewrote the entire codebase two times over the course of the last six months, as shown in the diff:
~$ git diff --stat old master
187 files changed, 28692 insertions(+), 12288 deletions(-)
- I completely refactored the connection stack:
I threw out of the window my custom OOP wrapper for vanilla PHP sockets and created a brand new OOP connection stack.
The new connection stack uses a brand new incremental buffered async socket wrapper Stream API, that greatly simplifies work with layered protocols like MTProto.
Each MTProto packet is passed through a Stream layer, each one taking care of one part of the MTProto envelope, finally sending off everything to telegram using a simple AMPHP socket.
The simplified async buffered implementation of AMPHP sockets I created allowed me to easily add support for ALL MTProto protocols, including a few I haven't implemented before like the padded protocol.
Obfuscation is now handled via a separate setting, and can be enabled for all transports, not just tcp_abridged
(it can be used to prevent ISP blocks in combination with the padded protocol, for example).
I also added support for different MTProto transports, including the brand new websocket transport and secure websocket transport (HTTPS), until now only implemented in tdlib!
If you want all communcations with telegram to be triple-encrypted using HTTPS+MTProto+obfuscation, you can enable the wss
transport (the third layer of encryption w/ obfuscation will be enabled automatically).
Note: the websocket HTTPS MTProto transport is different from the HTTPS MTProto protocol (both are supported by MadelineProto).
The websocket HTTPS MTProto transport is more reliable and faster than the HTTPS MTProto protocol, since MadelineProto does not have to handle HTTP long polls.
(the websocket transport may or may not also be used in future to implement MadelineProto in the browser with webassembly ;)
The new proxy API is also based on the new stream API, and now supports MTProxies!
You can still use the socks5 and HTTP transports if you want.
Writing your custom proxies now is now a LOT easier, thanks to the neat structure of the stream APIs and the abundant PHPDOC comments.
Fully asynchronous MadelineProto!
MadelineProto now features async, for incredible speed improvements, and parallel processing.
Powered by amphp, MadelineProto wraps the AMPHP APIs to provide a simpler generator-based async API.
What exactly is async, you may ask, and how is it better than threading or multiprocessing?
Async is a relatively new programming pattern that allows you to easily write non-blocking code as if you were using standard blocking functions.
More simply put: with MadelineProto 4.0, each update is handled in parallel using a separate thread, and everything is MUCH faster (even on restricted webhosts; this is perfect for creating file downloader bots!).
To enable async, you have to do two simple things:
1) Load the latest version of MadelineProto
2) yield your method calls.
That's it!
No need to set up thread pools, use synchronization primitives, and so on...
Just yield $MadelineProto->messages->sendMessage
instead of $MadelineProto->messages->sendMessage
.
Changed Constructors:
Added flags param to inputMediaGeoLive
Added stopped param to inputMediaGeoLive
Added file_reference param to inputPhoto
Added file_reference param to inputFileLocation
Added file_reference param to inputDocumentFileLocation
Removed version param from inputDocumentFileLocation
Added file_reference param to fileLocation
Added admin_rights param to chat
Added default_banned_rights param to chat
Removed admins_enabled param from chat
Removed admin param from chat
Added default_banned_rights param to channel
Removed editor param from channel
Removed democracy param from channel
Added flags param to chatFull
Added can_set_username param to chatFull
Added about param to chatFull
Added pinned_msg_id param to chatFull
Added can_view_stats param to channelFull
Added online_count param to channelFull
Added file_reference param to photo
Added flags param to wallPaper
Added creator param to wallPaper
Added default param to wallPaper
Added pattern param to wallPaper
Added dark param to wallPaper
Added access_hash param to wallPaper
Added slug param to wallPaper
Added document param to wallPaper
Added settings param to wallPaper
Removed title param from wallPaper
Removed sizes param from wallPaper
Removed color param from wallPaper
Added can_pin_message param to userFull
Added pinned_msg_id param to userFull
Added flags param to messages.messagesSlice
Added inexact param to messages.messagesSlice
Added lang_code param to updateLangPackTooLong
Added pfs_enabled param to config
Added base_lang_pack_version param to config
Added flags param to help.appUpdate
Added popup param to help.appUpdate
Added version param to help.appUpdate
Added entities param to help.appUpdate
Added document param to help.appUpdate
Removed critical param from help.appUpdate
Added file_reference param to inputDocument
Added flags param to document
Added file_reference param to document
Added thumbs param to document
Removed thumb param from document
Removed version param from document
Added current param to authorization
Added official_app param to authorization
Added password_pending param to authorization
Added has_password param to account.password
Added current_algo param to account.password
Added srp_B param to account.password
Added srp_id param to account.password
Added new_algo param to account.password
Added new_secure_algo param to account.password
Removed current_salt param from account.password
Removed new_salt param from account.password
Removed new_secure_salt param from account.password
Added flags param to account.passwordSettings
Added secure_settings param to account.passwordSettings
Removed secure_salt param from account.passwordSettings
Removed secure_secret param from account.passwordSettings
Removed secure_secret_id param from account.passwordSettings
Added new_algo param to account.passwordInputSettings
Added new_secure_settings param to account.passwordInputSettings
Removed new_salt param from account.passwordInputSettings
Removed new_secure_salt param from account.passwordInputSettings
Removed new_secure_secret param from account.passwordInputSettings
Removed new_secure_secret_id param from account.passwordInputSettings
Added thumb param to stickerSet
Added self param to channelParticipantAdmin
Added from_name param to messageFwdHeader
Removed ordered param from pageBlockList
Added flags param to pageBlockPhoto
Added url param to pageBlockPhoto
Added webpage_id param to pageBlockPhoto
Added flags param to phoneCall
Added p2p_allowed param to phoneCall
Added flags param to langPackLanguage
Added official param to langPackLanguage
Added rtl param to langPackLanguage
Added beta param to langPackLanguage
Added base_lang_code param to langPackLanguage
Added plural_code param to langPackLanguage
Added strings_count param to langPackLanguage
Added translated_count param to langPackLanguage
Added translations_url param to langPackLanguage
Added translation param to secureValue
Added translation param to inputSecureValue
Removed selfie_required param from account.authorizationForm
Deleted Methods (other methods can be used, instead):
Removed contacts.exportCard
Removed contacts.importCard
Removed messages.toggleChatAdmins
Removed channels.editAbout
Removed channels.exportInvite
Removed channels.toggleInvites
Removed channels.updatePinnedMessage
New Methods:
Added account.confirmPasswordEmail
Added account.resendPasswordEmail
Added account.cancelPasswordEmail
Added account.getContactSignUpNotification
Added account.setContactSignUpNotification
Added account.getNotifyExceptions
Added account.getWallPaper
Added account.uploadWallPaper
Added account.saveWallPaper
Added account.installWallPaper
Added account.resetWallPapers
Added account.getAutoDownloadSettings
Added account.saveAutoDownloadSettings
Added contacts.getContactIDs
Added contacts.deleteByPhones
Added messages.clearAllDrafts
Added messages.updatePinnedMessage
Added messages.sendVote
Added messages.getPollResults
Added messages.getOnlines
Added messages.getStatsURL
Added messages.editChatAbout
Added messages.editChatDefaultBannedRights
Added messages.getEmojiKeywords
Added messages.getEmojiKeywordsDifference
Added messages.getEmojiURL
Added help.getAppConfig
Added help.getPassportConfig
Added help.getSupportName
Added help.getUserInfo
Added help.editUserInfo
Added langpack.getLanguage
The PWRTelegram app is back!
And thanks to @windoz, it's more powerful than ever!
Features:
- Read old messages
- Read history of supergrups and channels
- Search by username + local database
Source: https://github.com/andrew-ld/PWRTelegram
Download: https://github.com/andrew-ld/PWRTelegram/releases/download/5.4-pwrt/TMessagesProj-afat-release.apk
To the people thinking that this won't change anything, govs and corps simply don't care about us, I reply: yes, this won't change anything in the immediate, in the current governments: but that's the nice thing about democracy
, governments change.
Maybe the strikes won't change a lot, but the media and social coverage will raise awareness to the issue, which will, in turn, convince more people to vote for parties that will actually do somemething about the issue (which, I think, is the main reason why the strikes are so close to the European elections).
I know they convinced me, I hope I can do the same for you.
Hello again, PWRT & Madeline users!
I have made a little update to PWRT Docker image.
What I've done? Nothing special..
I have fixed few bugs and enabled storage.* domain.
So you can use storage api!
This image has tag 0.4.3
and latest
I've also re-pushed the previous image and tagged it as houna/pwrt:0.4.2
, so it can still downloadable..
For any problem, DON'T write me in private. Use @pwrtelegramgroup instead
Hav a noice day!
Docker Hub Link: https://hub.docker.com/r/houna/pwrt
❤️
Читать полностью…Hi people!
I've pushed new image version of PWRT on Docker Hub, the v0.2.
What is changed? Not much...
I added (as a requesto from Daniil few days ago) a directive (composer update) in the Caddyfile..
I've also re-pushed the first image and tagged it with pwrt:0.1, so it can still downloadable..
Hav a noice day!
PWRT DOCKER: https://hub.docker.com/r/houna/pwrt
PS: From now, latest tag, will be the same ID as the latest tag number (es 0.2, 0.3 etc) pushed..
Actualli latest tag is same as v0.2
Streams and proxies aren't the only things that have been completely rewritten in this release:
I have written a unique socket message handler API based on MadelineProto's loop API, and guarantees maximum reliability while communicating with telegram.
By the way, the new async background loop API can also be used by you! It is perfect for repeating tasks in a cron-like manner, running multiple resumable event loops and much more! More on that later.
The new message handler loops run in the background, and guarantee that every single method call you make gets delivered to telegram.
Two signal loops running in two separate green threads take care of writing and reading data from the socket asynchronously.
A third signal loop uses state request messages to make sure that the method calls were received by telegram, and queries replies/resend method calls if something's wrong.
A fourth signal loop takes care of HTTP long polling.
This guarantees maximum stability even if telegram's having server issues.
The write loop also greatly reduces overhead, increasing performances by automatically wrapping in containers multiple method calls: this is especially useful when making multiple method calls simultaneously with async (more on that later).
The update state is now stored using a custom UpdatesState
API, that will simplify backup to a DBMS backend later on :).
And now, on to the API changes:
- First of all, we've got several bucketloads of telegram API changes, that can be viewed in the first posts.
- Very important, I wrote documentation on what to do if your account gets banned.
- Dropped support for PHP 5 and PHP 7.0: these versions of PHP have officially reached their end of life, so MadelineProto will not support them anymore.
You should use MadelineProto with PHP 7.3 (or PHP 7.2; PHP 7.1 is supported but not recommended).
- Dropped support for get_updates: it won't work properly on async, and I really recommend you stop using it
- You can now use the @support
username in sendMessage and other methods to send messages to the support user!
- Now MadelineProto will automatically try to get the access hash of users not present in the internal peer database (this should reduce errors)!
- If any file cannot be downloaded to due issues with the tg media server that is hosting it, it will be automatically sent to the @support
user (settings).
- Documented the MyTelegramOrgWrapper API, that can be used to login programmaticaly to the my.telegram.org management page and get the API ID of your app.
- Added an update_2fa method to update the login password
- Added a get_full_dialogs method to get a full list of all chats you’re member of, including dialog info (such as the pinned/last message ID, unread count, tag count, notification settings and message drafts).
- Added support for automatic file uploads by name in secret chats (as with normal chats); you can also now send secret chat messages using the sendMessage method as if it were a normal chat
- Added a resetUpdateState method to reset the update state and fetch ALL updates from the beginning
- Improved chat message splitting algorithm, for when the message you're trying to send is too long: performance improvements, and it will now notify you via the logs if there are too many entities in the logs, or if the entities are too long.
- Improved the get_self method.
- Added a __magic_sleep substitute for __sleep
in the CombinedEventHandler
- Removed all dependencies to curl
: now all HTTP requests are made asynchronously using a custom version of artax (more on that later).
- Updated php-libtgvoip and introduced a common API for changing phone call settings
- Improved the madeline.php
loader
- Removed the old serialization APIs: now serialization is done automatically by MadelineProto!
- Increased the default flood wait limit to 10 minutes, since with async waiting for the flood wait isn't blocking anymore
- When running from web, MadelineProto will also automatically enable logging of PHP errors (not MadelineProto logs) to a MadelineProto.log
file located in the same directory as the script that loaded MadelineProto.
Deleted Constructors (other constructors can be used, instead):
Removed wallPaperSolid
Removed updateContactRegistered
Removed updateChatAdmins
Removed account.noPassword
Removed pagePart
Removed pageFull
Removed channelAdminRights
Removed channelBannedRights
New Constructors:
Added inputMediaPoll
Added messageMediaPoll
Added messageActionContactSignUp
Added photoStrippedSize
Added inputNotifyBroadcasts
Added inputReportReasonChildAbuse
Added inputReportReasonCopyright
Added updateUserPinnedMessage
Added updateChatPinnedMessage
Added updateMessagePoll
Added updateChatDefaultBannedRights
Added notifyBroadcasts
Added inputPrivacyKeyPhoneP2P
Added inputPrivacyKeyForwards
Added inputPrivacyKeyProfilePhoto
Added privacyKeyPhoneP2P
Added privacyKeyForwards
Added privacyKeyProfilePhoto
Added channelParticipantsContacts
Added textSubscript
Added textSuperscript
Added textMarked
Added textPhone
Added textImage
Added textAnchor
Added pageBlockKicker
Added pageBlockTable
Added pageBlockOrderedList
Added pageBlockDetails
Added pageBlockRelatedArticles
Added pageBlockMap
Added channelAdminLogEventActionDefaultBannedRights
Added channelAdminLogEventActionStopPoll
Added secureValueError
Added secureValueErrorTranslationFile
Added secureValueErrorTranslationFiles
Added passwordKdfAlgoUnknown
Added passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow
Added securePasswordKdfAlgoUnknown
Added securePasswordKdfAlgoPBKDF2HMACSHA512iter100000
Added securePasswordKdfAlgoSHA512
Added secureSecretSettings
Added inputCheckPasswordEmpty
Added inputCheckPasswordSRP
Added secureRequiredType
Added secureRequiredTypeOneOf
Added help.passportConfigNotModified
Added help.passportConfig
Added jsonObjectValue
Added jsonNull
Added jsonBool
Added jsonNumber
Added jsonString
Added jsonArray
Added jsonObject
Added pageTableCell
Added pageTableRow
Added pageCaption
Added pageListItemText
Added pageListItemBlocks
Added pageListOrderedItemText
Added pageListOrderedItemBlocks
Added pageRelatedArticle
Added page
Added help.supportName
Added help.userInfoEmpty
Added help.userInfo
Added pollAnswer
Added poll
Added pollAnswerVoters
Added pollResults
Added chatOnlines
Added statsURL
Added chatAdminRights
Added chatBannedRights
Added inputWallPaper
Added inputWallPaperSlug
Added account.wallPapersNotModified
Added account.wallPapers
Added codeSettings
Added wallPaperSettings
Added autoDownloadSettings
Added account.autoDownloadSettings
Added emojiKeyword
Added emojiKeywordDeleted
Added emojiKeywordsDifference
Added emojiURL
Changed Methods:
Added settings param to auth.sendCode
Removed flags param from auth.sendCode
Removed allow_flashcall param from auth.sendCode
Removed current_number param from auth.sendCode
Added password param to auth.checkPassword
Removed password_hash param from auth.checkPassword
Added hash param to account.getWallPapers
Added settings param to account.sendChangePhoneCode
Removed flags param from account.sendChangePhoneCode
Removed allow_flashcall param from account.sendChangePhoneCode
Removed current_number param from account.sendChangePhoneCode
Added password param to account.getPasswordSettings
Removed current_password_hash param from account.getPasswordSettings
Added password param to account.updatePasswordSettings
Removed current_password_hash param from account.updatePasswordSettings
Added settings param to account.sendConfirmPhoneCode
Removed flags param from account.sendConfirmPhoneCode
Removed allow_flashcall param from account.sendConfirmPhoneCode
Removed current_number param from account.sendConfirmPhoneCode
Added password param to account.getTmpPassword
Removed password_hash param from account.getTmpPassword
Added settings param to account.sendVerifyPhoneCode
Removed flags param from account.sendVerifyPhoneCode
Removed allow_flashcall param from account.sendVerifyPhoneCode
Removed current_number param from account.sendVerifyPhoneCode
Added peer param to messages.exportChatInvite
Removed chat_id param from messages.exportChatInvite
Removed stop_geo_live param from messages.editMessage
Removed geo_point param from messages.editMessage
Removed stop_geo_live param from messages.editInlineBotMessage
Removed geo_point param from messages.editInlineBotMessage
Added source param to help.getAppUpdate
Added flags param to phone.setCallRating
Added user_initiative param to phone.setCallRating
Added lang_pack param to langpack.getLangPack
Added lang_pack param to langpack.getStrings
Added lang_pack param to langpack.getDifference
Added lang_code param to langpack.getDifference
Added lang_pack param to langpack.getLanguages
MadelineProto was updated!
Fully asynchronous MadelineProto!
MadelineProto now features async, for incredible speed improvements, and parallel processing.
The telegram API changelog is just enormous, and the MadelineProto API changelog is even bigger, so I'll split this in multiple messages.
Boring Telegram API changelog: /channel/MadelineProto/431
MadelineProto API changelog (read this): /channel/MadelineProto/437
Future MadelineProto API features: /channel/MadelineProto/449
Some people told me that they will participate in the strikes, so I ask you: send your photos of the protests to @pwrtelegramgroup, tomorrow, 14 March 2019.
Читать полностью…Will you strike tomorrow, for our future, for the future of our planet?
As you all probably know, with the increasing pollution of our planet, a great threat is hovering over the future of the new generation = our future.
The obtusity of current governments is doing little or NOTHING to prevent the impending climate catastrophe, whose effects we can already see: extreme weather events, global warming and extreme pollution in most developed countries.
For example, levels of particulate matter in the Padan Plain, Italy (where I live), are close to those of Beijing, the capital of China.
Scientists say we have some seven years before the process becomes irreversible, we, the young generation, must act fast in order to save our future.
Hundreds of events are being organized all over the world, join the strike and try to make it count!
Share the message to all your groups and friends here on Telegram, and let your physical family and friends know, too!
International website
Italian website
#FridaysForFuture
#ClimateStrike
MadelineProto was updated!
- Huge bugfixes and perfomance improvements!
- Better CLI/web login UI!
- Added automatical TOS flow!
Now, when and if telegram decides to update their TOS, MadelineProto will throw a \danog\MadelineProto\Exception with message "TOS action required, check the logs", and the logs will contain the full terms of service.
You will be required to accept them or refuse them, using the accept_tos() or decline_tos() methods.
Note that the decline_tos method will also delete your account, due to the TOS.
- Updated @magnaluna!
- HUGE file upload/download speed improvements!
- Implemented automatic message splitting if the length is bigger than 4096, even for markdown and HTML messages!
- You can now omit all string, byte and array parameters, they will be automatically populated by MadelineProto!
- COMBINED EVENT DRIVEN UPDATE HANDLING: https://docs.madelineproto.xyz/docs/UPDATES.html#combined-event-driven
You can now use a single event handler to manage updates from multiple MadelineProto instances! Very useful for group management bots coupled with inline bots.
- And, most importantly:
LAYER 82: tons of new features, edit media messages, Telegram Passport, Telegram Login, account export and MTProto proxies!
BOTS:
- New inputBotInlineResult for sending webdocument objects as inline results, that once sent and received as botInlineResult by the user, can be downloaded/proxied through telegram using upload.getWebFile.
TELEGRAM PASSPORT:
- New account.getAuthorizationForm method (bots) for sending the telegram passport authorization form.
- New account.acceptAuthorization method for accepting the authorization form.
- New account.saveSecureValue method for saving a telegram passport secure value (like your passport, your ID card, and so on...).
- New account.getSecureValue method for getting a telegram passport secure value.
- New account.getAllSecureValues method for getting all telegram passport secure values.
- New account.deleteSecureValue method for deleting a telegram passport secure value.
- New user.setSecureValueErrors method for notifying the user about errors in a telegram passport secure value.
GDPR ACCOUNT EXPORT:
- New account.initTakeoutSession for initialising account export.
- New account.finishTakeoutSession for ending account export.
- New channels.getLeftChannels method for fetching a list of channels you left!
- New messages.getSplitRanges method for fetching a list of message IDs to download!
- New invokeWithTakeout and invokeWithMessagesRange methods for calling takeout methods like messages.getHistory, messages.getDialogs.
MESSAGES:
- New messages.report method for reporting messages in groups
- messages.editMessage can now be used to edit MEDIA messages!
- New help.getDeepLinkInfo method for fetching info about deep links!
- New messageActionBotAllowed service message for telegram login notifications!
- New messageEntityPhone and messageEntityCashtag entities for blue link goodies in messages!
VCARD/CONTACTS:
- New vcard parameter for inputMediaContact to use with sendMedia!
- New vcard parameter for messageMediaContact, to be received in updates!
- New contacts.getSaved method for fetching all saved contacts.
- New contacts.toggleTopPeers method for deleting/adding top peers (the users you see when you click the search button in the app).
PROXIES:
- New help.getProxyData method for fetching info (sponsored channels) of the current proxy!
UNREAD CHATS:
- New updateDialogUndreadMark for updates for when you manually mark a dialog as unread using messages.markDialogUnread; use messages.getDialogUnreadMarks to get a list of all dialogs marked as unread manually.
- Improved stickerSet constructor for stickerpacks!
Stay tuned for updates, now that my exams are over, cool new proxy POCs coming up, along 100x speed improvements with asynchronous magic and long-awaited snakes!
EU is about to kill the internet with the new copyright law.
Call the EU Parliament NOW to stop this madness: https://changecopyright.org/
You can also do the same from telegram using the following bot: @changecopyrightbot
❤️
Читать полностью…❤️
Читать полностью…#pwrprojects @uploaditbot
This bot allows you to upload files of up to 1.5GB to telegram from a link, using MadelineProto.
created by @YoilyL
Just for the noobs, the docker image https://hub.docker.com/r/houna/pwrt/ can be used to easily install pwrtelegram on your server, for free.
Читать полностью…