mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
bump version
This commit is contained in:
43 files changed
+96
-53
No files matched your search
@@ -0,0 +1,22 @@
|
||||
cff-version: 1.2.0
|
||||
title: Hydro
|
||||
message: >-
|
||||
If you use this software, please cite it using the
|
||||
metadata from this file.
|
||||
type: software
|
||||
authors:
|
||||
- given-names: Yi
|
||||
family-names: Huang
|
||||
email: i@undefined.moe
|
||||
- given-names: Haojun
|
||||
family-names: Pan
|
||||
email: panda@hydro.ac
|
||||
- name: All Hydro Project Developers
|
||||
repository-code: 'https://github.com/hydro-dev/Hydro'
|
||||
url: 'https://hydro.js.org'
|
||||
keywords:
|
||||
- Online Judge
|
||||
- ICPC
|
||||
- OI
|
||||
- Competitive Programming
|
||||
license: AGPL-3.0-or-later
|
||||
@@ -111,7 +111,7 @@ Hydro 用户群:1085853538
|
||||
<details>
|
||||
<summary><h2>更新日志(点击展开)</h2></summary>
|
||||
|
||||
## Unreleased
|
||||
## Hydro 5.0.0-beta.0 / UI 4.58.0-beta.0
|
||||
|
||||
- judge: 添加 checker 编译缓存
|
||||
- ui: 优化题目详情页面 OGP 信息
|
||||
@@ -135,6 +135,8 @@ Hydro 用户群:1085853538
|
||||
- core: 支持存储并显示提交记录重测历史
|
||||
- core: 新的加域逻辑
|
||||
- ui: UserSelect.Multi: 支持批量粘贴用户名
|
||||
- ui: 修复在线 IDE 右键菜单
|
||||
- ui: 修复未登录用户查看题目文件页
|
||||
- core: oauth: 支持绑定/解绑三方平台账户 (#971)
|
||||
- ui: 修复暗色模式表格边框 (#968)
|
||||
- core: 优化 icpc 题目包导入 (#966)
|
||||
@@ -154,6 +156,9 @@ Hydro 用户群:1085853538
|
||||
- core: 升级至 Mongo Driver 6
|
||||
- core: 移除 registerResolver, registerValue, registerUnion (使用 ctx.api.resolver/...)
|
||||
- core: 移除 paginate, rank (使用 ctx.db.paginate, ctx.db.ranked)
|
||||
- core: 移除 setting.yaml
|
||||
- core: oauth: 改为使用 ctx.oauth.provide() 注册
|
||||
- framework: 移除 ready 与 dispose 事件 (使用 ctx.effect 代替)
|
||||
|
||||
## Hydro 4.19.0 / UI 4.57.0
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "@hydrooj/eslint-config",
|
||||
"version": "1.1.2",
|
||||
"version": "2.0.0",
|
||||
"license": "MIT",
|
||||
"main": "base.mjs",
|
||||
"dependencies": {
|
||||
"@eslint-react/eslint-plugin": "^1.40.0",
|
||||
"@eslint/compat": "^1.2.7",
|
||||
"@eslint-react/eslint-plugin": "^1.40.1",
|
||||
"@eslint/compat": "^1.2.8",
|
||||
"@eslint/eslintrc": "^3.3.1",
|
||||
"@stylistic/eslint-plugin": "^4.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.29.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/framework",
|
||||
"version": "0.2.0-alpha.0",
|
||||
"version": "0.2.0-beta.0",
|
||||
"main": "index.ts",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -424,7 +424,7 @@ ${c.response.status} ${endTime - startTime}ms ${c.response.length}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.ctx.on('dispose', () => {
|
||||
this.ctx.effect(() => () => {
|
||||
fs.emptyDirSync(uploadDir);
|
||||
});
|
||||
// if killed by ctrl-c, on('dispose') will not be called
|
||||
@@ -461,17 +461,17 @@ ${c.response.status} ${endTime - startTime}ms ${c.response.length}`);
|
||||
} catch (e) { }
|
||||
});
|
||||
socket.pause();
|
||||
const c: any = koa.createContext(request, {} as any); // eslint-disable-line
|
||||
await executeMiddlewareStack(c, this.wsLayers);
|
||||
const KoaContext: any = koa.createContext(request, {} as any);
|
||||
await executeMiddlewareStack(KoaContext, this.wsLayers);
|
||||
for (const manager of router.wsStack) {
|
||||
if (manager.accept(socket, request, c)) return;
|
||||
if (manager.accept(socket, request, KoaContext)) return;
|
||||
}
|
||||
socket.close();
|
||||
});
|
||||
}
|
||||
|
||||
async listen() {
|
||||
this.ctx.on('dispose', () => {
|
||||
this.ctx.effect(() => () => {
|
||||
httpServer.close();
|
||||
wsServer.close();
|
||||
});
|
||||
@@ -727,7 +727,7 @@ ${c.response.status} ${endTime - startTime}ms ${c.response.length}`);
|
||||
const dispose = router.disposeLastOp;
|
||||
// @ts-ignore
|
||||
this.ctx.parallel(`handler/register/${name}`, HandlerClass);
|
||||
this.ctx.on('dispose', () => {
|
||||
this.ctx.effect(() => () => {
|
||||
this.registrationCount[name]--;
|
||||
if (!this.registrationCount[name]) delete this.registry[name];
|
||||
dispose();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@hydrooj/blog",
|
||||
"version": "0.0.4",
|
||||
"version": "0.1.0-beta.0",
|
||||
"license": "AGPL-3.0-or-later"
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/common",
|
||||
"main": "./index.ts",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"dependencies": {
|
||||
"@hydrooj/utils": "workspace:^"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/components",
|
||||
"version": "1.0.0-alpha.0",
|
||||
"version": "1.0.0-beta.0",
|
||||
"main": "./frontend/index.ts",
|
||||
"dependencies": {
|
||||
"diff": "^7.0.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/elastic-search",
|
||||
"version": "1.2.0-alpha.0",
|
||||
"version": "1.2.0-beta.0",
|
||||
"main": "index.ts",
|
||||
"repository": "https://github.com/hydro-dev/Hydro",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/fps-importer",
|
||||
"version": "1.5.14",
|
||||
"version": "1.6.0-beta.0",
|
||||
"description": "Import FPS problems",
|
||||
"main": "index.ts",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/geoip",
|
||||
"version": "1.3.3",
|
||||
"version": "1.4.0-beta.0",
|
||||
"main": "index.ts",
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "3.5.0-alpha.0",
|
||||
"version": "3.5.0-beta.0",
|
||||
"main": "./src/index.ts",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -4,8 +4,8 @@ import { JudgeSettings, overrideConfig } from './config';
|
||||
export const Config = JudgeSettings;
|
||||
|
||||
export function apply(ctx: Context, config: ReturnType<typeof Config>) {
|
||||
if (process.env.NODE_APP_INSTANCE !== '0') return;
|
||||
overrideConfig(config);
|
||||
if (process.env.NODE_APP_INSTANCE !== '0') return;
|
||||
// eslint-disable-next-line consistent-return
|
||||
if (!config.disable) return require('./hosts/builtin').apply(ctx);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "5.0.0-alpha.0",
|
||||
"version": "5.0.0-beta.0",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/plugin-api",
|
||||
"module": "src/plugin-api",
|
||||
|
||||
@@ -113,7 +113,7 @@ export async function load(ctx: Context) {
|
||||
await ctx.plugin(ConfigService);
|
||||
await require('../model/system').runConfig();
|
||||
ctx = await new Promise((resolve) => {
|
||||
ctx.inject(['loader', 'config'], (c) => {
|
||||
ctx.inject(['loader', 'config', 'db'], (c) => {
|
||||
resolve(c);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ export async function apply(ctx: Context) {
|
||||
const modelSystem = require('../model/system');
|
||||
await modelSystem.runConfig();
|
||||
ctx = await new Promise((resolve) => {
|
||||
ctx.inject(['loader', 'config'], (c) => {
|
||||
ctx.inject(['loader', 'config', 'db'], (c) => {
|
||||
resolve(c);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -437,8 +437,9 @@ class OauthCallbackHandler extends Handler {
|
||||
noCheckPermView = true;
|
||||
|
||||
async get(args: any) {
|
||||
if (!this.ctx.oauth.providers[args.type]) throw new UserFacingError('Oauth type');
|
||||
const r = await this.ctx.oauth.providers[args.type].callback.call(this, args);
|
||||
const provider = this.ctx.oauth.providers[args.type];
|
||||
if (!provider) throw new UserFacingError('Oauth type');
|
||||
const r = await provider.callback.call(this, args);
|
||||
if (this.session.oauthBind === args.type) {
|
||||
delete this.session.oauthBind;
|
||||
const existing = await this.ctx.oauth.get(args.type, r._id);
|
||||
@@ -456,6 +457,7 @@ class OauthCallbackHandler extends Handler {
|
||||
this.response.redirect = '/';
|
||||
return;
|
||||
}
|
||||
if (!provider.canRegister) throw new ForbiddenError('No binded account found');
|
||||
this.checkPriv(PRIV.PRIV_REGISTER_USER);
|
||||
let username = '';
|
||||
r.uname ||= [];
|
||||
|
||||
@@ -31,12 +31,12 @@ class BlackListModel {
|
||||
}
|
||||
}
|
||||
|
||||
export function apply(ctx: Context) {
|
||||
coll = db.collection('blacklist');
|
||||
ctx.on('ready', () => db.ensureIndexes(
|
||||
export async function apply(ctx: Context) {
|
||||
coll = ctx.db.collection('blacklist');
|
||||
await ctx.db.ensureIndexes(
|
||||
coll,
|
||||
{ key: { expireAt: -1 }, name: 'expire', expireAfterSeconds: 0 },
|
||||
));
|
||||
);
|
||||
}
|
||||
export default BlackListModel;
|
||||
global.Hydro.model.blacklist = BlackListModel;
|
||||
@@ -34,6 +34,7 @@ export interface OAuthProvider {
|
||||
hidden?: boolean;
|
||||
get: (this: Handler) => Promise<void>;
|
||||
callback: (this: Handler, args: Record<string, any>) => Promise<OAuthUserResponse>;
|
||||
canRegister?: boolean;
|
||||
lockUsername?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Filter } from 'mongodb';
|
||||
import { Context } from '../context';
|
||||
import { TokenDoc } from '../interface';
|
||||
import bus from '../service/bus';
|
||||
import db from '../service/db';
|
||||
import { ArgMethod } from '../utils';
|
||||
|
||||
@@ -107,10 +107,12 @@ class TokenModel {
|
||||
}
|
||||
}
|
||||
|
||||
bus.on('ready', () => db.ensureIndexes(
|
||||
TokenModel.coll,
|
||||
{ key: { uid: 1, tokenType: 1, updateAt: -1 }, name: 'basic', sparse: true },
|
||||
{ key: { expireAt: -1 }, name: 'expire', expireAfterSeconds: 0 },
|
||||
));
|
||||
export async function apply(ctx: Context) {
|
||||
await ctx.db.ensureIndexes(
|
||||
TokenModel.coll,
|
||||
{ key: { uid: 1, tokenType: 1, updateAt: -1 }, name: 'basic', sparse: true },
|
||||
{ key: { expireAt: -1 }, name: 'expire', expireAfterSeconds: 0 },
|
||||
);
|
||||
}
|
||||
export default TokenModel;
|
||||
global.Hydro.model.token = TokenModel;
|
||||
@@ -104,7 +104,7 @@ class ApiService extends Service {
|
||||
constructor(ctx: Context) {
|
||||
super(ctx, 'api');
|
||||
this.rebuild = debounce(this.rebuild.bind(this), 500, { trailing: true });
|
||||
ctx.on('ready', this.rebuild);
|
||||
this.rebuild();
|
||||
}
|
||||
|
||||
private rebuild() {
|
||||
|
||||
@@ -178,10 +178,10 @@ export class MongoService extends Service {
|
||||
}
|
||||
|
||||
/** @deprecated use ctx.db instead */
|
||||
const db = new Proxy({} as MongoService, {
|
||||
const deprecatedDb = new Proxy({} as MongoService, {
|
||||
get(target, prop) {
|
||||
return app.get('db')?.[prop];
|
||||
},
|
||||
});
|
||||
|
||||
export default db;
|
||||
export default deprecatedDb;
|
||||
@@ -63,6 +63,7 @@ export default class MigrationService extends Service {
|
||||
dbVer++;
|
||||
await system.set(name, dbVer);
|
||||
}
|
||||
logger.success('Database upgraded [%s]: current version %d', channel, dbVer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ async function terminate() {
|
||||
}, 1000);
|
||||
try {
|
||||
await bus.parallel('app/exit');
|
||||
await app.scope.dispose();
|
||||
} catch (e) {
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/import-hoj",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.6-beta.0",
|
||||
"description": "Import HOJ problem export",
|
||||
"main": "index.ts",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/import-qduoj",
|
||||
"version": "1.5.9",
|
||||
"version": "1.6.0-beta.0",
|
||||
"description": "Import QDUOJ problem export",
|
||||
"main": "index.ts",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -13,6 +13,7 @@ export default class LoginWithGithubService extends Service {
|
||||
id: Schema.string().description('Github OAuth AppID').required(),
|
||||
secret: Schema.string().description('Github OAuth Secret').role('secret').required(),
|
||||
endpoint: Schema.string().description('Github Endpoint'),
|
||||
canRegister: Schema.boolean().default(true),
|
||||
});
|
||||
|
||||
constructor(ctx: Context, config: ReturnType<typeof LoginWithGithubService.Config>) {
|
||||
@@ -21,6 +22,7 @@ export default class LoginWithGithubService extends Service {
|
||||
text: 'Login with Github',
|
||||
name: 'Github',
|
||||
icon,
|
||||
canRegister: config.canRegister,
|
||||
callback: async function callback({ state, code }) {
|
||||
const s = await TokenModel.get(state, TokenModel.TYPE_OAUTH);
|
||||
if (!s) throw new ValidationError('token');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/login-with-github",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0-beta.0",
|
||||
"main": "index.ts",
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
|
||||
@@ -31,6 +31,7 @@ export default class GoogleOAuthService extends Service {
|
||||
id: Schema.string().description('Google OAuth AppID').required(),
|
||||
secret: Schema.string().description('Google OAuth Secret').role('secret').required(),
|
||||
proxy: Schema.string().description('Google OAuth Proxy').role('proxy'),
|
||||
canRegister: Schema.boolean().default(true),
|
||||
});
|
||||
|
||||
constructor(ctx: Context, config: ReturnType<typeof GoogleOAuthService.Config>) {
|
||||
@@ -38,6 +39,7 @@ export default class GoogleOAuthService extends Service {
|
||||
ctx.oauth.provide('google', {
|
||||
text: 'Login with Google',
|
||||
name: 'Google',
|
||||
canRegister: config.canRegister,
|
||||
callback: async function callback(this: Handler, {
|
||||
state, code, error,
|
||||
}) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/login-with-google",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0-beta.0",
|
||||
"main": "index.ts",
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/migrate",
|
||||
"version": "0.4.4-alpha.0",
|
||||
"version": "0.5.0-beta.0",
|
||||
"main": "index.ts",
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/onlyoffice",
|
||||
"version": "1.4.5",
|
||||
"version": "1.5.0-beta.0",
|
||||
"main": "index.ts",
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/onsite-toolkit",
|
||||
"version": "0.0.5-alpha.0",
|
||||
"version": "0.1.0-beta.0",
|
||||
"dependencies": {
|
||||
"@react-spring/web": "^9.7.5",
|
||||
"react-use": "^17.6.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/prom-client",
|
||||
"version": "0.2.0-alpha.0",
|
||||
"version": "0.2.0-beta.0",
|
||||
"main": "index.ts",
|
||||
"dependencies": {
|
||||
"prom-client": "^15.1.3"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/scoreboard-xcpcio",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.5-beta.0",
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
"postinstall": "node -r @hydrooj/register install.ts"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/sonic",
|
||||
"version": "1.4.0-alpha.0",
|
||||
"version": "1.4.0-beta.0",
|
||||
"description": "Sonic search service",
|
||||
"main": "index.ts",
|
||||
"preferUnplugged": true,
|
||||
|
||||
@@ -13,6 +13,7 @@ export default class TelegramService extends Service {
|
||||
token: Schema.string().role('secret').required(),
|
||||
botLogin: Schema.string().required(),
|
||||
endpoint: Schema.string().default('https://api.telegram.org/bot'),
|
||||
canRegister: Schema.boolean().default(false),
|
||||
});
|
||||
|
||||
constructor(ctx: Context, config: ReturnType<typeof TelegramService.Config>) {
|
||||
@@ -21,6 +22,7 @@ export default class TelegramService extends Service {
|
||||
text: 'Login with Telegram',
|
||||
name: 'Telegram',
|
||||
icon,
|
||||
canRegister: config.canRegister,
|
||||
callback: async function callback({ payload }) {
|
||||
const parsed = JSON.parse(payload);
|
||||
const hash = parsed.hash;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"name": "@hydrooj/telegram",
|
||||
"version": "0.0.1"
|
||||
"version": "0.0.2-beta.0"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.58.0-alpha.0",
|
||||
"version": "4.58.0-beta.0",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "index.ts",
|
||||
|
||||
@@ -52,7 +52,8 @@ export async function apply(ctx: Context) {
|
||||
render: async (name, args, context) => await vite.transformIndexHtml(context.handler.context.req.url, html),
|
||||
});
|
||||
|
||||
ctx.on('dispose', async () => {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return async () => {
|
||||
await vite.close().catch((e) => console.error(e));
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import type * as superagent from 'superagent';
|
||||
export * as yaml from 'js-yaml';
|
||||
export * as fs from 'fs-extra';
|
||||
|
||||
Factory.formatters['d'] = (value, exporter) => Reggol.color(exporter, 3, value);
|
||||
|
||||
const factory = new Factory();
|
||||
|
||||
factory.addExporter(new Exporter.Console({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/utils",
|
||||
"version": "1.4.34-alpha.0",
|
||||
"version": "1.4.34-beta.0",
|
||||
"description": "hydrooj utils",
|
||||
"main": "lib/utils.ts",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/vjudge",
|
||||
"version": "1.9.16",
|
||||
"version": "1.10.0-beta.0",
|
||||
"description": "Submit problems to remote oj",
|
||||
"main": "./src/index.ts",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
Reference in new issue
Block a user