feat: EveryPublish Web 管理端重构与全平台发布接入
- 新增 React + TDesign 管理端(sau_web_react),替代历史 Vue 前端 - 后端接入 11 平台登录/发布(视频+图文),check_cookie 扩展全平台 - 异步发布任务 + 实时进度监控 + 发布日志 - Open API 开放体系(API Key 鉴权 + 7 个开放接口 + API 文档页) - 账号单/批量校验与批量删除 - 全局配置(登录方式 + 发布静默模式) - 统一浏览器为系统 Chrome,品牌文案统一为 EveryPublish
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
"""全局系统配置存储(sqlite settings 表,覆盖所有平台)。"""
|
||||
import sqlite3
|
||||
from pathlib import Path
|
||||
|
||||
from conf import BASE_DIR
|
||||
|
||||
_DB_PATH = Path(BASE_DIR / "db" / "database.db")
|
||||
|
||||
|
||||
def _ensure_table(conn):
|
||||
conn.execute("CREATE TABLE IF NOT EXISTS settings (key TEXT PRIMARY KEY, value TEXT)")
|
||||
|
||||
|
||||
def get_setting(key: str, default=None):
|
||||
try:
|
||||
with sqlite3.connect(_DB_PATH) as conn:
|
||||
_ensure_table(conn)
|
||||
cur = conn.cursor()
|
||||
cur.execute("SELECT value FROM settings WHERE key = ?", (key,))
|
||||
row = cur.fetchone()
|
||||
return row[0] if row else default
|
||||
except Exception:
|
||||
return default
|
||||
|
||||
|
||||
def get_bool(key: str, default: bool = False) -> bool:
|
||||
val = get_setting(key, None)
|
||||
if val is None:
|
||||
return default
|
||||
return str(val).lower() in ("1", "true", "yes", "on")
|
||||
|
||||
|
||||
def set_setting(key: str, value) -> None:
|
||||
with sqlite3.connect(_DB_PATH) as conn:
|
||||
_ensure_table(conn)
|
||||
conn.execute("INSERT OR REPLACE INTO settings (key, value) VALUES (?, ?)", (key, str(value)))
|
||||
conn.commit()
|
||||
Reference in New Issue
Block a user