Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.

Commit 18a0902

Browse files
committed
Добавил поддержку ua-generator и обновил константы для устройств, экранов и часовых поясов
1 parent 51e8ec5 commit 18a0902

2 files changed

Lines changed: 66 additions & 7 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ dependencies = [
1919
"aiohttp>=3.12.15",
2020
"aiofiles>=24.1.0",
2121
"qrcode>=8.2",
22+
"ua-generator>=2.0.19",
2223
]
2324

2425
[project.urls]

src/pymax/static/constant.py

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,68 @@
1+
from random import choice, randint
12
from re import Pattern, compile
23
from typing import Final
34

5+
import ua_generator
46
from websockets.typing import Origin
57

8+
DEVICE_NAMES: Final[list[str]] = [
9+
"Chrome",
10+
"Firefox",
11+
"Edge",
12+
"Safari",
13+
"Opera",
14+
"Vivaldi",
15+
"Brave",
16+
"Chromium",
17+
# os
18+
"Windows 10",
19+
"Windows 11",
20+
"macOS Big Sur",
21+
"macOS Monterey",
22+
"macOS Ventura",
23+
"Ubuntu 20.04",
24+
"Ubuntu 22.04",
25+
"Fedora 35",
26+
"Fedora 36",
27+
"Debian 11",
28+
]
29+
SCREEN_SIZES: Final[list[str]] = [
30+
"1920x1080 1.0x",
31+
"1366x768 1.0x",
32+
"1440x900 1.0x",
33+
"1536x864 1.0x",
34+
"1280x720 1.0x",
35+
"1600x900 1.0x",
36+
"1680x1050 1.0x",
37+
"2560x1440 1.0x",
38+
"3840x2160 1.0x",
39+
]
40+
OS_VERSIONS: Final[list[str]] = [
41+
"Windows 10",
42+
"Windows 11",
43+
"macOS Big Sur",
44+
"macOS Monterey",
45+
"macOS Ventura",
46+
"Ubuntu 20.04",
47+
"Ubuntu 22.04",
48+
"Fedora 35",
49+
"Fedora 36",
50+
"Debian 11",
51+
]
52+
TIMEZONES: Final[list[str]] = [
53+
"Europe/Moscow",
54+
"Europe/Kaliningrad",
55+
"Europe/Samara",
56+
"Asia/Yekaterinburg",
57+
"Asia/Omsk",
58+
"Asia/Krasnoyarsk",
59+
"Asia/Irkutsk",
60+
"Asia/Yakutsk",
61+
"Asia/Vladivostok",
62+
"Asia/Kamchatka",
63+
]
64+
65+
666
PHONE_REGEX: Final[Pattern[str]] = compile(r"^\+?\d{10,15}$")
767
WEBSOCKET_URI: Final[str] = "wss://ws-api.oneme.ru/websocket"
868
WEBSOCKET_ORIGIN: Final[Origin] = Origin("https://web.max.ru")
@@ -12,16 +72,14 @@
1272
DEFAULT_DEVICE_TYPE: Final[str] = "DESKTOP"
1373
DEFAULT_LOCALE: Final[str] = "ru"
1474
DEFAULT_DEVICE_LOCALE: Final[str] = "ru"
15-
DEFAULT_DEVICE_NAME: Final[str] = "Chrome"
75+
DEFAULT_DEVICE_NAME: Final[str] = choice(DEVICE_NAMES)
1676
DEFAULT_APP_VERSION: Final[str] = "25.12.14"
1777
DEFAULT_SCREEN: Final[str] = "1080x1920 1.0x"
18-
DEFAULT_OS_VERSION: Final[str] = "Linux"
19-
DEFAULT_USER_AGENT: Final[str] = (
20-
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"
21-
)
78+
DEFAULT_OS_VERSION: Final[str] = choice(OS_VERSIONS)
79+
DEFAULT_USER_AGENT: Final[str] = ua_generator.generate().text
2280
DEFAULT_BUILD_NUMBER: Final[int] = 0x97CB
23-
DEFAULT_CLIENT_SESSION_ID: Final[int] = 14
24-
DEFAULT_TIMEZONE: Final[str] = "Europe/Moscow"
81+
DEFAULT_CLIENT_SESSION_ID: Final[int] = randint(1, 15)
82+
DEFAULT_TIMEZONE: Final[str] = choice(TIMEZONES)
2583
DEFAULT_CHAT_MEMBERS_LIMIT: Final[int] = 50
2684
DEFAULT_MARKER_VALUE: Final[int] = 0
2785
DEFAULT_PING_INTERVAL: Final[float] = 30.0

0 commit comments

Comments
 (0)