docs: document magnet normalization behavior

This commit is contained in:
thePR0M3TH3AN committed 2025-09-24 15:20:40 -04:00
1 parent d3f42b6eb3
commit 0d56082c54
1 file changed
+15
+15
View File
@@ -81,6 +81,21 @@ export function safeDecodeMagnet(value) {
return decoded;
}
/**
* Normalize a magnet URI while preserving legacy payload quirks and augmenting it
* for browser playback.
*
* Key behaviors:
* - Accepts bare info-hash strings and promotes them to full `magnet:?xt=urn:btih:` links.
* - Leaves the existing `xt` payload untouched—no percent re-encoding or normalization
* beyond decoding legacy `%3A` segments.
* - Only appends browser-safe WSS trackers in addition to whatever the caller provides.
* - Skips insecure `http:` web seeds unless the application itself is running over HTTP.
*
* Note: `didChange` may be reported even if the resulting magnet string is textually
* identical to the input. Callers should not rely on `didChange` to detect a modified
* URI.
*/
export function normalizeAndAugmentMagnet(
rawValue,
{