removed redirect_login

This commit is contained in:
Toni Förster 2023-11-13 22:02:12 +01:00
parent a563aabd5f
commit 0e98711e93
No known key found for this signature in database
GPG Key ID: 292F3E5086C83FC7
3 changed files with 15 additions and 32 deletions

View File

@ -252,16 +252,6 @@ https_only: false
## ##
#private_instance: false #private_instance: false
##
## Redirect request to the login page on private instances. Also requires
## login_enabled to be 'true', otherwise the server sends status code 401
## and closes the connection.
##
## Accepted values: true, false
## Default: false
##
#redirect_login: false
## ##
## Allow/Forbid Invidious (local) account creation. Invidious ## Allow/Forbid Invidious (local) account creation. Invidious
## accounts allow users to subscribe to channels and to create ## accounts allow users to subscribe to channels and to create

View File

@ -94,8 +94,6 @@ class Config
property captcha_enabled : Bool = true property captcha_enabled : Bool = true
# Only allow usage of the Invidious instance with an existing account # Only allow usage of the Invidious instance with an existing account
property private_instance : Bool = false property private_instance : Bool = false
# Redirected requests to the login page on a private instance. Requires login_enabled: true
property redirect_login : Bool = false
property login_enabled : Bool = true property login_enabled : Bool = true
property registration_enabled : Bool = true property registration_enabled : Bool = true
property statistics_enabled : Bool = false property statistics_enabled : Bool = false

View File

@ -99,31 +99,26 @@ module Invidious::Routes::BeforeAll
"/feed/webhook/v1:", "/feed/webhook/v1:",
"/api/v1/videos/dQw4w9WgXcQ", "/api/v1/videos/dQw4w9WgXcQ",
"/api/v1/comments/jNQXAC9IVRw", "/api/v1/comments/jNQXAC9IVRw",
} }
if CONFIG.private_instance && !env.get?("user") && !unregistered_path_whitelist.any? { |r| env.request.path.starts_with? r } if CONFIG.private_instance && !env.get?("user") && !unregistered_path_whitelist.any? { |r| env.request.path.starts_with? r }
if CONFIG.redirect_login && CONFIG.login_enabled env.response.headers["Location"] = "/login"
env.response.headers["Location"] = "/login" haltf env, status_code: 302
haltf env, status_code: 302
else
env.response.status_code = 401
env.response.close
end
end end
return if { return if {
"/sb/", "/sb/",
"/vi/", "/vi/",
"/s_p/", "/s_p/",
"/yts/", "/yts/",
"/ggpht/", "/ggpht/",
"/download", "/download",
"/licenses", "/licenses",
"/api/manifest/", "/api/manifest/",
"/videoplayback", "/videoplayback",
"/latest_version", "/latest_version",
"/opensearch.xml", "/opensearch.xml",
}.any? { |r| env.request.resource.starts_with? r } }.any? { |r| env.request.resource.starts_with? r }
dark_mode = convert_theme(env.params.query["dark_mode"]?) || preferences.dark_mode.to_s dark_mode = convert_theme(env.params.query["dark_mode"]?) || preferences.dark_mode.to_s
thin_mode = env.params.query["thin_mode"]? || preferences.thin_mode.to_s thin_mode = env.params.query["thin_mode"]? || preferences.thin_mode.to_s