🔄 Sync local code

This commit is contained in:
Sam 2022-01-11 22:35:38 +08:00
parent ec9e92d6d8
commit a2ccdb2378
Signed by: sam01101
GPG Key ID: 42D7B6D13FF5E611
9 changed files with 49 additions and 21 deletions

3
.github/FUNDING.yml vendored
View File

@ -1,3 +0,0 @@
github: delivrance
liberapay: delivrance
open_collective: pyrogram

View File

@ -9,7 +9,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] python-version: [3.7, 3.8, 3.9, "3.10", "pypy-3.7", "pypy-3.8"]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -107,6 +107,11 @@ class Client(Methods, Scaffold):
Only applicable for new sessions and will be ignored in case previously created sessions are loaded. Only applicable for new sessions and will be ignored in case previously created sessions are loaded.
Defaults to False. Defaults to False.
mode (``int``, *optional*):
The connection mode to use.
Defaults to Obfuscated TCPAbridged (3),
The list of modes are available at `connection/connection.py`
bot_token (``str``, *optional*): bot_token (``str``, *optional*):
Pass your Bot API token to create a bot session, e.g.: "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11" Pass your Bot API token to create a bot session, e.g.: "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
Only applicable for new sessions. Only applicable for new sessions.
@ -188,6 +193,7 @@ class Client(Methods, Scaffold):
ipv6: bool = False, ipv6: bool = False,
proxy: dict = None, proxy: dict = None,
test_mode: bool = False, test_mode: bool = False,
mode: int = 3,
bot_token: str = None, bot_token: str = None,
phone_number: str = None, phone_number: str = None,
phone_code: str = None, phone_code: str = None,
@ -216,6 +222,7 @@ class Client(Methods, Scaffold):
# TODO: Make code consistent, use underscore for private/protected fields # TODO: Make code consistent, use underscore for private/protected fields
self._proxy = proxy self._proxy = proxy
self.test_mode = test_mode self.test_mode = test_mode
self.mode = mode
self.bot_token = bot_token self.bot_token = bot_token
self.phone_number = phone_number self.phone_number = phone_number
self.phone_code = phone_code self.phone_code = phone_code

View File

@ -199,6 +199,30 @@ server_public_keys = {
16 16
), # Modulus ), # Modulus
int("010001", 16) # Exponent int("010001", 16) # Exponent
),
# -5741912883845771609
0xb050a0a773224ea7 - (1 << 64): PublicKey( # MTPager DEV
# -----BEGIN RSA PUBLIC KEY-----
# MIIBCgKCAQEAyY9aW/0U3Vpju5QWHi46n7OFHZnRfDRP34mX4k6xnK4xY14phjqa
# Slt0Jr37o/fLXyXCDSX3HoAG1uRNMiXss7luC1qkQBME8dHGWCprbkfjrh7HkrEd
# UkKU7FkSPqwVqEaNGwO8xedGXJYcZflVqDNA3V+prPSRvrsRw5aCXOxJvKy1AhVi
# fKCh+z59cMvn/H6U51H9E3+iAg0VkF5nQ+yemjP8BJ+/B2Be3TOMcQyEVC19JLj8
# EwBdYAVtEQbwYfjvhkU8m0PMYgCcg4jqKT/G4Z6vJd3Pd8ml/dkmcgz+OS5hOesk
# 9yJ+u5S2J86nLEJcPxajvOJ05GFpBZY/rQIDAQAB
# -----END RSA PUBLIC KEY-----
int(
"C98F5A5BFD14DD5A63BB94161E2E3A9FB3851D99D17C344FDF8997E24EB19CAE"
"31635E29863A9A4A5B7426BDFBA3F7CB5F25C20D25F71E8006D6E44D3225ECB3"
"B96E0B5AA4401304F1D1C6582A6B6E47E3AE1EC792B11D524294EC59123EAC15"
"A8468D1B03BCC5E7465C961C65F955A83340DD5FA9ACF491BEBB11C396825CEC"
"49BCACB50215627CA0A1FB3E7D70CBE7FC7E94E751FD137FA2020D15905E6743"
"EC9E9A33FC049FBF07605EDD338C710C84542D7D24B8FC13005D60056D1106F0"
"61F8EF86453C9B43CC62009C8388EA293FC6E19EAF25DDCF77C9A5FDD926720C"
"FE392E6139EB24F7227EBB94B627CEA72C425C3F16A3BCE274E4616905963FAD",
16
), # Modulus
int("010001", 16) # Exponent
) )
} }

