Update nostrMiddleware.ts

This commit is contained in:
Justin (shocknet) 2024-08-14 13:34:08 -04:00 committed by GitHub
parent a46f805764
commit 6b5a29db70

View file

@ -23,7 +23,7 @@ export default (serverMethods: Types.ServerMethods, mainHandler: Main, nostrSett
NostrMetricsAuthGuard: async (appId, pub) => { NostrMetricsAuthGuard: async (appId, pub) => {
const adminNpub = mainHandler.adminManager.GetAdminNpub() const adminNpub = mainHandler.adminManager.GetAdminNpub()
if (!adminNpub) { throw new Error("admin access not configured") } if (!adminNpub) { throw new Error("admin access not configured") }
if (pub !== adminNpub) { throw new Error("admin access denied") } if (pub !== adminNpub) { throw new Error("Metrics unavailable") }
log("operator access from", pub) log("operator access from", pub)
return { operator_id: pub } return { operator_id: pub }
}, },
@ -58,4 +58,4 @@ export default (serverMethods: Types.ServerMethods, mainHandler: Main, nostrSett
}, event.startAtNano, event.startAtMs) }, event.startAtNano, event.startAtMs)
}) })
return { Stop: () => nostr.Stop, Send: (...args) => nostr.Send(...args) } return { Stop: () => nostr.Stop, Send: (...args) => nostr.Send(...args) }
} }