Repository navigation
Read the Blossom server list published to relays - #92
Open
dadofsambonzuki wants to merge 1 commit into
Open
dadofsambonzuki wants to merge 1 commit into
dadofsambonzuki wants to merge 1 commit into
Conversation
Uploads now use the first server from the account's kind 10063 list (BUD-03) when no server is saved in Settings, and fall back to the built-in default when no list is published. The list is read when the session's subscriptions start, kept live while the app runs, restarted on session resume or relay-list change, and cleared on logout.
This was referenced Oct 14, 2026
Author
|
Following this up with #93, which adds NIP-B7's other half: when a stored media link is dead, the file is looked for on the author's published servers and shown only if the bytes match the hash. Stacking, since #93 needs the parser this PR introduces:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What happens today
Every upload uses one value: the encrypted app preference saved in Settings → Media & data storage, otherwise the built-in
https://blossom.nostr.build. Nothing reads a published server list (grep -rn 10063 src/is empty), so a user whose other clients already publish their Blossom servers to relays still uploads to whichever server Anagram happens to ship with, and the list they maintain elsewhere is ignored.The change
NostrKind.BlossomServerList(10063, BUD-03 / NIP-B7) in the nostr-tools adapter.src/utils/blossomServerList.tsturns aservertag list into ordered, de-duplicated HTTPS origins, reusing the existing normaliser (dropshttp:, upload paths, credentials).src/stores/nostr/blossomServerListRuntime.tsreads{kinds:[10063], authors:[me], limit:1}from the account's read relays, shaped like the existingmyRelayListRuntime: the list is replaceable, so only the newest snapshot is kept, a later list replaces the cached one while the app runs, and the cache is dropped on logout or account switch.getBlossomServerOrigin()reports which of the three it was, and Settings shows a short caption when the value comes from the published list. Restore default keeps its meaning (stop overriding) and is disabled when there is no override to drop.restartSessionSubscriptions(session resume, relay-list change), and live in between. Deliberately not a startup step — it only decides future uploads, so a slow or empty relay response neither delays startup nor fails a step; the saved setting and the default already cover the gap.blossomServerListVersioncounter means the Settings field follows the list while the screen is open.Deliberate limits
Verified
Unit tests (new): the parser keeps published order and drops duplicates, non-HTTPS and non-origin values; the runtime subscribes with a
limit: 1filter for the logged-in account, keeps the newest list when an older one arrives late, keeps a replacement published in the same second as the list it replaces, notifies listeners only when the list changes, ignores another author or kind, drops the cache when the account changes, and forgets everything on reset; the settings runtime uses the first published server when nothing is saved, lets the saved setting win, and falls through to the default when the list is unusable or missing; startup reads the list and stays successful when that read fails.e2e/blossom-server-list.spec.tspublishes a real signed kind 10063 to the test relay the way another client would and asserts the whole path in a browser: default → live update without a reload → newest list wins → still read after a restart → a saved setting wins → restore default hands the choice back to the list, with the caption appearing and disappearing as the source changes. On the current code it fails at the first step (uploads keep going to the default). I added it to the browser list in.github/workflows/ci.yml; drop that line if you would rather keep the CI browser set as it is.Ran locally:
npm run quality:all(0 errors),npm run test:unit(140 files, 1107 tests),npm run build,npm run verify:iroh, andnpx playwright test e2e/blossom-server-list.spec.ts e2e/settings-parity.spec.ts e2e/parity/session.spec.ts— 13 passed. The pre-existingnpx prettier --checkcomplaints innostrStore.svelte.ts,client.ts,authSessionRuntime.tsandstartupContactSyncRuntime.spec.tsare the repo's, not from this change; my own files and hunks are clean.One new UI string,
mediaDataStorage.serverUrlFromPublishedList:tests/unit/translation-catalogs.spec.tsrequires every catalog to carry every key, so it is added to all of them, with English only inen-US.jsonand untranslated English text in the other 19 for translators to replace.Note for review: open PR #82 rewrites the internals of
createBlossomSettingsRuntime. This change adds one dependency and the resolution to that function, so the two should be a small conflict rather than a design clash; #82 also adds a second server preference (for encrypted private media) that I have deliberately not touched.