ui: problemconfig: support new CompilableSource

This commit is contained in:
undefined committed 2025-02-09 15:17:10 +00:00
1 parent 4a33816a37
commit 5c9cecc197
17 files changed
+252 -228

No files matched your search

+2 -2
View File
@@ -1,9 +1,9 @@
/* eslint-disable no-await-in-loop */
import path from 'path';
import {
convertIniConfig, LangConfig,
normalizeSubtasks, ProblemConfigFile, readSubtasksFromFiles, readYamlCases,
convertIniConfig, LangConfig, normalizeSubtasks, ProblemConfigFile, readSubtasksFromFiles,
} from '@hydrooj/common';
import { readYamlCases } from '@hydrooj/common/cases';
import {
changeErrorType, fs, yaml,
} from '@hydrooj/utils';
+1 -1
View File
@@ -3,8 +3,8 @@ import path from 'path';
import PQueue from 'p-queue';
import superagent from 'superagent';
import WebSocket from 'ws';
import type { LangConfig } from '@hydrooj/common';
import { fs, pipeRequest } from '@hydrooj/utils';
import { LangConfig } from '@hydrooj/utils/lib/lang';
import * as sysinfo from '@hydrooj/utils/lib/sysinfo';
import type { JudgeResultBody } from 'hydrooj';
import { getConfig } from '../config';
+3 -1
View File
@@ -1,5 +1,6 @@
import path from 'path';
import { parse } from 'shell-quote';
import { CompilableSource } from '@hydrooj/common';
import { fs } from '@hydrooj/utils';
import { FormatError } from './error';
@@ -40,7 +41,8 @@ function restrictFile(p: string) {
}
export function ensureFile(folder: string) {
return (file: string, message: string) => {
return (src: CompilableSource, message: string) => {
const file = typeof src === 'string' ? src : src?.file;
if (file === '/dev/null') return file;
// Historical issue
if (file.includes('/')) {