From 2a1e59eb8f1b75f3815f6967556f50c31199d838 Mon Sep 17 00:00:00 2001
From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com>
Date: Sun, 29 Jun 2025 20:11:41 -0400
Subject: [PATCH] update
---
src/index.html | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/index.html b/src/index.html
index 542557c..03fffde 100644
--- a/src/index.html
+++ b/src/index.html
@@ -3,7 +3,7 @@
- Nostr Tip Jar
+ Lightning Tip Jar
@@ -59,12 +59,11 @@
}
function parseUrl() {
- const parts = location.pathname.split("/").filter(Boolean);
- let npub = null;
- if (parts[0] === "n" && parts[1]) npub = parts[1];
- else npub = new URLSearchParams(location.search).get("n");
- const idx = location.pathname.indexOf("/n/");
- const base = idx > 0 ? location.pathname.slice(0, idx) : location.pathname;
+ // Always use query parameter 'n' for npub
+ const params = new URLSearchParams(window.location.search);
+ const npub = params.get("n");
+ // Base is the URL of the HTML file (strip query and hash)
+ const base = window.location.href.split('?')[0].split('#')[0];
return { npub, base };
}
@@ -83,9 +82,10 @@
document.getElementById('form').onsubmit = e => {
e.preventDefault();
const v = document.getElementById('input').value.trim();
- if (!v.startsWith('npub')) return renderLanding(base, 'npub must start with "npub".');
- const isFile = /\.html?$/.test(base);
- location.href = isFile ? `${base}?n=${v}` : `${base.replace(/\/$/, '')}/n/${v}`;
+ if (!v.startsWith('npub')) { renderLanding(base, 'npub must start with "npub".'); return; }
+ const baseUrl = window.location.href.split('?')[0].split('#')[0];
+ log('Redirecting to', `${baseUrl}?n=${v}`);
+ location.href = `${baseUrl}?n=${v}`;
};
}
@@ -165,4 +165,4 @@
}
-