mirror of
https://github.com/anten-ka/gotelegram_pro.git
synced 2026-05-19 17:56:07 +00:00
v2.3.1: fix QR top margin, use domain instead of IP for pro-mode links
This commit is contained in:
@@ -835,7 +835,7 @@ async def cb_pro_confirm(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
|
||||
|
||||
|
||||
async def get_proxy_link() -> Optional[str]:
|
||||
"""Generate proxy link from config."""
|
||||
"""Generate proxy link from config. Pro-mode uses domain + fake-TLS secret."""
|
||||
config = load_json(GOTELEGRAM_CONFIG)
|
||||
if not config:
|
||||
return None
|
||||
@@ -851,12 +851,20 @@ async def get_proxy_link() -> Optional[str]:
|
||||
if not secret:
|
||||
return None
|
||||
|
||||
# Get server IP
|
||||
mode = config.get("mode", "lite")
|
||||
domain = config.get("domain", "")
|
||||
port = config.get("port", 443)
|
||||
|
||||
# Pro-режим: ссылка с доменом и fake-TLS секретом (ee + secret + hex domain)
|
||||
if mode == "pro" and domain:
|
||||
domain_hex = domain.encode().hex()
|
||||
faketls_secret = f"ee{secret}{domain_hex}"
|
||||
return f"tg://proxy?server={domain}&port={port}&secret={faketls_secret}"
|
||||
|
||||
# Lite-режим: IP
|
||||
code, stdout, _ = await sh("curl", "-s", "-4", "--max-time", "5", "https://api.ipify.org")
|
||||
server = stdout.strip() if code == 0 and stdout.strip() else "0.0.0.0"
|
||||
|
||||
port = config.get("port", 443)
|
||||
|
||||
return f"tg://proxy?server={server}&port={port}&secret={secret}"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user