mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
bump version
This commit is contained in:
43 files changed
+96
-53
No files matched your search
@@ -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