Add /subscription_manager
This commit is contained in:
parent
1ada71e5ba
commit
431fa642bf
@ -806,6 +806,24 @@ get "/modify_notifications" do |env|
|
|||||||
env.redirect referer
|
env.redirect referer
|
||||||
end
|
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|
|
get "/subscription_ajax" do |env|
|
||||||
authorized = env.get? "authorized"
|
authorized = env.get? "authorized"
|
||||||
referer = env.request.headers["referer"]?
|
referer = env.request.headers["referer"]?
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="h-box">
|
<div class="h-box">
|
||||||
<a style="width:100%;" href="/watch?v=<%= video.id %>">
|
<a style="width:100%;" href="/watch?v=<%= video.id %>">
|
||||||
<img style="width:100%;" src="https://i.ytimg.com/vi/<%= video.id %>/mqdefault.jpg"/>
|
<img style="width:100%;" src="https://i.ytimg.com/vi/<%= video.id %>/mqdefault.jpg"/>
|
||||||
<p style="height:100%"><%= video.title %></p>
|
<p><%= video.title %></p>
|
||||||
</a>
|
</a>
|
||||||
<p>
|
<p>
|
||||||
<b><a style="width:100%;" href="/channel/<%= video.ucid %>"><%= video.author %></a></b>
|
<b><a style="width:100%;" href="/channel/<%= video.ucid %>"><%= video.author %></a></b>
|
||||||
|
19
src/views/subscription_manager.ecr
Normal file
19
src/views/subscription_manager.ecr
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<% content_for "header" do %>
|
||||||
|
<title>Subscription manager - Invidious</title>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<h1><%= subscriptions.size %> subscriptions</h1>
|
||||||
|
|
||||||
|
<% subscriptions.each do |channel| %>
|
||||||
|
<h3 class="h-box">
|
||||||
|
<div class="pure-g">
|
||||||
|
<div class="pure-u-2-5">
|
||||||
|
<a href="/channel/<%= channel.id %>"><%= channel.author %></a>
|
||||||
|
</div>
|
||||||
|
<div class="pure-u-2-5"></div>
|
||||||
|
<div class="pure-u-1-5">
|
||||||
|
<a style="vertical-align: right;" href="/subscription_ajax?action_remove_subscriptions=1&c=<%= channel.id %>">unsubscribe</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</h3>
|
||||||
|
<% end %>
|
@ -2,6 +2,8 @@
|
|||||||
<title>Subscriptions - Invidious</title>
|
<title>Subscriptions - Invidious</title>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<h3><a href="/subscription_manager">View all subscriptions</a></h3>
|
||||||
|
|
||||||
<% if !notifications.empty? %>
|
<% if !notifications.empty? %>
|
||||||
<% notifications.each_slice(4) do |slice| %>
|
<% notifications.each_slice(4) do |slice| %>
|
||||||
<div class="pure-g">
|
<div class="pure-g">
|
||||||
|
Loading…
Reference in New Issue
Block a user