Fix JavaScript syntax error with UTF-8 encoding

Fixed template generation to explicitly use UTF-8 encoding when writing
the HTML template file. This resolves JavaScript syntax errors caused by
emoji characters (⚠️, 🔌, 🔄) in the shutdown/restart confirmation dialogs.

Changes:
- Added encoding='utf-8' parameter to template file write operation
- Updated template version to 1.9.1 to force regeneration
- Ensures all special characters render correctly in browser

Fixes error: "Uncaught SyntaxError: Invalid or unexpected token"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-29 17:35:52 +07:00
parent 112ab8c30a
commit 066abee508

View File

@@ -151,7 +151,7 @@ BACKUP_ON_WRITE = BACKUP_CONFIG.get('backup_on_write', True)
WEB_PORT = SYS_CONFIG['web']['port']
# Template version - increment this when HTML template changes
TEMPLATE_VERSION = "1.9.0" # Updated: Added system shutdown/restart controls
TEMPLATE_VERSION = "1.9.1" # Updated: Fixed UTF-8 encoding for JavaScript special characters
# Flask app
app = Flask(__name__)
@@ -1341,7 +1341,7 @@ def main():
else:
print(f"Creating new template at {template_file}")
with open(template_file, 'w') as f:
with open(template_file, 'w', encoding='utf-8') as f:
# Write version comment first, then the rest of the template
f.write(f'<!-- TEMPLATE_VERSION: {TEMPLATE_VERSION} -->\n')
f.write('''<!DOCTYPE html>