ui: 支持自定义导出文件名

This commit is contained in:
undefined committed 2021-05-27 23:16:18 +08:00
1 parent cdbbee8180
commit 0273bfe198
13 files changed
+50 -32

No files matched your search

+4 -14
View File
@@ -1,24 +1,14 @@
import readYamlCases from '@hydrooj/utils/lib/cases';
import { load } from 'js-yaml';
import type { ProblemConfig } from '../interface';
import type { ProblemConfig, ProblemConfigFile } from '../interface';
interface ParseResult {
count: number;
memoryMax: number;
memoryMin: number;
timeMax: number;
timeMin: number;
langs?: string[];
type: string;
}
export async function parseConfig(config: string | ProblemConfig = {}) {
let cfg: ProblemConfig = {};
export async function parseConfig(config: string | ProblemConfigFile = {}) {
let cfg: ProblemConfigFile = {};
if (typeof config === 'string') {
// TODO should validate here?
cfg = await readYamlCases(load(config) as Record<string, any>);
} else if (typeof config === 'object') cfg = await readYamlCases(config);
const result: ParseResult = {
const result: ProblemConfig = {
count: 0,
memoryMin: Number.MAX_SAFE_INTEGER,
memoryMax: 0,