bumi / lnme

Your friendly Bitcoin Lightning ⚡ payment page ⚡
MIT License
165 stars 31 forks source link

fix: when widget closed stop watching payment #1

Closed karliatto closed 3 years ago

karliatto commented 3 years ago

When widget was closed, it was still watching the payment. I guess it should be stopped when it is closed so it is not polling to the server without a reason.

It works when I run it but I guess it would require to update rice-box.go in order to have it in the binaries. I have tried following the instruction in README.md but when I run rice embed-go it creates a rice-box.go that does not look right to me.

bumi commented 3 years ago

ohh, nice! good catch! thanks a lot for the pull request!

I have to say it is the first time I am using go.rice. rice embed-go creates the rice-box.go file that contains all static assets like the JS. So it update the whole file. What does not look right for you?

I'll merge this one and update the rice-box.go file.

(P.S. unrelated, but fyi: I just changed the configuration options in master for the upcoming official release. In case you currently run lnme you might need to update the config options (macaroon -> lnd-macaroon-path ; cert -> lnd-cert-path)

karliatto commented 3 years ago

When I run rice embed-go, it creates a rice-box.go that contains Content with a an array of bytes instead of just a string as the rice-box.go in master.

file2 := &embedded.EmbeddedFile{
        Filename:    `index.html`,
        FileModTime: time.Unix(1603709268, 0),
        Content:     string([]byte{0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x20, 0x6c, 0x61, 0x6e, 0x67, 0x3d, 0x22, 0x65, 0x6e, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x6d, 0x65, 0x74, 0x61, 0x20, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x3d, 0x22, 0x55, 0x54, 0x46, 0x2d, 0x38, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xe2, 0x9a, 0xa1, 0x20, ...
....

intead of:

file2 := &embedded.EmbeddedFile{
        Filename:    "index.html",
        FileModTime: time.Unix(1603706396, 0),

        Content: string("<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\">\n    <title>⚡ Send me some Sats</title>\n    <style>\n      html {\n        width: 100%;\n        height: 100%;\n        font-size: 1vw;\n      }\n      body {\n        background-image: linear-gradient(60deg, #3d3393 0%, #2b76b9 37%, #2cacd1 65%, #35eb93 100%);\n        font-family: \"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif;\n      }\n      .wrapper {\n        font-weight: 400;\n        line-height: 1.25

I had to install go.ricein my OS (linux), and I though it could be some wong configuration but it does not look like it has many configuration options.