修复 @param 在类扩展时作用域污染的问题,完善interface

This commit is contained in:
undefined committed 2020-07-11 13:35:28 +08:00
1 parent cd6938dd6c
commit dd7914e1fb
31 files changed
+269 -179

No files matched your search

-5
View File
@@ -1,5 +0,0 @@
# Problem-Import-Syzoj
从运行 syzoj 系统的 OJ 导入题目。
使用方式:题目->导入题目(`/problem/import`)->选择类型:syzoj
-5
View File
@@ -1,5 +0,0 @@
{
"id": "problem-import-syzoj",
"version": "1.0.1",
"description": "Import problem from syzoj."
}
-71
View File
@@ -1,71 +0,0 @@
const assert = require('assert');
const { download } = global.Hydro.lib;
const { superagent } = global.nodeModules;
const { ValidationError, RemoteOnlineJudgeError } = global.Hydro.error;
async function syzoj(url, handler) {
const RE_SYZOJ = /https?:\/\/([a-zA-Z0-9.]+)\/problem\/([0-9]+)\/?/i;
assert(url.match(RE_SYZOJ), new ValidationError('url'));
if (!url.endsWith('/')) url += '/';
const [, host, pid] = RE_SYZOJ.exec(url);
const res = await superagent.get(`${url}export`);
assert(res.status === 200, new RemoteOnlineJudgeError('Cannot connect to target server'));
assert(res.body.success, new RemoteOnlineJudgeError((res.body.error || {}).message));
const p = res.body.obj;
const content = [];
if (p.description) {
content.push(
handler.translate('problem.import.problem_description'),
p.description,
);
}
if (p.input_format) {
content.push(
handler.translate('problem.import.input_format'),
p.input_format,
);
}
if (p.output_format) {
content.push(
handler.translate('problem.import.output_format'),
p.output_format,
);
}
if (p.hint) {
content.push(
handler.translate('problem.import.hint'),
p.hint,
);
}
if (p.limit_and_hint) {
content.push(
handler.translate('problem.import.limit_and_hint'),
p.limit_and_hint,
);
}
if (p.have_additional_file) {
content.push(
handler.translate('problem.import.additional_file'),
`${url}download/additional_file`,
);
}
const pdoc = {
title: p.title,
content: content.join(' \n'),
owner: handler.user._id,
from: url,
pid: `${host}_${pid}`,
tags: p.tags,
config: {
time: p.time_limit,
memory: p.memory_limit * 1024,
filename: p.file_io_input_name,
type: p.type,
},
};
const r = download(`${url}testdata/download`);
return [pdoc, r];
}
global.Hydro.lib['import.syzoj'] = module.exports = syzoj;
@@ -1,8 +0,0 @@
Import problem from syzoj.: 从运行 syzoj 系统的 OJ 导入题目。
problem.import.problem_description: '## 题目描述'
problem.import.input_format: '## 输入格式'
problem.import.output_format: '## 输出格式'
problem.import.hint: '## 提示'
problem.import.limit_and_hint: '## 限制'
problem.import.additional_file: '## 附加文件'
import: 导入