Fix magnet decoding and accept legacy notes

This commit is contained in:
thePR0M3TH3AN committed 2025-09-24 11:26:46 -04:00
1 parent fc0bae85af
commit 0d622bdb8d
3 files changed
+21 -4

No files matched your search

+3 -2
View File
@@ -716,7 +716,7 @@ class bitvidApp {
return decodeURIComponent(value);
} catch (err) {
console.warn("Failed to decode data attribute:", err);
return "";
return value;
}
};
@@ -724,7 +724,8 @@ class bitvidApp {
const encodedMagnet = trigger.getAttribute("data-play-magnet") || "";
const url = decodeDataValue(encodedUrl);
const magnet = decodeDataValue(encodedMagnet);
const rawMagnet = decodeDataValue(encodedMagnet);
const magnet = safeDecodeMagnet(rawMagnet) || rawMagnet;
const eventId = trigger.getAttribute("data-video-id");
if (eventId) {
+9 -1
View File
@@ -490,7 +490,15 @@ function localConvertEventToVideo(event) {
const trimmedMagnet = typeof magnet === "string" ? magnet.trim() : "";
const trimmedInfoHash = typeof infoHash === "string" ? infoHash.trim() : "";
const playbackMagnet = trimmedMagnet || trimmedInfoHash;
const numericVersion = Number.isFinite(version) ? version : 0;
const parsedVersion =
typeof version === "number"
? version
: typeof version === "string"
? Number.parseInt(version, 10)
: Number.NaN;
const numericVersion = Number.isFinite(parsedVersion)
? parsedVersion
: 0;
const hasPlayableSource = Boolean(trimmedUrl) || Boolean(playbackMagnet);
if (!hasPlayableSource) {
+9 -1
View File
@@ -518,7 +518,15 @@ class SubscriptionsManager {
const trimmedMagnet = typeof magnet === "string" ? magnet.trim() : "";
const trimmedInfoHash = typeof infoHash === "string" ? infoHash.trim() : "";
const playbackMagnet = trimmedMagnet || trimmedInfoHash;
const numericVersion = Number.isFinite(version) ? version : 0;
const parsedVersion =
typeof version === "number"
? version
: typeof version === "string"
? Number.parseInt(version, 10)
: Number.NaN;
const numericVersion = Number.isFinite(parsedVersion)
? parsedVersion
: 0;
const hasPlayableSource = Boolean(trimmedUrl) || Boolean(playbackMagnet);
if (!hasPlayableSource) {