diff --git a/.gitignore b/.gitignore index 1397614..1c41052 100644 --- a/.gitignore +++ b/.gitignore @@ -1,48 +1,38 @@ -```gitignore -# Python +``` +# Python cache files __pycache__/ *.pyc *.pyo *.pyd -*.py~ -# Dependencies +# Dependencies and build artifacts +dist/ +build/ +target/ +node_modules/ .venv/ venv/ .env .env.local -.env.* +*.env.* # Logs and temporary files *.log *.tmp +*.swp -# Editors +# Editor/IDE files .vscode/ .idea/ -# Build artifacts -dist/ -build/ -target/ -*.o -*.obj -*.out -*.exe -*.dll -*.so -*.a - -# Coverage -.coverage +# Coverage reports coverage/ htmlcov/ +.coverage -# Testing +# MyPy cache .mypy_cache/ -.pytest_cache/ -# System -.DS_Store -Thumbs.db +# Pytest cache +.pytest_cache/ ``` \ No newline at end of file diff --git a/store/@{Falck}/html-render/__pycache__/main.cpython-312.pyc b/store/@{Falck}/html-render/__pycache__/main.cpython-312.pyc index 6d9ca81..ea66617 100644 Binary files a/store/@{Falck}/html-render/__pycache__/main.cpython-312.pyc and b/store/@{Falck}/html-render/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{Falck}/web-toolkit/__pycache__/main.cpython-312.pyc b/store/@{Falck}/web-toolkit/__pycache__/main.cpython-312.pyc index 6ef6b37..f269c2b 100644 Binary files a/store/@{Falck}/web-toolkit/__pycache__/main.cpython-312.pyc and b/store/@{Falck}/web-toolkit/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{Falck}/web-toolkit/__pycache__/router.cpython-312.pyc b/store/@{Falck}/web-toolkit/__pycache__/router.cpython-312.pyc index 32852df..e540485 100644 Binary files a/store/@{Falck}/web-toolkit/__pycache__/router.cpython-312.pyc and b/store/@{Falck}/web-toolkit/__pycache__/router.cpython-312.pyc differ diff --git a/store/@{Falck}/web-toolkit/__pycache__/static.cpython-312.pyc b/store/@{Falck}/web-toolkit/__pycache__/static.cpython-312.pyc index 55a9d5c..a3bc72d 100644 Binary files a/store/@{Falck}/web-toolkit/__pycache__/static.cpython-312.pyc and b/store/@{Falck}/web-toolkit/__pycache__/static.cpython-312.pyc differ diff --git a/store/@{Falck}/web-toolkit/__pycache__/template.cpython-312.pyc b/store/@{Falck}/web-toolkit/__pycache__/template.cpython-312.pyc index 1b534e6..7002efa 100644 Binary files a/store/@{Falck}/web-toolkit/__pycache__/template.cpython-312.pyc and b/store/@{Falck}/web-toolkit/__pycache__/template.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/auto-dependency/PL/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/auto-dependency/PL/__pycache__/main.cpython-312.pyc index 0771879..66b6d8a 100644 Binary files a/store/@{FutureOSS}/auto-dependency/PL/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/auto-dependency/PL/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/auto-dependency/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/auto-dependency/__pycache__/main.cpython-312.pyc index f7b62fb..9f53b84 100644 Binary files a/store/@{FutureOSS}/auto-dependency/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/auto-dependency/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/code-reviewer.disabled/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/code-reviewer.disabled/__pycache__/main.cpython-312.pyc index e8088be..5828418 100644 Binary files a/store/@{FutureOSS}/code-reviewer.disabled/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/code-reviewer.disabled/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/__init__.cpython-312.pyc index 4f8f4e5..c9651a7 100644 Binary files a/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/quality.cpython-312.pyc b/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/quality.cpython-312.pyc index 3598d54..abc5e28 100644 Binary files a/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/quality.cpython-312.pyc and b/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/quality.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/references.cpython-312.pyc b/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/references.cpython-312.pyc index ae57540..4b6ccd1 100644 Binary files a/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/references.cpython-312.pyc and b/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/references.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/security.cpython-312.pyc b/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/security.cpython-312.pyc index 5e2f9ff..4b366b2 100644 Binary files a/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/security.cpython-312.pyc and b/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/security.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/style.cpython-312.pyc b/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/style.cpython-312.pyc index cc21d0b..d6f0410 100644 Binary files a/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/style.cpython-312.pyc and b/store/@{FutureOSS}/code-reviewer.disabled/checks/__pycache__/style.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/code-reviewer.disabled/core/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/code-reviewer.disabled/core/__pycache__/__init__.cpython-312.pyc index e34ae15..e1b616e 100644 Binary files a/store/@{FutureOSS}/code-reviewer.disabled/core/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/code-reviewer.disabled/core/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/code-reviewer.disabled/core/__pycache__/reviewer.cpython-312.pyc b/store/@{FutureOSS}/code-reviewer.disabled/core/__pycache__/reviewer.cpython-312.pyc index 048154e..c7628d8 100644 Binary files a/store/@{FutureOSS}/code-reviewer.disabled/core/__pycache__/reviewer.cpython-312.pyc and b/store/@{FutureOSS}/code-reviewer.disabled/core/__pycache__/reviewer.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/code-reviewer.disabled/report/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/code-reviewer.disabled/report/__pycache__/__init__.cpython-312.pyc index 03f41d5..ce5f502 100644 Binary files a/store/@{FutureOSS}/code-reviewer.disabled/report/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/code-reviewer.disabled/report/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/code-reviewer.disabled/report/__pycache__/formatter.cpython-312.pyc b/store/@{FutureOSS}/code-reviewer.disabled/report/__pycache__/formatter.cpython-312.pyc index cbb80dc..7119d6c 100644 Binary files a/store/@{FutureOSS}/code-reviewer.disabled/report/__pycache__/formatter.cpython-312.pyc and b/store/@{FutureOSS}/code-reviewer.disabled/report/__pycache__/formatter.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/code-reviewer.disabled/utils/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/code-reviewer.disabled/utils/__pycache__/__init__.cpython-312.pyc index c8a49c0..37ef0f1 100644 Binary files a/store/@{FutureOSS}/code-reviewer.disabled/utils/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/code-reviewer.disabled/utils/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/dashboard/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/dashboard/__pycache__/main.cpython-312.pyc index f4e0353..7ed2f26 100644 Binary files a/store/@{FutureOSS}/dashboard/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/dashboard/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/dashboard/main.py b/store/@{FutureOSS}/dashboard/main.py index ce50094..784884e 100644 --- a/store/@{FutureOSS}/dashboard/main.py +++ b/store/@{FutureOSS}/dashboard/main.py @@ -209,11 +209,11 @@ class DashboardPlugin(Plugin): Log.error("dashboard", "仪表盘已停止") def _render_content(self) -> str: + """渲染仪表盘页面 - 纯 HTML/Python 模板""" try: - php_file = os.path.join(self.views_dir, 'dashboard.php') - if not os.path.exists(php_file): - return "

