fix: 修复3个问题
1. 对比度: --text-muted 从 #94a3b8 改为 #c8d6e5 (文字更亮) 2. 登录: auth.py 从 .env 文件读取密码,解决后台进程环境变量丢失 3. 实例创建: 同步 instances.py 的 db import (之前缺 import db)
This commit is contained in:
@@ -7,10 +7,23 @@ bp = Blueprint("auth", __name__)
|
|||||||
|
|
||||||
|
|
||||||
def _get_admin_creds():
|
def _get_admin_creds():
|
||||||
return (
|
import os
|
||||||
os.environ.get("SM_ADMIN_USER", "admin"),
|
_ENV = "/root/socks-manager/.env"
|
||||||
os.environ.get("SM_ADMIN_PASSWORD", ""),
|
pwd = os.environ.get("SM_ADMIN_PASSWORD")
|
||||||
)
|
user = os.environ.get("SM_ADMIN_USER", "admin")
|
||||||
|
if not pwd and os.path.exists(_ENV):
|
||||||
|
try:
|
||||||
|
for line in open(_ENV):
|
||||||
|
line = line.strip()
|
||||||
|
if line and not line.startswith("#"):
|
||||||
|
k, _, v = line.partition("=")
|
||||||
|
if k.strip() == "SM_ADMIN_PASSWORD":
|
||||||
|
pwd = v.strip()
|
||||||
|
elif k.strip() == "SM_ADMIN_USER":
|
||||||
|
user = v.strip()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return (user, pwd or "")
|
||||||
|
|
||||||
|
|
||||||
def login_required(f):
|
def login_required(f):
|
||||||
|
|||||||
@@ -141,6 +141,8 @@ class InstanceManager:
|
|||||||
|
|
||||||
def sync_instances(self):
|
def sync_instances(self):
|
||||||
"""根据数据库配置同步实例运行状态。"""
|
"""根据数据库配置同步实例运行状态。"""
|
||||||
|
from models import Instance
|
||||||
|
from database import db
|
||||||
self.reload_config()
|
self.reload_config()
|
||||||
|
|
||||||
current_names = set(self._config_cache.keys())
|
current_names = set(self._config_cache.keys())
|
||||||
|
|||||||
+2
-2
@@ -11,7 +11,7 @@
|
|||||||
/* ── 全局 ─────────────────────────────────────────────────────── */
|
/* ── 全局 ─────────────────────────────────────────────────────── */
|
||||||
:root {
|
:root {
|
||||||
--bg-primary:#0b0e14; --bg-secondary:#161922; --bg-tertiary:#1e2235;
|
--bg-primary:#0b0e14; --bg-secondary:#161922; --bg-tertiary:#1e2235;
|
||||||
--border:#1f2335; --text:#e2e8f0; --text-muted:#94a3b8;
|
--border:#1f2335; --text:#e2e8f0; --text-muted:#c8d6e5;
|
||||||
--accent:#818cf8; --accent-hover:#6366f1;
|
--accent:#818cf8; --accent-hover:#6366f1;
|
||||||
--green:#10b981; --red:#ef4444; --yellow:#f59e0b; --gray:#6b7280;
|
--green:#10b981; --red:#ef4444; --yellow:#f59e0b; --gray:#6b7280;
|
||||||
--card-bg:#161922; --input-bg:#0b0e14;
|
--card-bg:#161922; --input-bg:#0b0e14;
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
* { box-sizing:border-box; }
|
* { box-sizing:border-box; }
|
||||||
body { background:var(--bg-primary); color:var(--text);
|
body { background:var(--bg-primary); color:var(--text);
|
||||||
font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
|
font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
|
||||||
font-size:14px; line-height:1.6; }
|
font-size:16px; line-height:1.7; }
|
||||||
a { color:var(--accent); text-decoration:none; }
|
a { color:var(--accent); text-decoration:none; }
|
||||||
a:hover { color:var(--accent-hover); }
|
a:hover { color:var(--accent-hover); }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user