mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
bump beta.10
This commit is contained in:
27 files changed
+143
-112
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "5.0.0-beta.9",
|
||||
"version": "5.0.0-beta.10",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/plugin-api",
|
||||
"module": "src/plugin-api",
|
||||
@@ -8,7 +8,7 @@
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0-or-later OR Proprietary",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
"node": ">=22"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"dependencies": {
|
||||
@@ -21,33 +21,33 @@
|
||||
"@hydrooj/common": "workspace:^",
|
||||
"@hydrooj/framework": "workspace:^",
|
||||
"@hydrooj/utils": "workspace:^",
|
||||
"@simplewebauthn/server": "13.1.2",
|
||||
"@simplewebauthn/server": "13.2.2",
|
||||
"@undefined-moe/require-resolve-hook": "^1.1.0",
|
||||
"@zip.js/zip.js": "^2.8.2",
|
||||
"@zip.js/zip.js": "^2.8.8",
|
||||
"adm-zip": "0.5.16",
|
||||
"cac": "^6.7.14",
|
||||
"cordis": "4.0.0-beta.5",
|
||||
"csv-stringify": "^6.6.0",
|
||||
"emoji-regex": "^10.5.0",
|
||||
"emoji-regex": "^10.6.0",
|
||||
"emojis-list": "2.1.0",
|
||||
"fs-extra": "^11.3.1",
|
||||
"fs-extra": "^11.3.2",
|
||||
"js-yaml": "^4.1.0",
|
||||
"koa-proxies": "^0.12.4",
|
||||
"koa-static-cache": "^5.1.4",
|
||||
"lodash": "^4.17.21",
|
||||
"lru-cache": "^11.2.1",
|
||||
"lru-cache": "^11.2.2",
|
||||
"mime-types": "^3.0.1",
|
||||
"moment-timezone": "^0.6.0",
|
||||
"mongodb": "^6.19.0",
|
||||
"mongodb": "^6.20.0",
|
||||
"mongodb-uri": "^0.9.7",
|
||||
"nanoid": "^5.1.5",
|
||||
"nodemailer": "^7.0.6",
|
||||
"nanoid": "^5.1.6",
|
||||
"nodemailer": "^7.0.9",
|
||||
"notp": "^2.0.3",
|
||||
"p-queue": "^8.1.1",
|
||||
"p-queue": "^9.0.0",
|
||||
"sanitize-filename": "^1.6.3",
|
||||
"saslprep": "^1.0.3",
|
||||
"schemastery": "^3.17.0",
|
||||
"semver": "^7.7.2",
|
||||
"schemastery": "^3.17.1",
|
||||
"semver": "^7.7.3",
|
||||
"shorty.js": "^1.0.1",
|
||||
"superagent": "^10.2.3",
|
||||
"tar": "6.2.1",
|
||||
@@ -63,7 +63,7 @@
|
||||
"@types/lodash": "^4.17.20",
|
||||
"@types/mime-types": "^3.0.1",
|
||||
"@types/mongodb-uri": "^0.9.4",
|
||||
"@types/nodemailer": "^7.0.1",
|
||||
"@types/nodemailer": "^7.0.2",
|
||||
"@types/notp": "^2.0.5",
|
||||
"@types/saslprep": "^1.0.3",
|
||||
"@types/semver": "^7.7.1",
|
||||
|
||||
@@ -59,7 +59,9 @@ class ScheduleModel {
|
||||
}
|
||||
|
||||
export async function apply(ctx: Context) {
|
||||
ctx.inject(['worker'], (c) => {
|
||||
ctx.on('domain/delete', (domainId) => coll.deleteMany({ domainId }));
|
||||
|
||||
await ctx.inject(['worker'], (c) => {
|
||||
c.worker.addHandler('task.daily', async (task) => {
|
||||
const pref: Record<string, number> = {};
|
||||
let start = Date.now();
|
||||
@@ -88,8 +90,6 @@ export async function apply(ctx: Context) {
|
||||
});
|
||||
});
|
||||
|
||||
ctx.on('domain/delete', (domainId) => coll.deleteMany({ domainId }));
|
||||
|
||||
if (process.env.NODE_APP_INSTANCE !== '0') return;
|
||||
if (!await ScheduleModel.count({ type: 'schedule', subType: 'task.daily' })) {
|
||||
await ScheduleModel.add({
|
||||
|
||||
@@ -179,9 +179,6 @@ async function cleanFiles() {
|
||||
}
|
||||
|
||||
export async function apply(ctx: Context) {
|
||||
ctx.inject(['worker'], (c) => {
|
||||
c.worker.addHandler('storage.prune', cleanFiles);
|
||||
});
|
||||
ctx.on('domain/delete', async (domainId) => {
|
||||
const [problemFiles, contestFiles, trainingFiles] = await Promise.all([
|
||||
StorageModel.list(`problem/${domainId}`),
|
||||
@@ -190,6 +187,9 @@ export async function apply(ctx: Context) {
|
||||
]);
|
||||
await StorageModel.del(problemFiles.concat(contestFiles).concat(trainingFiles).map((i) => i.path));
|
||||
});
|
||||
await ctx.inject(['worker'], (c) => {
|
||||
c.worker.addHandler('storage.prune', cleanFiles);
|
||||
});
|
||||
if (process.env.NODE_APP_INSTANCE !== '0') return;
|
||||
await db.ensureIndexes(
|
||||
StorageModel.coll,
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface EventMap {
|
||||
'subscription/init': (h: ConnectionHandler<Context>, privileged: boolean) => VoidReturn;
|
||||
'subscription/subscribe': (channel: string, user: User, metadata: Record<string, string>) => VoidReturn;
|
||||
'subscription/enable': (
|
||||
channel: string, h: ConnectionHandler<Context>, privileged: boolean, onDispose: (disposable: () => void) => void
|
||||
channel: string, h: ConnectionHandler<Context>, privileged: boolean, onDispose: (disposable: () => void) => void,
|
||||
) => VoidReturn;
|
||||
|
||||
'app/watch/change': (path: string) => VoidReturn;
|
||||
@@ -61,7 +61,7 @@ export interface EventMap {
|
||||
'document/add': (doc: any) => VoidReturn;
|
||||
'document/set': <T extends keyof DocType>(
|
||||
domainId: string, docType: T, docId: DocType[T],
|
||||
$set: any, $unset: OnlyFieldsOfType<DocType[T], any, true | '' | 1>
|
||||
$set: any, $unset: OnlyFieldsOfType<DocType[T], any, true | '' | 1>,
|
||||
) => VoidReturn;
|
||||
|
||||
'discussion/before-add': (payload: Partial<DiscussionDoc>) => VoidReturn;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { KoaContext } from '@hydrooj/framework';
|
||||
import { PERM } from '../../model/builtin';
|
||||
import { PERM, PRIV } from '../../model/builtin';
|
||||
import UserModel from '../../model/user';
|
||||
|
||||
export default async (ctx: KoaContext, next) => {
|
||||
@@ -13,6 +13,9 @@ export default async (ctx: KoaContext, next) => {
|
||||
user = await UserModel.getById(domainId, ctx.session.uid, ctx.session.scope);
|
||||
}
|
||||
if (user._id === 0) delete user.viewLang;
|
||||
else if (!user._udoc.ip.includes(ctx.request.ip) && user.hasPriv(PRIV.PRIV_USER_PROFILE)) {
|
||||
await UserModel.setById(user._id, { loginip: ctx.request.ip });
|
||||
}
|
||||
ctx.HydroContext.user = await user.private();
|
||||
await next();
|
||||
};
|
||||
@@ -24,7 +24,7 @@ export default class MigrationService extends Service {
|
||||
}
|
||||
|
||||
async registerChannel(name: string, s: MigrationScript[]) {
|
||||
if (this.called) logger.warn('MigrationService.registerChannel: called after doUpgrade');
|
||||
if (this.called) logger.warn('MigrationService.registerChannel: called after doUpgrade with name: %s', name);
|
||||
this.channels[name] = s;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user