1
0
mirror of https://github.com/hanxi/xiaomusic.git synced 2025-12-06 14:52:50 +08:00

fix: 修复设置页面可能打不开的问题

This commit is contained in:
涵曦
2024-07-17 02:13:18 +00:00
parent 19ddbb7ca9
commit e5b32b2831
6 changed files with 17 additions and 15 deletions

View File

@@ -21,7 +21,8 @@ def update_html_version(html_files, version):
:param html_files: 需要更新的HTML文件路径的列表。
:param version: 新的版本号字符串。
"""
pattern = re.compile(r"(/static/[a-zA-Z0-9_.-]+)(\?version=[0-9.a-zA-Z_-]*)?")
pattern = re.compile(r'(/static/.*(css|js))\?version=[^"]*"')
#pattern = re.compile(r'(/static/.*html)\?version=[^"]*"')
for html_file in html_files:
if not html_file.exists():
@@ -31,7 +32,8 @@ def update_html_version(html_files, version):
html_content = html_file.read_text()
# 更新CSS和JS版本号
html_content = pattern.sub(r"\g<1>?version=" + version, html_content)
html_content = pattern.sub(fr'\g<1>?version={version}"', html_content)
#html_content = pattern.sub(fr'\g<1>"', html_content)
# 保存更改到HTML文件
html_file.write_text(html_content)