From bac4fd90979432873663c6e67faac4f1f1de3c7f Mon Sep 17 00:00:00 2001 From: broquemonsieur Date: Thu, 15 Jun 2023 23:17:44 -0700 Subject: [PATCH] Add create_compilation route and ecr --- src/invidious/routes/api/v1/authenticated.cr | 3 ++- src/invidious/routing.cr | 5 +++++ src/invidious/views/create_compilation.ecr | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/invidious/views/create_compilation.ecr diff --git a/src/invidious/routes/api/v1/authenticated.cr b/src/invidious/routes/api/v1/authenticated.cr index 0f96965c..11ffe7ff 100644 --- a/src/invidious/routes/api/v1/authenticated.cr +++ b/src/invidious/routes/api/v1/authenticated.cr @@ -226,12 +226,13 @@ module Invidious::Routes::API::V1::Authenticated end 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 { "title" => title, "compilationId" => compilation.id, }.to_json + end def self.create_playlist(env) env.response.content_type = "application/json" diff --git a/src/invidious/routing.cr b/src/invidious/routing.cr index a40bef73..434392e9 100644 --- a/src/invidious/routing.cr +++ b/src/invidious/routing.cr @@ -80,6 +80,11 @@ module Invidious::Routing get "/subscription_manager", Routes::Subscriptions, :subscription_manager end + def register_iv_compilation_routes + get "/create_compilation", Routes::Compilations, :new + post "/create_compilation", Routes::Compilations, :create + end + def register_iv_playlist_routes get "/create_playlist", Routes::Playlists, :new post "/create_playlist", Routes::Playlists, :create diff --git a/src/invidious/views/create_compilation.ecr b/src/invidious/views/create_compilation.ecr new file mode 100644 index 00000000..296d873e --- /dev/null +++ b/src/invidious/views/create_compilation.ecr @@ -0,0 +1,3 @@ +<% content_for "header" do %> +<%= translate(locale, "Create compilation") %> - Invidious +<% end %> \ No newline at end of file