|
|
@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
require "uri"
|
|
|
|
|
|
|
|
|
|
|
|
module Invidious::HttpServer
|
|
|
|
module Invidious::HttpServer
|
|
|
|
module Utils
|
|
|
|
module Utils
|
|
|
|
extend self
|
|
|
|
extend self
|
|
|
@ -16,5 +18,23 @@ module Invidious::HttpServer
|
|
|
|
return "#{url.request_target}?#{params}"
|
|
|
|
return "#{url.request_target}?#{params}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def add_params_to_url(url : String | URI, params : URI::Params) : URI
|
|
|
|
|
|
|
|
url = URI.parse(url) if url.is_a?(String)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
url_query = url.query || ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Append the parameters
|
|
|
|
|
|
|
|
url.query = String.build do |str|
|
|
|
|
|
|
|
|
if !url_query.empty?
|
|
|
|
|
|
|
|
str << url_query
|
|
|
|
|
|
|
|
str << '&'
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
str << params
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return url
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|