mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix bugs (#435)
This commit is contained in:
1 parent
f4b12ef004
commit
4c669e0194
3 files changed
+7
-9
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "4.0.3",
|
"version": "4.0.4",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/plugin-api",
|
"main": "src/plugin-api",
|
||||||
"module": "src/plugin-api",
|
"module": "src/plugin-api",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { ObjectID } from 'mongodb';
|
|||||||
import { Context } from '../context';
|
import { Context } from '../context';
|
||||||
import db from '../service/db';
|
import db from '../service/db';
|
||||||
import {
|
import {
|
||||||
addon, lib, model, script, service, setting,
|
addon, builtinModel, lib, script, service, setting,
|
||||||
} from './common';
|
} from './common';
|
||||||
|
|
||||||
const argv = cac().parse();
|
const argv = cac().parse();
|
||||||
@@ -96,11 +96,8 @@ export async function load(ctx: Context) {
|
|||||||
lib(pending, fail, ctx),
|
lib(pending, fail, ctx),
|
||||||
service(pending, fail, ctx),
|
service(pending, fail, ctx),
|
||||||
]);
|
]);
|
||||||
require('../model/index');
|
await builtinModel(ctx);
|
||||||
await Promise.all([
|
await setting(pending, fail, require('../model/setting'));
|
||||||
model(pending, fail, ctx),
|
|
||||||
setting(pending, fail, require('../model/setting')),
|
|
||||||
]);
|
|
||||||
ctx.plugin(require('../service/server'));
|
ctx.plugin(require('../service/server'));
|
||||||
await addon(pending, fail, ctx);
|
await addon(pending, fail, ctx);
|
||||||
const scriptDir = path.resolve(__dirname, '..', 'script');
|
const scriptDir = path.resolve(__dirname, '..', 'script');
|
||||||
|
|||||||
@@ -51,8 +51,9 @@ class ProblemImportHydroHandler extends Handler {
|
|||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
const problems = await fs.readdir(tmpdir, { withFileTypes: true });
|
const problems = await fs.readdir(tmpdir, { withFileTypes: true });
|
||||||
for (const { name: i, isDirectory } of problems) {
|
for (const p of problems) {
|
||||||
if (!isDirectory()) continue;
|
const i = p.name;
|
||||||
|
if (!p.isDirectory()) continue;
|
||||||
const files = await fs.readdir(path.join(tmpdir, i));
|
const files = await fs.readdir(path.join(tmpdir, i));
|
||||||
if (!files.includes('problem.yaml')) continue;
|
if (!files.includes('problem.yaml')) continue;
|
||||||
const content = fs.readFileSync(path.join(tmpdir, i, 'problem.yaml'), 'utf-8');
|
const content = fs.readFileSync(path.join(tmpdir, i, 'problem.yaml'), 'utf-8');
|
||||||
|
|||||||
Reference in new issue
Block a user