diff --git a/config-example.json b/config-example.json index edf2043..7810d6a 100644 --- a/config-example.json +++ b/config-example.json @@ -71,18 +71,27 @@ "cpp17", "csharp", "c", - "vala", "java", "pascal", - "lua", - "luajit", "python2", "python3", "nodejs", "ruby", - "haskell", - "ocaml", - "vbnet" + "haskell" + ], + "filter_enabled_languages": [ + "cpp", + "cpp11", + "cpp17", + "csharp", + "c", + "java", + "pascal", + "python2", + "python3", + "nodejs", + "ruby", + "haskell" ], "links": [ { diff --git a/modules/problem.js b/modules/problem.js index 6a01cf3..8b46c72 100644 --- a/modules/problem.js +++ b/modules/problem.js @@ -592,7 +592,7 @@ app.post('/problem/:id/submit', app.multer.fields([{ name: 'answer', maxCount: 1 const curUser = res.locals.user; if (!problem) throw new ErrorMessage('无此题目。'); - if (problem.type !== 'submit-answer' && !syzoj.languages[req.body.language]) throw new ErrorMessage('不支持该语言。'); + if (problem.type !== 'submit-answer' && !syzoj.config.enabled_languages.includes(req.body.language)) throw new ErrorMessage('不支持该语言。'); if (!curUser) throw new ErrorMessage('请登录后继续。', { '登录': syzoj.utils.makeUrl(['login'], { 'url': syzoj.utils.makeUrl(['problem', id]) }) }); let judge_state; diff --git a/views/admin_rejudge.ejs b/views/admin_rejudge.ejs index d1b6cf2..4e68204 100644 --- a/views/admin_rejudge.ejs +++ b/views/admin_rejudge.ejs @@ -19,7 +19,7 @@
diff --git a/views/submissions.ejs b/views/submissions.ejs index f9fae7d..8b2dc7b 100644 --- a/views/submissions.ejs +++ b/views/submissions.ejs @@ -38,7 +38,7 @@