feat: follow lite forum updates
This commit is contained in:
1 parent
f59739e36f
commit
b42944b687
38 files changed
+1433
-71
No files matched your search
+32
-2
@@ -45,12 +45,21 @@ export const API = {
|
||||
getCaptcha() {
|
||||
return apiFetch('/captcha');
|
||||
},
|
||||
register(email, password, username, captcha) {
|
||||
register(email, password, username, captcha, emailCode = '') {
|
||||
return apiFetch('/auth/register', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ email, password, username, captcha_id: captcha?.id, captcha_answer: captcha?.answer, captcha_sig: captcha?.sig }),
|
||||
body: JSON.stringify({ email, password, username, email_code: emailCode, captcha_id: captcha?.id, captcha_answer: captcha?.answer, captcha_sig: captcha?.sig }),
|
||||
});
|
||||
},
|
||||
sendRegisterCode(email) {
|
||||
return apiFetch('/auth/send-code', { method: 'POST', body: JSON.stringify({ email }) });
|
||||
},
|
||||
sendResetCode(email) {
|
||||
return apiFetch('/auth/forgot-password', { method: 'POST', body: JSON.stringify({ email }) });
|
||||
},
|
||||
resetPasswordByEmail(email, code, newPassword) {
|
||||
return apiFetch('/auth/reset-password-by-email', { method: 'POST', body: JSON.stringify({ email, code, newPassword }) });
|
||||
},
|
||||
logout() { setToken(null); },
|
||||
getMe() { return apiFetch('/auth/me'); },
|
||||
|
||||
@@ -60,6 +69,9 @@ export const API = {
|
||||
if (userId) q += '&user_id=' + userId;
|
||||
return apiFetch(q);
|
||||
},
|
||||
searchPosts(query, page = 1, limit = 20) {
|
||||
return apiFetch(`/posts/search?q=${encodeURIComponent(query)}&page=${page}&limit=${limit}`);
|
||||
},
|
||||
getPost(postId) { return apiFetch('/posts/' + postId); },
|
||||
createPost(title, content, images, captcha) {
|
||||
return apiFetch('/posts', {
|
||||
@@ -96,6 +108,13 @@ export const API = {
|
||||
getUsers() { return apiFetch('/users'); },
|
||||
getUsersByUsername(username) { return apiFetch('/users?username=' + encodeURIComponent(username)); },
|
||||
getUserProfile(username) { return apiFetch('/users/profile/' + encodeURIComponent(username)); },
|
||||
searchUsers(query, limit = 10) {
|
||||
return apiFetch(`/users/search?q=${encodeURIComponent(query)}&limit=${limit}`);
|
||||
},
|
||||
getBlockStatus(userId) { return apiFetch(`/users/${encodeURIComponent(userId)}/block-status`); },
|
||||
getBlockedUsers() { return apiFetch('/blocks'); },
|
||||
blockUser(userId) { return apiFetch(`/users/${encodeURIComponent(userId)}/block`, { method: 'POST' }); },
|
||||
unblockUser(userId) { return apiFetch(`/users/${encodeURIComponent(userId)}/block`, { method: 'DELETE' }); },
|
||||
updateUserRole(userId, role) {
|
||||
return apiFetch('/users/' + userId + '/role', { method: 'PUT', body: JSON.stringify({ role }) });
|
||||
},
|
||||
@@ -127,6 +146,17 @@ export const API = {
|
||||
updateSettings(forum_name) {
|
||||
return apiFetch('/settings', { method: 'PUT', body: JSON.stringify({ forum_name }) });
|
||||
},
|
||||
adminGetSmtp() { return apiFetch('/admin/smtp'); },
|
||||
adminSaveSmtp(config) {
|
||||
return apiFetch('/admin/smtp', { method: 'PUT', body: JSON.stringify(config) });
|
||||
},
|
||||
adminTestSmtp(to) {
|
||||
return apiFetch('/admin/smtp/test', { method: 'POST', body: JSON.stringify({ to }) });
|
||||
},
|
||||
adminClearSmtpPassword() { return apiFetch('/admin/smtp/password', { method: 'DELETE' }); },
|
||||
adminSetEmailVerification(required) {
|
||||
return apiFetch('/admin/email-verify', { method: 'PUT', body: JSON.stringify({ required }) });
|
||||
},
|
||||
uploadFavicon(file) {
|
||||
const fd = new FormData();
|
||||
fd.append('file', file);
|
||||
|
||||
Reference in new issue
Block a user