migrate: add poj & fix bug (#801)

This commit is contained in:
panda authored and GitHub committed 2024-05-10 15:46:47 +08:00
1 parent 7c2e0ac400
commit 510d156383
4 files changed
+310 -8

No files matched your search

+22 -6
View File
@@ -9,13 +9,13 @@ export function apply(ctx: Context) {
ctx.addScript(
'migrateHustoj', 'migrate from hustoj',
Schema.object({
host: Schema.string().required(),
port: Schema.number().required(),
name: Schema.string().required(),
host: Schema.string().default('localhost'),
port: Schema.number().default(3306),
name: Schema.string().default('jol'),
username: Schema.string().required(),
password: Schema.string().required(),
domainId: Schema.string().required(),
contestType: Schema.string().required(),
domainId: Schema.string().default('system'),
contestType: Schema.string().default('oi'),
dataDir: Schema.string().required(),
uploadDir: Schema.string().default('/home/judge/src/web/upload/'),
}),
@@ -46,7 +46,7 @@ export function apply(ctx: Context) {
(...args) => require('./scripts/vijos').run(...args),
);
ctx.addScript(
'migrateuniversaloj', 'migrate from universaloj',
'migrateUniversaloj', 'migrate from universaloj',
Schema.object({
host: Schema.string().default('172.17.0.2'),
port: Schema.number().default(3306),
@@ -58,6 +58,21 @@ export function apply(ctx: Context) {
}),
(...args) => require('./scripts/universaloj').run(...args),
);
ctx.addScript(
'migratePoj', 'migrate from poj',
Schema.object({
host: Schema.string().required(),
port: Schema.number().default(3306),
name: Schema.string().default('judgeonline'),
username: Schema.string().required(),
password: Schema.string().required(),
domainId: Schema.string().default('system'),
contestType: Schema.string().default('oi'),
dataDir: Schema.string().required(),
imageDir: Schema.string().required(),
}),
(...args) => require('./scripts/poj').run(...args),
);
ctx.provideModule('hash', 'hust', ($password, $saved) => {
$password = md5($password);
@@ -84,5 +99,6 @@ export function apply(ctx: Context) {
'migrate from vijos': '从 Vijos 导入',
'migrate from syzoj': '从 SYZOJ 导入',
'migrate from universaloj': '从 UniversalOJ 导入',
'migrate from poj': '从 POJ 导入',
});
}