mirror of
https://github.com/iv-org/invidious.git
synced 2025-12-16 17:03:58 -05:00
Allow downloading via companion
* post request where not proxied for the download companion which made it impossible to download with the companion enabled
This commit is contained in:
parent
65463333f3
commit
f6d92ccca7
2 changed files with 20 additions and 1 deletions
|
|
@ -16,6 +16,24 @@ module Invidious::Routes::Companion
|
||||||
end
|
end
|
||||||
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)
|
def self.options_companion(env)
|
||||||
url = env.request.path
|
url = env.request.path
|
||||||
if env.request.query
|
if env.request.query
|
||||||
|
|
|
||||||
|
|
@ -227,6 +227,7 @@ module Invidious::Routing
|
||||||
def register_companion_routes
|
def register_companion_routes
|
||||||
if CONFIG.invidious_companion.present?
|
if CONFIG.invidious_companion.present?
|
||||||
get "/companion/*", Routes::Companion, :get_companion
|
get "/companion/*", Routes::Companion, :get_companion
|
||||||
|
post "/companion/*", Routes::Companion, :post_companion
|
||||||
options "/companion/*", Routes::Companion, :options_companion
|
options "/companion/*", Routes::Companion, :options_companion
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -252,7 +253,7 @@ module Invidious::Routing
|
||||||
get "/api/v1/trending", {{namespace}}::Feeds, :trending
|
get "/api/v1/trending", {{namespace}}::Feeds, :trending
|
||||||
get "/api/v1/popular", {{namespace}}::Feeds, :popular
|
get "/api/v1/popular", {{namespace}}::Feeds, :popular
|
||||||
|
|
||||||
# Channels
|
# Channel
|
||||||
get "/api/v1/channels/:ucid", {{namespace}}::Channels, :home
|
get "/api/v1/channels/:ucid", {{namespace}}::Channels, :home
|
||||||
get "/api/v1/channels/:ucid/latest", {{namespace}}::Channels, :latest
|
get "/api/v1/channels/:ucid/latest", {{namespace}}::Channels, :latest
|
||||||
get "/api/v1/channels/:ucid/videos", {{namespace}}::Channels, :videos
|
get "/api/v1/channels/:ucid/videos", {{namespace}}::Channels, :videos
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue