build: migrate deps to pyproject.toml (#201)

This commit is contained in:
delewer 2026-03-19 01:33:12 +07:00 committed by GitHub
parent 9924440c48
commit 99b5c722e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 115 additions and 14 deletions

View File

@ -30,7 +30,7 @@ jobs:
cache: "pip" cache: "pip"
- name: Install dependencies - name: Install dependencies
run: pip install -r requirements.txt run: pip install ".[win10]"
- name: Install pyinstaller - name: Install pyinstaller
run: pip install "pyinstaller==6.13.0" run: pip install "pyinstaller==6.13.0"
@ -58,7 +58,7 @@ jobs:
cache: "pip" cache: "pip"
- name: Install dependencies (Win7-compatible) - name: Install dependencies (Win7-compatible)
run: pip install -r requirements-win7.txt run: pip install ".[win7]"
- name: Install pyinstaller - name: Install pyinstaller
run: pip install "pyinstaller==5.13.2" run: pip install "pyinstaller==5.13.2"

View File

@ -42,16 +42,34 @@ Telegram Desktop → SOCKS5 (127.0.0.1:1080) → TG WS Proxy → WSS → Telegra
### MacOS (Tray-приложение) ### MacOS (Tray-приложение)
<<<<<<< build/pyproject-migration
```bash
pip install -e ".[win10]"
```
### Windows 7
```bash
pip install -e ".[win7]"
```
### Windows (Tray-приложение)
```bash
tg-ws-proxy-tray
```
=======
Перейдите на [страницу релизов](https://github.com/Flowseal/tg-ws-proxy/releases) и скачайте **`TgWsProxy.dmg`** — универсальная сборка для Apple Silicon и Intel. Перейдите на [страницу релизов](https://github.com/Flowseal/tg-ws-proxy/releases) и скачайте **`TgWsProxy.dmg`** — универсальная сборка для Apple Silicon и Intel.
1. Открыть образ 1. Открыть образ
2. Перенести **TG WS Proxy.app** в папку **Applications** 2. Перенести **TG WS Proxy.app** в папку **Applications**
3. При первом запуске macOS может попросить подтвердить открытие: **Системные настройки → Конфиденциальность и безопасность → Всё равно открыть** 3. При первом запуске macOS может попросить подтвердить открытие: **Системные настройки → Конфиденциальность и безопасность → Всё равно открыть**
>>>>>>> main
### Консольный режим из исходников ### Консольный режим из исходников
```bash ```bash
python proxy/tg_ws_proxy.py [--port PORT] [--dc-ip DC:IP ...] [-v] tg-ws-proxy [--port PORT] [--host HOST] [--dc-ip DC:IP ...] [-v]
``` ```
**Аргументы:** **Аргументы:**
@ -59,6 +77,7 @@ python proxy/tg_ws_proxy.py [--port PORT] [--dc-ip DC:IP ...] [-v]
| Аргумент | По умолчанию | Описание | | Аргумент | По умолчанию | Описание |
|---|---|---| |---|---|---|
| `--port` | `1080` | Порт SOCKS5-прокси | | `--port` | `1080` | Порт SOCKS5-прокси |
| `--host` | `127.0.0.1` | Хост SOCKS5-прокси |
| `--dc-ip` | `2:149.154.167.220`, `4:149.154.167.220` | Целевой IP для DC (можно указать несколько раз) | | `--dc-ip` | `2:149.154.167.220`, `4:149.154.167.220` | Целевой IP для DC (можно указать несколько раз) |
| `-v`, `--verbose` | выкл. | Подробное логирование (DEBUG) | | `-v`, `--verbose` | выкл. | Подробное логирование (DEBUG) |
@ -66,13 +85,25 @@ python proxy/tg_ws_proxy.py [--port PORT] [--dc-ip DC:IP ...] [-v]
```bash ```bash
# Стандартный запуск # Стандартный запуск
python proxy/tg_ws_proxy.py tg-ws-proxy
# Другой порт и дополнительные DC # Другой порт и дополнительные DC
python proxy/tg_ws_proxy.py --port 9050 --dc-ip 1:149.154.175.205 --dc-ip 2:149.154.167.220 tg-ws-proxy --port 9050 --dc-ip 1:149.154.175.205 --dc-ip 2:149.154.167.220
# С подробным логированием # С подробным логированием
python proxy/tg_ws_proxy.py -v tg-ws-proxy -v
```
## CLI-скрипты (pyproject.toml)
CLI команды объявляются в `pyproject.toml` в секции `[project.scripts]` и должны указывать на `module:function`.
Пример:
```toml
[project.scripts]
tg-ws-proxy = "proxy.tg_ws_proxy:main"
tg-ws-proxy-tray = "windows:main"
``` ```
## Настройка Telegram Desktop ## Настройка Telegram Desktop

1
proxy/__init__.py Normal file
View File

@ -0,0 +1 @@
__version__ = "1.1.3"

69
pyproject.toml Normal file
View File

@ -0,0 +1,69 @@
[build-system]
requires = ["hatchling>=1.25.0"]
build-backend = "hatchling.build"
[project]
name = "tg-ws-proxy"
dynamic=["version"]
description = "Telegram Desktop WebSocket Bridge Proxy"
readme = "README.md"
requires-python = ">=3.8"
license = { name = "MIT", file = "LICENSE" }
authors = [
{ name = "Flowseal" }
]
keywords = [
"telegram",
"proxy",
"websocket"
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Environment :: Win32 (MS Windows)",
"Intended Audience :: Customer Service",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: Microsoft :: Windows",
"Topic :: System :: Networking :: Firewalls",
]
dependencies = [
"customtkinter==5.2.2",
"pystray==0.19.5",
"pyperclip==1.9.0",
]
[project.optional-dependencies]
win7 = [
"cryptography==41.0.7",
"Pillow==10.4.0",
"psutil==5.9.8",
]
win10 = [
"cryptography==46.0.5",
"Pillow==12.1.1",
"psutil==7.0.0",
]
[project.scripts]
tg-ws-proxy = "proxy.tg_ws_proxy:main"
tg-ws-proxy-tray = "windows:main"
[project.urls]
Source = "https://github.com/Flowseal/tg-ws-proxy"
Issues = "https://github.com/Flowseal/tg-ws-proxy/issues"
[tool.hatch.build.targets.wheel]
packages = ["proxy"]
[tool.hatch.build.force-include]
"windows.py" = "windows.py"
[tool.hatch.version]
path = "proxy/__init__.py"

View File

@ -1,6 +1 @@
cryptography==41.0.7 -e .[win7]
customtkinter==5.2.2
Pillow==10.4.0
psutil==5.9.8
pystray==0.19.5
pyperclip==1.9.0

View File

@ -1,6 +1,10 @@
<<<<<<< build/pyproject-migration
-e .[win10]
=======
cryptography==46.0.5 cryptography==46.0.5
customtkinter==5.2.2 customtkinter==5.2.2
Pillow==12.1.0 Pillow==12.1.0
psutil==7.0.0 psutil==7.0.0
pystray==0.19.5 pystray==0.19.5
pyperclip==1.9.0 pyperclip==1.9.0
>>>>>>> main

View File

@ -9,12 +9,13 @@ import sys
import threading import threading
import time import time
import webbrowser import webbrowser
import pystray
import pyperclip import pyperclip
import asyncio as _asyncio import asyncio as _asyncio
import customtkinter as ctk
from pathlib import Path from pathlib import Path
from typing import Dict, Optional from typing import Dict, Optional
import pystray
import customtkinter as ctk
from PIL import Image, ImageDraw, ImageFont from PIL import Image, ImageDraw, ImageFont
import proxy.tg_ws_proxy as tg_ws_proxy import proxy.tg_ws_proxy as tg_ws_proxy