mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: add constant to error page
This commit is contained in:
1 parent
ea8bd323c7
commit
710f7c7086
5 files changed
+14
-5
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.1.21",
|
||||
"version": "3.1.22",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -64,9 +64,14 @@ export interface EventMap extends Record<string, any> {
|
||||
'handler/create': (thisArg: Handler) => VoidReturn
|
||||
'handler/init': (thisArg: Handler) => VoidReturn
|
||||
'handler/before-prepare/UserRegister': (thisArg: UserRegisterHandler) => VoidReturn
|
||||
'handler/before-prepare': (thisArg: Handler) => VoidReturn
|
||||
'handler/before/UserRegister': (thisArg: UserRegisterHandler) => VoidReturn
|
||||
'handler/before': (thisArg: Handler) => VoidReturn
|
||||
'handler/after/UserRegister': (thisArg: UserRegisterHandler) => VoidReturn
|
||||
'handler/after': (thisArg: Handler) => VoidReturn
|
||||
'handler/finish/UserRegister': (thisArg: UserRegisterHandler) => VoidReturn
|
||||
'handler/finish': (thisArg: Handler) => VoidReturn
|
||||
'handler/error': (thisArg: Handler) => VoidReturn
|
||||
'handler/solution/get': (thisArg: ProblemSolutionHandler) => VoidReturn
|
||||
|
||||
'discussion/before-add': (payload: Partial<DiscussionDoc>) => VoidReturn
|
||||
|
||||
@@ -725,6 +725,8 @@ async function handle(ctx, HandlerClass, checker) {
|
||||
await bail('handler/finish', h);
|
||||
} catch (e) {
|
||||
try {
|
||||
await bail(`handler/error/${HandlerClass.name.replace(/Handler$/, '')}`, h);
|
||||
await bail('handler/error', h);
|
||||
await h.onerror(e);
|
||||
} catch (err) {
|
||||
h.response.code = 500;
|
||||
|
||||
@@ -76,14 +76,16 @@ async function constant(args: ConstantArgs) {
|
||||
return version;
|
||||
}
|
||||
|
||||
bus.on('handler/after', async (that) => {
|
||||
if (that.response.template) {
|
||||
const versionHandler = async (that) => {
|
||||
if (that.response.template && !that.UiContext.constantVersion) {
|
||||
that.UiContext.constantVersion = await constant({
|
||||
domainId: that.domainId,
|
||||
lang: that.session.viewLang || that.user.viewLang,
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
bus.on('handler/after', versionHandler);
|
||||
bus.on('handler/error', versionHandler);
|
||||
|
||||
class WikiHelpHandler extends Handler {
|
||||
noCheckPermView = true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.26.10",
|
||||
"version": "4.26.11",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
Reference in new issue
Block a user