feat: 新增控制面管理功能,优化插件加载与消息通知

- 新增内网插件控制面服务,实现统一账户、权限管理与插件分发
- 重构后端插件加载逻辑,支持按账号动态权限白名单加载
- 优化XQ0001排班异常提醒文案与推送群配置
- 新增前端管理界面与登录态会话管理
- 新增插件上传、账号管理等后台管理接口
This commit is contained in:
2026-09-09 11:31:41 +08:00
parent 9d067c0646
commit 65540fb121
13 changed files with 1214 additions and 37 deletions
+53
View File
@@ -37,4 +37,57 @@ export function connectWS(onEvent) {
try { onEvent(JSON.parse(e.data)) } catch (_) {}
}
return ws
}
// ===== 控制面管理(统一后端数据库 API,经底座后端代理) =====
export async function adminMe() {
return j('/api/admin/me')
}
export async function adminLogin(account, password) {
return jj('/api/admin/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ account, password }) })
}
export async function adminLogout() {
return j('/api/admin/logout', { method: 'POST' })
}
export async function adminPassword(body) {
return jj('/api/admin/password', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
}
export async function adminOverview() {
return j('/api/admin/overview')
}
async function jj(url, opts) {
const r = await fetch(url, opts)
if (!r.ok) {
let m = `HTTP ${r.status}`
try { m = (await r.json()).detail || m } catch (_) {}
throw new Error(m)
}
return r.json()
}
export async function adminGrant(body) {
return jj('/api/admin/account_plugins', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
}
export async function adminAccounts() {
return j('/api/admin/accounts')
}
export async function adminAccountCreate(body) {
return jj('/api/admin/account', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
}
export async function adminAccountUpdate(body) {
return jj('/api/admin/account/update', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
}
export async function adminAccountReset(body) {
return jj('/api/admin/account/reset_pwd', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
}
export async function adminAccountDelete(body) {
return jj('/api/admin/account/delete', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
}
export async function adminPluginDelete(body) {
return jj('/api/admin/plugin/delete', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
}
export async function adminUpload(pluginId, name, version, file) {
const fd = new FormData()
fd.append('upload', file)
const qs = new URLSearchParams({ plugin_id: pluginId, name, version })
return jj('/api/admin/pkg?' + qs.toString(), { method: 'POST', body: fd })
}