mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: experimental hot reload support
This commit is contained in:
1 parent
632ae27b88
commit
fd7c9cbeb1
26 files changed
+429
-148
No files matched your search
@@ -6,7 +6,7 @@ import mysql from 'mysql';
|
||||
import TurndownService from 'turndown';
|
||||
import { STATUS } from '@hydrooj/utils/lib/status';
|
||||
import { noop, Time } from '@hydrooj/utils/lib/utils';
|
||||
import { addScript, Schema } from 'hydrooj';
|
||||
import { Schema } from 'hydrooj';
|
||||
import { NotFoundError } from 'hydrooj/src/error';
|
||||
import { postJudge } from 'hydrooj/src/handler/judge';
|
||||
import { RecordDoc } from 'hydrooj/src/interface';
|
||||
@@ -311,8 +311,9 @@ export async function run({
|
||||
return true;
|
||||
}
|
||||
|
||||
addScript('migrateHustoj', 'migrate from hustoj')
|
||||
.args(Schema.object({
|
||||
export const apply = (ctx) => ctx.addScript(
|
||||
'migrateHustoj', 'migrate from hustoj',
|
||||
Schema.object({
|
||||
host: Schema.string().required(),
|
||||
port: Schema.number().required(),
|
||||
name: Schema.string().required(),
|
||||
@@ -321,4 +322,6 @@ addScript('migrateHustoj', 'migrate from hustoj')
|
||||
domainId: Schema.string().required(),
|
||||
contestType: Schema.string().required(),
|
||||
dataDir: Schema.string().required(),
|
||||
})).action(run);
|
||||
}),
|
||||
run,
|
||||
);
|
||||
@@ -5,7 +5,7 @@ import mariadb from 'mariadb';
|
||||
import { ObjectID } from 'mongodb';
|
||||
import { STATUS } from '@hydrooj/utils/lib/status';
|
||||
import { noop, Time } from '@hydrooj/utils/lib/utils';
|
||||
import { addScript, Schema } from 'hydrooj';
|
||||
import { Schema } from 'hydrooj';
|
||||
import { NotFoundError } from 'hydrooj/src/error';
|
||||
import { postJudge } from 'hydrooj/src/handler/judge';
|
||||
import { DiscussionDoc, DiscussionReplyDoc, RecordDoc } from 'hydrooj/src/interface';
|
||||
@@ -227,7 +227,7 @@ export async function run({
|
||||
hint: pdoc.limit_and_hint,
|
||||
});
|
||||
for (const match of content.matchAll(fileReg)) {
|
||||
const [,origialPath, pid, filename] = match;
|
||||
const [, origialPath, pid, filename] = match;
|
||||
if (!problemAdditionalFile[`P${pdoc.id}`]) problemAdditionalFile[`P${pdoc.id}`] = [{ fromPid: pid, filename }];
|
||||
else problemAdditionalFile[`P${pdoc.id}`].push({ fromPid: pid, filename });
|
||||
content = content.replace(origialPath, `file://${filename}`);
|
||||
@@ -508,8 +508,9 @@ export async function run({
|
||||
return true;
|
||||
}
|
||||
|
||||
addScript('migrateSyzoj', 'migrate from syzoj')
|
||||
.args(Schema.object({
|
||||
export const apply = (ctx) => ctx.addScript(
|
||||
'migrateSyzoj', 'migrate from syzoj',
|
||||
Schema.object({
|
||||
host: Schema.string().required(),
|
||||
port: Schema.number().required(),
|
||||
name: Schema.string().required(),
|
||||
@@ -517,4 +518,6 @@ addScript('migrateSyzoj', 'migrate from syzoj')
|
||||
password: Schema.string().required(),
|
||||
domainId: Schema.string().default('system'),
|
||||
dataDir: Schema.string().default('/opt/syzoj/web/uploads'),
|
||||
})).action(run);
|
||||
}),
|
||||
run,
|
||||
);
|
||||
@@ -2,7 +2,7 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import mongodb, { Cursor, Db } from 'mongodb';
|
||||
import {
|
||||
addScript, DiscussionTailReplyDoc, MessageDoc,
|
||||
DiscussionTailReplyDoc, MessageDoc,
|
||||
RecordDoc, Schema, TestCase, TrainingNode,
|
||||
} from 'hydrooj';
|
||||
|
||||
@@ -507,11 +507,14 @@ export async function run({
|
||||
return true;
|
||||
}
|
||||
|
||||
addScript('migrateVijos', 'migrate from vijos')
|
||||
.args(Schema.object({
|
||||
export const apply = (ctx) => ctx.addScript(
|
||||
'migrateVijos', 'migrate from vijos',
|
||||
Schema.object({
|
||||
host: Schema.string().required(),
|
||||
port: Schema.number().required(),
|
||||
name: Schema.string().required(),
|
||||
username: Schema.string().required(),
|
||||
password: Schema.string().required(),
|
||||
})).action(run);
|
||||
}),
|
||||
run,
|
||||
);
|
||||
Reference in new issue
Block a user