mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-15 09:35:09 +00:00
API: make /api/v1/videos respect the 'local' parameter
This commit is contained in:
20
src/invidious/http_server/utils.cr
Normal file
20
src/invidious/http_server/utils.cr
Normal file
@@ -0,0 +1,20 @@
|
||||
module Invidious::HttpServer
|
||||
module Utils
|
||||
extend self
|
||||
|
||||
def proxy_video_url(raw_url : String, *, region : String? = nil, absolute : Bool = false)
|
||||
url = URI.parse(raw_url)
|
||||
|
||||
# Add some URL parameters
|
||||
params = url.query_params
|
||||
params["host"] = url.host.not_nil! # Should never be nil, in theory
|
||||
params["region"] = region if !region.nil?
|
||||
|
||||
if absolute
|
||||
return "#{HOST_URL}#{url.request_target}?#{params}"
|
||||
else
|
||||
return "#{url.request_target}?#{params}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user