mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 00:16:59 +00:00
fix(blossom): mirror and blob-manager use only the user's configured servers
Both the mirror-on-upload fan-out and the blob-manager matrix read the raw kind-10063 list (BlossomServerListState.flow) instead of hostNameFlow, which injects the 10 public DEFAULT_MEDIA_SERVERS when the user has none set. This avoids fanning uploads out to — and listing/HEAD-probing across — public servers the user never opted into. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ckbnz1N94W1hnNC9xpsCNP
This commit is contained in:
+5
-3
@@ -263,11 +263,13 @@ class UploadOrchestrator {
|
||||
val hash = result.sha256 ?: sourceUrl.substringAfterLast('/').substringBefore('.')
|
||||
if (hash.length != 64) return
|
||||
|
||||
// Only the user's *explicitly configured* kind-10063 servers (flow), NOT the
|
||||
// DEFAULT_MEDIA_SERVERS fallback that hostNameFlow injects — we must never fan
|
||||
// uploads out to public defaults the user never opted into.
|
||||
val primaryDomain = BlossomServerUrl.domain(primaryServerBaseUrl)
|
||||
val targets =
|
||||
account.blossomServers.hostNameFlow.value
|
||||
.filter { it.type == ServerType.Blossom && BlossomServerUrl.domain(it.baseUrl) != primaryDomain }
|
||||
.map { it.baseUrl }
|
||||
account.blossomServers.flow.value
|
||||
.filter { BlossomServerUrl.domain(it) != primaryDomain }
|
||||
.distinct()
|
||||
|
||||
if (targets.isEmpty()) return
|
||||
|
||||
+4
-3
@@ -80,10 +80,11 @@ class BlossomBlobManagerViewModel : ViewModel() {
|
||||
|
||||
private fun clientFor(server: String) = BlossomClient(Amethyst.instance.roleBasedHttpClientBuilder.okHttpClientForUploads(server))
|
||||
|
||||
// The user's explicitly configured kind-10063 servers (empty if they never set
|
||||
// a list) — not the DEFAULT_MEDIA_SERVERS fallback, so the matrix reflects the
|
||||
// servers the user actually chose.
|
||||
private fun servers(): List<String> =
|
||||
account.blossomServers.hostNameFlow.value
|
||||
.filter { it.type == ServerType.Blossom }
|
||||
.map { it.baseUrl }
|
||||
account.blossomServers.flow.value
|
||||
.distinct()
|
||||
|
||||
fun refresh() {
|
||||
|
||||
Reference in New Issue
Block a user