feat: toast notifications, canvas captcha, super admin, mobile fixes

- Toast system (ToastProvider + useToast): right-top colored toasts
  replace alert for publish success/error; CSS + layout mount
- Captcha as canvas image (noise + distortion) in NewPost/ReplyList/
  register modal — blocks bots, click to refresh
- Super admin: first registered user cannot be demoted (isFirstUser by
  created_at, DB-agnostic)
- Admins can delete others' posts/replies (UI buttons shown for admin)
- Mobile: post-actions wrap + compact, feed excerpt 2.5 lines
- Fix: missing sun icon in Icons (dark mode toggle showed nothing)
- Feed long posts: gradient fade mask instead of line-clamp
This commit is contained in:
lezi-fun committed 2026-08-10 21:56:05 +08:00
1 parent c059ad0979
commit 80eb313604
12 files changed
+262 -31

No files matched your search

+10
View File
@@ -40,3 +40,13 @@ export async function requireAdmin(user) {
return Response.json({ error: '服务器错误' }, { status: 500 });
}
}
// 判断是否为第一个注册的用户(超级管理员,按创建时间最早,兼容 UUID/自增 id 数据库)
export async function isFirstUser(userId) {
try {
const r = await pool.query('SELECT id FROM users ORDER BY created_at ASC, id ASC LIMIT 1');
return r.rows.length > 0 && r.rows[0].id === userId;
} catch {
return false;
}
}