mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
bug fixes
This commit is contained in:
20 files changed
+43
-35
No files matched your search
@@ -274,6 +274,7 @@ SystemSetting(
|
||||
Setting('setting_basic', 'pagination.contest', 20, 'number', 'pagination.contest', 'Contests per page'),
|
||||
Setting('setting_basic', 'pagination.discussion', 50, 'number', 'pagination.discussion', 'Discussions per page'),
|
||||
Setting('setting_basic', 'pagination.record', 100, 'number', 'pagination.record', 'Records per page'),
|
||||
Setting('setting_basic', 'pagination.ranking', 100, 'number', 'pagination.ranking', 'Users per page'),
|
||||
Setting('setting_basic', 'pagination.solution', 20, 'number', 'pagination.solution', 'Solutions per page'),
|
||||
Setting('setting_basic', 'pagination.training', 10, 'number', 'pagination.training', 'Trainings per page'),
|
||||
Setting('setting_basic', 'pagination.reply', 50, 'number', 'pagination.reply', 'Replies per page'),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { KoaContext } from '@hydrooj/framework';
|
||||
import { KoaContext, NotFoundError } from '@hydrooj/framework';
|
||||
import BlackListModel from '../../model/blacklist';
|
||||
import DomainModel from '../../model/domain';
|
||||
import * as system from '../../model/system';
|
||||
@@ -24,5 +24,12 @@ export default async (ctx: KoaContext, next) => {
|
||||
ctx.domainId = inferDomain?._id || domainId;
|
||||
ctx.domainInfo = inferDomain || absoluteDomain;
|
||||
if (ctx.domainInfo && ctx.domainId !== ctx.domainInfo._id) ctx.redirect(ctx.originalPath.replace(/^\/d\/[^/]+\//, `/d/${ctx.domainInfo._id}/`));
|
||||
else await next();
|
||||
else {
|
||||
if (!ctx.domainInfo) {
|
||||
ctx.pendingError = new NotFoundError(ctx.domainId);
|
||||
ctx.domainId = 'system';
|
||||
ctx.domainInfo = await DomainModel.get('system');
|
||||
}
|
||||
await next();
|
||||
}
|
||||
};
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { KoaContext } from '@hydrooj/framework';
|
||||
import { NotFoundError } from '../../error';
|
||||
import { PERM } from '../../model/builtin';
|
||||
import UserModel from '../../model/user';
|
||||
|
||||
@@ -15,9 +14,5 @@ export default async (ctx: KoaContext, next) => {
|
||||
}
|
||||
if (user._id === 0) delete user.viewLang;
|
||||
ctx.HydroContext.user = await user.private();
|
||||
if (!domain) {
|
||||
ctx.pendingError = new NotFoundError(args.domainId);
|
||||
args.domainId = 'system';
|
||||
}
|
||||
await next();
|
||||
};
|
||||
@@ -276,6 +276,7 @@ export async function apply(ctx: Context) {
|
||||
text: global.Hydro.module.oauth[key].text,
|
||||
}));
|
||||
if (!h.noCheckPermView && !h.user.hasPriv(PRIV.PRIV_VIEW_ALL_DOMAIN)) h.checkPerm(PERM.PERM_VIEW);
|
||||
if (h.context.pendingError) throw h.context.pendingError;
|
||||
});
|
||||
|
||||
on('app/listen', () => {
|
||||
|
||||
Reference in new issue
Block a user