mirror of
https://gitea.invidious.io/iv-org/invidious.git
synced 2024-08-15 00:53:41 +00:00
Add subscribe button to channel page
This commit is contained in:
parent
7234785145
commit
650b8a50fc
2 changed files with 29 additions and 0 deletions
|
@ -939,6 +939,14 @@ get "/videoplayback*" do |env|
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/channel/:ucid" do |env|
|
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"]
|
ucid = env.params.url["ucid"]
|
||||||
|
|
||||||
page = env.params.query["page"]?.try &.to_i
|
page = env.params.query["page"]?.try &.to_i
|
||||||
|
|
|
@ -3,6 +3,27 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<h1><%= author %></h1>
|
<h1><%= author %></h1>
|
||||||
|
<% if authorized %>
|
||||||
|
<% if subscriptions.includes? ucid %>
|
||||||
|
<p>
|
||||||
|
<a href="/subscription_ajax?action_remove_subscriptions=1&c=<%= ucid %>">
|
||||||
|
<b>Unsubscribe from <%= author %></b>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<% else %>
|
||||||
|
<p>
|
||||||
|
<a href="/subscription_ajax?action_create_subscription_to_channel=1&c=<%= ucid %>">
|
||||||
|
<b>Subscribe to <%= author %></b>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<p>
|
||||||
|
<a href="/login">
|
||||||
|
<b>Login to subscribe to <%= author %></b>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
<% videos.each_slice(4) do |slice| %>
|
<% videos.each_slice(4) do |slice| %>
|
||||||
<div class="pure-g">
|
<div class="pure-g">
|
||||||
<% slice.each do |video| %>
|
<% slice.each do |video| %>
|
||||||
|
|
Loading…
Reference in a new issue