mirror of
https://github.com/Yonle/bostr.git
synced 2025-03-18 05:42:03 +01:00
fix auth.js didn't work with noscraper
Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
parent
e1fbfbf06d
commit
60c1674fd6
4
auth.js
4
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user