mirror of
https://github.com/iv-org/invidious.git
synced 2025-05-31 14:11:54 +05:30
login_only
This commit is contained in:
@@ -84,6 +84,7 @@ class Config
|
|||||||
|
|
||||||
# Used to tell Invidious it is behind a proxy, so links to resources should be https://
|
# Used to tell Invidious it is behind a proxy, so links to resources should be https://
|
||||||
property https_only : Bool?
|
property https_only : Bool?
|
||||||
|
property login_only : Bool?
|
||||||
# HMAC signing key for CSRF tokens and verifying pubsub subscriptions
|
# HMAC signing key for CSRF tokens and verifying pubsub subscriptions
|
||||||
property hmac_key : String?
|
property hmac_key : String?
|
||||||
# Domain to be used for links to resources on the site where an absolute URL is required
|
# Domain to be used for links to resources on the site where an absolute URL is required
|
||||||
|
@@ -148,5 +148,11 @@ module Invidious::Routes::BeforeAll
|
|||||||
end
|
end
|
||||||
|
|
||||||
env.set "current_page", URI.encode_www_form(current_page)
|
env.set "current_page", URI.encode_www_form(current_page)
|
||||||
|
|
||||||
|
unregistered_path_whitelist = {"/", "/login", "/licenses", "/privacy"}
|
||||||
|
if !env.get?("user") && !unregistered_path_whitelist.includes?(env.request.path) && CONFIG.login_only
|
||||||
|
env.response.headers["Location"] = "/login"
|
||||||
|
haltf env, status_code: 302
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user