From 83e8250dc11524db4cdb2313342d7844e37c82e9 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sat, 28 Sep 2024 15:48:07 +0200 Subject: [PATCH] Support copying post links from the context menu --- src/main/index.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/index.js b/src/main/index.js index c9c38fe39368c..92ce4f9ae01cc 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -87,7 +87,7 @@ function runApp() { const path = urlParts[1] if (path) { - visible = ['/channel', '/watch', '/hashtag'].some(p => path.startsWith(p)) || + visible = ['/channel', '/watch', '/hashtag', '/post'].some(p => path.startsWith(p)) || // Only show copy link entry for non user playlists (path.startsWith('/playlist') && !/playlistType=user/.test(path)) } @@ -157,6 +157,21 @@ function runApp() { return url.toString() } + case 'post': { + if (query) { + const authorId = new URLSearchParams(query).get('authorId') + + if (authorId) { + if (toYouTube) { + return `${origin}/channel/${authorId}/community?lb=${id}` + } else { + return `${origin}/post/${id}?ucid=${authorId}` + } + } + } + + return `${origin}/post/${id}` + } } }