2026-06-01 12:30:24 +08:00
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
"""
|
2026-06-01 15:54:45 +08:00
|
|
|
|
HTML 模板 - 包含所有完整功能
|
2026-06-01 12:30:24 +08:00
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
from config import APP_NAME, APP_VERSION
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_html_template():
|
2026-06-01 15:54:45 +08:00
|
|
|
|
"""返回完整的HTML模板(包含所有原有功能)"""
|
|
|
|
|
|
# 读取完整模板文件
|
|
|
|
|
|
import os
|
|
|
|
|
|
template_file = os.path.join(os.path.dirname(__file__), 'templates_full.txt')
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
with open(template_file, 'r', encoding='utf-8') as f:
|
|
|
|
|
|
template_content = f.read()
|
|
|
|
|
|
|
2026-06-01 15:56:47 +08:00
|
|
|
|
# 替换版本号(支持多种格式)
|
2026-06-01 15:54:45 +08:00
|
|
|
|
template_content = template_content.replace('v2.1', APP_VERSION)
|
|
|
|
|
|
template_content = template_content.replace('v3.3.1', APP_VERSION)
|
2026-06-01 15:56:47 +08:00
|
|
|
|
template_content = template_content.replace('v3.3.5', APP_VERSION)
|
|
|
|
|
|
template_content = template_content.replace('v3.4.0', APP_VERSION)
|
|
|
|
|
|
template_content = template_content.replace('v3.4.1', APP_VERSION) # 预留未来版本
|
2026-06-01 15:54:45 +08:00
|
|
|
|
|
2026-06-01 17:44:39 +08:00
|
|
|
|
# 替换默认IP地址
|
|
|
|
|
|
template_content = template_content.replace("'192.168.2.17'", "'121.40.164.32'")
|
|
|
|
|
|
template_content = template_content.replace('"192.168.2.17"', '"121.40.164.32"')
|
|
|
|
|
|
|
2026-06-01 15:54:45 +08:00
|
|
|
|
return template_content
|
|
|
|
|
|
except:
|
|
|
|
|
|
# 如果文件不存在,返回基本模板
|
|
|
|
|
|
return get_basic_template()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_basic_template():
|
|
|
|
|
|
"""基本模板(备用)"""
|
2026-06-01 12:30:24 +08:00
|
|
|
|
return '''<!DOCTYPE html>
|
|
|
|
|
|
<html lang="zh-CN">
|
|
|
|
|
|
<head>
|
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
|
<title>''' + APP_NAME + '''</title>
|
|
|
|
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
|
|
|
|
<link href="https://cdn.remarkable.ai/css/remixicon.css" rel="stylesheet">
|
|
|
|
|
|
</head>
|
|
|
|
|
|
<body class="min-h-screen text-gray-100">
|
|
|
|
|
|
<div class="container mx-auto px-4 py-8">
|
2026-06-01 15:54:45 +08:00
|
|
|
|
<h1 class="text-3xl font-bold">''' + APP_NAME + ''' ''' + APP_VERSION + '''</h1>
|
|
|
|
|
|
<p>模板加载失败,请检查 templates_full.txt 文件</p>
|
2026-06-01 12:30:24 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</body>
|
2026-06-01 15:54:45 +08:00
|
|
|
|
</html>'''
|