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); } +} + /* ================= 第二批小功能 ================= */ /* 复制消息 */