Compare commits

...

2 commits

Author SHA1 Message Date
a8fd9eb96b
allow non https relays 2025-08-06 00:16:35 +02:00
b0ef76baf0
fix issue when pubkeys file doesn't exist 2025-08-05 23:56:26 +02:00
2 changed files with 2 additions and 2 deletions

View file

@ -1,7 +1,7 @@
import { main } from "./src/main.ts";
let relay = process.env.RELAY_URL ?? Bun.argv[Bun.argv.length - 1];
if (!relay?.startsWith("wss://"))
if (!relay?.startsWith("wss://") && !relay?.startsWith("ws://"))
relay = "wss://relay.arx-ccn.com";
main(relay)

View file

@ -23,7 +23,7 @@ async function validateAuthEvent(event: Event, challenge: string): boolean {
const challengeTag = event.tags.find(tag => tag[0] === 'challange')?.[1];
if (challengeTag !== challenge) return false;
const file = Bun.file("./allowed-pubkeys.json");
if (!file.exists()) return true;
if (!await file.exists()) return true;
const allowedPubkeys = JSON.parse(await file.text());
if (!allowedPubkeys.includes(event.pubkey)) return false;
return true;