aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-30 18:03:33 +0000
committerAdam Soltys <[email protected]>2026-09-30 18:03:33 +0000
commit95eaf11d116260b101c81346ba41810aacf49a7d (patch)
tree299312129da5aea63b1827ba049e787d92fb8723
parent573cfcc8d57ca568be66afd19c06bcd758be6073 (diff)
downloadcoinosv3-95eaf11d116260b101c81346ba41810aacf49a7d.tar.gz
coinosv3-95eaf11d116260b101c81346ba41810aacf49a7d.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_01WMMwWYJkPQxLgfMsY7hWcU
-rw-r--r--src/features/messages.js5
1 files changed, 3 insertions, 2 deletions
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;