仪表盘视图文件丢失

" - + import psutil + import platform + cpu_percent = psutil.cpu_percent(interval=0.5) cpu_cores = psutil.cpu_count(logical=True) mem = psutil.virtual_memory() @@ -224,108 +224,100 @@ class DashboardPlugin(Plugin): disk_percent = round(disk.percent, 1) disk_used_gb = round(disk.used / (1024**3), 1) disk_total_gb = round(disk.total / (1024**3), 1) - net = self._get_network_stats() - disk_io = self._get_disk_io_stats() - load = self._get_load_info() - net_interfaces = self._get_network_interfaces() - processes = len(psutil.pids()) - - if disk_percent < 50: - disk_color = 'gauge-green' - elif disk_percent < 80: - disk_color = 'gauge-orange' - else: - disk_color = 'gauge-blue' - + circumference = 2 * 3.14159 * 52 cpu_dash_offset = round(circumference - (cpu_percent / 100) * circumference, 1) ram_dash_offset = round(circumference - (ram_percent / 100) * circumference, 1) disk_dash_offset = round(circumference - (disk_percent / 100) * circumference, 1) - + uptime_str = self._get_uptime_str() - - def fmt_speed(bps): - if bps >= 1024 * 1024: - return f"{round(bps / (1024*1024), 1)} MB/s" - elif bps >= 1024: - return f"{round(bps / 1024, 1)} KB/s" - else: - return f"{round(bps, 0)} B/s" - - variables = { - 'cpuPercent': int(cpu_percent), - 'cpuDashArray': str(circumference), - 'cpuDashOffset': str(cpu_dash_offset), - 'cpuCores': str(cpu_cores), - 'ramPercent': ram_percent, - 'ramDashArray': str(circumference), - 'ramDashOffset': str(ram_dash_offset), - 'ramUsed': f"{ram_used_gb} GB", - 'ramTotal': f"{ram_total_gb} GB", - 'diskPercent': disk_percent, - 'diskDashArray': str(circumference), - 'diskDashOffset': str(disk_dash_offset), - 'diskUsed': f"{disk_used_gb} GB", - 'diskTotal': f"{disk_total_gb} GB", - 'diskColorClass': disk_color, - 'uptime': uptime_str, - 'osName': f"{platform.system()} {platform.release()}", - 'pythonVersion': platform.python_version(), - 'phpVersion': self._get_php_version(), - 'hostname': platform.node(), - 'netRecvSpeed': fmt_speed(net['recv_rate']), - 'netSentSpeed': fmt_speed(net['sent_rate']), - 'diskReadSpeed': fmt_speed(disk_io['read_rate']), - 'diskWriteSpeed': fmt_speed(disk_io['write_rate']), - 'load1': str(load['load1']), - 'load5': str(load['load5']), - 'load15': str(load['load15']), - 'processes': str(processes), - 'netInterfaces': json.dumps(net_interfaces), - } - - return self._execute_php(php_file, variables) + + disk_color = 'gauge-green' if disk_percent < 50 else ('gauge-orange' if disk_percent < 80 else 'gauge-blue') + + html = f""" + + + + + 系统仪表盘 + + + + +
+
+

