diff --git a/modules/discussion.js b/modules/discussion.js index c9fba57..47a3279 100644 --- a/modules/discussion.js +++ b/modules/discussion.js @@ -137,7 +137,7 @@ app.post('/article/:id/edit', async (req, res) => { } }); -app.get('/article/:id/delete', async (req, res) => { +app.post('/article/:id/delete', async (req, res) => { try { if (!res.locals.user) throw new ErrorMessage('请登录后继续。', { '登录': syzoj.utils.makeUrl(['login'], { 'url': req.originalUrl }) }); @@ -192,7 +192,7 @@ app.post('/article/:id/comment', async (req, res) => { } }); -app.get('/article/:article_id/comment/:id/delete', async (req, res) => { +app.post('/article/:article_id/comment/:id/delete', async (req, res) => { try { if (!res.locals.user) throw new ErrorMessage('请登录后继续。', { '登录': syzoj.utils.makeUrl(['login'], { 'url': req.originalUrl }) }); diff --git a/modules/problem.js b/modules/problem.js index 9961334..7f80cdc 100644 --- a/modules/problem.js +++ b/modules/problem.js @@ -549,11 +549,11 @@ async function setPublic(req, res, is_public) { } } -app.get('/problem/:id/public', async (req, res) => { +app.post('/problem/:id/public', async (req, res) => { await setPublic(req, res, true); }); -app.get('/problem/:id/dis_public', async (req, res) => { +app.post('/problem/:id/dis_public', async (req, res) => { await setPublic(req, res, false); }); @@ -697,7 +697,7 @@ app.post('/problem/:id/testdata/upload', app.multer.array('file'), async (req, r } }); -app.get('/problem/:id/testdata/delete/:filename', async (req, res) => { +app.post('/problem/:id/testdata/delete/:filename', async (req, res) => { try { let id = parseInt(req.params.id); let problem = await Problem.fromID(id); diff --git a/modules/submission.js b/modules/submission.js index aa2e961..8b2e1ce 100644 --- a/modules/submission.js +++ b/modules/submission.js @@ -229,7 +229,7 @@ app.get('/submission/:id/ajax', async (req, res) => { } }); -app.get('/submission/:id/rejudge', async (req, res) => { +app.post('/submission/:id/rejudge', async (req, res) => { try { let id = parseInt(req.params.id); let judge = await JudgeState.fromID(id); diff --git a/modules/user.js b/modules/user.js index 5a30c43..d14ccc6 100644 --- a/modules/user.js +++ b/modules/user.js @@ -76,7 +76,7 @@ app.get('/sign_up', async (req, res) => { }); // Logout -app.get('/logout', async (req, res) => { +app.post('/logout', async (req, res) => { req.session.user_id = null; res.clearCookie('login'); res.redirect(req.query.url || '/'); diff --git a/static/script.js b/static/script.js new file mode 100644 index 0000000..9b62439 --- /dev/null +++ b/static/script.js @@ -0,0 +1,13 @@ +$(function () { + $('a[href-post]').click(function (e) { + e.preventDefault(); + + var form = document.createElement('form'); + form.style.display = 'none'; + form.method = 'post'; + form.action = $(this).attr('href-post'); + form.target = '_self'; + document.body.appendChild(form); + form.submit(); + }); +}); diff --git a/views/article.ejs b/views/article.ejs index 3083dc7..f9070e8 100644 --- a/views/article.ejs +++ b/views/article.ejs @@ -25,7 +25,7 @@ 否 - + @@ -65,7 +65,7 @@ 否 - + diff --git a/views/footer.ejs b/views/footer.ejs index 85ec1fd..1879604 100644 --- a/views/footer.ejs +++ b/views/footer.ejs @@ -7,10 +7,6 @@ - + diff --git a/views/header.ejs b/views/header.ejs index a0c6606..6215ee6 100644 --- a/views/header.ejs +++ b/views/header.ejs @@ -34,7 +34,7 @@ <%= user.username %><% if (user.nameplate) { %><%- user.nameplate %><% } %> diff --git a/views/problem.ejs b/views/problem.ejs index c93cca1..43834d1 100644 --- a/views/problem.ejs +++ b/views/problem.ejs @@ -106,9 +106,9 @@ div[class*=ace_br] { <% } %> <% if (problem.allowedManage) { %> <% if (problem.is_public) { %> - 取消公开 + 取消公开 <% } else { %> - 公开 + 公开 <% } %> <% } %> diff --git a/views/problem_data.ejs b/views/problem_data.ejs index 374956b..ac2969a 100644 --- a/views/problem_data.ejs +++ b/views/problem_data.ejs @@ -95,7 +95,7 @@ function getIcon(filename) { 否 - + diff --git a/views/submission_content.ejs b/views/submission_content.ejs index 3ca2274..f9db6fb 100644 --- a/views/submission_content.ejs +++ b/views/submission_content.ejs @@ -92,7 +92,7 @@ else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]); <% if (judge.problem.type !== 'submit-answer' && judge.allowedSeeCode) { %>
<% if (judge.allowedRejudge) { %> - 重新评测 + 重新评测 <% } %>
<%- judge.code %>