From 39083f3ca2f80c7c51fefffb1e473f3d0a7d4ed6 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 18 Oct 2026 08:59:03 -0700 Subject: Allow custom Blossom servers for attachments and post media --- src/media-upload.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/media-upload.js') diff --git a/src/media-upload.js b/src/media-upload.js index e45d2fe..d7a99e1 100644 --- a/src/media-upload.js +++ b/src/media-upload.js @@ -1,3 +1,4 @@ +import { mediaServers } from './media-servers.js'; import { sha256 } from '@noble/hashes/sha256'; import { bytesToHex } from '@noble/hashes/utils'; @@ -65,7 +66,7 @@ function putWithProgress(url, { body, headers, signal }, onProgress) { // BUD-02 upload. `signEvent` is deliberately injected: the app can use its // always-available wallet identity, while tests need no secret key. export async function uploadPublicMedia(file, signEvent, { - servers = PUBLIC_MEDIA_SERVERS, + servers = mediaServers(PUBLIC_MEDIA_SERVERS), fetcher = globalThis.fetch, timeoutMs = 5 * 60_000, onProgress = null, // (fraction 0..1) as the bytes go out @@ -132,7 +133,7 @@ export function rewritePlaylist(text, urls) { return line.replace(/URI="([^"]+)"/g, (m, p) => `URI="${to(p)}"`); }).join('\n'); } -export async function uploadStream({ files, master }, signEvent, { servers = STREAM_SERVERS, fetcher, onProgress = null } = {}) { +export async function uploadStream({ files, master }, signEvent, { servers = mediaServers(STREAM_SERVERS), fetcher, onProgress = null } = {}) { const media = [...files.keys()].filter((p) => !/\.m3u8$/.test(p)); const lists = [...files.keys()].filter((p) => /\.m3u8$/.test(p) && p !== master); const total = [...files.values()].reduce((n, f) => n + f.size, 0) || 1; -- cgit v1.2.3