From 30c92ce1b73ee07d913c0bd83701614f20992893 Mon Sep 17 00:00:00 2001 From: saltycrys <73420320+saltycrys@users.noreply.github.com> Date: Tue, 8 Dec 2020 02:28:44 +0100 Subject: [PATCH] Add embed link to watch page --- src/invidious/routes/watch.cr | 8 ++++++++ src/invidious/views/watch.ecr | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index 7018d0a4..9c3ef755 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -28,6 +28,14 @@ class Invidious::Routes::Watch < Invidious::Routes::BaseRoute return env.redirect "/" end + embed_link = "/embed/#{id}" + if env.params.query.size > 1 + embed_params = env.params.query.dup + embed_params.delete_all("v") + embed_link += "?" + embed_link += embed_params.to_s + end + plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "") continuation = process_continuation(PG_DB, env.params.query, plid, id) diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 9a1e6c32..fe970c54 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -89,6 +89,9 @@ <%= translate(locale, "Watch on YouTube") %> +

<% if params.annotations %>