Add /subscription_manager

このコミットが含まれているのは:
Omar Roth 2018-07-05 19:48:55 -05:00
コミット 431fa642bf
4個のファイルの変更40行の追加1行の削除

ファイルの表示

@ -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"]?

ファイルの表示

@ -2,7 +2,7 @@
<div class="h-box">
<a style="width:100%;" href="/watch?v=<%= video.id %>">
<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>
<p>
<b><a style="width:100%;" href="/channel/<%= video.ucid %>"><%= video.author %></a></b>

19
src/views/subscription_manager.ecr ノーマルファイル
ファイルの表示

@ -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>
<% end %>
<h3><a href="/subscription_manager">View all subscriptions</a></h3>
<% if !notifications.empty? %>
<% notifications.each_slice(4) do |slice| %>
<div class="pure-g">