mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix config hande
This commit is contained in:
1 parent
f4c3ca20a2
commit
a7dc00361c
4 files changed
+14
-3
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.23.1",
|
"version": "2.23.2",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { Readable } from 'stream';
|
import type { Readable } from 'stream';
|
||||||
import { ObjectID, FilterQuery } from 'mongodb';
|
import { ObjectID, FilterQuery } from 'mongodb';
|
||||||
import { Dictionary, escapeRegExp, pick } from 'lodash';
|
import { Dictionary, escapeRegExp, pick } from 'lodash';
|
||||||
|
import { streamToBuffer } from '@hydrooj/utils/lib/utils';
|
||||||
import { STATUS } from './builtin';
|
import { STATUS } from './builtin';
|
||||||
import * as document from './document';
|
import * as document from './document';
|
||||||
import { buildProjection } from '../utils';
|
import { buildProjection } from '../utils';
|
||||||
@@ -248,6 +249,16 @@ export class ProblemModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bus.on('problem/addTestdata', async (domainId, docId, name) => {
|
||||||
|
if (!['config.yaml', 'config.yml', 'Config.yaml', 'Config.yml'].includes(name)) return;
|
||||||
|
const buf = await storage.get(`problem/${domainId}/${docId}/testdata/${name}`);
|
||||||
|
await ProblemModel.edit(domainId, docId, { config: (await streamToBuffer(buf)).toString() });
|
||||||
|
});
|
||||||
|
bus.on('problem/delTestdata', async (domainId, docId, names) => {
|
||||||
|
if (!names.includes('config.yaml')) return;
|
||||||
|
await ProblemModel.edit(domainId, docId, { config: '' });
|
||||||
|
});
|
||||||
|
|
||||||
ProblemModel.extend((docId, pid) => ({
|
ProblemModel.extend((docId, pid) => ({
|
||||||
_id: new ObjectID(),
|
_id: new ObjectID(),
|
||||||
domainId: 'system',
|
domainId: 'system',
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export default function (env = {}) {
|
|||||||
function fileLoader() {
|
function fileLoader() {
|
||||||
return {
|
return {
|
||||||
loader: 'file-loader',
|
loader: 'file-loader',
|
||||||
options: { name: '[path][name].[ext]?[sha1:hash:hex:10]' },
|
options: { name: 'files/[name].[sha1:hash:hex:10].[ext]' },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.6.2",
|
"version": "4.6.3",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
Reference in new issue
Block a user