View File

@ -18,7 +18,7 @@
from gzip import compress, decompress from gzip import compress, decompress
from io import BytesIO from io import BytesIO
from typing import cast, Any from typing import Any
from .primitives.bytes import Bytes from .primitives.bytes import Bytes
from .primitives.int import Int from .primitives.int import Int
@ -37,8 +37,7 @@ class GzipPacked(TLObject):
@staticmethod @staticmethod
def read(data: BytesIO, *args: Any) -> "GzipPacked": def read(data: BytesIO, *args: Any) -> "GzipPacked":
# Return the Object itself instead of a GzipPacked wrapping it return GzipPacked(TLObject.read(
return cast(GzipPacked, TLObject.read(
BytesIO( BytesIO(
decompress( decompress(
Bytes.read(data) Bytes.read(data)

View File

@ -42,6 +42,7 @@ class Auth:
self.test_mode = test_mode self.test_mode = test_mode
self.ipv6 = client.ipv6 self.ipv6 = client.ipv6
self.proxy = client.proxy self.proxy = client.proxy
self.mode = client.mode
self.connection = None self.connection = None
@ -76,7 +77,7 @@ class Auth:
# The server may close the connection at any time, causing the auth key creation to fail. # The server may close the connection at any time, causing the auth key creation to fail.
# If that happens, just try again up to MAX_RETRIES times. # If that happens, just try again up to MAX_RETRIES times.
while True: while True:
self.connection = Connection(self.dc_id, self.test_mode, self.ipv6, self.proxy) self.connection = Connection(self.dc_id, self.test_mode, self.ipv6, self.proxy, False, self.mode)
try: try:
log.info(f"Start creating a new auth key on DC{self.dc_id}") log.info(f"Start creating a new auth key on DC{self.dc_id}")

View File

@ -21,9 +21,7 @@ from typing import Tuple
class DataCenter: class DataCenter:
TEST = { TEST = {
1: "149.154.175.10", 2: "tg.dev01.0s.hk",
2: "149.154.167.40",
3: "149.154.175.117",
} }
PROD = { PROD = {
@ -65,7 +63,7 @@ class DataCenter:
else: else:
ip = cls.TEST[dc_id] ip = cls.TEST[dc_id]
return ip, 80 return ip, 443
else: else:
if ipv6: if ipv6:
if media: if media:

View File

@ -68,6 +68,7 @@ class Session:
self.test_mode = test_mode self.test_mode = test_mode
self.is_media = is_media self.is_media = is_media
self.is_cdn = is_cdn self.is_cdn = is_cdn
self.mode = client.mode
self.connection = None self.connection = None
@ -103,7 +104,8 @@ class Session:
self.test_mode, self.test_mode,
self.client.ipv6, self.client.ipv6,
self.client.proxy, self.client.proxy,
self.is_media self.is_media,
self.mode
) )
try: try:

View File

@ -131,13 +131,13 @@ if len(argv) > 1 and argv[1] in ["bdist_wheel", "install", "develop"]:
errors_compiler.start() errors_compiler.start()
setup( setup(
name="Pyrogram", name="MTPyroger",
version=version, version=version,
description="Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots", description="A Pyrogram for MTPager for testing purposes",
long_description=readme, long_description=readme,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
url="https://github.com/pyrogram", url="https://github.com/Xtao-Labs",
download_url="https://github.com/pyrogram/pyrogram/releases/latest", download_url="https://github.com/Xtao-Labs/pyrogram/releases/latest",
author="Dan", author="Dan",
author_email="dan@pyrogram.org", author_email="dan@pyrogram.org",
license="LGPLv3+", license="LGPLv3+",
@ -164,11 +164,11 @@ setup(
"Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries :: Application Frameworks" "Topic :: Software Development :: Libraries :: Application Frameworks"
], ],
keywords="telegram chat messenger mtproto api client library python", keywords="mtpager pagermaid",
project_urls={ project_urls={
"Tracker": "https://github.com/pyrogram/pyrogram/issues", "Tracker": "https://github.com/Xtao-Labs/pyrogram/issues",
"Community": "https://t.me/pyrogram", "Community": "https://t.me/PagerMaid_Modify",
"Source": "https://github.com/pyrogram/pyrogram", "Source": "https://github.com/Xtao-Labs/pyrogram",
"Documentation": "https://docs.pyrogram.org", "Documentation": "https://docs.pyrogram.org",
}, },
python_requires="~=3.6", python_requires="~=3.6",