diff --git a/templates.py b/templates.py index 18b0145..87dfc7b 100644 --- a/templates.py +++ b/templates.py @@ -1,590 +1,45 @@ #!/usr/bin/env python3 """ -HTML 模板 +HTML 模板 - 包含所有完整功能 """ from config import APP_NAME, APP_VERSION def get_html_template(): - """返回完整的HTML模板""" + """返回完整的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() + + # 替换版本号 + template_content = template_content.replace('v2.1', APP_VERSION) + template_content = template_content.replace('v3.3.1', APP_VERSION) + + return template_content + except: + # 如果文件不存在,返回基本模板 + return get_basic_template() + + +def get_basic_template(): + """基本模板(备用)""" return ''' - ''' + APP_NAME + ''' -
- -
-
-

- - ''' + APP_NAME + ''' - ''' + APP_VERSION + ''' -

-
-
-
- 对外IP: - -
- - - -
- 间隔: - - s -
- -
-
- 已连接 -
-
-
- - -
- - - -
- - -
-
- -
-
- - - - - - +

''' + APP_NAME + ''' ''' + APP_VERSION + '''

+

模板加载失败,请检查 templates_full.txt 文件

- - - - - - -''' \ No newline at end of file +''' \ No newline at end of file diff --git a/templates_full.txt b/templates_full.txt new file mode 100644 index 0000000..4abfc60 --- /dev/null +++ b/templates_full.txt @@ -0,0 +1,2366 @@ +# ==================== HTML 模板 ==================== + +HTML_TEMPLATE = ''' + + + + + 项目服务管理面板 v3.3.1 + + + + + + +
+ +
+
+

+ + 项目服务管理面板 + v2.1 +

+
+
+
+ 对外IP: + +
+ + + +
+ 间隔: + + s +
+ +
+
+ 已连接 +
+
+
+ + +
+ + + +
+ + +
+ +
+
+
+
+

Web服务

+

-

+
+ +
+
+
+
+
+

运行中

+

-

+
+ +
+
+
+
+
+

Cron任务

+

-

+
+ +
+
+
+
+
+

CLI工具

+

-

+
+ +
+
+
+ + +
+ + + + + + +
+ + +
+

加载中...

+
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +''' + + +if __name__ == '__main__': + os.makedirs(os.path.join(BASE_DIR, 'logs'), exist_ok=True) + os.makedirs(CRON_BACKUP_DIR, exist_ok=True) + init_db() + + log_message("=" * 50) + log_message("项目服务管理面板 v2.0.0 启动")