Remove old code that is done on the Openresty side
All checks were successful
Invidious CI / build (push) Successful in 5m26s
All checks were successful
Invidious CI / build (push) Successful in 5m26s
This commit is contained in:
parent
b95a8bfbd3
commit
4da3936b5a
5 changed files with 4 additions and 34 deletions
|
@ -204,6 +204,8 @@ class Config
|
||||||
|
|
||||||
property ignore_user_tokens : Bool = false
|
property ignore_user_tokens : Bool = false
|
||||||
|
|
||||||
|
property server_id_cookie_name : String = "INVIDIOUS_SERVER_ID"
|
||||||
|
|
||||||
{% if flag?(:linux) %}
|
{% if flag?(:linux) %}
|
||||||
property reload_config_automatically : Bool = true
|
property reload_config_automatically : Bool = true
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
{% skip_file if flag?(:api_only) %}
|
|
||||||
|
|
||||||
module Invidious::Routes::BackendSwitcher
|
|
||||||
def self.switch(env)
|
|
||||||
referer = get_referer(env)
|
|
||||||
backend_id = env.params.query["backend_id"]
|
|
||||||
|
|
||||||
# Checks if there is any alternative domain, like a second domain name,
|
|
||||||
# TOR or I2P address
|
|
||||||
if alt = CONFIG.alternative_domains.index(env.request.headers["Host"])
|
|
||||||
env.response.cookies["SERVER_ID"] = Invidious::User::Cookies.server_id(CONFIG.alternative_domains[alt], backend_id)
|
|
||||||
else
|
|
||||||
env.response.cookies["SERVER_ID"] = Invidious::User::Cookies.server_id(CONFIG.domain, backend_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
env.redirect referer
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -21,7 +21,6 @@ module Invidious::Routing
|
||||||
get "/privacy", Routes::Misc, :privacy
|
get "/privacy", Routes::Misc, :privacy
|
||||||
get "/licenses", Routes::Misc, :licenses
|
get "/licenses", Routes::Misc, :licenses
|
||||||
get "/redirect", Routes::Misc, :cross_instance_redirect
|
get "/redirect", Routes::Misc, :cross_instance_redirect
|
||||||
get "/switchbackend", Routes::BackendSwitcher, :switch
|
|
||||||
|
|
||||||
self.register_channel_routes
|
self.register_channel_routes
|
||||||
self.register_watch_routes
|
self.register_watch_routes
|
||||||
|
|
|
@ -45,18 +45,5 @@ struct Invidious::User
|
||||||
samesite: HTTP::Cookie::SameSite::Lax
|
samesite: HTTP::Cookie::SameSite::Lax
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Server ID (SERVER_ID) cookie used for Sticky Sessions
|
|
||||||
# Parameter "domain" comes from the global config
|
|
||||||
def server_id(domain : String?, server_id) : HTTP::Cookie
|
|
||||||
return HTTP::Cookie.new(
|
|
||||||
name: "SERVER_ID",
|
|
||||||
domain: domain,
|
|
||||||
value: server_id,
|
|
||||||
secure: false,
|
|
||||||
http_only: true,
|
|
||||||
samesite: HTTP::Cookie::SameSite::Lax
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<%
|
<%
|
||||||
locale = env.get("preferences").as(Preferences).locale
|
locale = env.get("preferences").as(Preferences).locale
|
||||||
dark_mode = env.get("preferences").as(Preferences).dark_mode
|
dark_mode = env.get("preferences").as(Preferences).dark_mode
|
||||||
current_backend = env.request.cookies["SERVER_ID"]?.try &.value
|
current_backend = env.request.cookies[CONFIG.server_id_cookie_name]?.try &.value
|
||||||
%>
|
%>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="<%= locale %>">
|
<html lang="<%= locale %>">
|
||||||
|
@ -310,7 +310,7 @@
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="footer-footer">
|
<div class="footer-footer">
|
||||||
<div class="box">You are currently using Backend: <%= current_backend %></p>
|
<div class="box">You are currently using Backend: <%= current_backend %></div>
|
||||||
<span class="left">
|
<span class="left">
|
||||||
<% if CONFIG.modified_source_code_url %>
|
<% if CONFIG.modified_source_code_url %>
|
||||||
<%= translate(locale, "footer_current_version_modified") %>
|
<%= translate(locale, "footer_current_version_modified") %>
|
||||||
|
|
Loading…
Reference in a new issue