feat: port upstream custom pages, notifications, recovery codes, account security

- schema: custom_pages, notifications, recovery_codes tables + UNIQUE(conversations) + posts.edited_at
- API: custom-pages CRUD (public + admin), notifications (list/read/read-all), recovery-codes (generate/count/reset-password), user avatar/password/email, post edit
- UI: custom page nav links + iframe rendering, admin custom pages tab with editor modal, messages page shows notifications, settings page gains avatar upload, password/email change, recovery codes manager
- Sync globals.css with upstream rewrite
This commit is contained in:
lezi-fun committed 2026-08-10 09:07:06 +08:00
1 parent 9e72e4de8e
commit 4732e7d61d
28 files changed
+1196 -255

No files matched your search

+25 -3
View File
@@ -1,13 +1,19 @@
'use client';
// 导航栏:论坛名、登录/注册按钮、用户下拉菜单、主题切换
import { useState } from 'react';
// 导航栏:论坛名、自定义页面链接、登录/注册、用户菜单、主题切换
import { useState, useEffect } from 'react';
import { useApp } from './AppProvider';
import { Icon } from './Icons';
import { API } from '@/lib/api';
export default function Navbar({ onOpenModal }) {
const { currentUser, forumName, theme, toggleTheme, navigate, logout } = useApp();
const { currentUser, forumName, theme, toggleTheme, navigate, openCustomPage, logout } = useApp();
const [menuOpen, setMenuOpen] = useState(false);
const [customPages, setCustomPages] = useState([]);
useEffect(() => {
API.getCustomPages().then(setCustomPages).catch(() => {});
}, []);
const avatarSrc = currentUser?.avatar_url ||
'https://ui-avatars.com/api/?name=' + encodeURIComponent(currentUser?.username || 'U') +
@@ -35,6 +41,22 @@ export default function Navbar({ onOpenModal }) {
<span className="forum-name" onClick={() => navigate('feed')} style={{ cursor: 'pointer' }}>
{forumName}
</span>
<span id="customNavLinks" style={{ display: 'inline-flex', alignItems: 'center', gap: 6, marginLeft: 16 }}>
{customPages.map((p) => (
<a
key={p.id}
href="#"
className="custom-page-nav-link"
data-custom={p.name}
onClick={(e) => { e.preventDefault(); openCustomPage(p.name); }}
style={{ color: 'var(--text-secondary)', textDecoration: 'none', fontSize: 14, padding: '4px 10px', borderRadius: 4, transition: 'color 0.15s' }}
onMouseEnter={(e) => { e.currentTarget.style.color = 'var(--text)'; }}
onMouseLeave={(e) => { e.currentTarget.style.color = 'var(--text-secondary)'; }}
>
{p.title}
</a>
))}
</span>
</div>
<div className="nav-right">
<div id="userMenu">