mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix filter
This commit is contained in:
1 parent
fc98c61f7b
commit
229869bc5c
2 files changed
+4
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.24.19",
|
||||
"version": "2.24.20",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -520,9 +520,9 @@ export class Handler extends HandlerCommon {
|
||||
text: global.Hydro.lib[key].text,
|
||||
}));
|
||||
if (!this.noCheckPermView) this.checkPerm(PERM.PERM_VIEW);
|
||||
if (this.request.method === 'POST' && this.request.headers.referer) {
|
||||
const hostname = new URL(this.request.headers.referer).hostname;
|
||||
if (hostname !== this.request.hostname) throw new CsrfTokenError(hostname);
|
||||
if (this.request.method === 'post' && this.request.headers.referer !== '/') {
|
||||
const host = new URL(this.request.headers.referer).host;
|
||||
if (host !== this.request.host) throw new CsrfTokenError(host);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user