Restructure

This commit is contained in:
Flowseal 2026-03-06 19:48:12 +03:00
parent 01b3aca85e
commit f69d20ad85
6 changed files with 30 additions and 34 deletions

View File

@ -27,8 +27,11 @@ jobs:
- name: Install dependencies
run: pip install -r requirements.txt
- name: Install pyinstaller
run: pip install pyinstaller
- name: Build EXE with PyInstaller
run: pyinstaller tg_ws_proxy.spec --noconfirm
run: pyinstaller windows/windows.spec --noconfirm
- name: Upload artifact
uses: actions/upload-artifact@v4

View File

@ -18,21 +18,10 @@ Telegram Desktop → SOCKS5 (127.0.0.1:1080) → TG WS Proxy → WSS (kws*.web.t
4. Устанавливает WebSocket (TLS) соединение к соответствующему DC через домены `kws{N}.web.telegram.org`
5. Если WS недоступен (302 redirect) — автоматически переключается на прямое TCP-соединение
## Установка
## 🚀 Быстрый старт
### Из исходников
```bash
pip install -r requirements.txt
```
## Использование
### Tray-приложение (рекомендуется для Windows)
```bash
python tg_ws_tray.py
```
### Windows
Перейдите на [страницу релизов](https://github.com/Flowseal/tg-ws-proxy/releases) и скачайте **`TgWsProxy.exe`**. Он собирается автоматически через [Github Actions](https://github.com/Flowseal/tg-ws-proxy/actions) из открытого исходного кода.
При первом запуске откроется окно с инструкцией по подключению Telegram Desktop. Приложение сворачивается в системный трей.
@ -43,10 +32,22 @@ python tg_ws_tray.py
- **Открыть логи** — открыть файл логов
- **Выход** — остановить прокси и закрыть приложение
## Установка из исходников
```bash
pip install -r requirements.txt
```
### Windows (Tray-приложение)
```bash
python windows.py
```
### Консольный режим
```bash
python tg_ws_proxy.py [--port PORT] [--dc-ip DC:IP ...] [-v]
python proxy/tg_ws_proxy.py [--port PORT] [--dc-ip DC:IP ...] [-v]
```
**Аргументы:**
@ -61,13 +62,13 @@ python tg_ws_proxy.py [--port PORT] [--dc-ip DC:IP ...] [-v]
```bash
# Стандартный запуск
python tg_ws_proxy.py
python proxy/tg_ws_proxy.py
# Другой порт и дополнительные DC
python tg_ws_proxy.py --port 9050 --dc-ip 1:149.154.175.205 --dc-ip 2:149.154.167.220
python proxy/tg_ws_proxy.py --port 9050 --dc-ip 1:149.154.175.205 --dc-ip 2:149.154.167.220
# С подробным логированием
python tg_ws_proxy.py -v
python proxy/tg_ws_proxy.py -v
```
## Настройка Telegram Desktop
@ -87,7 +88,7 @@ python tg_ws_proxy.py -v
## Конфигурация
Tray-приложение хранит конфигурацию в `%APPDATA%/TgWsProxy/config.json`:
Tray-приложение хранит данные в `%APPDATA%/TgWsProxy`:
```json
{
@ -100,20 +101,15 @@ Tray-приложение хранит конфигурацию в `%APPDATA%/Tg
}
```
Логи записываются в `%APPDATA%/TgWsProxy/proxy.log`.
## Автоматическая сборка
## Сборка exe
Проект содержит спецификацию PyInstaller ([`tg_ws_proxy.spec`](tg_ws_proxy.spec)) и GitHub Actions workflow ([`.github/workflows/build.yml`](.github/workflows/build.yml)) для автоматической сборки.
Проект содержит спецификацию PyInstaller ([`windows.spec`](packaging/windows.spec)) и GitHub Actions workflow ([`.github/workflows/build.yml`](.github/workflows/build.yml)) для автоматической сборки.
```bash
pip install pyinstaller
pyinstaller tg_ws_proxy.spec
pyinstaller packaging/windows.spec
```
## Дисклеймер
Проект частично vibecoded by Opus 4.6. Если вы найдете баг, то создайте Issue с его описанем.
## Лицензия
[MIT License](LICENSE)

View File

@ -10,12 +10,11 @@ import customtkinter
ctk_path = os.path.dirname(customtkinter.__file__)
a = Analysis(
['tg_ws_tray.py'],
[os.path.join(os.path.dirname(SPEC), os.pardir, 'windows.py')],
pathex=[],
binaries=[],
datas=[(ctk_path, 'customtkinter/')],
hiddenimports=[
'tg_ws_proxy',
'pystray._win32',
'PIL._tkinter_finder',
'customtkinter',
@ -34,7 +33,7 @@ a = Analysis(
noarchive=False,
)
icon_path = os.path.join(os.path.dirname(SPEC), 'icon.ico')
icon_path = os.path.join(os.path.dirname(SPEC), os.pardir, 'icon.ico')
if os.path.exists(icon_path):
a.datas += [('icon.ico', icon_path, 'DATA')]

View File

@ -2,5 +2,4 @@ cryptography
pystray
Pillow
customtkinter
pyinstaller
psutil

View File

@ -16,8 +16,7 @@ from pathlib import Path
from typing import Dict, Optional
from PIL import Image, ImageDraw, ImageFont
# Proxy engine
import tg_ws_proxy
import proxy.tg_ws_proxy as tg_ws_proxy
APP_NAME = "TgWsProxy"