bouncer: if nobot is being set, don't perform request for bot/scraper/crawler/similiar.

Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
Yonle
2024-03-27 23:15:16 +07:00
parent 406dcecb63
commit dfdc5fbcc4
2 changed files with 12 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ module.exports = (authKey, data, ws, req) => {
return false;
}
if (!authorized_keys?.includes(data.pubkey) && !(private_keys && private_keys[data.pubkey])) {
if ((authorized_keys?.length || Object.keys(private_keys).length) && !authorized_keys?.includes(data.pubkey) && !(private_keys && private_keys[data.pubkey])) {
ws.send(JSON.stringify(["OK", data.id, false, "unauthorized."]));
return false;
}