mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +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
|
||||
<!-- 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)
|
||||
|
||||
Hydro是一个高效的信息学在线测评系统。特点:易于部署(且提供安装脚本),轻量,功能强大且易于扩展。
|
||||
|
||||
@@ -5,9 +5,7 @@ import fs from 'fs-extra';
|
||||
import { filter } from 'lodash';
|
||||
import decodeHTML from 'decode-html';
|
||||
import type { ProblemConfig } from 'hydrooj';
|
||||
import {
|
||||
Route, Handler, param, Types,
|
||||
} from 'hydrooj/dist/service/server';
|
||||
import { Route, Handler } from 'hydrooj/dist/service/server';
|
||||
import { buildContent } from 'hydrooj/dist/lib/content';
|
||||
import { ProblemAdd } from 'hydrooj/dist/lib/ui';
|
||||
import * as solution from 'hydrooj/dist/model/solution';
|
||||
@@ -61,9 +59,8 @@ class FpsProblemImportHandler extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
@param('input', Types.String, true)
|
||||
async post(domainId: string, input: string) {
|
||||
if (!input && !this.request.files.file) throw new ValidationError('file');
|
||||
async post({ domainId }) {
|
||||
if (!this.request.files.file) throw new ValidationError('file');
|
||||
const tasks = [];
|
||||
if (this.request.files.file) {
|
||||
try {
|
||||
@@ -80,13 +77,9 @@ class FpsProblemImportHandler extends Handler {
|
||||
} catch { } // eslint-disable-line no-empty
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tasks.push(await xml2js.parseStringPromise(input));
|
||||
}
|
||||
if (!tasks.length) throw new ValidationError('file');
|
||||
for (const task of tasks) {
|
||||
await this.run(domainId, task);
|
||||
}
|
||||
for (const task of tasks) await this.run(domainId, task);
|
||||
this.response.redirect = this.url('problem_main');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/fps-importer",
|
||||
"version": "1.1.5",
|
||||
"version": "1.1.6",
|
||||
"description": "Import FPS problems",
|
||||
"main": "package.json",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
Reference in new issue
Block a user