core: allow websocket server without auth

This commit is contained in:
undefined committed 2022-01-09 05:03:53 +08:00
1 parent 86ead663df
commit fda667c424
2 files changed
+10 -8

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "3.3.6", "version": "3.3.7",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "src/loader", "main": "src/loader",
"module": "src/loader", "module": "src/loader",
+9 -7
View File
@@ -868,13 +868,15 @@ export function Connection(
const args = { domainId: 'system', ...h.request.params }; const args = { domainId: 'system', ...h.request.params };
h.args = args; h.args = args;
h.domainId = args.domainId; h.domainId = args.domainId;
const cookie = await new Promise((r) => { if (!h.noAuth) {
conn.once('data', r); const cookie = await new Promise((r) => {
}); conn.once('data', r);
args.cookie = cookie; });
await h.init(args); args.cookie = cookie;
conn.write(JSON.stringify({ event: 'auth' })); await h.init(args);
checker.call(h); conn.write(JSON.stringify({ event: 'auth' }));
checker.call(h);
}
if (h._prepare) await h._prepare(args); if (h._prepare) await h._prepare(args);
if (h.prepare) await h.prepare(args); if (h.prepare) await h.prepare(args);