From f7e5a88dad8df6a08d413d80678a849f61396f99 Mon Sep 17 00:00:00 2001 From: unlxam <177877261+unlxam@users.noreply.github.com> Date: Sat, 10 Aug 2024 12:40:59 -0300 Subject: [PATCH] feat: update youtube.com links to confirm before leaving --- src/invidious/frontend/comments_youtube.cr | 6 +++++- src/invidious/views/watch.ecr | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/invidious/frontend/comments_youtube.cr b/src/invidious/frontend/comments_youtube.cr index a0e1d783..93edffdc 100644 --- a/src/invidious/frontend/comments_youtube.cr +++ b/src/invidious/frontend/comments_youtube.cr @@ -1,3 +1,5 @@ +require "uri" + module Invidious::Frontend::Comments extend self @@ -148,8 +150,10 @@ module Invidious::Frontend::Comments END_HTML if comments["videoId"]? + permalink = "https://www.youtube.com/watch?v=#{comments["videoId"]}&lc=#{child["commentId"]}" + permalink_confirm = "/confirm_leave?link=#{URI.encode_path(permalink)}" html << <<-END_HTML - [YT] + [YT] | END_HTML elsif comments["authorId"]? diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 45c58a16..1753a331 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -122,9 +122,12 @@ we're going to need to do it here in order to allow for translations. link_yt_watch = IV::HttpServer::Utils.add_params_to_url(link_yt_watch, link_yt_param) link_yt_embed = IV::HttpServer::Utils.add_params_to_url(link_yt_embed, link_yt_param) end + + confirm_yt_watch = "/confirm_leave?link=#{URI.encode_path(link_yt_watch.to_s)}" + confirm_yt_embed = "/confirm_leave?link=#{URI.encode_path(link_yt_embed.to_s)}" -%> - <%= translate(locale, "videoinfo_watch_on_youTube") %> - (<%= translate(locale, "videoinfo_youTube_embed_link") %>) + <%= translate(locale, "videoinfo_watch_on_youTube") %> + (<%= translate(locale, "videoinfo_youTube_embed_link") %>)