Added possibility to simply forward address to an exisiting one

This commit is contained in:
Dr. Tobias Baur
2023-03-10 10:23:00 +01:00
parent f5329e6ab5
commit 64d605b659
5 changed files with 37 additions and 6 deletions
+6 -3
View File
@@ -65,9 +65,12 @@ func SaveName(
params.Name = name
params.Domain = domain
// check if the given data works
if inv, err = makeInvoice(params, 1000, &pin, "", ""); err != nil {
return "", "", fmt.Errorf("couldn't make an invoice with the given data: %w", err)
if params.Kind != "forward" {
// check if the given data works
if inv, err = makeInvoice(params, 1000, &pin, "", ""); err != nil {
return "", "", fmt.Errorf("couldn't make an invoice with the given data: %w", err)
}
}
// save it
+3
View File
@@ -23,13 +23,16 @@
<button class="copy-button" @click="copyToClipboard">
{{ copied ? 'Copied!' : 'Copy Secret PIN' }}
</button>
<div v-if="invoice != ''">
<div class="bold-small">
To ensure the connection with your Lightning backend is configured
properly, we've created a test invoice that can be seen below.
</div>
<canvas id="qr"></canvas>
<div class="code">{{ invoice }}</div>
</div>
</div>
<div class="resources">
<a class="resource-button" target="_blank" href="https://t.me/lnurl">
Not working? Ask for help!
+17
View File
@@ -56,9 +56,26 @@
<option value="sparko">Sparko (CLN)</option>
<option value="eclair">Eclair</option>
<option value="lnpay">LNPay</option>
<option value="forward">Forward</option>
</select>
</div>
<div v-if="kind == 'forward'">
<div class="field">
<label for="host">
Forward URl
</label>
<input
class="input full-width"
name="host"
id="host"
placeholder="https://walletofsatoshi.com/.well-known/lnurlp/ninthtractor31"
/>
</div>
</div>
<div v-if="kind == 'lnd'">
<div class="field">
<label for="host">
+5
View File
@@ -89,6 +89,11 @@ func handleLNURL(w http.ResponseWriter, r *http.Request) {
return
}
if params.Kind == "forward" {
http.Redirect(w, r, params.Host, http.StatusSeeOther)
return
}
log.Info().Str("username", username).Str("domain", domain).Msg("got lnurl request")
if amount := r.URL.Query().Get("amount"); amount == "" {
+6 -3
View File
@@ -64,9 +64,12 @@ func handleNip05(w http.ResponseWriter, r *http.Request) {
}
if s.Nip05 {
middlestringtrim := middlestring[:len(middlestring)-2]
middlestringtrim += "\n"
response = firstpartstring + middlestringtrim + finalpartstring
if len(middlestring) > 2 {
middlestringtrim := middlestring[:len(middlestring)-2]
middlestringtrim += "\n"
response = firstpartstring + middlestringtrim + finalpartstring
}
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
fmt.Fprintf(w, response)