multiplexing media through cfproxy

This commit is contained in:
Flowseal committed 2026-10-04 15:57:33 +03:00
1 parent fe1580cd83
commit 48954ff9ab
26 files changed
+3598 -23

No files matched your search

+3 -1
View File
@@ -19,6 +19,8 @@
"section.mtproto": "MTProto Connection",
"section.dc": "Telegram Data Centers (DC → IP)",
"section.cfproxy": "Cloudflare Proxy",
"label.h2_enable": "Media multiplexing (HTTP/2)",
"tip.h2": "Share one HTTP/2 connection per data center and domain for media downloads through Cloudflare.\nRequires CF proxy and TLS enabled.",
"section.cfworker": "Cloudflare Worker",
"section.logs": "Logs & Performance",
"section.updates": "Updates",
@@ -52,7 +54,7 @@
"tip.autostart": "Launch TG WS Proxy on Windows login. If you move the app to another folder, autostart will reset",
"tip.check_updates": "Check for updates on startup",
"tip.cfproxy": "Use Cloudflare proxy for unreachable data centers",
"tip.cfproxy_domain": "Your own domains proxied through Cloudflare for WS connections.\nSeparate multiple domains with commas.\nIf empty — chosen automatically from supported domains",
"tip.cfproxy_domain": "Your own domains proxied through Cloudflare for HTTP/2 and WS connections.\nSeparate multiple domains with commas.\nIf empty — chosen automatically from supported domains",
"tip.cfproxy_user_domain_cb": "Specify your own domains instead of automatic selection",
"tip.cfworker_domain": "Cloudflare Worker domains (e.g. name.account.workers.dev).\nSeparate multiple domains with commas.\nThe proxy routes connections to Telegram DCs by IP through them",
"tip.save": "Save settings",
+3 -1
View File
@@ -19,6 +19,8 @@
"section.mtproto": "Подключение MTProto",
"section.dc": "Датацентры Telegram (DC → IP)",
"section.cfproxy": "Cloudflare Proxy",
"label.h2_enable": "Мультиплексирование медиа (HTTP/2)",
"tip.h2": "Объединять загрузку медиа через Cloudflare в общее HTTP/2-соединение для каждого датацентра и домена.\nТребуется включённый CF-прокси и включённый TLS.",
"section.cfworker": "Cloudflare Worker",
"section.logs": "Логи и производительность",
"section.updates": "Обновления",
@@ -52,7 +54,7 @@
"tip.autostart": "Запускать TG WS Proxy при входе в Windows. Если вы переместите программу в другую папку, автозапуск сбросится",
"tip.check_updates": "При запуске проверять наличие обновлений",
"tip.cfproxy": "Использовать Cloudflare прокси для недоступных датацентров",
"tip.cfproxy_domain": "Ваши собственные домены, проксируемые через Cloudflare, для WS-подключения.\nНесколько доменов указывайте через запятую.\nЕсли не указаны — выбираются автоматически из поддерживаемых доменов",
"tip.cfproxy_domain": "Ваши собственные домены, проксируемые через Cloudflare, для HTTP/2 и WS-подключений.\nНесколько доменов указывайте через запятую.\nЕсли не указаны — выбираются автоматически из поддерживаемых доменов",
"tip.cfproxy_user_domain_cb": "Указать свои домены вместо автоматического выбора",
"tip.cfworker_domain": "Домены Cloudflare Worker (например, name.account.workers.dev).\nНесколько доменов указывайте через запятую.\nПрокси передает через них подключение к Telegram DC по IP",
"tip.save": "Сохранить настройки",
+18 -3
View File
@@ -65,6 +65,7 @@ class TrayConfigFormWidgets:
autostart_var: Optional[Any]
check_updates_var: Optional[Any]
cfproxy_var: Optional[Any] = None
h2_var: Optional[Any] = None
cfproxy_user_domain_enabled_var: Optional[Any] = None
cfproxy_user_domain_var: Optional[Any] = None
cfproxy_worker_enabled_var: Optional[Any] = None
@@ -91,7 +92,7 @@ def install_tray_config_form(
appearance_var, language_var = _create_interface(ctk, frame, theme, cfg, default_config)
host_var, port_var, secret_var = _create_connection(ctk, frame, theme, cfg, default_config)
dc_textbox = _create_dc(ctk, frame, theme, cfg, default_config)
cfproxy_var, cf_custom_cb_var, cfproxy_user_domain_var = _create_cfproxy(
cfproxy_var, h2_var, cf_custom_cb_var, cfproxy_user_domain_var = _create_cfproxy(
ctk, frame, theme, cfg, default_config, no_secure_var,
)
cfproxy_worker_enabled_var, cfproxy_worker_domain_var = _create_cfworker(
@@ -109,6 +110,7 @@ def install_tray_config_form(
advanced_vars=advanced_vars,
autostart_var=autostart_var, check_updates_var=check_updates_var,
cfproxy_var=cfproxy_var,
h2_var=h2_var,
cfproxy_user_domain_enabled_var=cf_custom_cb_var,
cfproxy_user_domain_var=cfproxy_user_domain_var,
cfproxy_worker_enabled_var=cfproxy_worker_enabled_var,
@@ -300,6 +302,19 @@ def _create_cfproxy(ctk, frame, theme, cfg, default_config, no_secure_var):
)
_cf_test_widget.pack(side="right")
h2_var = ctk.BooleanVar(master=frame, value=cfg.get("h2", default_config.get("h2", True)))
h2_cb = create_checkbox(ctk, cf_inner, theme, t("label.h2_enable"), h2_var)
h2_cb.pack(anchor="w", pady=(2, 8))
attach_ctk_tooltip(h2_cb, t("tip.h2"))
def _sync_h2(*_):
enabled = cfproxy_var.get() and not no_secure_var.get() and not cfg.get("force_test_dc", False)
h2_cb.configure(state="normal" if enabled else "disabled")
cfproxy_var.trace_add("write", _sync_h2)
no_secure_var.trace_add("write", _sync_h2)
_sync_h2()
cf_custom_row = ctk.CTkFrame(cf_inner, fg_color="transparent")
cf_custom_row.pack(fill="x")
@@ -335,7 +350,7 @@ def _create_cfproxy(ctk, frame, theme, cfg, default_config, no_secure_var):
cf_custom_cb_var.trace_add("write", _sync_domain_entry)
_sync_domain_entry()
return cfproxy_var, cf_custom_cb_var, cfproxy_user_domain_var
return cfproxy_var, h2_var, cf_custom_cb_var, cfproxy_user_domain_var
def _create_cfworker(ctk, frame, theme, cfg, default_config, no_secure_var):
@@ -554,7 +569,7 @@ def validate_config_form(
for key, var in widgets.advanced_vars.items():
values[key] = var.get()
for key in (
"check_updates", "cfproxy", "cfproxy_user_domain_enabled",
"check_updates", "cfproxy", "h2", "cfproxy_user_domain_enabled",
"cfproxy_worker_enabled", "no_secure",
):
var = getattr(widgets, f"{key}_var")