mirror of
https://github.com/anten-ka/gotelegram_pro.git
synced 2026-05-19 11:26:03 +00:00
bugfix: {{NC}} typo, bot TOML v3 parsing, add_secret v3 format
- install.sh: fix {{NC}} -> ${NC} color escape on line 265
- bot.py: fix TOML parsing for telemt v3 [access.users] format
- bot.py: fix telemt config section [server].port instead of [config].listen_port
- telemt_config.sh: fix add_secret_to_config() for v3 format
This commit is contained in:
@@ -499,12 +499,15 @@ async def get_status_text() -> str:
|
||||
if "port" in config:
|
||||
lines.append(f"<b>Port:</b> {html.escape(str(config['port']))}")
|
||||
|
||||
# Telemt config
|
||||
# Telemt config (v3: [server] port = ..., [censorship] tls_domain = ...)
|
||||
telemt_cfg = load_toml(TELEMT_CONFIG)
|
||||
if telemt_cfg:
|
||||
cfg = telemt_cfg.get("config", {})
|
||||
if "listen_port" in cfg:
|
||||
lines.append(f"<b>Listen Port:</b> {cfg['listen_port']}")
|
||||
server_cfg = telemt_cfg.get("server", {})
|
||||
if "port" in server_cfg:
|
||||
lines.append(f"<b>Listen Port:</b> {server_cfg['port']}")
|
||||
censor_cfg = telemt_cfg.get("censorship", {})
|
||||
if "tls_domain" in censor_cfg:
|
||||
lines.append(f"<b>TLS Domain:</b> {html.escape(str(censor_cfg['tls_domain']))}")
|
||||
|
||||
# Backups
|
||||
backup_count = 0
|
||||
@@ -946,14 +949,15 @@ async def get_proxy_link() -> Optional[str]:
|
||||
if not config:
|
||||
return None
|
||||
|
||||
# Get secret from telemt TOML config
|
||||
# Get secret from telemt TOML config (v3 format: [access.users] main = "...")
|
||||
secret = config.get("secret", "")
|
||||
if not secret:
|
||||
telemt_cfg = load_toml(TELEMT_CONFIG)
|
||||
if telemt_cfg:
|
||||
users = telemt_cfg.get("users", [])
|
||||
if isinstance(users, list) and users:
|
||||
secret = users[0].get("secret", "")
|
||||
access = telemt_cfg.get("access", {})
|
||||
users = access.get("users", {})
|
||||
if isinstance(users, dict):
|
||||
secret = users.get("main", "")
|
||||
if not secret:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user