mirror of
https://github.com/iv-org/invidious.git
synced 2026-07-07 06:06:48 -05:00
Add require_login config option to redirect unauthenticated users
This commit is contained in:
parent
625d128645
commit
c010be3e0c
@ -206,12 +206,13 @@ before_all do |env|
|
|||||||
path = env.request.path
|
path = env.request.path
|
||||||
allowed = {
|
allowed = {
|
||||||
"/login", "/register", "/api/",
|
"/login", "/register", "/api/",
|
||||||
|
"/embed/",
|
||||||
"/sb/", "/vi/", "/s_p/", "/yts/", "/ggpht/",
|
"/sb/", "/vi/", "/s_p/", "/yts/", "/ggpht/",
|
||||||
"/api/manifest/", "/videoplayback", "/latest_version",
|
"/api/manifest/", "/videoplayback", "/latest_version",
|
||||||
"/download", "/companion/",
|
"/download", "/companion/",
|
||||||
}
|
}
|
||||||
unless allowed.any? { |p| path.starts_with?(p) }
|
unless allowed.any? { |p| path.starts_with?(p) }
|
||||||
env.redirect "/login?return_path=#{URI.encode_www_form(path)}"
|
env.redirect "/login?referer=#{URI.encode_www_form(path)}"
|
||||||
halt env, 302
|
halt env, 302
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user