Browse Source

Become domain-agnostic, with .onion-specific address generation

1) use window.location instead of hardcoded lnurl-pay.me
2) don't use subdomains for address creation on .onion
master
Anton Kovalenko 2 years ago
parent
commit
0d61244ad4
  1. 9
      src/App.svelte

9
src/App.svelte

@ -84,7 +84,11 @@
amount.toFixed(2))+payway.currency.toLowerCase()+"-"):""
if (account[0]=='+')
account=account.slice(1)
return prefix + account + "@" + payway.id + ".lnurl-pay.me"
if (window.location.hostname.endsWith(".onion")) {
return prefix + account + "." + payway.id + "@" + window.location.hostname
} else {
return prefix + account + "@" + payway.id + "." + window.location.hostname
}
}
function genLNURL(payway,account,amount,memo,isEncrypted) {
@ -100,7 +104,8 @@
if (memo) {
params.set("m",toHexString(UTF8.setBytesFromString(memo)))
}
return lnurlEncode("https://lnurl-pay.me/pay?"+params.toString()).toUpperCase()
const me = window.location.protocol + "//" + window.location.host
return lnurlEncode(me + "/pay?" + params.toString()).toUpperCase()
}

Loading…
Cancel
Save