# -*- coding: utf-8 -*- r'''修官网上残留的两个问题。 1. 管理入口的链接拼接写坏了 生成的源码里是: · 管理入口 结果是页面上真的显示成 href= + ADMIN_PATH +, 点了打不开管理页。改成直接写字面路径。 2. .lead{color:#c9d1d9} 是给深色底配的浅灰, 白底上几乎看不见。换成深色。 ''' from __future__ import annotations import ast import sys from pathlib import Path ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote") sys.path.insert(0, str(ROOT / "_build")) from devssh import run, upload # noqa: E402 RELAY = ROOT / "relay" / "relay.py" FIXES = [ # 管理入口链接 (''' · 管理入口''', ''' · 管理入口'''), # 白底上看不见的浅灰 ("color:#c9d1d9", "color:#1f2328"), ] def main() -> int: text = RELAY.read_text(encoding="utf-8") changed = [] for old, new in FIXES: if new in text: continue if old in text: text = text.replace(old, new) changed.append(old[:50]) if changed: RELAY.write_text(text, encoding="utf-8", newline="\n") for c in changed: print(f" 修好: {c}") else: print(" 没有要修的") ast.parse(text) print(" 语法 OK") # 复核 print() print(" 复核:") has_link = 'href="/zhingzhuanzhan"' in text no_light = "#c9d1d9" not in text print(" 管理入口链接写字面量: " + ("✓" if has_link else "✗")) print(" 没有残留的 #c9d1d9: " + ("✓" if no_light else "✗")) print() print(" 部署…") upload(str(RELAY), "/root/lanremote-relay/relay.py", 0o755) run("systemctl restart lanremote-relay", timeout=90) _c, out, _e = run("sleep 5; bash /root/check_web.sh 2>&1", timeout=200) print(out[-1000:]) return 0 if __name__ == "__main__": sys.exit(main())