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:
1 parent
9e72e4de8e
commit
4732e7d61d
28 files changed
+1196
-255
No files matched your search
+38
@@ -57,6 +57,9 @@ export const API = {
|
||||
createPost(title, content, images) {
|
||||
return apiFetch('/posts', { method: 'POST', body: JSON.stringify({ title, content, images: images || [] }) });
|
||||
},
|
||||
updatePost(postId, title, content) {
|
||||
return apiFetch('/posts/' + postId, { method: 'PUT', body: JSON.stringify({ title, content }) });
|
||||
},
|
||||
deletePost(postId) { return apiFetch('/posts/' + postId, { method: 'DELETE' }); },
|
||||
|
||||
// 回复
|
||||
@@ -75,6 +78,15 @@ export const API = {
|
||||
updateProfile(userId, username, bio) {
|
||||
return apiFetch('/users/' + userId, { method: 'PUT', body: JSON.stringify({ username, bio }) });
|
||||
},
|
||||
updateAvatar(userId, avatar_url) {
|
||||
return apiFetch('/users/' + userId + '/avatar', { method: 'PUT', body: JSON.stringify({ avatar_url }) });
|
||||
},
|
||||
updatePassword(userId, oldPassword, newPassword) {
|
||||
return apiFetch('/users/' + userId + '/password', { method: 'PUT', body: JSON.stringify({ oldPassword, newPassword }) });
|
||||
},
|
||||
updateEmail(userId, password, newEmail) {
|
||||
return apiFetch('/users/' + userId + '/email', { method: 'PUT', body: JSON.stringify({ password, newEmail }) });
|
||||
},
|
||||
|
||||
// 举报
|
||||
getReports() { return apiFetch('/reports'); },
|
||||
@@ -115,6 +127,32 @@ export const API = {
|
||||
markMessageRead(messageId) {
|
||||
return apiFetch('/messages/' + messageId + '/read', { method: 'PUT' });
|
||||
},
|
||||
|
||||
// 自定义页面
|
||||
getCustomPages() { return apiFetch('/custom-pages'); },
|
||||
getCustomPage(name) { return apiFetch('/custom-pages/' + name); },
|
||||
adminGetCustomPages() { return apiFetch('/admin/custom-pages'); },
|
||||
adminCreateCustomPage(name, title, content) {
|
||||
return apiFetch('/admin/custom-pages', { method: 'POST', body: JSON.stringify({ name, title, content }) });
|
||||
},
|
||||
adminUpdateCustomPage(id, title, content, enabled) {
|
||||
return apiFetch('/admin/custom-pages/' + id, { method: 'PUT', body: JSON.stringify({ title, content, enabled }) });
|
||||
},
|
||||
adminDeleteCustomPage(id) {
|
||||
return apiFetch('/admin/custom-pages/' + id, { method: 'DELETE' });
|
||||
},
|
||||
|
||||
// 通知
|
||||
getNotifications() { return apiFetch('/notifications'); },
|
||||
markNotificationRead(id) { return apiFetch('/notifications/' + id + '/read', { method: 'PUT' }); },
|
||||
markAllNotificationsRead() { return apiFetch('/notifications/read-all', { method: 'PUT' }); },
|
||||
|
||||
// 恢复码
|
||||
generateRecoveryCodes() { return apiFetch('/auth/recovery-codes/generate', { method: 'POST' }); },
|
||||
getRecoveryCodeCount() { return apiFetch('/auth/recovery-codes/count'); },
|
||||
resetPassword(email, recoveryCode, newPassword) {
|
||||
return apiFetch('/auth/reset-password', { method: 'POST', body: JSON.stringify({ email, recoveryCode, newPassword }) });
|
||||
},
|
||||
};
|
||||
|
||||
// 图片上传 (multipart)
|
||||
|
||||
Reference in new issue
Block a user