From 95eaf11d116260b101c81346ba41810aacf49a7d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 30 Sep 2026 18:03:33 +0000 Subject: Encrypted chat pictures get blossom.yakihonne.com as a third host; a small file stops at two copies. Benchmarked 18 public Blossom hosts: only ditto, nostr.download and yakihonne take opaque (application/octet-stream) blobs, which is what an encrypted attachment is. ditto is fastest; yakihonne is slow, so it is reached only when one of the first two fails. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WMMwWYJkPQxLgfMsY7hWcU --- src/features/messages.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/features/messages.js b/src/features/messages.js index fb2986f..f00a52b 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -5417,7 +5417,7 @@ export function messagesFeature(ctx) { // blob, the key riding inside the (already encrypted) message. The media // host never sees a picture. coinos's own Blossom server stores only sync // envelopes, so these go to public hosts that take anonymous blobs. - const MEDIA_SERVERS = ['https://blossom.ditto.pub', 'https://nostr.download']; + const MEDIA_SERVERS = ['https://blossom.ditto.pub', 'https://nostr.download', 'https://blossom.yakihonne.com']; const MEDIA_MAX = 20 * 1024 * 1024; async function encryptFile(file) { if (file.size > MEDIA_MAX) throw new Error(t('msgAttachTooBig')); @@ -5453,7 +5453,8 @@ export function messagesFeature(ctx) { const j = await r.json(); if (j && j.url) urls.push(j.url); } catch {} - if (urls.length && enc.cipher.length > 4 * 1024 * 1024) break; // one copy is enough for a big file + // one copy is enough for a big file, two for a small one — later hosts are fallbacks + if (urls.length >= (enc.cipher.length > 4 * 1024 * 1024 ? 1 : 2)) break; } if (!urls.length) throw new Error(t('msgUploadFailed')); return urls; -- cgit v1.2.3