diff --git a/README.md b/README.md index 398d9a1..682877f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,31 @@ # LightningTip -Get tips via the Lightning Network +A simple way to accept tips via the Lightning Network on your website. + + + +## How to install +To get all necessary files for setting up LightningTip you can either [download a prebuilt version](https://github.com/michael1011/lightningtip/releases) or [compile from source](#how-to-install). + + +LightningTip is using [LND](https://github.com/lightningnetwork/lnd) as backend. Please make sure it is installed and fully synced before you install LightningTip. + + +The default config file location is `lightningTip.conf` in the directory you are executing LightningTip in. The [sample config](https://github.com/michael1011/lightningtip/blob/master/sample-lightningTip.conf) contains everything you need to know about the configuration. To use a custom config file location use the flag `--config filename`. + + +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 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. + + +If you are not running LightningTip on the same domain or IP address as your werbserver or not on port 8081 change the variable `requestUrl` (which is in the first line) in the file `lightningTip.js` accordingly. + + +That's it! The only two things you need to take care about is keeping the LND node online and making sure that your channels are funded well enough to receive tips. LightningTip will take care of everything else. + +## How to build +First of all make sure [Golang](https://golang.org/) and [Dep](https://github.com/golang/dep) are both correctly installed. Golang version 1.10 or newer is recommended. + +``` +go get github.com/michael1011/lightningtip.git +dep ensure +go install +``` diff --git a/build.sh b/build.sh index 02a4fb4..4411a62 100644 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ gofmt -s -w . -go build -o lightningTip. \ No newline at end of file +go build -o lightningTip \ No newline at end of file diff --git a/frontend/lightningTip.js b/frontend/lightningTip.js index 2b4ad30..0805dd3 100644 --- a/frontend/lightningTip.js +++ b/frontend/lightningTip.js @@ -1,5 +1,4 @@ -//var requestUrl = window.location.protocol + "//" + window.location.hostname + ":8081/"; -var requestUrl = "http://localhost:8081/"; +var requestUrl = window.location.protocol + "//" + window.location.hostname + ":8081/"; // To prohibit multiple requests at the same time var running = false; @@ -18,7 +17,6 @@ function getInvoice() { var tipValue = document.getElementById("lightningTipAmount"); if (tipValue.value !== "") { - if (!isNaN(tipValue.value)) { var data = JSON.stringify({"Amount": parseInt(tipValue.value), "Message": document.getElementById("lightningTipMessage").value}); diff --git a/lightningtip.go b/lightningtip.go index 6227414..1675bc9 100644 --- a/lightningtip.go +++ b/lightningtip.go @@ -54,7 +54,6 @@ type errorResponse struct { Error string } -// TODO: write how to build and install in README // TODO: add option to show URI of Lightning node func main() { initLog() diff --git a/sample-lightningTip.conf b/sample-lightningTip.conf index 70a15b9..77de6cc 100644 --- a/sample-lightningTip.conf +++ b/sample-lightningTip.conf @@ -1,12 +1,12 @@ [Application Options] # Location of the log file -logfile = lightningTip.log +# logfile = lightningTip.log # Log level for log file and console. Options are: debug, info, warning and error -loglevel = info +# loglevel = info # Host for the REST interface of LightningTip -resthost = localhost:8081 +# resthost = localhost:8081 # The domain (or IP address) you are using LightningTip from # Only needed if LightningTip is running on another port than the web server and no reverse proxy is used @@ -15,7 +15,7 @@ resthost = localhost:8081 # accessdomain = # After how many seconds invoices should expire -tipexpiry = 3600 +# tipexpiry = 3600 [LND] # LightningTip should work out of the box with LND