diff --git a/www/js/init-ndk.mjs b/www/js/init-ndk.mjs index 155d319..fc7cb81 100644 --- a/www/js/init-ndk.mjs +++ b/www/js/init-ndk.mjs @@ -393,6 +393,8 @@ function handleWorkerMessage(event) { latestRelay: message.latestRelay, latestError: message.latestError, relayUrls: message.relayUrls || [], + batchCurrent: message.batchCurrent, + batchTotal: message.batchTotal, } })); } else if (message.type === 'startupStatus') { diff --git a/www/js/version.json b/www/js/version.json index 2aa5070..d87fac3 100644 --- a/www/js/version.json +++ b/www/js/version.json @@ -1,5 +1,5 @@ { - "VERSION": "v0.7.78", - "VERSION_NUMBER": "0.7.78", - "BUILD_DATE": "2026-06-30T14:33:14.964Z" + "VERSION": "v0.7.79", + "VERSION_NUMBER": "0.7.79", + "BUILD_DATE": "2026-06-30T14:36:42.724Z" } diff --git a/www/ndk-worker.js b/www/ndk-worker.js index 045ed4e..f05291a 100644 --- a/www/ndk-worker.js +++ b/www/ndk-worker.js @@ -6322,7 +6322,21 @@ async function handlePublish(requestId, event, port) { for (let i = 0; i < broadcastOnlyUrls.length; i += BATCH_SIZE) { batches.push(broadcastOnlyUrls.slice(i, i + BATCH_SIZE)); } - console.log(`[Worker] Phase 2: Broadcasting to ${broadcastOnlyUrls.length} relays in ${batches.length} batches of ${BATCH_SIZE}`); + const totalBatches = batches.length; + console.log(`[Worker] Phase 2: Broadcasting to ${broadcastOnlyUrls.length} relays in ${totalBatches} batches of ${BATCH_SIZE}`); + + // Emit a progress event showing batch info before starting batches. + broadcast({ + type: 'broadcastProgress', + sessionId: publishSessionId, + phase: 'progress', + total: totalTarget, + successful: publishedSoFar.size, + failed: failedSoFar.size + timedOutSoFar.size, + latestRelay: null, + batchCurrent: 0, + batchTotal: totalBatches, + }); for (let bi = 0; bi < batches.length; bi++) { const batch = batches[bi]; @@ -6341,7 +6355,19 @@ async function handlePublish(requestId, event, port) { } catch (batchErr) { // Expected — some relays in this batch may fail. } - console.log(`[Worker] Batch ${bi + 1}/${batches.length} complete — ` + + // Emit a progress event with batch info after each batch. + broadcast({ + type: 'broadcastProgress', + sessionId: publishSessionId, + phase: 'progress', + total: totalTarget, + successful: publishedSoFar.size, + failed: failedSoFar.size + timedOutSoFar.size, + latestRelay: null, + batchCurrent: bi + 1, + batchTotal: totalBatches, + }); + console.log(`[Worker] Batch ${bi + 1}/${totalBatches} complete — ` + `${publishedSoFar.size}/${totalTarget} total succeeded, ` + `${failedSoFar.size + timedOutSoFar.size} failed/timeout so far`); } diff --git a/www/post.html b/www/post.html index dd6a6e9..5a8d949 100644 --- a/www/post.html +++ b/www/post.html @@ -831,7 +831,11 @@ import { initPostCards } from './js/post-interactions2.mjs'; const shortRelay = d.latestRelay ? d.latestRelay.replace(/^wss?:\/\//, '').replace(/\/.*$/, '').slice(0, 30) : ''; - spanBroadcastStatus.textContent = `📡 ${d.successful}/${d.total} relays · ${shortRelay}`; + const batchInfo = (d.batchTotal && d.batchTotal > 0) + ? ` · ${d.batchCurrent}/${d.batchTotal} batches` + : ''; + const relayInfo = shortRelay ? ` · ${shortRelay}` : ''; + spanBroadcastStatus.textContent = `📡 ${d.successful}/${d.total} relays${batchInfo}${relayInfo}`; } else if (d.phase === 'done') { // Keep the result displayed until the next publish overwrites it. spanBroadcastStatus.textContent = `✅ ${d.successful}/${d.total} relays` + (d.failed > 0 ? ` (${d.failed} failed)` : '');