From 52ebe4d86a75def089a0b706d2b9d1f445bcd31b Mon Sep 17 00:00:00 2001 From: Fishcake Date: Mon, 24 Apr 2023 17:08:19 +0900 Subject: [PATCH] Fix relay variable name and add bootstrap relays --- .env.example | 2 +- README.md | 2 +- main.go | 16 +++++++++++++--- nostr.go | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index da8a2c8..e162697 100644 --- a/.env.example +++ b/.env.example @@ -11,4 +11,4 @@ NIP05=true GET_NOSTR_PROFILE=false LND_PRIVATE_ONLY=false DB_DIR="./" -OUR_RELAYS="wss://nostr.mutinywallet.com,wss://blastr.f7z.xyz,wss://relay.damus.io/,wss://relay.utxo.one,wss://relay.nostr.ch,wss://eden.nostr.land,wss://nostr.btcmp.com,wss://nostr.relayer.se,wss://relay.current.fyi,wss://nos.lol,wss://nostr.mom,wss://relay.nostr.info,wss://nostr.zebedee.cloud,wss://nostr-pub.wellorder.net,wss://relay.snort.social/,wss://nostr.oxtr.dev/,wss://nostr.fmt.wiz.biz/,wss://brb.io" \ No newline at end of file +RELAYS="wss://nostr.mutinywallet.com,wss://relay.nostrgraph.net,wss://blastr.f7z.xyz,wss://relay.damus.io/,wss://relay.utxo.one,wss://relay.nostr.ch,wss://eden.nostr.land,wss://nostr.btcmp.com,wss://nostr.relayer.se,wss://relay.current.fyi,wss://nos.lol,wss://nostr.mom,wss://relay.nostr.info,wss://nostr.zebedee.cloud,wss://nostr-pub.wellorder.net,wss://relay.snort.social/,wss://nostr.oxtr.dev/,wss://nostr.fmt.wiz.biz/,wss://brb.io" \ No newline at end of file diff --git a/README.md b/README.md index c9a9f14..4d10842 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ New parameters in this fork: > (`DB_DIR`) Specify directory to create or access database -> (`OUR_RELAYS`) Specify comma separate list of relays to push zap notes to, in addition to the zapped user relays. +> (`RELAYS`) Specify comma separate list of relays to push zap notes to, in addition to the zapped user relays. diff --git a/main.go b/main.go index 836e148..79b95ac 100644 --- a/main.go +++ b/main.go @@ -26,7 +26,7 @@ type Settings struct { Port string `envconfig:"PORT" required:"true"` Domain string `envconfig:"DOMAIN" required:"true"` DBDirectory string `envconfig:"DB_DIR" required:"false" default:""` - OURRelayes string `envconfig:"OUR_RELAYS" required:"false" default:""` + Relayes string `envconfig:"RELAYS" 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"` @@ -53,7 +53,7 @@ var ( ) // array of additional relays -var ourRelays []string +var Relays []string //go:embed index.html var indexHTML string @@ -73,7 +73,17 @@ func main() { } // parse our relays - ourRelays = strings.Split(s.OURRelayes, ",") + Relays = strings.Split(s.Relayes, ",") + // Check if relays are not specified and add our bootstrap relays + if len(Relays) == 1 && Relays[0] == "" { + Relays = []string{ + "wss://relay.damus.io", // Main Damus Relay + "wss://nostr.mutinywallet.com", // Special broadcast relay + "wss://relay.nostrgraph.net", // Special broadcast relay + "wss://nos.lol", // Large relay + "wss://relay.snort.social", // Large relay for snort Users + } + } // increase default makeinvoice client timeout because people are using tor makeinvoice.Client = &http.Client{Timeout: 25 * time.Second} diff --git a/nostr.go b/nostr.go index 0b2f95e..8684075 100644 --- a/nostr.go +++ b/nostr.go @@ -197,7 +197,7 @@ func GetNostrProfileMetaData(npub string) (nostr.ProfileMetadata, error) { func publishNostrEvent(ev nostr.Event, relays []string) { // more relays - relays = append(relays, ourRelays...) + relays = append(relays, Relays...) // remove trailing / relays = cleanUrls(relays) // unique relays