diff options
| author | Adam Soltys <[email protected]> | 2026-10-18 08:59:03 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-18 08:59:03 -0700 |
| commit | 39083f3ca2f80c7c51fefffb1e473f3d0a7d4ed6 (patch) | |
| tree | 712f0dd93ef0f10df1439b1ac43dd865802e17e8 /src/media-upload.js | |
| parent | 98d90827cbf581c4322232063b4f785f97bcb45b (diff) | |
| download | coinosv3-39083f3ca2f80c7c51fefffb1e473f3d0a7d4ed6.tar.gz coinosv3-39083f3ca2f80c7c51fefffb1e473f3d0a7d4ed6.zip | |
Allow custom Blossom servers for attachments and post media
Diffstat (limited to 'src/media-upload.js')
| -rw-r--r-- | src/media-upload.js | 5 |
1 files changed, 3 insertions, 2 deletions
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; |
