feat: refine forum settings uploads and transitions

This commit is contained in:
lezi-fun committed 2026-08-14 10:16:34 +08:00
1 parent e85ced7319
commit f5d173350b
23 files changed
+985 -54

No files matched your search

+11
View File
@@ -127,6 +127,17 @@ export const API = {
updateSettings(forum_name) {
return apiFetch('/settings', { method: 'PUT', body: JSON.stringify({ forum_name }) });
},
uploadFavicon(file) {
const fd = new FormData();
fd.append('file', file);
const headers = {};
if (token) headers['Authorization'] = 'Bearer ' + token;
return fetch('/api/admin/favicon', { method: 'POST', body: fd, headers }).then(async (res) => {
const data = await res.json().catch(() => ({}));
if (!res.ok || data.error) throw new Error(data.error || '上传失败');
return data;
});
},
getLinks() { return apiFetch('/links'); },
addLink(title, url) {
return apiFetch('/links', { method: 'POST', body: JSON.stringify({ title, url }) });