mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 12:52:26 +00:00
feat(webseed): upload form accepts multiple web seeds (slice 2/3)
Let uploaders declare a backup origin at creation time so the swarm can keep streaming when the primary CDN is overloaded. - upload-modal.html: the single "Web Seed (ws)" input becomes a "Web seeds (one per line)" textarea with help text explaining the backup-origin use case and the byte-identical-file requirement. - UploadModal: in upload mode the R2/CDN url stays the primary webseed and any textarea entries follow it (passed as [primaryUrl, textarea]); external mode already flowed the field through. All parsing stays in the payload layer. - videoNotePayload.normalizeWebSeedList now splits every entry (array OR string) on newlines/commas, so the upload-modal's [url, "a\nb"] shape and a plain multi-line string both expand + dedupe correctly. Mutation-verified (array entries no longer split fails the upload-shape test); build + full unit suite green. Lints relevant to the change (inline-styles, tokens, innerHTML) pass. Note: npm run lint also reports pre-existing file-size violations in unrelated files (SignerManager, watchHistory, playbackService, webtorrent, etc.) that grew in earlier commits — none are touched here. Flagging separately. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
cf98d06cca
commit
ce7ef9ef2d
4 files changed
+44
-13
No files matched your search
@@ -81,6 +81,25 @@ test("a single webseed string still works (back-compat)", () => {
|
||||
assert.equal(payload.legacyFormData.ws, SEED_A);
|
||||
});
|
||||
|
||||
test("upload-modal shape ([primaryUrl, textarea]) yields primary-first, all split", () => {
|
||||
// This mirrors exactly what UploadModal hands over in upload mode: the CDN
|
||||
// url as the primary entry, followed by the raw multi-line textarea value.
|
||||
const cdn = "https://cdn.example.com/video.mp4";
|
||||
const { payload } = normalizeVideoNotePayload({
|
||||
title: "Upload shape",
|
||||
url: cdn,
|
||||
magnet: MAGNET,
|
||||
ws: [cdn, `${SEED_A}\n${SEED_B}`],
|
||||
});
|
||||
|
||||
const seeds = extractAllWebSeeds(payload.legacyFormData.magnet);
|
||||
assert.ok(seeds.includes(cdn), "CDN url carried");
|
||||
assert.ok(seeds.includes(SEED_A), "first backup webseed carried");
|
||||
assert.ok(seeds.includes(SEED_B), "second backup webseed carried");
|
||||
// CDN stays the primary (first) seed.
|
||||
assert.equal(payload.legacyFormData.ws, cdn);
|
||||
});
|
||||
|
||||
test("duplicate webseeds are not written twice", () => {
|
||||
const { payload } = normalizeVideoNotePayload({
|
||||
title: "Dupe seed",
|
||||
|
||||
Reference in new issue
Block a user