From 60c1674fd62ff1bff04da8009971ea35670c6f57 Mon Sep 17 00:00:00 2001 From: Yonle Date: Fri, 10 May 2024 17:23:23 +0700 Subject: [PATCH] fix auth.js didn't work with noscraper Signed-off-by: Yonle --- auth.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auth.js b/auth.js index ae5b34d..880044c 100644 --- a/auth.js +++ b/auth.js @@ -1,9 +1,9 @@ "use strict"; const { validateEvent, verifyEvent } = require("nostr-tools"); -const { authorized_keys, private_keys } = require(process.env.BOSTR_CONFIG_PATH || "./config"); +const { authorized_keys, private_keys, noscraper } = require(process.env.BOSTR_CONFIG_PATH || "./config"); module.exports = (authKey, data, ws, req) => { - if (!(authorized_keys?.length || Object.keys(private_keys).length)) return; // do nothing + if (!authorized_keys?.length && !Object.keys(private_keys).length && !noscraper) return; // do nothing if (!validateEvent(data) || !verifyEvent(data)) { ws.send(JSON.stringify(["NOTICE", "error: invalid challenge response."])); return false;