From 004c6426a84a4fb35b611a4c4f3d4b0c2a6d4bfe Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 8 Oct 2025 09:31:33 -0400 Subject: [PATCH] Stop obfuscating private magnets --- js/app.js | 10 ---------- js/channelProfile.js | 16 ---------------- js/nostr.js | 34 ++++++++------------------------- js/ui/components/RevertModal.js | 2 +- js/utils/fakeDecrypt.js | 13 ------------- 5 files changed, 9 insertions(+), 66 deletions(-) delete mode 100644 js/utils/fakeDecrypt.js diff --git a/js/app.js b/js/app.js index 6198c217..4ed69712 100644 --- a/js/app.js +++ b/js/app.js @@ -71,7 +71,6 @@ import ProfileModalController from "./ui/profileModalController.js"; import ZapController from "./ui/zapController.js"; import { MediaLoader } from "./utils/mediaLoader.js"; import { pointerArrayToKey } from "./utils/pointer.js"; -import { fakeDecrypt } from "./utils/fakeDecrypt.js"; import { isValidMagnetUri } from "./utils/magnetValidators.js"; import { dedupeToNewestByRoot } from "./utils/videoDeduper.js"; import { @@ -6199,15 +6198,6 @@ class Application { return; } - if ( - video.isPrivate && - video.pubkey === this.pubkey && - !video.alreadyDecrypted - ) { - video.magnet = fakeDecrypt(video.magnet); - video.alreadyDecrypted = true; - } - let trimmedUrl = typeof video.url === "string" ? video.url.trim() : ""; if (!trimmedUrl && fallbackUrl) { trimmedUrl = fallbackUrl; diff --git a/js/channelProfile.js b/js/channelProfile.js index 04f8b7b2..60480634 100644 --- a/js/channelProfile.js +++ b/js/channelProfile.js @@ -1769,15 +1769,6 @@ function renderChannelVideosFromList({ }; videos.forEach((video, index) => { - if ( - video.isPrivate && - video.pubkey === nostrClient.pubkey && - !video.alreadyDecrypted - ) { - video.magnet = fakeDecrypt(video.magnet); - video.alreadyDecrypted = true; - } - app?.videosMap?.set(video.id, video); const canEdit = video.pubkey === app?.pubkey; @@ -2281,13 +2272,6 @@ window.addEventListener("bitvid:access-control-updated", () => { }); }); -/** - * Minimal placeholder for private video decryption. - */ -function fakeDecrypt(str) { - return str.split("").reverse().join(""); -} - /** * Keep only the newest version of each video root. */ diff --git a/js/nostr.js b/js/nostr.js index ad4386a5..83623de7 100644 --- a/js/nostr.js +++ b/js/nostr.js @@ -1689,17 +1689,6 @@ function cloneEventForCache(event) { return cloned; } -/** - * Example "encryption" that just reverses strings. - * In real usage, replace with actual crypto. - */ -function fakeEncrypt(magnet) { - return magnet.split("").reverse().join(""); -} -function fakeDecrypt(encrypted) { - return encrypted.split("").reverse().join(""); -} - function decodeNpubToHex(npub) { if (typeof npub !== "string" || !npub.trim()) { return ""; @@ -4827,10 +4816,7 @@ class NostrClient { } const rawMagnet = typeof videoData.magnet === "string" ? videoData.magnet : ""; - let finalMagnet = rawMagnet.trim(); - if (videoData.isPrivate && finalMagnet) { - finalMagnet = fakeEncrypt(finalMagnet); - } + const finalMagnet = rawMagnet.trim(); const finalUrl = typeof videoData.url === "string" ? videoData.url.trim() : ""; const finalThumbnail = @@ -5052,12 +5038,12 @@ class NostrClient { throw new Error("You do not own this video (pubkey mismatch)."); } - // Decrypt the old magnet if the note is private - let oldPlainMagnet = baseEvent.magnet || ""; - if (baseEvent.isPrivate && oldPlainMagnet) { - oldPlainMagnet = fakeDecrypt(oldPlainMagnet); - } - + const oldMagnet = + typeof baseEvent.rawMagnet === "string" && baseEvent.rawMagnet.trim() + ? baseEvent.rawMagnet.trim() + : typeof baseEvent.magnet === "string" + ? baseEvent.magnet.trim() + : ""; const oldUrl = baseEvent.url || ""; // Determine if the updated note should be private @@ -5067,11 +5053,7 @@ class NostrClient { const magnetEdited = updatedData.magnetEdited === true; const newMagnetValue = typeof updatedData.magnet === "string" ? updatedData.magnet.trim() : ""; - let finalPlainMagnet = magnetEdited ? newMagnetValue : oldPlainMagnet; - let finalMagnet = - wantPrivate && finalPlainMagnet - ? fakeEncrypt(finalPlainMagnet) - : finalPlainMagnet; + const finalMagnet = magnetEdited ? newMagnetValue : oldMagnet; const urlEdited = updatedData.urlEdited === true; const newUrlValue = diff --git a/js/ui/components/RevertModal.js b/js/ui/components/RevertModal.js index 4de7e350..c434e1e1 100644 --- a/js/ui/components/RevertModal.js +++ b/js/ui/components/RevertModal.js @@ -562,7 +562,7 @@ export class RevertModal { ? escape(this.truncateMiddle(displayMagnet, 72)) : escape(displayMagnet); const caption = isPrivate - ? 'Encrypted magnet (only decrypted locally for the owner).' + ? 'Magnet stays visible only to you — private notes keep the raw string local.' : ""; magnetHtml = `
${label}${caption}
`; } diff --git a/js/utils/fakeDecrypt.js b/js/utils/fakeDecrypt.js deleted file mode 100644 index 656170c8..00000000 --- a/js/utils/fakeDecrypt.js +++ /dev/null @@ -1,13 +0,0 @@ -// js/utils/fakeDecrypt.js - -/** - * Simple "decryption" placeholder for private videos. - */ -export function fakeDecrypt(str) { - if (typeof str !== "string") { - return ""; - } - return str.split("").reverse().join(""); -} - -export default fakeDecrypt;