28 lines
673 B
Python
28 lines
673 B
Python
import re
|
||
|
||
with open("/opt/nezha/dashboard/data/config.yaml") as f:
|
||
content = f.read()
|
||
|
||
# 1. 清空 CustomLinks(删掉 PeekaboCDN)
|
||
content = re.sub(
|
||
r"window\.CustomLinks = '[^']*'",
|
||
"window.CustomLinks = '[]'",
|
||
content
|
||
)
|
||
|
||
# 2. 替换跑马灯内容
|
||
# 把 bm-item 里的所有内容替换
|
||
old_marquee = re.compile(
|
||
r'(<span class=\\"bm-item\\">)\s*Driven by leading AI models.*?由领先 AI 模型技术驱动!\s*(</span>)',
|
||
re.DOTALL
|
||
)
|
||
content = old_marquee.sub(
|
||
r'\1\n ✨ 永远顶尖,永远在路上\n \2',
|
||
content
|
||
)
|
||
|
||
with open("/opt/nezha/dashboard/data/config.yaml", "w") as f:
|
||
f.write(content)
|
||
|
||
print("done")
|