diff --git a/frontend/src/lib/blossom.ts b/frontend/src/lib/blossom.ts index 1918d04..0345843 100644 --- a/frontend/src/lib/blossom.ts +++ b/frontend/src/lib/blossom.ts @@ -24,7 +24,12 @@ export async function uploadToBlossom( file: File, sha256: string, onProgress?: (frac: number) => void, + onSigning?: () => void, ): Promise { + // signEvent() waits on the NIP-07 extension's own approval popup, which can + // take an unbounded amount of time (or go unnoticed) — tell the caller so + // the UI doesn't say "Uploading… 0%" while nothing has actually started. + onSigning?.(); const now = Math.floor(Date.now() / 1000); const auth = await nip07().signEvent({ kind: 24242, diff --git a/frontend/src/views/wizard/EpisodeWizard.vue b/frontend/src/views/wizard/EpisodeWizard.vue index 9d45f83..4788a69 100644 --- a/frontend/src/views/wizard/EpisodeWizard.vue +++ b/frontend/src/views/wizard/EpisodeWizard.vue @@ -17,7 +17,7 @@ const podcast = ref(null); const creatingNew = ref(false); const file = ref(null); -const phase = ref<'idle' | 'hashing' | 'uploading' | 'registering'>('idle'); +const phase = ref<'idle' | 'hashing' | 'signing' | 'uploading' | 'registering'>('idle'); const progress = ref(0); const error = ref(''); @@ -31,6 +31,7 @@ const episodeUrl = ref(''); const phaseLabel = computed(() => ({ idle: '', hashing: 'Computing sha256…', + signing: 'Waiting for your nostr extension to approve the upload — check for a popup (it may be behind this window).', uploading: `Uploading to Blossom… ${(progress.value * 100).toFixed(0)}%`, registering: 'Publishing episode…', }[phase.value])); @@ -72,9 +73,17 @@ async function publish() { durationSecs.value = await probeDuration(file.value); const sha = await sha256File(file.value); - phase.value = 'uploading'; const blossomUrl = settings.public!.blossomUrl; - await uploadToBlossom(blossomUrl, file.value, sha, (f) => (progress.value = f)); + await uploadToBlossom( + blossomUrl, + file.value, + sha, + (f) => { + phase.value = 'uploading'; + progress.value = f; + }, + () => (phase.value = 'signing'), + ); uploaded.value = { sha256: sha, size: file.value.size }; phase.value = 'registering';