diff --git a/assets/js/handlers.js b/assets/js/handlers.js
index 539974fb..f36da244 100644
--- a/assets/js/handlers.js
+++ b/assets/js/handlers.js
@@ -60,12 +60,21 @@
document.querySelectorAll('[data-onclick="add_playlist_video"]').forEach(function (el) {
el.onclick = function () { add_playlist_video(el); };
});
+ document.querySelectorAll('[data-onclick="add_compilation_video"]').forEach(function (el) {
+ el.onclick = function () { add_compilation_video(el); };
+ });
document.querySelectorAll('[data-onclick="add_playlist_item"]').forEach(function (el) {
el.onclick = function () { add_playlist_item(el); };
});
+ document.querySelectorAll('[data-onclick="add_compilation_item"]').forEach(function (el) {
+ el.onclick = function () { add_compilation_item(el); };
+ });
document.querySelectorAll('[data-onclick="remove_playlist_item"]').forEach(function (el) {
el.onclick = function () { remove_playlist_item(el); };
});
+ document.querySelectorAll('[data-onclick="remove_compilation_item"]').forEach(function (el) {
+ el.onclick = function () { remove_compilation_item(el); };
+ });
document.querySelectorAll('[data-onclick="revoke_token"]').forEach(function (el) {
el.onclick = function () { revoke_token(el); };
});
diff --git a/config/sql/compilations.sql b/config/sql/compilations.sql
index d1ee949b..95d2d0af 100644
--- a/config/sql/compilations.sql
+++ b/config/sql/compilations.sql
@@ -1,8 +1,8 @@
--- Type: public.privacy
+-- Type: public.compilation_privacy
--- DROP TYPE public.privacy;
+-- DROP TYPE public.compilation_privacy;
-CREATE TYPE public.privacy AS ENUM
+CREATE TYPE public.compilation_privacy AS ENUM
(
'Unlisted',
'Private'
@@ -21,7 +21,7 @@ CREATE TABLE IF NOT EXISTS public.compilations
video_count integer,
created timestamptz,
updated timestamptz,
- privacy privacy,
+ privacy compilation_privacy,
index int8[]
);
diff --git a/src/invidious/compilations.cr b/src/invidious/compilations.cr
index 42e9aaf5..695a37ea 100644
--- a/src/invidious/compilations.cr
+++ b/src/invidious/compilations.cr
@@ -319,8 +319,6 @@ def get_compilation(compid : String)
else
raise NotFoundException.new("Compilation does not exist.")
end
- else
- return fetch_compilation(compid)
end
end
diff --git a/src/invidious/config.cr b/src/invidious/config.cr
index cee33ce1..df64c9b8 100644
--- a/src/invidious/config.cr
+++ b/src/invidious/config.cr
@@ -30,7 +30,7 @@ struct ConfigPreferences
property quality : String = "hd720"
property quality_dash : String = "auto"
property default_home : String? = "Popular"
- property feed_menu : Array(String) = ["Popular", "Trending", "Subscriptions", "Playlists"]
+ property feed_menu : Array(String) = ["Popular", "Trending", "Subscriptions", "Playlists", "Compilations"]
property automatic_instance_redirect : Bool = false
property region : String = "US"
property related_videos : Bool = true
@@ -138,6 +138,9 @@ class Config
# Playlist length limit
property playlist_length_limit : Int32 = 500
+ # Compilation length limit
+ property compilation_length_limit : Int32 = 500
+
def disabled?(option)
case disabled = CONFIG.disable_proxy
when Bool
diff --git a/src/invidious/routes/feeds.cr b/src/invidious/routes/feeds.cr
index fec94682..3e68bcfb 100644
--- a/src/invidious/routes/feeds.cr
+++ b/src/invidious/routes/feeds.cr
@@ -5,6 +5,10 @@ module Invidious::Routes::Feeds
env.redirect "/feed/playlists"
end
+ def self.view_all_compilations_redirect(env)
+ env.redirect "/feed/compilations"
+ end
+
def self.compilations(env)
locale = env.get("preferences").as(Preferences).locale
diff --git a/src/invidious/routes/misc.cr b/src/invidious/routes/misc.cr
index 4f7f65a8..bd3245cc 100644
--- a/src/invidious/routes/misc.cr
+++ b/src/invidious/routes/misc.cr
@@ -27,7 +27,7 @@ module Invidious::Routes::Misc
if user
env.redirect "/feed/compilations"
else
- env.redirect "/feed/popyular"
+ env.redirect "/feed/popular"
end
else
templated "search_homepage", navbar_search: false
diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr
index 6d410e87..eea93858 100644
--- a/src/invidious/routes/preferences.cr
+++ b/src/invidious/routes/preferences.cr
@@ -186,7 +186,7 @@ module Invidious::Routes::PreferencesRoute
CONFIG.default_user_preferences.default_home = env.params.body["admin_default_home"]?.try &.as(String) || CONFIG.default_user_preferences.default_home
admin_feed_menu = [] of String
- 4.times do |index|
+ 5.times do |index|
option = env.params.body["admin_feed_menu[#{index}]"]?.try &.as(String) || ""
if !option.empty?
admin_feed_menu << option
diff --git a/src/invidious/routing.cr b/src/invidious/routing.cr
index 434392e9..5f743ab5 100644
--- a/src/invidious/routing.cr
+++ b/src/invidious/routing.cr
@@ -26,6 +26,7 @@ module Invidious::Routing
self.register_watch_routes
self.register_iv_playlist_routes
+ self.register_iv_compilation_routes
self.register_yt_playlist_routes
self.register_search_routes
@@ -83,6 +84,7 @@ module Invidious::Routing
def register_iv_compilation_routes
get "/create_compilation", Routes::Compilations, :new
post "/create_compilation", Routes::Compilations, :create
+ post "/compilation_ajax", Routes::Compilations, :compilation_ajax
end
def register_iv_playlist_routes
@@ -279,7 +281,7 @@ module Invidious::Routing
post "/api/v1/auth/subscriptions/:ucid", {{namespace}}::Authenticated, :subscribe_channel
delete "/api/v1/auth/subscriptions/:ucid", {{namespace}}::Authenticated, :unsubscribe_channel
- get "/api/v1/auth/compilations", {{namespace}}::Authenticated, :create_compilation
+ post "/api/v1/auth/compilations", {{namespace}}::Authenticated, :create_compilation
get "/api/v1/auth/playlists", {{namespace}}::Authenticated, :list_playlists
post "/api/v1/auth/playlists", {{namespace}}::Authenticated, :create_playlist
diff --git a/src/invidious/views/user/preferences.ecr b/src/invidious/views/user/preferences.ecr
index 1ef99cd2..93f03a05 100644
--- a/src/invidious/views/user/preferences.ecr
+++ b/src/invidious/views/user/preferences.ecr
@@ -174,7 +174,7 @@
@@ -184,7 +184,7 @@
<% (feed_options.size - 1).times do |index| %>
<% end %>