Keep short URL in share field when loaded via short link

This commit is contained in:
Alexander Schmidt
2026-03-26 13:40:16 +01:00
parent 3dd1e55432
commit 69f173bc2f
2 changed files with 10 additions and 6 deletions

14
app.js
View File

@@ -320,12 +320,16 @@
buildSummary(xmrAmount, desc, timer);
updatePageTitle(xmrAmount, desc);
// Share link — show long URL immediately, then replace with short
// Share link — keep existing short URL if present; otherwise shorten new hash
const hash = buildHash(addr, xmrAmount, desc, timer);
shareLinkInput.value = location.origin + '/#' + hash;
shortenUrl(hash).then(function (shortUrl) {
if (shortUrl) shareLinkInput.value = shortUrl;
});
if (invoiceCode) {
shareLinkInput.value = location.origin + '/s/' + invoiceCode;
} else {
shareLinkInput.value = location.origin + '/#' + hash;
shortenUrl(hash).then(function (shortUrl) {
if (shortUrl) shareLinkInput.value = shortUrl;
});
}
// QR
qrContainer.innerHTML = '';