Files
bitvid/js/magnet.js
2025-09-24 17:08:36 -04:00

20 lines
643 B
JavaScript

import { WSS_TRACKERS } from "./constants.js";
import { normalizeAndAugmentMagnet as normalizeLegacy } from "./magnetUtils.js";
export function normalizeAndAugmentMagnet(rawValue, { ws = "", xs = "" } = {}) {
const trimmedInput = typeof rawValue === "string" ? rawValue.trim() : "";
const trimmedWs = typeof ws === "string" ? ws.trim() : "";
const trimmedXs = typeof xs === "string" ? xs.trim() : "";
const webSeeds = trimmedWs ? [trimmedWs] : [];
const result = normalizeLegacy(trimmedInput, {
webSeed: webSeeds,
torrentUrl: trimmedXs,
xs: trimmedXs,
extraTrackers: WSS_TRACKERS,
});
return result.magnet;
}