Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/invidious/routes/companion.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/invidious/routing.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down