mirror of
https://github.com/believethehype/nostdress.git
synced 2026-07-23 22:28:11 -07:00
rebranded to nostdress, option to deactivate registration and notifications
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
module github.com/nbd-wtf/satdress
|
||||
module github.com/believethehype/nostdress
|
||||
|
||||
go 1.19
|
||||
|
||||
|
||||
+16
-7
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Satdress - Federated Lightning Address Server</title>
|
||||
<title>Nostdress - Federated Lightning Address Server with Nostr Support</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" type="image/png" href="https://i.imgur.com/4yaPtA2.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
@@ -13,9 +13,14 @@
|
||||
<link rel="stylesheet" href="/static/style.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<main id="main">
|
||||
|
||||
<div class="title">{{ siteName }}</div>
|
||||
<div class="tagline">Federated Lightning Address Server</div>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
<div class="tagline">Federated Lightning Address Server with Nostr support</div>
|
||||
<div class="owner">
|
||||
<a class="owner-button" :href="siteOwnerURL" target="_blank">
|
||||
Brought to you by <span class="owner-name">{{ siteOwnerName }}</span>
|
||||
@@ -190,7 +195,7 @@
|
||||
id="npub"
|
||||
placeholder="npub123..."
|
||||
/>
|
||||
<div class="field">
|
||||
<div class="field" id="nostrnotifications" v-if="notifynostr == 'true'" >
|
||||
<label style="float: right">
|
||||
Get notifed on Nostr</label>
|
||||
<label style="float: left">
|
||||
@@ -209,10 +214,13 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<button class="submit">Submit</button>
|
||||
</form>
|
||||
<button class="submit" v-if="allowregistration == 'true'" >Submit</button>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="field"> <label style="float: left" v-if="allowregistration == 'false'">
|
||||
Registration has been deactivated by adminsitrator for this domain</label></div>
|
||||
|
||||
</form>
|
||||
<div class="resources">
|
||||
<a
|
||||
class="resource-button"
|
||||
@@ -224,12 +232,13 @@
|
||||
<a
|
||||
class="resource-button"
|
||||
target="_blank"
|
||||
href="https://github.com/fiatjaf/satdress"
|
||||
href="https://github.com/believethehype/nostdress"
|
||||
>
|
||||
Host this server on your domain!
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/3.2.2/vue.global.prod.min.js"></script>
|
||||
<script>
|
||||
const initial = {} // REPLACED WITH SERVER DATA //
|
||||
|
||||
@@ -6,9 +6,10 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"path"
|
||||
|
||||
"github.com/cockroachdb/pebble"
|
||||
"github.com/fiatjaf/makeinvoice"
|
||||
@@ -21,26 +22,26 @@ 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"`
|
||||
DBDirectory string `envconfig:"DB_DIR" required:"false" default:""`
|
||||
Host string `envconfig:"HOST" default:"0.0.0.0"`
|
||||
Port string `envconfig:"PORT" required:"true"`
|
||||
Domain string `envconfig:"DOMAIN" required:"true"`
|
||||
DBDirectory string `envconfig:"DB_DIR" required:"false" default:""`
|
||||
// GlobalUsers means that user@ part is globally unique across all domains
|
||||
// WARNING: if you toggle this existing users won't work anymore for safety reasons!
|
||||
GlobalUsers bool `envconfig:"GLOBAL_USERS" default:"false"`
|
||||
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"`
|
||||
NostrPrivateKey string `envconfig:"NOSTR_PRIVATE_KEY" required:"false" default:""`
|
||||
ForwardMainPageUrl string `envconfig:"FORWARD_URL" required:"false"`
|
||||
Nip05 bool `envconfig:"NIP05" default:"false" required:"false"`
|
||||
GetNostrProfile bool `envconfig:"GET_NOSTR_PROFILE" required:"false" default:"false"`
|
||||
ForceMigrate bool `envconfig:"FORCE_MIGRATE" default:"false"`
|
||||
TorProxyURL string `envconfig:"TOR_PROXY_URL"`
|
||||
NotifyNostrUsersCommentOnly bool `envconfig:"NOTIFY_NOSTR_USERS_COMMENT" required:"false" default:"false"`
|
||||
NotifyNostrUsers bool `envconfig:"NOTIFY_NOSTR_USERS" required:"false" default:"false"`
|
||||
LNDprivateOnly bool `envconfig:"LND_PRIVATE_ONLY" required:"false" default:"false"`
|
||||
GlobalUsers bool `envconfig:"GLOBAL_USERS" default:"false"`
|
||||
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"`
|
||||
NostrPrivateKey string `envconfig:"NOSTR_PRIVATE_KEY" required:"false" default:""`
|
||||
ForwardMainPageUrl string `envconfig:"FORWARD_URL" required:"false"`
|
||||
Nip05 bool `envconfig:"NIP05" default:"false" required:"false"`
|
||||
GetNostrProfile bool `envconfig:"GET_NOSTR_PROFILE" required:"false" default:"false"`
|
||||
ForceMigrate bool `envconfig:"FORCE_MIGRATE" default:"false"`
|
||||
TorProxyURL string `envconfig:"TOR_PROXY_URL"`
|
||||
NotifyNostrUsers bool `envconfig:"NOTIFY_NOSTR_USERS" required:"false" default:"true"`
|
||||
AllowRegistration bool `envconfig:"ALLOW_REGISTRATION" required:"false" default:"true"`
|
||||
LNDprivateOnly bool `envconfig:"LND_PRIVATE_ONLY" required:"false" default:"false"`
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -76,7 +77,7 @@ func main() {
|
||||
makeinvoice.TorProxyURL = s.TorProxyURL
|
||||
}
|
||||
|
||||
dbName := path.Join(s.DBDirectory,fmt.Sprintf("%v-multiple.db", s.SiteName))
|
||||
dbName := path.Join(s.DBDirectory, fmt.Sprintf("%v-multiple.db", s.SiteName))
|
||||
if _, err := os.Stat(dbName); os.IsNotExist(err) || s.ForceMigrate {
|
||||
for _, one := range getDomains(s.Domain) {
|
||||
tryMigrate(one, dbName)
|
||||
@@ -96,7 +97,11 @@ func main() {
|
||||
|
||||
router.Path("/lnaddress").HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
renderHTML(w, indexHTML, map[string]interface{}{})
|
||||
//renderHTML(w, indexHTML, map[string]interface{}{})
|
||||
renderHTML(w, indexHTML, struct {
|
||||
AllowRegistration string `json:"allowregistration"`
|
||||
NotifyNostrUsers string `json:"notifynostr"`
|
||||
}{strconv.FormatBool(s.AllowRegistration), strconv.FormatBool(s.NotifyNostrUsers)})
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user