seed default channel(s) on boot
fresh relay seeds configured open channels (RELAY_DEFAULT_CHANNELS, default general) so a client always has a room. relay-signed 9007 through the normal pipeline; idempotent; never reopens a closed group. also adds mission/roadmap and separation rationale to the readme.
This commit is contained in:
@@ -5,10 +5,27 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"fiatjaf.com/nostr"
|
||||
)
|
||||
|
||||
// parseChannels splits a comma-separated channel list into cleaned group ids: a
|
||||
// leading `#` is tolerated and blanks/dupes are dropped. Order is preserved.
|
||||
func parseChannels(s string) []string {
|
||||
var out []string
|
||||
seen := map[string]bool{}
|
||||
for _, part := range strings.Split(s, ",") {
|
||||
id := strings.TrimPrefix(strings.TrimSpace(part), "#")
|
||||
if id == "" || seen[id] {
|
||||
continue
|
||||
}
|
||||
seen[id] = true
|
||||
out = append(out, id)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func envOr(key, fallback string) string {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
return v
|
||||
|
||||
Reference in New Issue
Block a user