From 6f46fce6254ee7e77099e15fa0250f9a80ecab48 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 24 Sep 2025 10:48:35 -0400 Subject: [PATCH] . --- .gitignore | 4 +++- deploy.sh | 2 +- nostr_login_lite | 2 +- web/superball.html | 48 +++++++++++++++++++++++++++++++++++++++------- web/thrower.html | 42 +++++++++++++++++++++------------------- 5 files changed, 68 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index e59d632..e70e380 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -Nostr_NIPs/ \ No newline at end of file +Nostr_NIPs/ +nostr_login_lite/ +style_guide/ diff --git a/deploy.sh b/deploy.sh index ecc7286..8d33688 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,3 +1,3 @@ #!/bin/bash -rsync -avz --progress web/{superball.html,thrower.html,superball-shared.css} ubuntu@laantungir.net:WWW/superball/ +rsync -avz --chmod=644 --progress web/{superball.html,thrower.html,superball-shared.css} ubuntu@laantungir.net:WWW/superball/ diff --git a/nostr_login_lite b/nostr_login_lite index a7dceb1..3109a93 160000 --- a/nostr_login_lite +++ b/nostr_login_lite @@ -1 +1 @@ -Subproject commit a7dceb115626f3cab558802a753e52b34a527c2b +Subproject commit 3109a93163427b97067fc5e8a7377e81fad91f62 diff --git a/web/superball.html b/web/superball.html index 42e25b2..0a621aa 100644 --- a/web/superball.html +++ b/web/superball.html @@ -101,8 +101,9 @@ extension: true, local: true, seedphrase: true, + readonly: false, connect: true, - remote: false, + remote: true, otp: false }, debug: true @@ -1622,6 +1623,19 @@ ? userNameElement.textContent : 'User'; + // Helper function to get thrower name + function getThrowerName(bounce, bounceNumber) { + const throwerPubkey = bounce.throwerPubkey; + const thrower = discoveredThrowers.find(t => t.pubkey === throwerPubkey); + + if (thrower && thrower.name !== 'Unnamed Thrower') { + return thrower.name; + } + + // Fallback to generic naming + return `Superball ${bounceNumber}`; + } + // Start with user sending the outermost bounce let currentTime = baseTime; @@ -1630,6 +1644,7 @@ const bounceNumber = index + 1; const isFirst = (index === 0); const isLast = (index === bounces.length - 1); + const throwerName = getThrowerName(bounce, bounceNumber); if (isFirst) { // User sends the outermost routing event (first bounce created) @@ -1649,7 +1664,7 @@ flow.push({ time: currentTime, actor: `Relay (${relays.join(', ')})`, - action: `Event available for Superball ${bounceNumber}`, + action: `Event available for ${throwerName}`, size: routingEventSize }); } @@ -1665,12 +1680,21 @@ // Last bounce - posts final event const finalEventSize = JSON.stringify(finalEvent).length + paddingAdjustment; const finalRelays = getRelaysForBounce(bounceNumber); + const delaySeconds = getDelayForBounce(bounceNumber); + const paddingAdded = getPaddingAdjustmentForBounce(bounceNumber); + + // Create detailed final action description + let actionDescription = `Grabs message, waits ${delaySeconds} seconds`; + if (paddingAdded > 0) { + actionDescription += `, adds ${paddingAdded} bytes of padding`; + } + actionDescription += `, and publishes your original message to: ${finalRelays.join(', ')}`; // Step 3: Superball decrypts and sends final message flow.push({ time: currentTime, - actor: `Superball ${bounceNumber}`, - action: `Decrypts and publishes your original message`, + actor: throwerName, + action: actionDescription, size: Math.max(finalEventSize, 0) }); @@ -1685,14 +1709,24 @@ } else { // Intermediate bounce - forwards to next superball const nextBounce = bounces[index + 1]; + const nextThrowerName = getThrowerName(nextBounce, bounceNumber + 1); const nextRoutingSize = JSON.stringify(nextBounce.routingEvent).length + paddingAdjustment; const nextRelays = getRelaysForBounce(bounceNumber + 1); // Next superball's relays + const delaySeconds = getDelayForBounce(bounceNumber); + const paddingAdded = getPaddingAdjustmentForBounce(bounceNumber); + + // Create detailed forwarding action description + let actionDescription = `Grabs message, waits ${delaySeconds} seconds`; + if (paddingAdded > 0) { + actionDescription += `, adds ${paddingAdded} bytes of padding`; + } + actionDescription += `, and forwards to: ${nextRelays.join(', ')}`; // Step 3: Superball forwards to next relay flow.push({ time: currentTime, - actor: `Superball ${bounceNumber}`, - action: `Forwards routing event to next hop`, + actor: throwerName, + action: actionDescription, size: Math.max(nextRoutingSize, 0) }); @@ -1701,7 +1735,7 @@ flow.push({ time: currentTime, actor: `Relay (${nextRelays.join(', ')})`, - action: `Event available for Superball ${bounceNumber + 1}`, + action: `Event available for ${nextThrowerName}`, size: Math.max(nextRoutingSize, 0) }); } diff --git a/web/thrower.html b/web/thrower.html index 9e4a81d..594d369 100644 --- a/web/thrower.html +++ b/web/thrower.html @@ -12,12 +12,13 @@

Superball Thrower

+

Login as an existing or new Thrower, not with your personal key.