系统仪表盘

+
+
+
+
{cpu_percent}%
+
CPU 使用率 ({cpu_cores} 核心)
+
+
+
+
{ram_percent}%
+
内存使用 ({ram_used_gb} GB / {ram_total_gb} GB)
+
+
+
+
{disk_percent}%
+
磁盘使用 ({disk_used_gb} GB / {disk_total_gb} GB)
+
+
+
+
+
系统运行时间
+
{uptime_str}
+
+
+
操作系统
+
{platform.system()} {platform.release()}
+
+
+
Python 版本
+
{platform.python_version()}
+
+
+
主机名
+
{platform.node()}
+
+
+
+
+ + +""" + return html except Exception as e: - return f"

仪表盘渲染出错: {e}

" - - def _execute_php(self, php_file: str, variables: dict) -> str: - php_vars = "" - for key, value in variables.items(): - if isinstance(value, str): - escaped = value.replace('\\', '\\\\').replace("'", "\\'").replace("\n", "\\n") - php_vars += f"${key} = '{escaped}';\n" - else: - php_vars += f"${key} = {value};\n" - - with open(php_file, 'r', encoding='utf-8') as f: - php_content = f.read() - - tmp_file = os.path.join(os.path.dirname(php_file), '.temp_dashboard.php') - try: - with open(tmp_file, 'w', encoding='utf-8') as f: - f.write(f"\n{php_content}") - result = subprocess.run( - ["php", "-f", tmp_file], - capture_output=True, text=True, timeout=10, - encoding='utf-8', errors='replace' - ) - return result.stdout if result.returncode == 0 else f"
{result.stderr}
" - finally: - try: - if os.path.exists(tmp_file): - os.unlink(tmp_file) - except Exception: - pass - - @staticmethod - def _get_php_version() -> str: - try: - res = subprocess.run(['php', '-r', 'echo phpversion();'], capture_output=True, text=True, timeout=5, - encoding='utf-8', errors='replace') - return res.stdout if res.returncode == 0 else 'N/A' - except Exception: - return 'N/A' - + return f"

仪表盘渲染出错:{{e}}

" register_plugin_type("DashboardPlugin", DashboardPlugin) diff --git a/store/@{FutureOSS}/dashboard/views/dashboard.php b/store/@{FutureOSS}/dashboard/views/dashboard.php deleted file mode 100644 index 11a626b..0000000 --- a/store/@{FutureOSS}/dashboard/views/dashboard.php +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - -
- -
实时指标
-
-
-
CPU 使用率
-
- -
%
-
-
核心
-
-
-
内存使用
-
- -
%
-
-
/
-
-
-
磁盘使用
-
- -
%
-
-
/
-
-
-
系统负载
-
- -
-
-
1m / 5m / 15m: / /
-
-
- -
网络 & 磁盘 I/O
-
-
-
网络流量
-
下载速度
-
上传速度
-
-
-
磁盘 I/O
-
读取速度
-
写入速度
-
-
-
系统概况
-
运行进程
-
运行时间
-
-
- -
历史趋势
-
-
-
CPU & 内存趋势
-
-
-
-
网络吞吐
-
-
-
-
磁盘读写
-
-
-
-
网络延迟
-
-
-
- -
系统信息
-
-
-
系统详情
-
-
主机名
-
操作系统
-
Python
-
PHP
-
运行时间
-
-
-
-
网络接口
-
- -
-
-
-
- - - - - diff --git a/store/@{FutureOSS}/dependency/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/dependency/__pycache__/main.cpython-312.pyc index 66c88f8..23d2fca 100644 Binary files a/store/@{FutureOSS}/dependency/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/dependency/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/hot-reload.disabled/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/hot-reload.disabled/__pycache__/main.cpython-312.pyc index 399bfa4..6dbfaa8 100644 Binary files a/store/@{FutureOSS}/hot-reload.disabled/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/hot-reload.disabled/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/http-api/__pycache__/events.cpython-312.pyc b/store/@{FutureOSS}/http-api/__pycache__/events.cpython-312.pyc index 9b62a48..be3d1bf 100644 Binary files a/store/@{FutureOSS}/http-api/__pycache__/events.cpython-312.pyc and b/store/@{FutureOSS}/http-api/__pycache__/events.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/http-api/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/http-api/__pycache__/main.cpython-312.pyc index 37900c3..45f731c 100644 Binary files a/store/@{FutureOSS}/http-api/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/http-api/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/http-api/__pycache__/middleware.cpython-312.pyc b/store/@{FutureOSS}/http-api/__pycache__/middleware.cpython-312.pyc index 75db755..f4c59bd 100644 Binary files a/store/@{FutureOSS}/http-api/__pycache__/middleware.cpython-312.pyc and b/store/@{FutureOSS}/http-api/__pycache__/middleware.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/http-api/__pycache__/router.cpython-312.pyc b/store/@{FutureOSS}/http-api/__pycache__/router.cpython-312.pyc index c5294b1..4421e8a 100644 Binary files a/store/@{FutureOSS}/http-api/__pycache__/router.cpython-312.pyc and b/store/@{FutureOSS}/http-api/__pycache__/router.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/http-api/__pycache__/server.cpython-312.pyc b/store/@{FutureOSS}/http-api/__pycache__/server.cpython-312.pyc index ed93230..3c4dd67 100644 Binary files a/store/@{FutureOSS}/http-api/__pycache__/server.cpython-312.pyc and b/store/@{FutureOSS}/http-api/__pycache__/server.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/http-tcp/__pycache__/events.cpython-312.pyc b/store/@{FutureOSS}/http-tcp/__pycache__/events.cpython-312.pyc index 0572bf4..c8b3a25 100644 Binary files a/store/@{FutureOSS}/http-tcp/__pycache__/events.cpython-312.pyc and b/store/@{FutureOSS}/http-tcp/__pycache__/events.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/http-tcp/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/http-tcp/__pycache__/main.cpython-312.pyc index fe86acd..3633263 100644 Binary files a/store/@{FutureOSS}/http-tcp/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/http-tcp/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/http-tcp/__pycache__/middleware.cpython-312.pyc b/store/@{FutureOSS}/http-tcp/__pycache__/middleware.cpython-312.pyc index dbdae02..1c4b689 100644 Binary files a/store/@{FutureOSS}/http-tcp/__pycache__/middleware.cpython-312.pyc and b/store/@{FutureOSS}/http-tcp/__pycache__/middleware.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/http-tcp/__pycache__/router.cpython-312.pyc b/store/@{FutureOSS}/http-tcp/__pycache__/router.cpython-312.pyc index 3c44de5..baeb4ca 100644 Binary files a/store/@{FutureOSS}/http-tcp/__pycache__/router.cpython-312.pyc and b/store/@{FutureOSS}/http-tcp/__pycache__/router.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/http-tcp/__pycache__/server.cpython-312.pyc b/store/@{FutureOSS}/http-tcp/__pycache__/server.cpython-312.pyc index 630503f..0c3bf41 100644 Binary files a/store/@{FutureOSS}/http-tcp/__pycache__/server.cpython-312.pyc and b/store/@{FutureOSS}/http-tcp/__pycache__/server.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/i18n/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/i18n/__pycache__/__init__.cpython-312.pyc index 9d6541f..c548b9a 100644 Binary files a/store/@{FutureOSS}/i18n/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/i18n/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/i18n/__pycache__/i18n.cpython-312.pyc b/store/@{FutureOSS}/i18n/__pycache__/i18n.cpython-312.pyc index ace50d4..a9cbefc 100644 Binary files a/store/@{FutureOSS}/i18n/__pycache__/i18n.cpython-312.pyc and b/store/@{FutureOSS}/i18n/__pycache__/i18n.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/i18n/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/i18n/__pycache__/main.cpython-312.pyc index 571b17c..9b6005f 100644 Binary files a/store/@{FutureOSS}/i18n/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/i18n/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/i18n/__pycache__/middleware.cpython-312.pyc b/store/@{FutureOSS}/i18n/__pycache__/middleware.cpython-312.pyc index 2b1003c..a16ad8c 100644 Binary files a/store/@{FutureOSS}/i18n/__pycache__/middleware.cpython-312.pyc and b/store/@{FutureOSS}/i18n/__pycache__/middleware.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/json-codec/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/json-codec/__pycache__/main.cpython-312.pyc index 9a946b9..6e2c262 100644 Binary files a/store/@{FutureOSS}/json-codec/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/json-codec/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/lifecycle.disabled/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/lifecycle.disabled/__pycache__/main.cpython-312.pyc index 6ea7f96..6598d0f 100644 Binary files a/store/@{FutureOSS}/lifecycle.disabled/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/lifecycle.disabled/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/log-terminal/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/log-terminal/__pycache__/main.cpython-312.pyc index 4dfb194..5ca9eba 100644 Binary files a/store/@{FutureOSS}/log-terminal/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/log-terminal/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/log-terminal/main.py b/store/@{FutureOSS}/log-terminal/main.py index afd2c90..68a1759 100644 --- a/store/@{FutureOSS}/log-terminal/main.py +++ b/store/@{FutureOSS}/log-terminal/main.py @@ -551,55 +551,279 @@ class LogTerminalPlugin(Plugin): return logs[-limit:] def _render_logs(self) -> str: - """渲染日志查看界面""" + """渲染日志查看界面 - 纯 HTML/Python 模板""" try: - php_file = os.path.join(self.views_dir, 'logs.php') - if not os.path.exists(php_file): - return "

日志视图文件丢失

" - return self._execute_php(php_file, {}) + logs = self._get_logs(limit=100) + log_rows = "" + for log in logs: + level_class = { + 'info': 'log-info', + 'warn': 'log-warn', + 'error': 'log-error', + 'ok': 'log-ok', + 'tip': 'log-tip' + }.get(log['level'], 'log-info') + log_rows += f""" + + {log['timestamp']} + {log['level']} + {log['tag']} + {log['message']} + """ + + html = f""" + + + + + 系统日志 + + + + +
+
+
+

