This commit is contained in:
Your Name 2025-09-24 10:48:35 -04:00
parent 9dc7cdacec
commit 6f46fce625
5 changed files with 68 additions and 30 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
Nostr_NIPs/
nostr_login_lite/
style_guide/

View File

@ -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/

@ -1 +1 @@
Subproject commit a7dceb115626f3cab558802a753e52b34a527c2b
Subproject commit 3109a93163427b97067fc5e8a7377e81fad91f62

View File

@ -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)
});
}

View File

@ -12,6 +12,7 @@
<div id="login-section">
<h1>Superball Thrower</h1>
<h3 style="max-width: 500px; margin: 0 auto;">Login as an existing or new Thrower, not with your personal key.</h3>
<div id="login-container"></div>
</div>
@ -26,7 +27,7 @@
<!-- Start Thrower Button (moved above main section) -->
<div style="margin: 20px 0 5px 0; width: 100%;">
<button id="daemon-toggle" class="button-primary" onclick="toggleDaemon()"
style="width: 100%; font-size: 16px; font-weight: bold; margin-bottom: 0;">
style="width: 100%; font-size: 16px; font-weight: bold; margin-bottom: 0;">
<span id="daemon-button-text">Start Thrower</span>
</button>
</div>
@ -228,8 +229,9 @@
extension: true,
local: true,
seedphrase: true,
readonly: false,
connect: true,
remote: false,
remote: true,
otp: false
},
debug: true