Browse Source

Drop some langauges by default

pull/6/head
Menci 6 years ago
parent
commit
8245c0a6fa
  1. 21
      config-example.json
  2. 2
      modules/problem.js
  3. 2
      views/admin_rejudge.ejs
  4. 2
      views/submissions.ejs

21
config-example.json

@ -71,18 +71,27 @@
"cpp17", "cpp17",
"csharp", "csharp",
"c", "c",
"vala",
"java", "java",
"pascal", "pascal",
"lua",
"luajit",
"python2", "python2",
"python3", "python3",
"nodejs", "nodejs",
"ruby", "ruby",
"haskell", "haskell"
"ocaml", ],
"vbnet" "filter_enabled_languages": [
"cpp",
"cpp11",
"cpp17",
"csharp",
"c",
"java",
"pascal",
"python2",
"python3",
"nodejs",
"ruby",
"haskell"
], ],
"links": [ "links": [
{ {

2
modules/problem.js

@ -592,7 +592,7 @@ app.post('/problem/:id/submit', app.multer.fields([{ name: 'answer', maxCount: 1
const curUser = res.locals.user; const curUser = res.locals.user;
if (!problem) throw new ErrorMessage('无此题目。'); 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]) }) }); if (!curUser) throw new ErrorMessage('请登录后继续。', { '登录': syzoj.utils.makeUrl(['login'], { 'url': syzoj.utils.makeUrl(['problem', id]) }) });
let judge_state; let judge_state;

2
views/admin_rejudge.ejs

@ -19,7 +19,7 @@
<div class="menu"> <div class="menu">
<div class="item" data-value="">不限</div> <div class="item" data-value="">不限</div>
<div class="item" data-value="submit-answer">提交答案</div> <div class="item" data-value="submit-answer">提交答案</div>
<% for (let lang of syzoj.config.enabled_languages) { %> <% for (let lang of syzoj.config.filter_enabled_languages) { %>
<div class="item" data-value="<%= lang %>"><%= syzoj.languages[lang].show %></div> <div class="item" data-value="<%= lang %>"><%= syzoj.languages[lang].show %></div>
<% } %> <% } %>
</div> </div>

2
views/submissions.ejs

@ -38,7 +38,7 @@
<div class="menu"> <div class="menu">
<div class="item" data-value=""><b>不限</b></div> <div class="item" data-value=""><b>不限</b></div>
<div class="item" data-value="submit-answer"><b>提交答案</b></div> <div class="item" data-value="submit-answer"><b>提交答案</b></div>
<% for (let lang of syzoj.config.enabled_languages) { %> <% for (let lang of syzoj.config.filter_enabled_languages) { %>
<div class="item" data-value="<%= lang %>"><b><%= syzoj.languages[lang].show %></b></div> <div class="item" data-value="<%= lang %>"><b><%= syzoj.languages[lang].show %></b></div>
<% } %> <% } %>
</div> </div>

Loading…
Cancel
Save