mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: step=any
This commit is contained in:
1 parent
0c7745d435
commit
cabd3b44f9
10 files changed
+47
-33
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.32.17",
|
||||
"version": "2.32.18",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -177,14 +177,6 @@ class ProblemImportSYZOJHandler extends Handler {
|
||||
text: p.limit_and_hint,
|
||||
});
|
||||
}
|
||||
if (p.have_additional_file) {
|
||||
content.push({
|
||||
type: 'Text',
|
||||
subType: 'markdown',
|
||||
sectionTitle: this.translate('Additional File'),
|
||||
text: `${url}download/additional_file`,
|
||||
});
|
||||
}
|
||||
const c = buildContent(content, 'markdown');
|
||||
const docId = await problem.add(
|
||||
domainId, target, p.title, c, this.user._id, p.tags || [], hidden,
|
||||
@@ -215,6 +207,25 @@ class ProblemImportSYZOJHandler extends Handler {
|
||||
} finally {
|
||||
fs.unlinkSync(file);
|
||||
}
|
||||
if (p.have_additional_file) {
|
||||
const r1 = download(`${url}download/additional_file`);
|
||||
const file1 = path.resolve(os.tmpdir(), 'hydro', `import_${domainId}_${docId}_a.zip`);
|
||||
const w1 = fs.createWriteStream(file1);
|
||||
try {
|
||||
await new Promise((resolve, reject) => {
|
||||
w1.on('finish', resolve);
|
||||
w1.on('error', reject);
|
||||
r1.pipe(w1);
|
||||
});
|
||||
const zip = new AdmZip(file1);
|
||||
const entries = zip.getEntries();
|
||||
for (const entry of entries) {
|
||||
await problem.addAdditionalFile(domainId, docId, entry.entryName.replace('/', '_'), entry.getData());
|
||||
}
|
||||
} finally {
|
||||
fs.unlinkSync(file1);
|
||||
}
|
||||
}
|
||||
return docId;
|
||||
}
|
||||
|
||||
@@ -296,7 +307,7 @@ class ProblemImportSYZOJHandler extends Handler {
|
||||
let version = 2;
|
||||
if (!prefix.endsWith('/')) prefix += '/';
|
||||
if (prefix.endsWith('/p/')) version = 3;
|
||||
else if (!prefix.endsWith('/problem/')) prefix += 'problem/';
|
||||
else prefix = `${prefix.split('/problem/')[0]}/problem/`;
|
||||
const base = `${prefix}${start}/`;
|
||||
assert(base.match(RE_SYZOJ), new ValidationError('prefix'));
|
||||
const [, protocol, host] = RE_SYZOJ.exec(base);
|
||||
|
||||
@@ -488,7 +488,7 @@ export interface JudgeResultBody {
|
||||
export interface Task {
|
||||
_id: ObjectID,
|
||||
type: string,
|
||||
executeAfter?: Date,
|
||||
executeAfter: Date,
|
||||
priority: number,
|
||||
[key: string]: any
|
||||
}
|
||||
@@ -624,24 +624,26 @@ export interface UI {
|
||||
UserDropdown: typeof import('./lib/ui').UserDropdown,
|
||||
}
|
||||
|
||||
export interface HydroGlobal {
|
||||
version: Record<string, string>,
|
||||
model: Model,
|
||||
handler: Record<string, Function>,
|
||||
script: Record<string, Script>,
|
||||
service: Service,
|
||||
lib: Lib,
|
||||
stat: any,
|
||||
ui: UI,
|
||||
error: typeof import('./error'),
|
||||
Logger: typeof import('./logger').Logger,
|
||||
logger: typeof import('./logger').logger,
|
||||
locales: Record<string, Record<string, string>>,
|
||||
isFirstWorker: boolean,
|
||||
}
|
||||
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface Global {
|
||||
Hydro: {
|
||||
version: Record<string, string>,
|
||||
model: Model,
|
||||
handler: Dict<Function>,
|
||||
script: Dict<Script>,
|
||||
service: Service,
|
||||
lib: Lib,
|
||||
stat: any,
|
||||
ui: UI,
|
||||
error: typeof import('./error'),
|
||||
Logger: typeof import('./logger').Logger,
|
||||
logger: typeof import('./logger').logger,
|
||||
locales: Dict<Dict<string>>,
|
||||
isFirstWorker: boolean,
|
||||
},
|
||||
Hydro: HydroGlobal,
|
||||
addons: string[],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export const DOMAIN_SETTINGS_BY_KEY: SettingDict = {};
|
||||
export const SYSTEM_SETTINGS_BY_KEY: SettingDict = {};
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
export type SettingType = 'text' | 'yaml' | 'number' | 'markdown' | 'password' | 'boolean' | 'textarea' | [string, string][] | Record<string, string>;
|
||||
export type SettingType = 'text' | 'yaml' | 'number' | 'float' | 'markdown' | 'password' | 'boolean' | 'textarea' | [string, string][] | Record<string, string>;
|
||||
|
||||
export const Setting = (
|
||||
family: string, key: string, value: any = null,
|
||||
|
||||
@@ -141,7 +141,7 @@ bus.once('app/started', async () => {
|
||||
await TaskModel.add({
|
||||
type: 'schedule',
|
||||
subType: 'task.daily',
|
||||
executeAfter: moment().hour(3).minute(0).second(0).millisecond(0).toDate(),
|
||||
executeAfter: moment().add(1, 'day').hour(3).minute(0).second(0).millisecond(0).toDate(),
|
||||
interval: [1, 'day'],
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user