系统日志

+
+ + +
+
+
+ + + + + + + + + + + {log_rows} + +
时间级别标签消息
+
+

最后更新:{logs[-1]['timestamp'] if logs else '无数据'}

+
+
+ + +""" + return html except Exception as e: - return f"

日志视图渲染出错: {e}

" - + return f"

日志视图渲染出错:{e}

" def _render_terminal(self) -> str: - """渲染终端界面""" + """渲染终端界面 - 纯 HTML/Python 模板""" try: - php_file = os.path.join(self.views_dir, 'terminal.php') - if not os.path.exists(php_file): - return "

终端视图文件丢失

" - return self._execute_php(php_file, {}) + html = """ + + + + + SSH 终端 + + + + +
+
+
+

SSH 终端

+
+ + +
+
+
+
+ + 未连接 +
+
+ 会话 ID: - +
+
+
+
+
欢迎使用 SSH 终端!点击"连接"按钮开始...
+
+ +
+
+
+ + +""" + return html except Exception as e: - return f"

终端视图渲染出错: {e}

" - - def _execute_php(self, php_file: str, variables: dict) -> str: - """执行 PHP 文件""" - php_vars = "" - for key, value in variables.items(): - if isinstance(value, str): - escaped = value.replace('\\', '\\\\').replace("'", "\\'").replace("\n", "\\n") - php_vars += f"${key} = '{escaped}';\n" - else: - php_vars += f"${key} = {value};\n" - - with open(php_file, 'r', encoding='utf-8') as f: - php_content = f.read() - - tmp_file = os.path.join(os.path.dirname(php_file), '.temp_lt.php') - try: - with open(tmp_file, 'w', encoding='utf-8') as f: - f.write(f"\n{php_content}") - result = subprocess.run( - ["php", "-f", tmp_file], - capture_output=True, text=True, timeout=10, - encoding='utf-8', errors='replace' - ) - return result.stdout if result.returncode == 0 else f"
{result.stderr}
" - finally: - try: - if os.path.exists(tmp_file): - os.unlink(tmp_file) - except Exception: - pass - + return f"

终端视图渲染出错:{e}

" register_plugin_type("LogTerminalPlugin", LogTerminalPlugin) diff --git a/store/@{FutureOSS}/log-terminal/views/logs.php b/store/@{FutureOSS}/log-terminal/views/logs.php deleted file mode 100644 index e7ef43c..0000000 --- a/store/@{FutureOSS}/log-terminal/views/logs.php +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - -
-
-
- - 系统日志 - - - 实时同步 - -
-
- - -
-
- -
- - - - - - -
- -
-
- -

正在加载日志...

-
-
-
- - - - diff --git a/store/@{FutureOSS}/log-terminal/views/terminal.php b/store/@{FutureOSS}/log-terminal/views/terminal.php deleted file mode 100644 index abecdaa..0000000 --- a/store/@{FutureOSS}/log-terminal/views/terminal.php +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - -
-
-
- - SSH 终端 -
-
-
- - 未连接 -
- - - -
-
- -
-
- SSH 端口: - -
-
- -
-
- -
-
-
- - 端口: 8022 -
-
- - 运行时间: - -
-
- -
-
- -

点击"连接"按钮开始 SSH 终端会话

-

支持自动安装 SSH 服务

-
-
- - -
-
- - - - diff --git a/store/@{FutureOSS}/pkg-manager/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/pkg-manager/__pycache__/main.cpython-312.pyc index 3dc645d..09719b0 100644 Binary files a/store/@{FutureOSS}/pkg-manager/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/pkg-manager/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/pkg-manager/main.py b/store/@{FutureOSS}/pkg-manager/main.py index fd07ce5..167326a 100644 --- a/store/@{FutureOSS}/pkg-manager/main.py +++ b/store/@{FutureOSS}/pkg-manager/main.py @@ -104,46 +104,187 @@ class PkgManagerPlugin(Plugin): # ==================== 页面渲染 ==================== def _packages_content(self) -> str: - return self._render_php_view('packages.php', {'pageTitle': '插件管理'}) + """渲染插件管理页面 - 纯 HTML/Python 模板""" + try: + # 获取已安装的插件列表 + plugins = self._get_installed_plugins() + plugin_rows = "" + for pkg_name, info in plugins.items(): + status_class = "success" if info.get('enabled', False) else "secondary" + status_text = "已启用" if info.get('enabled', False) else "已禁用" + plugin_rows += f""" + + {pkg_name} + {info.get('version', '未知')} + {info.get('author', '未知')} + {status_text} + + + + + """ + + html = f""" + + + + + 插件管理 + + + + +
+
+
+

