minor fixes

This commit is contained in:
michael1011 2018-03-31 16:11:25 +02:00
parent 6c69629eed
commit 9b80af5a29
No known key found for this signature in database
GPG Key ID: 84D249BA71685D46
5 changed files with 17 additions and 13 deletions

View File

@ -16,7 +16,7 @@ The default config file location is `lightningTip.conf` in the directory you are
Embedding LightningTip is also quite easy. Upload all files excluding `lightningTip.html` to your webserver. Copy the contents of the head tag of the before mentioned HTML file into a HTML file you want to show LightningTip in. The div below the head tag is LightningTip itself. Paste it into any place in the already edited HTML file on you server.
Make sure that the executable of **LightningTip is always running** in the background. It connects LND and the widget on your website.
Make sure that the executable of **LightningTip is always running** in the background. It connects LND and the widget on your website. A sample configuration for systemd can be found [on this wiki page](https://github.com/michael1011/lightningtip/wiki/Running-LightningTip-with-systemd).
If you are not running LightningTip on the same domain or IP address as your webserver or not on port 8081 change the variable `requestUrl` (which is in the first line) in the file `lightningTip.js` accordingly.

View File

@ -8,6 +8,8 @@ type PublishInvoiceSettled func(invoice string, eventSrv *eventsource.Server)
type Backend interface {
Connect() error
// Amount in satoshis and expiry in seconds
// Amount in satoshi and expiry in seconds
GetInvoice(description string, amount int64, expiry int64) (invoice string, err error)
SubscribeInvoices(callback PublishInvoiceSettled, eventSrv *eventsource.Server) error
}

View File

@ -56,16 +56,6 @@ func (lnd *LND) Connect() error {
return err
}
func getMacaroon(macaroonFile string) (macaroon metadata.MD, err error) {
data, err := ioutil.ReadFile(macaroonFile)
if err == nil {
macaroon = metadata.Pairs("macaroon", hex.EncodeToString(data))
}
return macaroon, err
}
func (lnd *LND) GetInvoice(message string, amount int64, expiry int64) (invoice string, err error) {
var response *lnrpc.AddInvoiceResponse
@ -131,3 +121,13 @@ func (lnd *LND) SubscribeInvoices(callback PublishInvoiceSettled, eventSrv *even
return err
}
func getMacaroon(macaroonFile string) (macaroon metadata.MD, err error) {
data, err := ioutil.ReadFile(macaroonFile)
if err == nil {
macaroon = metadata.Pairs("macaroon", hex.EncodeToString(data))
}
return macaroon, err
}

View File

@ -140,6 +140,8 @@ func initConfig() {
log.Debug("Initialized log file: " + cfg.LogFile)
}
backends.UseLogger(*log)
// TODO: add more backend options like for example c-lighting and eclair
backend = cfg.LND
}

View File

@ -107,7 +107,7 @@ func main() {
log.Info("Subscribing to invoices")
go func() {
err = cfg.LND.SubscribeInvoices(publishInvoiceSettled, eventSrv)
err = backend.SubscribeInvoices(publishInvoiceSettled, eventSrv)
if err != nil {
log.Error("Failed to subscribe to invoices: " + fmt.Sprint(err))