summaryrefslogtreecommitdiffstats
path: root/src/invidious.cr
diff options
context:
space:
mode:
authorOmar Roth <omarroth@protonmail.com>2019-07-07 09:07:53 -0500
committerOmar Roth <omarroth@protonmail.com>2019-07-08 12:15:18 -0500
commit2cc25b1e6e5fec79b393d077ecb7b1ceee332b48 (patch)
tree840b05a4ef3a8da46ddfc70612de22b439d5dd7b /src/invidious.cr
parent5fd3ed782f5577b685e7de79a8bdf551dc64e13b (diff)
downloadinvidious-2cc25b1e6e5fec79b393d077ecb7b1ceee332b48.tar.gz
invidious-2cc25b1e6e5fec79b393d077ecb7b1ceee332b48.tar.bz2
invidious-2cc25b1e6e5fec79b393d077ecb7b1ceee332b48.zip
Add administrator option to disable proxying
Diffstat (limited to 'src/invidious.cr')
-rw-r--r--src/invidious.cr13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 3fee0a36..79968448 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -4667,6 +4667,12 @@ get "/videoplayback" do |env|
end
if url.includes? "&file=seg.ts"
+ if CONFIG.disabled?("livestreams")
+ env.response.status_code = 403
+ error_message = "Administrator has disabled this endpoint."
+ next templated "error"
+ end
+
begin
client = make_client(URI.parse(host), region)
client.get(url, headers) do |response|
@@ -4694,6 +4700,13 @@ get "/videoplayback" do |env|
rescue ex
end
else
+ if query_params["title"]? && CONFIG.disabled?("downloads") ||
+ CONFIG.disabled?("dash")
+ env.response.status_code = 403
+ error_message = "Administrator has disabled this endpoint."
+ next templated "error"
+ end
+
content_length = nil
first_chunk = true
range_start, range_end = parse_range(env.request.headers["Range"]?)