Skip to content

fixing overflow of text inputs #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@ To get all necessary files for setting up LightningTip you can either [download
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`.
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`. You can use all keys in the config as command line flag. Command line flags *always* override values in the config.


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.


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.


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.
When using LightningTip behind a proxy make sure the proxy supports [EventSource](https://developer.mozilla.org/en-US/docs/Web/API/EventSource). Without support for it the users will not see the "Thank you for your tip!" screen.


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.
Expand Down
22 changes: 16 additions & 6 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ const (
defaultLogFile = "lightningTip.log"
defaultLogLevel = "debug"

defaultRESTHost = "localhost:8081"
defaultRESTHost = "0.0.0.0:8081"
defaultTlsCertFile = ""
defaultTlsKeyFile = ""

defaultAccessDomain = ""

defaultTipExpiry = 3600
Expand All @@ -32,7 +35,10 @@ type config struct {
LogFile string `long:"logfile" Description:"Location of the log file"`
LogLevel string `long:"loglevel" Description:"Log level: debug, info, warning, error"`

RESTHost string `long:"resthost" Description:"Host for the REST interface of LightningTip"`
RESTHost string `long:"resthost" Description:"Host for the REST interface of LightningTip"`
TlsCertFile string `long:"tlscertfile" Description:"Certificate for using LightningTip via HTTPS"`
TlsKeyFile string `long:"tlskeyfile" Description:"Certificate for using LightningTip via HTTPS"`

AccessDomain string `long:"accessdomain" Description:"The domain you are using LightningTip from"`

TipExpiry int64 `long:"tipexpiry" Description:"Invoice expiry time in seconds"`
Expand All @@ -53,7 +59,10 @@ func initConfig() {
LogFile: defaultLogFile,
LogLevel: defaultLogLevel,

RESTHost: defaultRESTHost,
RESTHost: defaultRESTHost,
TlsCertFile: defaultTlsCertFile,
TlsKeyFile: defaultTlsKeyFile,

AccessDomain: defaultAccessDomain,

TipExpiry: defaultTipExpiry,
Expand All @@ -65,12 +74,13 @@ func initConfig() {
},
}

_, err := flags.Parse(&cfg)
// Ignore unknown flags the first time parsing command line flags to prevent showing the unknown flag error twice
flags.NewParser(&cfg, flags.IgnoreUnknown).Parse()

errFile := flags.IniParse(cfg.ConfigFile, &cfg)

// Parse flags again to override config file
_, err = flags.Parse(&cfg)
_, err := flags.Parse(&cfg)

// Default log level
logLevel := logging.DEBUG
Expand Down Expand Up @@ -118,4 +128,4 @@ func getDefaultLndDir() (dir string) {
}

return dir
}
}
4 changes: 2 additions & 2 deletions frontend/lightningTip.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.lightningTipInput {
width: 100%;
width: 90%;

display: inline-block;

Expand Down Expand Up @@ -151,4 +151,4 @@
100% {
transform: rotate(360deg);
}
}
}
9 changes: 8 additions & 1 deletion lightningtip.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,14 @@ func main() {
log.Info("Starting HTTP server")

go func() {
err = http.ListenAndServe(cfg.RESTHost, nil)
var err error

if cfg.TlsCertFile != "" && cfg.TlsKeyFile != "" {
err = http.ListenAndServeTLS(cfg.RESTHost, cfg.TlsCertFile, cfg.TlsKeyFile, nil)

} else {
err = http.ListenAndServe(cfg.RESTHost, nil)
}

if err != nil {
log.Error("Failed to start HTTP server: " + fmt.Sprint(err))
Expand Down
5 changes: 5 additions & 0 deletions sample-lightningTip.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# This value is used for the HTTP header: "Access-Control-Allow-Origin"
# accessdomain =

# It is possible to use LightningTip over HTTPS instead of HTTP
# If you want to: edit "tlscertfile" and "tlskeyfile" accordingly
# tlscertfile =
# tlskeyfile =

# After how many seconds invoices should expire
# tipexpiry = 3600

Expand Down