diff --git a/.env.example b/.env.example index b5f8b1e..2638944 100644 --- a/.env.example +++ b/.env.example @@ -3,6 +3,8 @@ RELAY_NAME="utxo WoT relay" RELAY_PUBKEY="e2ccf7cf20403f3f2a4a55b328f0de3be38558a7d5f33632fdaaefc726c1c8eb" # not your npub! RELAY_DESCRIPTION="Only notes in utxo WoT" RELAY_URL="wss://wot.utxo.one" +RELAY_ICON="https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg" +RELAY_CONTACT="https://utxo.one" # where we should store the database DB_PATH="db" @@ -18,4 +20,4 @@ REFRESH_INTERVAL_HOURS=1 MINIMUM_FOLLOWERS=5 # archive all notes from everyone in your WoT from other relays -ARCHIVAL_SYNC="FALSE" \ No newline at end of file +ARCHIVAL_SYNC="FALSE" diff --git a/README.md b/README.md index b68f9a0..f983c79 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ ARCHIVAL_SYNC="FALSE" # set to TRUE to archive every note from every person in t Run the following command to build the relay: ```bash -go build +go build -ldflags "-X main.version=$(git describe --tags --always)" ``` ### 5. Create a Systemd Service (optional) diff --git a/main.go b/main.go index 5d7b5ce..4834636 100644 --- a/main.go +++ b/main.go @@ -18,6 +18,10 @@ import ( "github.com/nbd-wtf/go-nostr" ) +var ( + version string +) + type Config struct { RelayName string RelayPubkey string @@ -29,6 +33,8 @@ type Config struct { RefreshInterval int MinimumFollowers int ArchivalSync bool + RelayContact string + RelayIcon string } var pool *nostr.SimplePool @@ -73,7 +79,12 @@ func main() { relay.Info.Name = config.RelayName relay.Info.PubKey = config.RelayPubkey + relay.Info.Icon = config.RelayIcon + relay.Info.Contact = config.RelayContact relay.Info.Description = config.RelayDescription + relay.Info.Software = "WoT Relay" + relay.Info.Version = version + appendPubkey(config.RelayPubkey) db := getDB() @@ -183,6 +194,8 @@ func LoadConfig() Config { RelayName: getEnv("RELAY_NAME"), RelayPubkey: getEnv("RELAY_PUBKEY"), RelayDescription: getEnv("RELAY_DESCRIPTION"), + RelayContact: getEnv("RELAY_CONTACT"), + RelayIcon: getEnv("RELAY_ICON"), DBPath: getEnv("DB_PATH"), RelayURL: getEnv("RELAY_URL"), IndexPath: getEnv("INDEX_PATH"),