From 017eb03c482e355c2cb0d2ffa11b6222989d0a86 Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Mon, 19 Feb 2024 16:29:59 +0800 Subject: [PATCH 1/2] ! Fix URL copied via right click menu - Invalid URL when copying IV video - URL with user playlist ID --- src/main/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index 2f8944c88df09..52e27df5a75d5 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -103,17 +103,17 @@ function runApp() { let url if (toYouTube) { - url = `https://youtu.be/${id}` + url = new URL(`https://youtu.be/${id}`) } else { - url = `https://redirect.invidious.io/watch?v=${id}` + url = new URL(`https://redirect.invidious.io/watch?v=${id}`) } if (query) { const params = new URLSearchParams(query) - const newParams = new URLSearchParams() + const newParams = new URLSearchParams(url.search) let hasParams = false - if (params.has('playlistId')) { + if (params.has('playlistId') && params.get('playlistType') !== 'user') { newParams.set('list', params.get('playlistId')) hasParams = true } @@ -124,11 +124,11 @@ function runApp() { } if (hasParams) { - url += '?' + newParams.toString() + url.search = newParams.toString() } } - return url + return url.toString() } } } From 8d6a128d12ada2c4dcfe58f0bfca921309fd2a96 Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Fri, 23 Feb 2024 07:11:42 +0800 Subject: [PATCH 2/2] * Make copy link entry in right click menu to only show for non user playlists --- src/main/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/index.js b/src/main/index.js index 52e27df5a75d5..f9c8fd7a901d5 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -64,7 +64,9 @@ function runApp() { const path = urlParts[1] if (path) { - visible = ['/playlist', '/channel', '/watch'].some(p => path.startsWith(p)) + visible = ['/channel', '/watch'].some(p => path.startsWith(p)) || + // Only show copy link entry for non user playlists + (path.startsWith('/playlist') && !/playlistType=user/.test(path)) } } else { visible = true