0bd9bcac12
后端修复: - engine/instances.py: Socks5Server.start() 端口占用时死循环, 增加超时和异常透传 - engine/instances.py: import time 移至顶层 - engine/instances.py: sync_instances/start_instance 容忍单实例启动失败 - run.py: 启动时 sync_instances 失败不退出进程 - web/routes.py: instances start/restart/edit 路由捕获 OSError, flash 友好提示 - api/v1.py: instances start/restart/update API 返回 JSON 错误而非 500 崩溃 - web/routes.py: toggle_user/ban_user 支持 hidden 字段语义, 缺字段时切换状态 - web/routes.py: inject_nav 增加独立 nav.dashboard 和 page_name, 修复双 active bug - auth.py: login 路由添加 logging import, 修 NameError 前端重构: - templates/base.html: 全局对比度提升(--text #f1f5f9, --accent #a5b4fc), 标题色显式声明, alert/modal/progress/table 完整暗色样式 - templates/base.html: main-content padding-top 修复 navbar 遮挡内容 - templates/base.html: 侧边栏 active 高亮 (白字 + elevated bg + 左边框) - templates/base.html: 顶栏动态显示当前页面名 - templates/*.html: 统一 page-header 类, 所有图标按钮添加 title tooltip - templates/users.html: toggle/ban 表单添加 hidden enabled/ban 字段 - templates/connections.html: fmtBytes 改为 Jinja macro, 时间格式化 - templates/dashboard.html: 时间格式化为 YYYY-MM-DD HH:MM:SS, chart canvas 高度调整 - templates/logs.html: 时间格式化为可读格式 - templates/stats.html: 提升 chart 颜色对比度 - templates/system.html: 使用 time.localtime() 显示本地时间
95 lines
3.4 KiB
HTML
95 lines
3.4 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}系统管理 · SOCKS Manager{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="page-header">
|
|
<h5><i class="bi bi-shield-lock"></i> 系统管理</h5>
|
|
</div>
|
|
|
|
<!-- 备份管理 -->
|
|
<div class="card mb-3">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<span><i class="bi bi-download"></i> 数据库备份</span>
|
|
<form method="post" action="/system/backup" style="display:inline">
|
|
<button type="submit" class="btn btn-primary btn-sm">
|
|
<i class="bi bi-plus-lg"></i> 立即备份</button>
|
|
</form>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
<table class="table table-dark table-sm">
|
|
<thead><tr><th>文件名</th><th>大小</th><th>创建时间</th><th>备注</th><th>操作</th></tr></thead>
|
|
<tbody>
|
|
{% for b in backups %}
|
|
<tr>
|
|
<td><code>{{ b.filename }}</code></td>
|
|
<td>{{ b.size_mb }} MB</td>
|
|
<td>{{ b.created_at[:16] }}</td>
|
|
<td>{{ b.note or '-' }}</td>
|
|
<td>
|
|
{% if b.exists %}
|
|
<form method="post" action="/system/restore/{{ b.id }}" style="display:inline"
|
|
onsubmit="return confirm('确认从备份 {{ b.filename }} 恢复?当前数据将被覆盖。')">
|
|
<button class="btn btn-outline-warning btn-sm">
|
|
<i class="bi bi-arrow-counterclockwise"></i> 恢复</button>
|
|
</form>
|
|
{% else %}
|
|
<span class="text-muted">文件已删除</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% if not backups %}
|
|
<div class="text-center py-4 text-muted">暂无备份</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 系统信息 -->
|
|
<div class="card mb-3">
|
|
<div class="card-header"><span><i class="bi bi-info-circle"></i> 系统信息</span></div>
|
|
<div class="card-body">
|
|
<table class="table table-dark table-sm">
|
|
<tbody>
|
|
<tr><td class="text-muted">Python 版本</td><td>{{ sys_version }}</td></tr>
|
|
<tr><td class="text-muted">操作系统</td><td>{{ sys_platform }}</td></tr>
|
|
<tr><td class="text-muted">主机名</td><td>{{ sys_hostname }}</td></tr>
|
|
<tr><td class="text-muted">数据库</td><td>SQLite (socks_manager.db)</td></tr>
|
|
<tr><td class="text-muted">启动时间</td><td>{{ uptime }}</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- API 密钥 -->
|
|
<div class="card">
|
|
<div class="card-header"><span><i class="bi bi-key"></i> API 密钥</span></div>
|
|
<div class="card-body">
|
|
<p class="text-muted small">RESTful API 端点: <code>/api/</code>,支持全部管理功能。
|
|
可使用 Session Cookie 认证(登录后自动附带)。</p>
|
|
<div class="row g-3">
|
|
<div class="col-md-6">
|
|
<div class="card" style="background:var(--bg-tertiary)">
|
|
<div class="card-body">
|
|
<h6 class="text-muted small">创建实例</h6>
|
|
<code>POST /api/instances<br>
|
|
{"name":"main","listen_port":1080,"auth_method":"userpass"}</code>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="card" style="background:var(--bg-tertiary)">
|
|
<div class="card-body">
|
|
<h6 class="text-muted small">创建用户</h6>
|
|
<code>POST /api/users<br>
|
|
{"username":"test","password":"pass","bandwidth_down":10}</code>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% endblock %}
|