mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: update redirect
This commit is contained in:
1 parent
bff83350a0
commit
979cc6a1bd
2 files changed
+3
-3
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.33.3",
|
"version": "2.33.4",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -651,13 +651,13 @@ export class Handler extends HandlerCommon {
|
|||||||
logger.error(`User: ${this.user._id}(${this.user.uname}) Path: ${this.request.path}`, error.msg(), error.params);
|
logger.error(`User: ${this.user._id}(${this.user.uname}) Path: ${this.request.path}`, error.msg(), error.params);
|
||||||
if (error.stack) logger.error(error.stack);
|
if (error.stack) logger.error(error.stack);
|
||||||
}
|
}
|
||||||
if (this.user?._id === 0 && !(error instanceof LoginError) && !(error instanceof NotFoundError)) {
|
if (this.user?._id === 0 && (error instanceof PermissionError || error instanceof PrivilegeError)) {
|
||||||
this.response.redirect = this.url('user_login', { query: { redirect: this.request.path + this.ctx.search } });
|
this.response.redirect = this.url('user_login', { query: { redirect: this.request.path + this.ctx.search } });
|
||||||
} else {
|
} else {
|
||||||
this.response.status = error instanceof UserFacingError ? error.code : 500;
|
this.response.status = error instanceof UserFacingError ? error.code : 500;
|
||||||
this.response.template = error instanceof UserFacingError ? 'error.html' : 'bsod.html';
|
this.response.template = error instanceof UserFacingError ? 'error.html' : 'bsod.html';
|
||||||
this.response.body = {
|
this.response.body = {
|
||||||
error: { message: error.msg(), params: error.params, stack: errorMessage(error.stack) },
|
error: { message: error.msg(), params: error.params, stack: errorMessage(error.stack || '') },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
await this.finish().catch(() => { });
|
await this.finish().catch(() => { });
|
||||||
|
|||||||
Reference in new issue
Block a user