Add create_compilation route and ecr

This commit is contained in:
broquemonsieur 2023-06-15 23:17:44 -07:00
parent b6181b9d97
commit bac4fd9097
3 changed files with 10 additions and 1 deletions

View File

@ -226,12 +226,13 @@ module Invidious::Routes::API::V1::Authenticated
end end
compilation = create_compilation(title, privacy, user) compilation = create_compilation(title, privacy, user)
env.response.headers["Location"] = "#{HOST_URL}/api/v1/auth/compilations/#{playlist.id}" env.response.headers["Location"] = "#{HOST_URL}/api/v1/auth/compilations/#{compilation.id}"
env.response.status_code = 201 env.response.status_code = 201
{ {
"title" => title, "title" => title,
"compilationId" => compilation.id, "compilationId" => compilation.id,
}.to_json }.to_json
end
def self.create_playlist(env) def self.create_playlist(env)
env.response.content_type = "application/json" env.response.content_type = "application/json"

View File

@ -80,6 +80,11 @@ module Invidious::Routing
get "/subscription_manager", Routes::Subscriptions, :subscription_manager get "/subscription_manager", Routes::Subscriptions, :subscription_manager
end end
def register_iv_compilation_routes
get "/create_compilation", Routes::Compilations, :new
post "/create_compilation", Routes::Compilations, :create
end
def register_iv_playlist_routes def register_iv_playlist_routes
get "/create_playlist", Routes::Playlists, :new get "/create_playlist", Routes::Playlists, :new
post "/create_playlist", Routes::Playlists, :create post "/create_playlist", Routes::Playlists, :create

View File

@ -0,0 +1,3 @@
<% content_for "header" do %>
<title><%= translate(locale, "Create compilation") %> - Invidious</title>
<% end %>