mirror of
https://github.com/iv-org/invidious.git
synced 2025-12-16 17:03:58 -05:00
Merge 4506f04358 into aba31a8e20
This commit is contained in:
commit
591591a88f
2 changed files with 19 additions and 0 deletions
|
|
@ -16,6 +16,24 @@ module Invidious::Routes::Companion
|
|||
end
|
||||
end
|
||||
|
||||
# /companion
|
||||
def self.post_companion(env)
|
||||
url = env.request.path
|
||||
if env.request.query
|
||||
url += "?#{env.request.query}"
|
||||
end
|
||||
|
||||
begin
|
||||
COMPANION_POOL.client do |wrapper|
|
||||
wrapper.client.post(url, env.request.headers, env.request.body) do |resp|
|
||||
return self.proxy_companion(env, resp)
|
||||
end
|
||||
end
|
||||
rescue ex
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def self.options_companion(env)
|
||||
url = env.request.path
|
||||
if env.request.query
|
||||
|
|
|
|||
|
|
@ -227,6 +227,7 @@ module Invidious::Routing
|
|||
def register_companion_routes
|
||||
if CONFIG.invidious_companion.present?
|
||||
get "/companion/*", Routes::Companion, :get_companion
|
||||
post "/companion/*", Routes::Companion, :post_companion
|
||||
options "/companion/*", Routes::Companion, :options_companion
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue