mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: 支持自定义导出文件名
This commit is contained in:
1 parent
cdbbee8180
commit
0273bfe198
13 files changed
+50
-32
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user