Files
vps-management-bot/tmp/fix-nezha-final.py
2026-03-21 01:10:53 +08:00

25 lines
717 B
Python

import re
with open("/opt/nezha/dashboard/data/config.yaml") as f:
content = f.read()
# 1. 换背景图URL
content = content.replace(
"https://cdn.nodeimage.com/i/kuGNwxfnYgxe5dxdCa8abjjQr7XMOKEy.webp",
"https://i.111666.best/image/sCIbJNyiOUJSXhKexulIpr.jpeg"
)
# 2. 替换跑马灯:找到 bm-item span 的内容,替换为新文字
# 原文: "Driven by leading AI models" + 图片链接 + "由领先 AI 模型技术驱动!"
content = re.sub(
r'Driven by leading AI models.*?由领先 AI 模型技术驱动!',
'✨ 永远顶尖,永远在路上 ✨',
content,
flags=re.DOTALL
)
with open("/opt/nezha/dashboard/data/config.yaml", "w") as f:
f.write(content)
print("done")