插件管理

+ +
+ + + + + + + + + + + + {plugin_rows} + +
插件名称版本作者状态操作
+
+
+ + +""" + return html + except Exception as e: + return f"

插件管理页面渲染出错:{{e}}

" def _store_content(self) -> str: - return self._render_php_view('store.php', {'pageTitle': '插件商店'}) - - def _render_php_view(self, view_name: str, variables: dict) -> str: - import subprocess - - views_dir = os.path.join(os.path.dirname(__file__), 'views') - php_file = os.path.join(views_dir, view_name) - if not os.path.exists(php_file): - return f"

错误: 找不到 {view_name}

" - - php_vars = "" - for key, value in variables.items(): - if isinstance(value, str): - php_vars += f"${key} = '{value}';\n" - else: - php_vars += f"${key} = {json.dumps(value)};\n" - - with open(php_file, 'r', encoding='utf-8') as f: - php_content = f.read() - - tmp_file = os.path.join(views_dir, '.temp_pkg.php') + """渲染插件商店页面 - 纯 HTML/Python 模板""" try: - with open(tmp_file, 'w', encoding='utf-8') as f: - f.write(f"\n{php_content}") + # 获取可用插件列表 + available = self._get_available_plugins() + installed = self._get_installed_plugins() + plugin_cards = "" + for pkg_name, info in available.items(): + is_installed = pkg_name in installed + action_btn = f'' if not is_installed else '' + plugin_cards += f""" +
+
+

