core: use problem.md for export

This commit is contained in:
undefined committed 2021-09-28 23:56:57 +08:00
1 parent 69f84b4a28
commit 3e517aa840
6 files changed
+12 -17

No files matched your search

+3 -8
View File
@@ -114,13 +114,6 @@ TaskModel.Worker.addHandler('import.syzoj', syzojSync);
class ProblemImportSYZOJHandler extends Handler {
async get() {
this.response.template = 'problem_import_syzoj.html';
this.response.body = {
path: [
['Hydro', 'homepage'],
['problem_main', 'problem_main'],
['problem_import_syzoj', null],
],
};
}
async v2(domainId: string, target: string, hidden = false, url: string) {
@@ -359,8 +352,10 @@ class ProblemImportHydroHandler extends Handler {
const pdoc: ProblemDoc = yaml.load(content) as any;
const current = await problem.get(domainId, pdoc.pid);
const pid = current ? undefined : pdoc.pid;
const overrideContent = fs.existsSync(path.join(tmpdir, i, 'problem.md'))
? fs.readFileSync(path.join(tmpdir, i, 'problem.md'), 'utf8') : '';
const docId = await problem.add(
domainId, pid, pdoc.title, pdoc.content,
domainId, pid, pdoc.title, overrideContent || pdoc.content,
keepUser ? pdoc.owner : this.user._id, pdoc.tag, pdoc.hidden,
);
if (files.includes('testdata')) {
+1 -1
View File
@@ -19,7 +19,7 @@ export class Logger {
static readonly INFO = 2;
static readonly WARN = 2;
static readonly DEBUG = 3;
static baseLevel = process.env.DEV ? 3 : 2;
static baseLevel = process.env.DEV ? 4 : 2;
static levels: Record<string, number> = {};
private code: number;
private displayName: string;