support eclair with new makeinvoice version.

This commit is contained in:
fiatjaf 2021-09-13 21:27:04 -03:00
parent 5574a494ed
commit d49f2dc2c5
5 changed files with 54 additions and 16 deletions

View File

@ -2,6 +2,6 @@ satdress: $(shell find . -name "*.go") $(shell find . -name "*.html") $(shell fi
CC=$$(which musl-gcc) go build -ldflags='-s -w -linkmode external -extldflags "-static"' -o ./satdress CC=$$(which musl-gcc) go build -ldflags='-s -w -linkmode external -extldflags "-static"' -o ./satdress
deploy: satdress deploy: satdress
ssh root@hulsmann 'systemctl stop bitmia tinytip payaddress paymentlink' ssh root@turgot 'systemctl stop bitmia tinytip payaddress paymentlink'
scp satdress hulsmann:satdress/satdress scp satdress turgot:satdress/satdress
ssh root@hulsmann 'systemctl start bitmia tinytip payaddress paymentlink' ssh root@turgot 'systemctl start bitmia tinytip payaddress paymentlink'

3
go.mod
View File

@ -5,9 +5,8 @@ go 1.16
require ( require (
github.com/cockroachdb/pebble v0.0.0-20210812144839-61318a019370 github.com/cockroachdb/pebble v0.0.0-20210812144839-61318a019370
github.com/fiatjaf/go-lnurl v1.4.0 github.com/fiatjaf/go-lnurl v1.4.0
github.com/fiatjaf/makeinvoice v1.2.3 github.com/fiatjaf/makeinvoice v1.3.0
github.com/gorilla/mux v1.8.0 github.com/gorilla/mux v1.8.0
github.com/joho/godotenv v1.3.0 // indirect
github.com/kelseyhightower/envconfig v1.4.0 github.com/kelseyhightower/envconfig v1.4.0
github.com/lib/pq v1.10.2 github.com/lib/pq v1.10.2
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646

8
go.sum
View File

@ -112,6 +112,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fiatjaf/eclair-go v0.2.1 h1:e4P9k0kL3+ePA/24oVSJPbD3i0I0uJix2SSYmO+OzBU=
github.com/fiatjaf/eclair-go v0.2.1/go.mod h1:GVwvLpx9QwIcVnhJDn1r+LAS3B1jX++ARXahxpU6RZc=
github.com/fiatjaf/go-lnurl v1.0.0/go.mod h1:BqA8WXAOzntF7Z3EkVO7DfP4y5rhWUmJ/Bu9KBke+rs= github.com/fiatjaf/go-lnurl v1.0.0/go.mod h1:BqA8WXAOzntF7Z3EkVO7DfP4y5rhWUmJ/Bu9KBke+rs=
github.com/fiatjaf/go-lnurl v1.4.0 h1:hVFEEJD2A9D6ojEcqLyD54CM2ZJ9Tzs2jNKw/GNq52A= github.com/fiatjaf/go-lnurl v1.4.0 h1:hVFEEJD2A9D6ojEcqLyD54CM2ZJ9Tzs2jNKw/GNq52A=
github.com/fiatjaf/go-lnurl v1.4.0/go.mod h1:BqA8WXAOzntF7Z3EkVO7DfP4y5rhWUmJ/Bu9KBke+rs= github.com/fiatjaf/go-lnurl v1.4.0/go.mod h1:BqA8WXAOzntF7Z3EkVO7DfP4y5rhWUmJ/Bu9KBke+rs=
@ -119,8 +121,6 @@ github.com/fiatjaf/lightningd-gjson-rpc v1.4.0 h1:Iv5tt4YuNoSMfR39wiV0tqnHYTJ85o
github.com/fiatjaf/lightningd-gjson-rpc v1.4.0/go.mod h1:SQGA0qcY2qypaMXDQlE5V5+2MnLZzQ7NzfRsScliFeE= github.com/fiatjaf/lightningd-gjson-rpc v1.4.0/go.mod h1:SQGA0qcY2qypaMXDQlE5V5+2MnLZzQ7NzfRsScliFeE=
github.com/fiatjaf/ln-decodepay v1.0.0 h1:1YUMjvLock+BicMNwoZ/OA3oG2ZYEaJ8AzdS6EGVMTQ= github.com/fiatjaf/ln-decodepay v1.0.0 h1:1YUMjvLock+BicMNwoZ/OA3oG2ZYEaJ8AzdS6EGVMTQ=
github.com/fiatjaf/ln-decodepay v1.0.0/go.mod h1:/LWK+ZUa3i8MqbRjIMAiVQS2+NbhwKWlwib2n446cMQ= github.com/fiatjaf/ln-decodepay v1.0.0/go.mod h1:/LWK+ZUa3i8MqbRjIMAiVQS2+NbhwKWlwib2n446cMQ=
github.com/fiatjaf/makeinvoice v1.2.3 h1:a2tvuv4q823+2Q7gw9QGoPGhhTQ2LmMzgQjDF9zKXeM=
github.com/fiatjaf/makeinvoice v1.2.3/go.mod h1:R+p/0XfRNob2hu+nyIiC2xaSy/HcdQ21rbNNuUHRB70=
github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA= github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA=
github.com/frankban/quicktest v1.2.2/go.mod h1:Qh/WofXFeiAFII1aEBu529AtJo6Zg2VHscnEsbBnJ20= github.com/frankban/quicktest v1.2.2/go.mod h1:Qh/WofXFeiAFII1aEBu529AtJo6Zg2VHscnEsbBnJ20=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
@ -182,6 +182,8 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.8.6/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.8.6/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
@ -203,8 +205,6 @@ github.com/jackpal/go-nat-pmp v0.0.0-20170405195558-28a68d0c24ad/go.mod h1:QPH04
github.com/jedib0t/go-pretty v4.3.0+incompatible/go.mod h1:XemHduiw8R651AF9Pt4FwCTKeG3oo7hrHJAoznj9nag= github.com/jedib0t/go-pretty v4.3.0+incompatible/go.mod h1:XemHduiw8R651AF9Pt4FwCTKeG3oo7hrHJAoznj9nag=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=

View File

@ -36,6 +36,7 @@
<select name="kind" id="kind" id="kind" v-model="kind"> <select name="kind" id="kind" id="kind" v-model="kind">
<option disabled value="">Please select one:</option> <option disabled value="">Please select one:</option>
<option value="lnd">LND</option> <option value="lnd">LND</option>
<option value="eclair">Eclair</option>
<option value="sparko">Sparko</option> <option value="sparko">Sparko</option>
<option value="lnpay">LNPay</option> <option value="lnpay">LNPay</option>
<option value="lnbits">LNbits</option> <option value="lnbits">LNbits</option>
@ -43,30 +44,63 @@
</div> </div>
<div v-if="kind == 'lnd'"> <div v-if="kind == 'lnd'">
<div class="field"> <div class="field">
<label for="host"> LND REST Host (Protocol + IP/Domain + Port) </label> <label for="host">
LND REST Host (Protocol + IP/Domain + Port)
</label>
<input <input
class="input full-width" name="host" id="host" class="input full-width"
placeholder="https://foo.bar:8080" name="host"
id="host"
placeholder="http://mylndonionztxrvxtzrs.onion:8080"
/> />
</div> </div>
<div class="field"> <div class="field">
<label for="key"> Invoice Macaroon (base64 encoded) </label> <label for="macaroon"> Invoice Macaroon (base64 encoded) </label>
<input <input
class="input full-width" name="key" id="key" class="input full-width"
name="key"
id="macaroon"
placeholder="V2UgYWxsIGxvdmUgQGZpYXRqYWYhCg==" placeholder="V2UgYWxsIGxvdmUgQGZpYXRqYWYhCg=="
/> />
</div> </div>
</div> </div>
<div v-if="kind == 'sparko' || kind == 'lnbits'"> <div v-if="kind == 'sparko' || kind == 'lnbits'">
<div class="field"> <div class="field">
<label for="host"> Host (IP or Domain + Port) </label> <label for="host"> Host (Protocol + IP or Domain + Port) </label>
<input class="input full-width" name="host" id="host" /> <input
class="input full-width"
name="host"
id="host"
placeholder="http://10.147.17.32:9737"
/>
</div> </div>
<div class="field"> <div class="field">
<label for="key"> Key </label> <label for="key"> Key </label>
<input class="input full-width" name="key" id="key" /> <input class="input full-width" name="key" id="key" />
</div> </div>
</div> </div>
<div v-if="kind == 'eclair'">
<div class="field">
<label for="host"> Host (Protocol + IP or Domain + Port) </label>
<input
class="input full-width"
name="host"
id="host"
placeholder="http://myeclair.com"
/>
</div>
<div>
<p>
Don't input your Eclair password here nor expose your Eclair
node carelessly. Follow
<a
href="https://gist.github.com/fiatjaf/8e74740d30763713154de15562e08789#file-exposing-eclair-md"
>these instructions</a
>
instead (or do something better).
</p>
</div>
</div>
<div v-if="kind == 'lnpay'"> <div v-if="kind == 'lnpay'">
<div class="field"> <div class="field">
<label for="pak"> Public Access Key (pak) </label> <label for="pak"> Public Access Key (pak) </label>

View File

@ -50,6 +50,11 @@ func makeInvoice(
PublicAccessKey: params.Pak, PublicAccessKey: params.Pak,
WalletInvoiceKey: params.Waki, WalletInvoiceKey: params.Waki,
} }
case "eclair":
backend = makeinvoice.EclairParams{
Host: params.Host,
Password: "",
}
} }
mip := makeinvoice.Params{ mip := makeinvoice.Params{