fix: surface NIP-07 signature wait as a distinct upload phase
Episode uploads that looked 'stuck uploading to blossom' were actually stuck waiting on the browser nostr extension's own approval popup — confirmed via server/blossom logs showing zero incoming requests for the reported attempt, meaning the upload never left the browser. The UI flipped to phase 'uploading' (0%) before the NIP-07 signEvent() call resolved, so a user who didn't notice the extension's popup saw a progress bar frozen at 0% with no indication anything needed their action. Added a 'signing' phase with an explicit message telling them to check for the popup.
This commit is contained in:
@@ -24,7 +24,12 @@ export async function uploadToBlossom(
|
|||||||
file: File,
|
file: File,
|
||||||
sha256: string,
|
sha256: string,
|
||||||
onProgress?: (frac: number) => void,
|
onProgress?: (frac: number) => void,
|
||||||
|
onSigning?: () => void,
|
||||||
): Promise<BlossomUpload> {
|
): Promise<BlossomUpload> {
|
||||||
|
// 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 now = Math.floor(Date.now() / 1000);
|
||||||
const auth = await nip07().signEvent({
|
const auth = await nip07().signEvent({
|
||||||
kind: 24242,
|
kind: 24242,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const podcast = ref<PodcastSummary | null>(null);
|
|||||||
const creatingNew = ref(false);
|
const creatingNew = ref(false);
|
||||||
|
|
||||||
const file = ref<File | null>(null);
|
const file = ref<File | null>(null);
|
||||||
const phase = ref<'idle' | 'hashing' | 'uploading' | 'registering'>('idle');
|
const phase = ref<'idle' | 'hashing' | 'signing' | 'uploading' | 'registering'>('idle');
|
||||||
const progress = ref(0);
|
const progress = ref(0);
|
||||||
const error = ref('');
|
const error = ref('');
|
||||||
|
|
||||||
@@ -31,6 +31,7 @@ const episodeUrl = ref('');
|
|||||||
const phaseLabel = computed(() => ({
|
const phaseLabel = computed(() => ({
|
||||||
idle: '',
|
idle: '',
|
||||||
hashing: 'Computing sha256…',
|
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)}%`,
|
uploading: `Uploading to Blossom… ${(progress.value * 100).toFixed(0)}%`,
|
||||||
registering: 'Publishing episode…',
|
registering: 'Publishing episode…',
|
||||||
}[phase.value]));
|
}[phase.value]));
|
||||||
@@ -72,9 +73,17 @@ async function publish() {
|
|||||||
durationSecs.value = await probeDuration(file.value);
|
durationSecs.value = await probeDuration(file.value);
|
||||||
const sha = await sha256File(file.value);
|
const sha = await sha256File(file.value);
|
||||||
|
|
||||||
phase.value = 'uploading';
|
|
||||||
const blossomUrl = settings.public!.blossomUrl;
|
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 };
|
uploaded.value = { sha256: sha, size: file.value.size };
|
||||||
|
|
||||||
phase.value = 'registering';
|
phase.value = 'registering';
|
||||||
|
|||||||
Reference in New Issue
Block a user