diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7448dfac..af365267 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog
+# 1.2.3
+
+* Add `created_at` to event info dialog
+* Add signer status to profile page
+* Re-work bunker login flow
+
# 1.2.2
* Fix phantom chat notifications
diff --git a/src/app/components/BunkerConnect.svelte b/src/app/components/BunkerConnect.svelte
index 10b9d272..179b3cb5 100644
--- a/src/app/components/BunkerConnect.svelte
+++ b/src/app/components/BunkerConnect.svelte
@@ -1,79 +1,25 @@
-
-
-{#if controller.url}
-
-
-
+{#if $url}
+ {#if $loading}
+
+ Establishing connection...
+
+ {:else}
+
+
+
Scan with your signer to log in, or click to copy.
+
+ {/if}
{/if}
diff --git a/src/app/components/BunkerUrl.svelte b/src/app/components/BunkerUrl.svelte
index 2d5fd0ca..ab8cd5eb 100644
--- a/src/app/components/BunkerUrl.svelte
+++ b/src/app/components/BunkerUrl.svelte
@@ -1,16 +1,30 @@
@@ -20,7 +34,10 @@
{#snippet input()}
{/snippet}
{#snippet info()}
@@ -30,3 +47,6 @@
{/snippet}
+{#if showScanner}
+
+{/if}
diff --git a/src/app/components/LogInBunker.svelte b/src/app/components/LogInBunker.svelte
index 72fe1e64..296d52eb 100644
--- a/src/app/components/LogInBunker.svelte
+++ b/src/app/components/LogInBunker.svelte
@@ -1,4 +1,5 @@
diff --git a/src/app/components/PrimaryNav.svelte b/src/app/components/PrimaryNav.svelte
index 2fa7ee95..7564712c 100644
--- a/src/app/components/PrimaryNav.svelte
+++ b/src/app/components/PrimaryNav.svelte
@@ -77,7 +77,7 @@
{/if}
-
+
{/each}
diff --git a/src/app/components/SignerStatus.svelte b/src/app/components/SignerStatus.svelte
new file mode 100644
index 00000000..e9b3f859
--- /dev/null
+++ b/src/app/components/SignerStatus.svelte
@@ -0,0 +1,48 @@
+
+
+
+
+
+ Signer Status
+
+ {#if isDisconnected}
+ Disconnected
+ {:else if recentFailure > 3}
+ Partial Failure
+ {:else if recentAvg > 1000 || recentPending > 3}
+ Slow connection
+ {:else if recentSuccess === 0 && recentFailure > 0}{:else}
+ Ok
+ {/if}
+
+
+
+ {success} requests succeeded, {failure} failed, {pending} pending
+
+
+ {#if isDisconnected}
+
+ {/if}
+
diff --git a/src/app/nip46.ts b/src/app/nip46.ts
new file mode 100644
index 00000000..fe214975
--- /dev/null
+++ b/src/app/nip46.ts
@@ -0,0 +1,54 @@
+import {writable} from "svelte/store"
+import type {Nip46ResponseWithResult} from "@welshman/signer"
+import {Nip46Broker, makeSecret} from "@welshman/signer"
+import {NIP46_PERMS, PLATFORM_URL, PLATFORM_NAME, PLATFORM_LOGO, SIGNER_RELAYS} from "@app/state"
+import {pushToast} from "@app/toast"
+
+export class Nip46Controller {
+ url = writable("")
+ bunker = writable("")
+ loading = writable(false)
+ clientSecret = makeSecret()
+ abortController = new AbortController()
+ broker = new Nip46Broker({clientSecret: this.clientSecret, relays: SIGNER_RELAYS})
+ onNostrConnect: (response: Nip46ResponseWithResult) => void
+
+ constructor({onNostrConnect}: {onNostrConnect: (response: Nip46ResponseWithResult) => void}) {
+ this.onNostrConnect = onNostrConnect
+ }
+
+ async start() {
+ const url = await this.broker.makeNostrconnectUrl({
+ perms: NIP46_PERMS,
+ url: PLATFORM_URL,
+ name: PLATFORM_NAME,
+ image: PLATFORM_LOGO,
+ })
+
+ this.url.set(url)
+
+ let response
+ try {
+ response = await this.broker.waitForNostrconnect(url, this.abortController.signal)
+ } catch (errorResponse: any) {
+ if (errorResponse?.error) {
+ pushToast({
+ theme: "error",
+ message: `Received error from signer: ${errorResponse.error}`,
+ })
+ } else if (errorResponse) {
+ console.error(errorResponse)
+ }
+ }
+
+ if (response) {
+ this.loading.set(true)
+ this.onNostrConnect(response)
+ }
+ }
+
+ stop() {
+ this.broker.cleanup()
+ this.abortController.abort()
+ }
+}
diff --git a/src/routes/settings/profile/+page.svelte b/src/routes/settings/profile/+page.svelte
index 43b9d4d6..c2bcb554 100644
--- a/src/routes/settings/profile/+page.svelte
+++ b/src/routes/settings/profile/+page.svelte
@@ -11,6 +11,7 @@
import Content from "@app/components/Content.svelte"
import ProfileEdit from "@app/components/ProfileEdit.svelte"
import ProfileDelete from "@app/components/ProfileDelete.svelte"
+ import SignerStatus from "@app/components/SignerStatus.svelte"
import InfoKeys from "@app/components/InfoKeys.svelte"
import Alerts from "@app/components/Alerts.svelte"
import {PLATFORM_NAME} from "@app/state"
@@ -129,6 +130,7 @@
{/snippet}
{/if}
+
diff --git a/svelte.config.js b/svelte.config.js
index 0699ce97..7b71079d 100644
--- a/svelte.config.js
+++ b/svelte.config.js
@@ -16,7 +16,7 @@ export default {
},
csp: {
directives: {
- "script-src": ["self", "plausible.coracle.social"],
+ "script-src": ["self", "wasm-unsafe-eval", "plausible.coracle.social", "sha256-NpqGpeZTuPniNAucgyfqzWy9iIHwOswFzPzpigwvp/c="],
"worker-src": ["self", "blob:"],
"style-src": ["self", "unsafe-inline"],
"frame-src": ["none"],