From 513b53672e9c48899086feda075ea7a211c0816a Mon Sep 17 00:00:00 2001 From: zhiqui Date: Sun, 15 Nov 2026 14:57:42 +0800 Subject: [PATCH] =?UTF-8?q?admin=E9=A1=B5:=20=E6=96=B0=E5=BB=BA=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=8C=89=E9=92=AE;=20=E9=9D=99=E6=80=81=E8=B5=84?= =?UTF-8?q?=E6=BA=90v=3D2=E9=98=B2=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/index.html | 4 ++-- web/js/app.js | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/web/index.html b/web/index.html index c5fc2c97..1b73c828 100644 --- a/web/index.html +++ b/web/index.html @@ -4,7 +4,7 @@ Open Maopaoya · 冒泡鸭开源复刻 - +
@@ -160,6 +160,6 @@ - + diff --git a/web/js/app.js b/web/js/app.js index f8a8ebf6..c2728744 100644 --- a/web/js/app.js +++ b/web/js/app.js @@ -401,7 +401,9 @@ async function loadAdmin() { `).join(""); const u = await api("/admin/users"); $("#admin-stats").textContent = `用户 ${u.stats.users} · 会话 ${u.stats.sessions}`; - $("#admin-users").innerHTML = `` + u.users.map(x => + $("#admin-users").innerHTML = `
+ +
` + u.users.map(x => `
${esc(x.username)} ${x.is_admin ? '管理员' : ""} ${x.is_active ? "" : '已封禁'}
@@ -498,6 +500,22 @@ async function revokeGrant(cid, uid) { adminGrantChannel(); } +async function adminCreateUser() { + openModal(`

新建用户

+ + +
+ +
`); +} +async function doCreateUser() { + try { + await api("/admin/users", { method: "POST", body: { + username: $("#nu-name").value, password: $("#nu-pass").value } }); + closeModal(); loadAdmin(); toast("用户已创建"); + } catch (e) { toast(e.message); } +} + /* ================= 第二批小功能 ================= */ /* 复制消息 */