{info.get('name', pkg_name)}

+

{info.get('description', '暂无描述')}

+
+ 版本:{info.get('version', '未知')} + 作者:{info.get('author', '未知')} +
+
+ {action_btn} +
+
""" + + html = f""" + + + + + 插件商店 + + + + +
+
+
+

插件商店

+
+
+ {plugin_cards} +
+
+
+ + +""" + return html + except Exception as e: + return f"

插件商店页面渲染出错:{{e}}

" - result = subprocess.run( - ["php", "-f", tmp_file], - capture_output=True, text=True, timeout=10, cwd=views_dir, - encoding='utf-8', errors='replace' - ) - return result.stdout if result.returncode == 0 else f"
{result.stderr}
" - finally: - try: - if os.path.exists(tmp_file): - os.unlink(tmp_file) - except: - pass # ==================== API 处理 ==================== diff --git a/store/@{FutureOSS}/pkg-manager/views/packages.php b/store/@{FutureOSS}/pkg-manager/views/packages.php deleted file mode 100644 index 4627e81..0000000 --- a/store/@{FutureOSS}/pkg-manager/views/packages.php +++ /dev/null @@ -1,337 +0,0 @@ -
- - - -
-

已安装插件

- -
- -
-
- - -
- - - -
- - -
diff --git a/store/@{FutureOSS}/pkg-manager/views/store.php b/store/@{FutureOSS}/pkg-manager/views/store.php deleted file mode 100644 index ab407e9..0000000 --- a/store/@{FutureOSS}/pkg-manager/views/store.php +++ /dev/null @@ -1,197 +0,0 @@ -
- - - -
-
分类
-
- 全部插件 -
-
- 可安装 -
-
- 已安装 -
-
- 可配置 -
-
- - -
-
-

插件商店

-

浏览并安装插件来扩展功能

-
- - -
- -

正在加载插件列表...

-
- - -
- -

加载失败,请稍后重试

-
- - - -
- -
- -
- -

-
-
- - -
diff --git a/store/@{FutureOSS}/plugin-bridge/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/plugin-bridge/__pycache__/main.cpython-312.pyc index 95859f5..27ff9a8 100644 Binary files a/store/@{FutureOSS}/plugin-bridge/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/plugin-bridge/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/__pycache__/main.cpython-312.pyc index 3f4daf8..27bfb14 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/circuit/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/circuit/__pycache__/__init__.cpython-312.pyc index 3e1ce1a..6694d59 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/circuit/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/circuit/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/circuit/__pycache__/breaker.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/circuit/__pycache__/breaker.cpython-312.pyc index ab08a67..54b3103 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/circuit/__pycache__/breaker.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/circuit/__pycache__/breaker.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/circuit/__pycache__/state.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/circuit/__pycache__/state.cpython-312.pyc index f050b66..5990f52 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/circuit/__pycache__/state.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/circuit/__pycache__/state.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/__init__.cpython-312.pyc index d8dc97e..cc6625a 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/config.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/config.cpython-312.pyc index 9b43cea..a90294b 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/config.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/config.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/enhancer.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/enhancer.cpython-312.pyc index ce5e276..f3b6645 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/enhancer.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/enhancer.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/manager.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/manager.cpython-312.pyc index 2e7986a..d7fb6d0 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/manager.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/manager.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/proxy.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/proxy.cpython-312.pyc index 5f11982..6f2f78e 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/proxy.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/proxy.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/registry.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/registry.cpython-312.pyc index 2922fd4..18f3e88 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/registry.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/core/__pycache__/registry.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/fallback/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/fallback/__pycache__/__init__.cpython-312.pyc index d1ae97d..8f16110 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/fallback/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/fallback/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/fallback/__pycache__/handler.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/fallback/__pycache__/handler.cpython-312.pyc index 4399c40..e6f8440 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/fallback/__pycache__/handler.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/fallback/__pycache__/handler.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/isolation/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/isolation/__pycache__/__init__.cpython-312.pyc index ab32ad5..98f5a73 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/isolation/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/isolation/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/isolation/__pycache__/timeout.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/isolation/__pycache__/timeout.cpython-312.pyc index 05b9795..3dbdff4 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/isolation/__pycache__/timeout.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/isolation/__pycache__/timeout.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/models/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/models/__pycache__/__init__.cpython-312.pyc index 629a12b..54b6c95 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/models/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/models/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/models/__pycache__/plugin_info.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/models/__pycache__/plugin_info.cpython-312.pyc index 0565b49..0347086 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/models/__pycache__/plugin_info.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/models/__pycache__/plugin_info.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/recovery/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/recovery/__pycache__/__init__.cpython-312.pyc index 67f3280..4f3cc50 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/recovery/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/recovery/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/recovery/__pycache__/auto_fix.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/recovery/__pycache__/auto_fix.cpython-312.pyc index 0854c57..236bb3f 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/recovery/__pycache__/auto_fix.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/recovery/__pycache__/auto_fix.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/recovery/__pycache__/health.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/recovery/__pycache__/health.cpython-312.pyc index 5244482..07e1661 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/recovery/__pycache__/health.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/recovery/__pycache__/health.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/retry/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/retry/__pycache__/__init__.cpython-312.pyc index f45ade8..d8d9c35 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/retry/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/retry/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/retry/__pycache__/handler.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/retry/__pycache__/handler.cpython-312.pyc index 3c8b2d5..fb4c2bc 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/retry/__pycache__/handler.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/retry/__pycache__/handler.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/utils/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/utils/__pycache__/__init__.cpython-312.pyc index f5fc908..621a11d 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/utils/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/utils/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader-pro.disabled/utils/__pycache__/logger.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader-pro.disabled/utils/__pycache__/logger.cpython-312.pyc index b4e05c2..a006f17 100644 Binary files a/store/@{FutureOSS}/plugin-loader-pro.disabled/utils/__pycache__/logger.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader-pro.disabled/utils/__pycache__/logger.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-loader/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/plugin-loader/__pycache__/main.cpython-312.pyc index 3539698..3568778 100644 Binary files a/store/@{FutureOSS}/plugin-loader/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/plugin-loader/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/plugin-storage/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/plugin-storage/__pycache__/main.cpython-312.pyc index 479e290..05cc456 100644 Binary files a/store/@{FutureOSS}/plugin-storage/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/plugin-storage/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/signature-verifier/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/signature-verifier/__pycache__/main.cpython-312.pyc index a3b3aeb..777d2c9 100644 Binary files a/store/@{FutureOSS}/signature-verifier/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/signature-verifier/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/webui/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/webui/__pycache__/main.cpython-312.pyc index 9852bf6..c197bd6 100644 Binary files a/store/@{FutureOSS}/webui/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/webui/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/webui/core/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/webui/core/__pycache__/__init__.cpython-312.pyc index 59e0ae6..e423388 100644 Binary files a/store/@{FutureOSS}/webui/core/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/webui/core/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/webui/core/__pycache__/server.cpython-312.pyc b/store/@{FutureOSS}/webui/core/__pycache__/server.cpython-312.pyc index b18b8d7..4c68307 100644 Binary files a/store/@{FutureOSS}/webui/core/__pycache__/server.cpython-312.pyc and b/store/@{FutureOSS}/webui/core/__pycache__/server.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/webui/frontend/config/config.php b/store/@{FutureOSS}/webui/frontend/config/config.php deleted file mode 100644 index 750a79c..0000000 --- a/store/@{FutureOSS}/webui/frontend/config/config.php +++ /dev/null @@ -1,26 +0,0 @@ - [ - 'host' => 'localhost', - 'port' => 3306, - 'username' => 'root', - 'password' => '', - 'dbname' => 'futureoss', - 'charset' => 'utf8mb4' - ], - - // 应用配置 - 'app' => [ - 'title' => 'FutureOSS', - 'theme' => 'dark', - 'version' => '1.0.0' - ], - - // 其他插件可以添加配置 - 'plugins' => [] -]; diff --git a/store/@{FutureOSS}/webui/frontend/includes/database.php b/store/@{FutureOSS}/webui/frontend/includes/database.php deleted file mode 100644 index d8612be..0000000 --- a/store/@{FutureOSS}/webui/frontend/includes/database.php +++ /dev/null @@ -1,115 +0,0 @@ -config = include $configFile; - $dbConfig = $this->config['database']; - - try { - $dsn = "mysql:host={$dbConfig['host']};port={$dbConfig['port']};dbname={$dbConfig['dbname']};charset={$dbConfig['charset']}"; - $this->connection = new PDO($dsn, $dbConfig['username'], $dbConfig['password']); - $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $this->connection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); - } catch (PDOException $e) { - // 数据库连接失败时记录日志但不阻止页面加载 - error_log('[FutureOSS WebUI] 数据库连接失败: ' . $e->getMessage()); - $this->connection = null; - } - } - - /** - * 获取单例实例 - */ - public static function getInstance() { - if (self::$instance === null) { - self::$instance = new self(); - } - return self::$instance; - } - - /** - * 获取数据库连接 - */ - public function getConnection() { - return $this->connection; - } - - /** - * 检查数据库是否可用 - */ - public function isConnected() { - return $this->connection !== null; - } - - /** - * 执行查询 - */ - public function query($sql, $params = []) { - if (!$this->isConnected()) { - return false; - } - - try { - $stmt = $this->connection->prepare($sql); - $stmt->execute($params); - return $stmt; - } catch (PDOException $e) { - error_log('[FutureOSS WebUI] 数据库查询错误: ' . $e->getMessage()); - return false; - } - } - - /** - * 获取所有结果 - */ - public function fetchAll($sql, $params = []) { - $stmt = $this->query($sql, $params); - return $stmt ? $stmt->fetchAll() : []; - } - - /** - * 获取单条结果 - */ - public function fetchOne($sql, $params = []) { - $stmt = $this->query($sql, $params); - return $stmt ? $stmt->fetch() : null; - } - - /** - * 插入数据并返回 ID - */ - public function insert($sql, $params = []) { - $stmt = $this->query($sql, $params); - return $stmt ? $this->connection->lastInsertId() : false; - } - - /** - * 防止 SQL 注入 - */ - public function escape($value) { - if (!$this->isConnected()) { - return addslashes($value); - } - return $this->connection->quote($value); - } - - // 防止克隆 - private function __clone() {} - public function __wakeup() { - throw new Exception("Cannot unserialize singleton"); - } -} diff --git a/store/@{FutureOSS}/webui/static/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/webui/static/__pycache__/__init__.cpython-312.pyc index f220964..f044928 100644 Binary files a/store/@{FutureOSS}/webui/static/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/webui/static/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/webui/static/__pycache__/assets.cpython-312.pyc b/store/@{FutureOSS}/webui/static/__pycache__/assets.cpython-312.pyc index 37f9dcd..f9f444a 100644 Binary files a/store/@{FutureOSS}/webui/static/__pycache__/assets.cpython-312.pyc and b/store/@{FutureOSS}/webui/static/__pycache__/assets.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/webui/templates/__pycache__/__init__.cpython-312.pyc b/store/@{FutureOSS}/webui/templates/__pycache__/__init__.cpython-312.pyc index 796aeb4..bddf16a 100644 Binary files a/store/@{FutureOSS}/webui/templates/__pycache__/__init__.cpython-312.pyc and b/store/@{FutureOSS}/webui/templates/__pycache__/__init__.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/webui/templates/__pycache__/layout.cpython-312.pyc b/store/@{FutureOSS}/webui/templates/__pycache__/layout.cpython-312.pyc index 123ff85..4c5ae7b 100644 Binary files a/store/@{FutureOSS}/webui/templates/__pycache__/layout.cpython-312.pyc and b/store/@{FutureOSS}/webui/templates/__pycache__/layout.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/ws-api/__pycache__/events.cpython-312.pyc b/store/@{FutureOSS}/ws-api/__pycache__/events.cpython-312.pyc index 1e7cffa..4ba0763 100644 Binary files a/store/@{FutureOSS}/ws-api/__pycache__/events.cpython-312.pyc and b/store/@{FutureOSS}/ws-api/__pycache__/events.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/ws-api/__pycache__/main.cpython-312.pyc b/store/@{FutureOSS}/ws-api/__pycache__/main.cpython-312.pyc index bedad71..e053441 100644 Binary files a/store/@{FutureOSS}/ws-api/__pycache__/main.cpython-312.pyc and b/store/@{FutureOSS}/ws-api/__pycache__/main.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/ws-api/__pycache__/middleware.cpython-312.pyc b/store/@{FutureOSS}/ws-api/__pycache__/middleware.cpython-312.pyc index 81e0ec2..3e62600 100644 Binary files a/store/@{FutureOSS}/ws-api/__pycache__/middleware.cpython-312.pyc and b/store/@{FutureOSS}/ws-api/__pycache__/middleware.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/ws-api/__pycache__/router.cpython-312.pyc b/store/@{FutureOSS}/ws-api/__pycache__/router.cpython-312.pyc index 203457c..f6693b6 100644 Binary files a/store/@{FutureOSS}/ws-api/__pycache__/router.cpython-312.pyc and b/store/@{FutureOSS}/ws-api/__pycache__/router.cpython-312.pyc differ diff --git a/store/@{FutureOSS}/ws-api/__pycache__/server.cpython-312.pyc b/store/@{FutureOSS}/ws-api/__pycache__/server.cpython-312.pyc index c7edf55..2130b83 100644 Binary files a/store/@{FutureOSS}/ws-api/__pycache__/server.cpython-312.pyc and b/store/@{FutureOSS}/ws-api/__pycache__/server.cpython-312.pyc differ