diff --git a/src/invidious.cr b/src/invidious.cr index d3c563c8..71a0f0b6 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -939,6 +939,14 @@ get "/videoplayback*" do |env| end get "/channel/:ucid" do |env| + authorized = env.get? "authorized" + if authorized + sid = env.get("sid").as(String) + + subscriptions = PG_DB.query_one?("SELECT subscriptions FROM users WHERE id = $1", sid, as: Array(String)) + end + subscriptions ||= [] of String + ucid = env.params.url["ucid"] page = env.params.query["page"]?.try &.to_i diff --git a/src/views/channel.ecr b/src/views/channel.ecr index 857ad57a..e67dbfda 100644 --- a/src/views/channel.ecr +++ b/src/views/channel.ecr @@ -3,6 +3,27 @@ <% end %>
+ + Unsubscribe from <%= author %> + +
+ <% else %> ++ + Subscribe to <%= author %> + +
+ <% end %> +<% else %> ++ + Login to subscribe to <%= author %> + +
+<% end %> <% videos.each_slice(4) do |slice| %>