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:
Jeroen Boersma 2025-12-02 16:58:34 +01:00
parent 65463333f3
commit f6d92ccca7
No known key found for this signature in database
GPG key ID: 5B1BD6489492C40A
2 changed files with 20 additions and 1 deletions

View file

@ -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

View file

@ -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
@ -252,7 +253,7 @@ module Invidious::Routing
get "/api/v1/trending", {{namespace}}::Feeds, :trending
get "/api/v1/popular", {{namespace}}::Feeds, :popular
# Channels
# Channel
get "/api/v1/channels/:ucid", {{namespace}}::Channels, :home
get "/api/v1/channels/:ucid/latest", {{namespace}}::Channels, :latest
get "/api/v1/channels/:ucid/videos", {{namespace}}::Channels, :videos