diff options
| author | Samantaz Fox <coding@samantaz.fr> | 2023-09-14 20:50:17 +0200 |
|---|---|---|
| committer | Samantaz Fox <coding@samantaz.fr> | 2023-09-14 22:27:36 +0200 |
| commit | 2456b629365450970363e5cf0e9a65c1a24160ab (patch) | |
| tree | 901e1402cb277008e93ba73078c90e712daef9eb /src | |
| parent | 792a999386f9147233d26300856a5802da5fc8c1 (diff) | |
| download | invidious-2456b629365450970363e5cf0e9a65c1a24160ab.tar.gz invidious-2456b629365450970363e5cf0e9a65c1a24160ab.tar.bz2 invidious-2456b629365450970363e5cf0e9a65c1a24160ab.zip | |
Frontend: Add timestamp on invidious embed links
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/routes/watch.cr | 8 | ||||
| -rw-r--r-- | src/invidious/views/watch.ecr | 12 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index e5cf3716..3d935f0a 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -30,14 +30,6 @@ module Invidious::Routes::Watch return env.redirect "/" end - embed_link = "/embed/#{id}" - if env.params.query.size > 1 - embed_params = HTTP::Params.parse(env.params.query.to_s) - 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(env.params.query, plid, id) diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index ac3fee65..a768328a 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -125,6 +125,7 @@ we're going to need to do it here in order to allow for translations. <a id="link-yt-watch" data-base-url="<%= link_yt_watch %>" href="<%= link_yt_watch %>"><%= translate(locale, "videoinfo_watch_on_youTube") %></a> (<a id="link-yt-embed" data-base-url="<%= link_yt_embed %>" href="<%= link_yt_embed %>"><%= translate(locale, "videoinfo_youTube_embed_link") %></a>) </span> + <p id="watch-on-another-invidious-instance"> <% if env.get("preferences").as(Preferences).automatic_instance_redirect%> <a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a> @@ -132,9 +133,18 @@ we're going to need to do it here in order to allow for translations. <a href="https://redirect.invidious.io<%= env.request.resource %>"><%= translate(locale, "Switch Invidious Instance") %></a> <% end %> </p> + <p id="embed-link"> - <a href="<%= embed_link %>"><%= translate(locale, "videoinfo_invidious_embed_link") %></a> + <%- + params_iv_embed = env.params.query.dup + params_iv_embed.delete_all("v") + + link_iv_embed = URI.new(path: "/embed/#{id}") + link_iv_embed = IV::HttpServer::Utils.add_params_to_url(link_iv_embed, params_iv_embed) + -%> + <a id="link-iv-embed" data-base-url="<%= link_iv_embed %>" href="<%= link_iv_embed %>"><%= translate(locale, "videoinfo_invidious_embed_link") %></a> </p> + <p id="annotations"> <% if params.annotations %> <a href="/watch?<%= env.params.query %>&iv_load_policy=3"> |
