mirror of
https://github.com/iv-org/invidious.git
synced 2026-07-27 16:06:47 -05:00
fix
This commit is contained in:
parent
c6dfc0017d
commit
1dceabf4f2
@ -1,20 +1,22 @@
|
|||||||
module Invidious::Routes::Companion
|
module Invidious::Routes::Companion
|
||||||
|
extend self
|
||||||
|
|
||||||
# GET /companion
|
# GET /companion
|
||||||
def self.get_companion(env)
|
def get_companion(env)
|
||||||
url = self.make_url
|
url = make_url(env)
|
||||||
self.proxy_companion(env, "GET", url)
|
proxy_companion(env, "GET", url)
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /companion
|
# POST /companion
|
||||||
def self.post_companion(env)
|
def post_companion(env)
|
||||||
url = self.make_url
|
url = make_url(env)
|
||||||
self.proxy_companion(env, "POST", url)
|
proxy_companion(env, "POST", url)
|
||||||
end
|
end
|
||||||
|
|
||||||
# OPTIONS /companion
|
# OPTIONS /companion
|
||||||
def self.options_companion(env)
|
def options_companion(env)
|
||||||
url = self.make_url
|
url = make_url(env)
|
||||||
self.proxy_companion(env, "OPTIONS", url)
|
proxy_companion(env, "OPTIONS", url)
|
||||||
end
|
end
|
||||||
|
|
||||||
private def make_url(env)
|
private def make_url(env)
|
||||||
@ -22,9 +24,10 @@ module Invidious::Routes::Companion
|
|||||||
if env.request.query
|
if env.request.query
|
||||||
url += "?#{env.request.query}"
|
url += "?#{env.request.query}"
|
||||||
end
|
end
|
||||||
|
url
|
||||||
end
|
end
|
||||||
|
|
||||||
private def self.proxy_companion(env, method, url)
|
private def proxy_companion(env, method, url)
|
||||||
begin
|
begin
|
||||||
COMPANION_POOL.client do |wrapper|
|
COMPANION_POOL.client do |wrapper|
|
||||||
wrapper.client.exec(method, url, env.request.headers, (env.request.body if method == "POST")) do |resp|
|
wrapper.client.exec(method, url, env.request.headers, (env.request.body if method == "POST")) do |resp|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user