diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..a97a245 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,8 @@ +Copyright © 2021 fiatjaf + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..03cc3a0 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Satdress + +Federated Lightning Address Server + +## Instructions diff --git a/index.html b/index.html index 84a3fa7..f75a9de 100644 --- a/index.html +++ b/index.html @@ -1,113 +1,263 @@ - + + + + Satdress - Federated Lightning Address Server + + + + + + + + + + +
+
Satdress
+
Federated Lightning Address Server
+
+
Use the form below to connect your own node to a Lightning Address.
+
+ + +
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ + Lightning Address Documentation + + Brought to you by {{ siteOwnerName }} + You can host this server on your domain +
+
+ + + + diff --git a/main.go b/main.go index f77d40a..23f0b41 100644 --- a/main.go +++ b/main.go @@ -9,6 +9,7 @@ import ( "fmt" "net/http" "os" + "strings" "time" "github.com/cockroachdb/pebble" @@ -19,11 +20,13 @@ import ( ) type Settings struct { - Host string `envconfig:"HOST" default:"0.0.0.0"` - Port string `envconfig:"PORT" required:"true"` - Domain string `envconfig:"DOMAIN" required:"true"` - Secret string `envconfig:"SECRET" required:"true"` - SiteOwner string `envconfig:"SITE_OWNER" required:"true"` + Host string `envconfig:"HOST" default:"0.0.0.0"` + Port string `envconfig:"PORT" required:"true"` + Domain string `envconfig:"DOMAIN" required:"true"` + Secret string `envconfig:"SECRET" required:"true"` + SiteOwnerName string `envconfig:"SITE_OWNER_NAME" required:"true"` + SiteOwnerURL string `envconfig:"SITE_OWNER_URL" required:"true"` + SiteName string `envconfig:"SITE_NAME" required:"true"` } var s Settings @@ -51,7 +54,25 @@ func main() { router.Path("/").HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.Header().Set("content-type", "text/html") - fmt.Fprintf(w, html+"

offered by %s

", s.SiteOwner) + serverData, _ := json.Marshal(struct { + Domain string `json:"domain"` + SiteOwnerName string `json:"siteOwnerName"` + SiteOwnerURL string `json:"siteOwnerURL"` + SiteName string `json:"siteName"` + }{ + Domain: s.Domain, + SiteOwnerName: s.SiteOwnerName, + SiteOwnerURL: s.SiteOwnerURL, + SiteName: s.SiteName, + }) + fmt.Fprintf(w, + strings.ReplaceAll( + strings.ReplaceAll( + html, "{} // REPLACED WITH SERVER DATA", string(serverData), + ), + "Satdress", s.SiteName, + ), + ) }, )