move scheme logic
This commit is contained in:
parent
0bb37e4156
commit
8b3b2d0bf5
4 changed files with 6 additions and 4 deletions
|
@ -67,9 +67,11 @@ module Invidious::Routes::BeforeAll
|
|||
frame_ancestors = "'none'"
|
||||
end
|
||||
|
||||
scheme = env.request.headers["X-Forwarded-Proto"]? || ("https" if CONFIG.https_only) || "http"
|
||||
env.set "scheme", scheme
|
||||
|
||||
# TODO: Remove style-src's 'unsafe-inline', requires to remove all
|
||||
# inline styles (<style> [..] </style>, style=" [..] ")
|
||||
scheme = env.request.headers["X-Forwarded-Proto"]? || ("https" if CONFIG.https_only) || "http"
|
||||
env.response.headers["Content-Security-Policy"] = {
|
||||
"default-src 'none'",
|
||||
"script-src 'self'",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
author = HTML.escape(channel.author)
|
||||
channel_profile_pic = URI.parse(channel.author_thumbnail).request_target
|
||||
host = env.request.headers["Host"]
|
||||
scheme = env.request.headers["X-Forwarded-Proto"]? || ("https" if CONFIG.https_only) || "http"
|
||||
scheme = env.get("scheme")
|
||||
|
||||
relative_url =
|
||||
case selected_tab
|
||||
|
|
|
@ -110,12 +110,12 @@
|
|||
if CONFIG.invidious_companion.present?
|
||||
current_backend = env.get?("current_companion").try &.as(Int32)
|
||||
using_numbered_backend = env.get?("using_numbered_backend").try &.as(Bool)
|
||||
scheme = env.get("scheme")
|
||||
status = BackendInfo.get_status
|
||||
%>
|
||||
<div class="h-box" style="margin-bottom: 10px;">
|
||||
<% if using_numbered_backend %>
|
||||
<b>Switch Backend (Numbered):</b>
|
||||
<% scheme = env.request.headers["X-Forwarded-Proto"]? || ("https" if CONFIG.https_only) || "http" %>
|
||||
<% CONFIG.invidious_companion.each_with_index do | companion, index | %>
|
||||
<a href="<%= scheme %>://<%= companion.domain %><%= env.request.resource %>" style="<%= current_backend == index ? "text-decoration-line: underline;" : "" %> display: inline-block;">
|
||||
Backend<%= HTML.escape((index + 1).to_s) %> <%= HTML.escape(companion.note) %>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<% title = HTML.escape(video.title) %>
|
||||
<% author = HTML.escape(video.author) %>
|
||||
<% host = env.request.headers["Host"] %>
|
||||
<% scheme = env.request.headers["X-Forwarded-Proto"]? || ("https" if CONFIG.https_only) || "http" %>
|
||||
<% scheme = env.get("scheme") %>
|
||||
|
||||
|
||||
<% content_for "header" do %>
|
||||
|
|
Loading…
Add table
Reference in a new issue