diff --git a/README.md b/README.md index f2a99885..6b39dda4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,4 @@ # Hydro - -[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-) - [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhydro-dev%2FHydro.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhydro-dev%2FHydro?ref=badge_shield) Hydro是一个高效的信息学在线测评系统。特点:易于部署(且提供安装脚本),轻量,功能强大且易于扩展。 diff --git a/packages/fps-importer/handler.ts b/packages/fps-importer/handler.ts index 7dc51d7d..8513b829 100644 --- a/packages/fps-importer/handler.ts +++ b/packages/fps-importer/handler.ts @@ -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'); } } diff --git a/packages/fps-importer/package.json b/packages/fps-importer/package.json index 11b593a5..38f4cec4 100644 --- a/packages/fps-importer/package.json +++ b/packages/fps-importer/package.json @@ -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",