修复添加引号的错误
This commit is contained in:
@@ -8,23 +8,23 @@
|
||||
<script>
|
||||
window.routerBase = "/";
|
||||
window.settings = {
|
||||
title: {{printf "%q" .Title}},
|
||||
assets_path: {{printf "%q" .AssetsPath}},
|
||||
title: "{{.Title}}",
|
||||
assets_path: "{{.AssetsPath}}",
|
||||
theme: { color: "aurora" },
|
||||
version: {{printf "%q" .Version}},
|
||||
version: "{{.Version}}",
|
||||
background_url: "",
|
||||
description: {{printf "%q" .Description}},
|
||||
description: "{{.Description}}",
|
||||
i18n: ["zh-CN", "en-US", "ja-JP", "vi-VN", "ko-KR", "zh-TW", "fa-IR"],
|
||||
logo: {{printf "%q" .Logo}}
|
||||
logo: "{{.Logo}}"
|
||||
};
|
||||
|
||||
window.NEBULA_THEME = {
|
||||
title: {{printf "%q" .Title}},
|
||||
theme: {{printf "%q" .Theme}},
|
||||
version: {{printf "%q" .Version}},
|
||||
description: {{printf "%q" .Description}},
|
||||
logo: {{printf "%q" .Logo}},
|
||||
assetsPath: {{printf "%q" .AssetsPath}},
|
||||
title: "{{.Title}}",
|
||||
theme: "{{.Theme}}",
|
||||
version: "{{.Version}}",
|
||||
description: "{{.Description}}",
|
||||
logo: "{{.Logo}}",
|
||||
assetsPath: "{{.AssetsPath}}",
|
||||
config: {{.ThemeConfigJSON}}
|
||||
};
|
||||
|
||||
|
||||
8
scratch/check_invalid.py
Normal file
8
scratch/check_invalid.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import sys
|
||||
try:
|
||||
with open('frontend/admin/locales/zh-CN.js', 'rb') as f:
|
||||
content = f.read()
|
||||
content.decode('utf-8')
|
||||
print('Valid UTF-8')
|
||||
except UnicodeDecodeError as e:
|
||||
print(f'Invalid UTF-8 at byte {e.start}: {content[e.start:e.start+10]}')
|
||||
35
scratch/scan_encoding.py
Normal file
35
scratch/scan_encoding.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import os
|
||||
|
||||
def check_encoding(file_path):
|
||||
try:
|
||||
with open(file_path, 'rb') as f:
|
||||
content = f.read()
|
||||
content.decode('utf-8')
|
||||
# Also check for commonMojibake patterns or literal strings
|
||||
# U+FFFD is b'\xef\xbf\xbd' in UTF-8
|
||||
if b'\xef\xbf\xbd' in content:
|
||||
return "Contains U+FFFD (Replacement Character)"
|
||||
return None
|
||||
except UnicodeDecodeError as e:
|
||||
return f"Invalid UTF-8 at byte {e.start}"
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
|
||||
search_dir = r"d:\Development\SingBox-Gopanel"
|
||||
extensions = ('.go', '.js', '.jsx', '.ts', '.tsx', '.html', '.css', '.json', '.sql', '.md')
|
||||
exclude_dirs = {'.git', 'node_modules', 'dist'}
|
||||
|
||||
results = []
|
||||
for root, dirs, files in os.walk(search_dir):
|
||||
dirs[:] = [d for d in dirs if d not in exclude_dirs]
|
||||
for file in files:
|
||||
if file.endswith(extensions):
|
||||
full_path = os.path.join(root, file)
|
||||
issue = check_encoding(full_path)
|
||||
if issue:
|
||||
results.append(f"{full_path}: {issue}")
|
||||
|
||||
if results:
|
||||
print("\n".join(results))
|
||||
else:
|
||||
print("No issues found in source files.")
|
||||
Reference in New Issue
Block a user