Avoid duplicate auth_urls

This commit is contained in:
Jon Staab
2024-11-20 10:27:11 -08:00
parent ca00081b2b
commit 86c710f40f
+8 -1
View File
@@ -65,6 +65,7 @@ export class Nip46Broker extends Emitter {
#processing = false
#connectResponse?: Nip46Response
#queue: Nip46Request[] = []
#window?: Window
#sub?: Subscription
static initiate({url, name, image, perms, relays, abortController}: Nip46InitiateParams) {
@@ -248,7 +249,13 @@ export class Nip46Broker extends Emitter {
})
this.once(`auth-${id}`, response => {
window.open(response.error, "", "width=600,height=800,popup=yes")
if (!this.#window || this.#window.closed) {
const w = window.open(response.error, "", "width=600,height=800,popup=yes")
if (w) {
this.#window = w
}
}
})
return new Promise<Nip46ResponseWithResult>((resolve, reject) => {