support for "commando" method.

This commit is contained in:
fiatjaf 2022-03-15 21:16:02 -03:00
parent e4f330d3a4
commit dadd45cf08
6 changed files with 767 additions and 44 deletions

4
db.go
View File

@ -17,10 +17,14 @@ type Params struct {
Name string `json:"name"`
Domain string `json:"domain,omitempty"`
Kind string `json:"kind"`
Host string `json:"host"`
Key string `json:"key"`
Pak string `json:"pak"`
Waki string `json:"waki"`
NodeId string `json:"nodeid"`
Rune string `json:"rune"`
Pin string `json:"pin"`
MinSendable string `json:"minSendable"`
MaxSendable string `json:"maxSendable"`

4
go.mod
View File

@ -5,10 +5,10 @@ go 1.16
require (
github.com/cockroachdb/pebble v0.0.0-20210812144839-61318a019370
github.com/fiatjaf/go-lnurl v1.4.0
github.com/fiatjaf/makeinvoice v1.3.1
github.com/fiatjaf/makeinvoice v1.4.0
github.com/gorilla/mux v1.8.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/lib/pq v1.10.2
github.com/lib/pq v1.10.3
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/rs/zerolog v1.23.0
github.com/tidwall/sjson v1.1.7

744
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,8 @@
<option disabled value="">Please select one:</option>
<option value="lnd">LND</option>
<option value="eclair">Eclair</option>
<option value="sparko">Sparko</option>
<option value="sparko">Sparko (c-lightning)</option>
<option value="commando">Commando (c-lightning)</option>
<option value="lnpay">LNPay</option>
<option value="lnbits">LNbits</option>
</select>
@ -122,6 +123,30 @@
<input type="checkbox" v-model="isNew" />
</label>
</div>
<div v-if="kind == 'commando'">
<div class="field">
<label for="nodeid">Node ID (pubkey)</label>
<input
class="input full-width"
name="nodeid"
id="nodeid"
placeholder="02c16cca44562b590dd279c942200bdccfd4f990c3a69fad620c10ef2f8228eaff"
/>
</div>
<div class="field">
<label for="host">Node IP + Port</label>
<input
class="input full-width"
name="host"
id="host"
placeholder="10.147.17.32:9735"
/>
</div>
<div class="field">
<label for="rune">Rune</label>
<input class="input full-width" name="rune" id="rune" />
</div>
</div>
<br />
<div class="field" v-if="!isNew">
<label for="pin"> Secret PIN </label>

View File

@ -109,6 +109,8 @@ func main() {
Key: r.FormValue("key"),
Pak: r.FormValue("pak"),
Waki: r.FormValue("waki"),
NodeId: r.FormValue("nodeid"),
Rune: r.FormValue("rune"),
}, r.FormValue("pin"))
if err != nil {
w.WriteHeader(500)

View File

@ -55,6 +55,12 @@ func makeInvoice(
Host: params.Host,
Password: "",
}
case "commando":
backend = makeinvoice.CommandoParams{
Host: params.Host,
NodeId: params.NodeId,
Rune: params.Rune,
}
}
mip := makeinvoice.Params{