mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
fps: 移除input参数
This commit is contained in:
1 parent
8d8ad69a98
commit
4652ce86ab
3 files changed
+5
-15
No files matched your search
@@ -1,7 +1,4 @@
|
|||||||
# Hydro
|
# Hydro
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
||||||
[](#contributors-)
|
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
||||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fhydro-dev%2FHydro?ref=badge_shield)
|
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fhydro-dev%2FHydro?ref=badge_shield)
|
||||||
|
|
||||||
Hydro是一个高效的信息学在线测评系统。特点:易于部署(且提供安装脚本),轻量,功能强大且易于扩展。
|
Hydro是一个高效的信息学在线测评系统。特点:易于部署(且提供安装脚本),轻量,功能强大且易于扩展。
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import fs from 'fs-extra';
|
|||||||
import { filter } from 'lodash';
|
import { filter } from 'lodash';
|
||||||
import decodeHTML from 'decode-html';
|
import decodeHTML from 'decode-html';
|
||||||
import type { ProblemConfig } from 'hydrooj';
|
import type { ProblemConfig } from 'hydrooj';
|
||||||
import {
|
import { Route, Handler } from 'hydrooj/dist/service/server';
|
||||||
Route, Handler, param, Types,
|
|
||||||
} from 'hydrooj/dist/service/server';
|
|
||||||
import { buildContent } from 'hydrooj/dist/lib/content';
|
import { buildContent } from 'hydrooj/dist/lib/content';
|
||||||
import { ProblemAdd } from 'hydrooj/dist/lib/ui';
|
import { ProblemAdd } from 'hydrooj/dist/lib/ui';
|
||||||
import * as solution from 'hydrooj/dist/model/solution';
|
import * as solution from 'hydrooj/dist/model/solution';
|
||||||
@@ -61,9 +59,8 @@ class FpsProblemImportHandler extends Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@param('input', Types.String, true)
|
async post({ domainId }) {
|
||||||
async post(domainId: string, input: string) {
|
if (!this.request.files.file) throw new ValidationError('file');
|
||||||
if (!input && !this.request.files.file) throw new ValidationError('file');
|
|
||||||
const tasks = [];
|
const tasks = [];
|
||||||
if (this.request.files.file) {
|
if (this.request.files.file) {
|
||||||
try {
|
try {
|
||||||
@@ -80,13 +77,9 @@ class FpsProblemImportHandler extends Handler {
|
|||||||
} catch { } // eslint-disable-line no-empty
|
} catch { } // eslint-disable-line no-empty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
tasks.push(await xml2js.parseStringPromise(input));
|
|
||||||
}
|
}
|
||||||
if (!tasks.length) throw new ValidationError('file');
|
if (!tasks.length) throw new ValidationError('file');
|
||||||
for (const task of tasks) {
|
for (const task of tasks) await this.run(domainId, task);
|
||||||
await this.run(domainId, task);
|
|
||||||
}
|
|
||||||
this.response.redirect = this.url('problem_main');
|
this.response.redirect = this.url('problem_main');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/fps-importer",
|
"name": "@hydrooj/fps-importer",
|
||||||
"version": "1.1.5",
|
"version": "1.1.6",
|
||||||
"description": "Import FPS problems",
|
"description": "Import FPS problems",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
Reference in new issue
Block a user