diff --git a/main.tsx b/main.tsx index d8a5a72..eb0d9f2 100644 --- a/main.tsx +++ b/main.tsx @@ -15,7 +15,12 @@ import { } from "./resolvers/event.ts"; import Landing from "./routes/landing.tsx"; import Error404 from "./routes/_404.tsx"; -import { RelayInformation, RelayInformationStore, RelayInformationStringify, informationPubkeyStringify } from "./resolvers/nip11.ts"; +import { + informationPubkeyStringify, + RelayInformation, + RelayInformationStore, + RelayInformationStringify, +} from "./resolvers/nip11.ts"; import { EventStore, func_GetEventsByFilter, @@ -230,7 +235,7 @@ export const software = "https://github.com/BlowaterNostr/relayed"; const landing_handler = async (args: { relayInformationStore: RelayInformationStore }) => { const storeInformation = await args.relayInformationStore.resolveRelayInformation(); - if(storeInformation instanceof Error) { + if (storeInformation instanceof Error) { return new Response(render(Error404()), { status: 404 }); } const resp = new Response( @@ -242,10 +247,10 @@ const landing_handler = async (args: { relayInformationStore: RelayInformationSt const information_handler = async (args: { relayInformationStore: RelayInformationStore }) => { const storeInformation = await args.relayInformationStore.resolveRelayInformation(); - if(storeInformation instanceof Error) { + if (storeInformation instanceof Error) { return new Response(render(Error404()), { status: 404 }); } - const information = informationPubkeyStringify(storeInformation) + const information = informationPubkeyStringify(storeInformation); const resp = new Response(JSON.stringify(information), { status: 200, }); @@ -266,7 +271,7 @@ async function verifyToken(event: NostrEvent, relayInformationStore: RelayInform throw new Error("pubkey not valid"); } const storeInformation = await relayInformationStore.resolveRelayInformation(); - if(storeInformation instanceof Error) { + if (storeInformation instanceof Error) { throw new Error("store pubkey not valid"); } if (pubkey.hex !== storeInformation.pubkey.hex) { diff --git a/resolvers/nip11.ts b/resolvers/nip11.ts index 68edb3f..6521d81 100644 --- a/resolvers/nip11.ts +++ b/resolvers/nip11.ts @@ -5,7 +5,7 @@ type RelayInfomationBase = { description?: string; contact?: string; icon?: string; -} +}; export type RelayInformationStringify = { pubkey?: string; @@ -47,7 +47,8 @@ export class RelayInformationStore { } resolveRelayInformation = async (): Promise => { - const store_information_i = (await this.kv.get(["relay_information"])).value; + const store_information_i = + (await this.kv.get(["relay_information"])).value; if (!store_information_i) { return { ...this.default_information, ...not_modifiable_information }; } diff --git a/test.ts b/test.ts index 2cfb382..e76c9fc 100644 --- a/test.ts +++ b/test.ts @@ -284,7 +284,7 @@ async function queryGql(relay: Relay, query: string, variables?: object) { const res = await fetch(`http://${hostname}:${port}/api`, { method: "POST", headers: { - "cookie": `token="${test_auth_event()}`, + "cookie": `token="${await test_auth_event()}`, "Content-Type": "application/json", }, body: JSON.stringify({ query, variables }),