Files
ykxmz/_build/fix_site_bugs.py
xmz7891 51565112b9 网页改成白色简洁 + 修官网两个 bug
配色
- 官网 / 登录页 / 管理页从 GitHub 深色风改成白色简洁
  (用户的设计理念:所有东西都要白色简洁)
- 白底上把浅灰文字换成深色,链接蓝也调深一档保证对比度

修 bug
- 管理入口的链接拼接写坏了,页面上显示成 href= + ADMIN_PATH +,
  点了打不开管理页
- .lead 用的是深色主题的浅灰,白底上几乎看不见

其他
- 清掉提交信息里的 BOM(PowerShell 的 Set-Content 加的)
2026-10-06 23:10:08 +08:00

75 lines
2.0 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
r'''修官网上残留的两个问题。
1. 管理入口的链接拼接写坏了
生成的源码里是:
· <a href="""" + ADMIN_PATH + """">管理入口</a>
结果是页面上真的显示成 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 = [
# 管理入口链接
(''' · <a href="""" + ADMIN_PATH + """">管理入口</a>''',
''' · <a href="/zhingzhuanzhan">管理入口</a>'''),
# 白底上看不见的浅灰
("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())