forked from midou/invidious
Add option to redirect to HTTPS links even if ssl isn't enabled
This commit is contained in:
parent
30929a9574
commit
e49dadbb65
@ -861,7 +861,7 @@ post "/login" do |env|
|
|||||||
host = URI.parse(env.request.headers["Host"]).host
|
host = URI.parse(env.request.headers["Host"]).host
|
||||||
|
|
||||||
login.cookies.each do |cookie|
|
login.cookies.each do |cookie|
|
||||||
if Kemal.config.ssl
|
if Kemal.config.ssl || CONFIG.https_only
|
||||||
cookie.secure = true
|
cookie.secure = true
|
||||||
else
|
else
|
||||||
cookie.secure = false
|
cookie.secure = false
|
||||||
@ -924,7 +924,7 @@ post "/login" do |env|
|
|||||||
sid = Base64.encode(Random::Secure.random_bytes(50))
|
sid = Base64.encode(Random::Secure.random_bytes(50))
|
||||||
PG_DB.exec("UPDATE users SET id = $1 WHERE email = $2", sid, email)
|
PG_DB.exec("UPDATE users SET id = $1 WHERE email = $2", sid, email)
|
||||||
|
|
||||||
if Kemal.config.ssl
|
if Kemal.config.ssl || CONFIG.https_only
|
||||||
secure = true
|
secure = true
|
||||||
else
|
else
|
||||||
secure = false
|
secure = false
|
||||||
@ -951,7 +951,7 @@ post "/login" do |env|
|
|||||||
|
|
||||||
PG_DB.exec("INSERT INTO users VALUES (#{args})", user_array)
|
PG_DB.exec("INSERT INTO users VALUES (#{args})", user_array)
|
||||||
|
|
||||||
if Kemal.config.ssl
|
if Kemal.config.ssl || CONFIG.https_only
|
||||||
secure = true
|
secure = true
|
||||||
else
|
else
|
||||||
secure = false
|
secure = false
|
||||||
@ -1180,7 +1180,7 @@ get "/feed/private" do |env|
|
|||||||
videos.sort_by! { |video| video.author }.reverse!
|
videos.sort_by! { |video| video.author }.reverse!
|
||||||
end
|
end
|
||||||
|
|
||||||
if Kemal.config.ssl
|
if Kemal.config.ssl || CONFIG.https_only
|
||||||
scheme = "https://"
|
scheme = "https://"
|
||||||
else
|
else
|
||||||
scheme = "http://"
|
scheme = "http://"
|
||||||
@ -1459,7 +1459,7 @@ get "/api/manifest/dash/id/:id" do |env|
|
|||||||
url = url.rchop("</BaseURL>")
|
url = url.rchop("</BaseURL>")
|
||||||
|
|
||||||
if local
|
if local
|
||||||
if Kemal.config.ssl
|
if Kemal.config.ssl || CONFIG.https_only
|
||||||
scheme = "https://"
|
scheme = "https://"
|
||||||
end
|
end
|
||||||
scheme ||= "http://"
|
scheme ||= "http://"
|
||||||
@ -1484,7 +1484,7 @@ get "/api/manifest/dash/id/:id" do |env|
|
|||||||
|
|
||||||
if local
|
if local
|
||||||
adaptive_fmts.each do |fmt|
|
adaptive_fmts.each do |fmt|
|
||||||
if Kemal.config.ssl
|
if Kemal.config.ssl || CONFIG.https_only
|
||||||
scheme = "https://"
|
scheme = "https://"
|
||||||
end
|
end
|
||||||
scheme ||= "http://"
|
scheme ||= "http://"
|
||||||
|
@ -42,6 +42,7 @@ class Config
|
|||||||
dbname: String,
|
dbname: String,
|
||||||
),
|
),
|
||||||
dl_api_key: String?,
|
dl_api_key: String?,
|
||||||
|
https_only: Bool?,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user