diff --git a/src/invidious.cr b/src/invidious.cr index 71051b33..44c0c2d2 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -806,6 +806,24 @@ get "/modify_notifications" do |env| env.redirect referer end +get "/subscription_manager" do |env| + authorized = env.get? "authorized" + if !authorized + next env.redirect "/" + end + + subscriptions = env.get?("subscriptions").as(Array(String)) + subscriptions ||= [] of String + + client = make_client(YT_URL) + subscriptions = subscriptions.map do |ucid| + get_channel(ucid, client, PG_DB, false) + end + subscriptions.sort_by! { |channel| channel.author.downcase } + + templated "subscription_manager" +end + get "/subscription_ajax" do |env| authorized = env.get? "authorized" referer = env.request.headers["referer"]? diff --git a/src/views/components/subscription_video.ecr b/src/views/components/subscription_video.ecr index 9abbb09f..377f51cb 100644 --- a/src/views/components/subscription_video.ecr +++ b/src/views/components/subscription_video.ecr @@ -2,7 +2,7 @@
-

<%= video.title %>

+

<%= video.title %>

<%= video.author %> diff --git a/src/views/subscription_manager.ecr b/src/views/subscription_manager.ecr new file mode 100644 index 00000000..23afa609 --- /dev/null +++ b/src/views/subscription_manager.ecr @@ -0,0 +1,19 @@ +<% content_for "header" do %> +Subscription manager - Invidious +<% end %> + +

<%= subscriptions.size %> subscriptions

+ +<% subscriptions.each do |channel| %> +

+ +

+<% end %> \ No newline at end of file diff --git a/src/views/subscriptions.ecr b/src/views/subscriptions.ecr index c0e15b47..f2411b24 100644 --- a/src/views/subscriptions.ecr +++ b/src/views/subscriptions.ecr @@ -2,6 +2,8 @@ Subscriptions - Invidious <% end %> +

View all subscriptions

+ <% if !notifications.empty? %> <% notifications.each_slice(4) do |slice| %>