Make audit logs server owned
This commit is contained in:
1 parent
145f13fee5
commit
a5a880dfb2
6 files changed
+81
-28
No files matched your search
@@ -214,14 +214,6 @@ const API = {
|
||||
return data;
|
||||
},
|
||||
|
||||
async logEvent(action) {
|
||||
try {
|
||||
await apiFetch('/event-logs', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ action })
|
||||
});
|
||||
} catch (e) { /* 静默失败 */ }
|
||||
},
|
||||
|
||||
// ============================================================
|
||||
// 论坛设置
|
||||
|
||||
@@ -1091,7 +1091,7 @@ async function init() {
|
||||
try {
|
||||
const user = await API.getMe();
|
||||
currentUser = user;
|
||||
API.logEvent('login').catch(() => {});
|
||||
|
||||
} catch (e) {
|
||||
token = null;
|
||||
localStorage.removeItem('forumlify-token');
|
||||
@@ -1242,7 +1242,7 @@ async function init() {
|
||||
});
|
||||
try {
|
||||
await API.createPost(title, content, images);
|
||||
API.logEvent('create_post').catch(() => {});
|
||||
|
||||
alert('发布成功!');
|
||||
switchPage('feed');
|
||||
renderFeed();
|
||||
|
||||
@@ -18,7 +18,6 @@ document.getElementById('loginSubmit').addEventListener('click', async () => {
|
||||
document.getElementById('loginPassword').value = '';
|
||||
if (result.user) {
|
||||
currentUser = result.user;
|
||||
API.logEvent('login').catch(() => {});
|
||||
renderNav();
|
||||
if (currentPage === 'admin' && currentUser.role !== 'admin') {
|
||||
switchPage('feed');
|
||||
@@ -63,7 +62,6 @@ document.getElementById('registerSubmit').addEventListener('click', async () =>
|
||||
try {
|
||||
await API.login(email, password);
|
||||
currentUser = await API.getMe();
|
||||
API.logEvent('register').catch(() => {});
|
||||
renderNav();
|
||||
|
||||
if (currentPage === 'admin' && currentUser.role !== 'admin') {
|
||||
|
||||
+1
-1
@@ -228,7 +228,7 @@ async function handleReplySubmit(postId) {
|
||||
if (parseInt(captchaInput) !== captchaAnswer) { alert('验证码错误,请重新计算'); refreshCaptcha('reply'); return; }
|
||||
try {
|
||||
await API.createReply(postId, content);
|
||||
API.logEvent('create_reply').catch(() => {});
|
||||
|
||||
renderPostDetail(postId);
|
||||
if (currentPage === 'feed') {
|
||||
renderFeed();
|
||||
|
||||
Reference in new issue
Block a user