Skip to main content

Module blossom_servers

Module blossom_servers 

Source
Expand description

BUD-03 user blossom server list (kind 10063) — store, merge, publish, fetch.

Two SQL settings rows back the user’s preferences:

  • custom_blossom_serversVec<CustomBlossomServer> JSON
  • disabled_default_blossom_serversVec<String> JSON

Resolution order (BUD-03 trust order): enabled defaults, then enabled customs.

Structs§

BlossomServerInfo
One row in the frontend’s Media Servers list.
CustomBlossomServer

Constants§

DEFAULT_BLOSSOM_SERVERS
Default servers in trust order (first = first try). All verified to accept Vector’s encrypted octet-stream uploads at common sizes.

Functions§

compute_enabled_servers
fetch_and_merge_own_list
Fetch our latest kind 10063 and reconcile: append unknown customs, follow the originating device’s default enable/disable choices. session gates writes against a mid-fetch account swap.
is_default_server
is_enabled_server
Race-guard for in-flight probes: true if url is in the currently enabled list at this moment.
list_all_servers
All rows for the frontend (defaults then customs, including disabled).
load_custom_blossom_servers
load_disabled_default_blossom_servers
merge_urls_into_customs
Pure merge: append novel URLs from incoming (validated, normalized) into customs as enabled. Existing rows are never removed or reordered.
publish_blossom_servers
Publish the resolved enabled list (defaults + customs, in trust order) as a BUD-03 kind 10063 replaceable event. Peers using our list as a fallback need to see every server we use, not just the customs.
refresh_cache
Refresh the in-memory BLOSSOM_SERVERS cache. Call after edits + on login.
republish_blossom_servers_debounced
Debounced republish: rapid edits coalesce; mid-window session swap aborts. Retries once on failure (5s backoff): a stale event on the network would otherwise let fetch_and_merge_own_list overwrite the local prefs on the next boot.
save_custom_blossom_servers
save_disabled_default_blossom_servers
validate_url
Validate + canonicalize a server URL: trim, strip trailing slash, auto-prefix https:// on bare domains, enforce http(s) + non-empty host.