Merge pull request #23 from omarroth/add-feed

Add Atom feed
This commit is contained in:
Omar Roth 2018-07-20 18:35:40 -05:00 committed by GitHub
commit 44effdd3a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 128 additions and 7 deletions

View file

@ -139,6 +139,7 @@ class User
converter: PreferencesConverter,
},
password: String?,
token: String,
})
end
@ -829,13 +830,17 @@ def fetch_user(sid, client, headers, db)
email = ""
end
user = User.new(sid, Time.now, [] of String, channels, email, DEFAULT_USER_PREFERENCES, nil)
token = Base64.encode(Random::Secure.random_bytes(32))
user = User.new(sid, Time.now, [] of String, channels, email, DEFAULT_USER_PREFERENCES, nil, token)
return user
end
def create_user(sid, email, password)
password = Crypto::Bcrypt::Password.create(password, cost: 10)
user = User.new(sid, Time.now, [] of String, [] of String, email, DEFAULT_USER_PREFERENCES, password.to_s)
token = Base64.encode(Random::Secure.random_bytes(32))
user = User.new(sid, Time.now, [] of String, [] of String, email, DEFAULT_USER_PREFERENCES, password.to_s, token)
return user
end

View file

@ -2,7 +2,19 @@
<title>Subscriptions - Invidious</title>
<% end %>
<h3><a href="/subscription_manager">Manage subscriptions</a></h3>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-3-5">
<h3>
<a href="/subscription_manager">Manage subscriptions</a>
</h3>
</div>
<div class="pure-u-1 pure-u-md-1-5"></div>
<div style="text-align:right;" class="pure-u-1 pure-u-md-1-5">
<h3>
<a href="/feed/private?token=<%= user.token %>"><i class="fas fa-rss-square"></i></a>
</h3>
</div>
</div>
<% if !notifications.empty? %>
<% notifications.each_slice(4) do |slice| %>
@ -26,13 +38,13 @@
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-5">
<% if page > 2 %>
<a href="/feed/subscriptions?maxResults=<%= max_results %>&page=<%= page - 1 %>">Previous page</a>
<a href="/feed/subscriptions?max_results=<%= max_results %>&page=<%= page - 1 %>">Previous page</a>
<% else %>
<a href="/feed/subscriptions?maxResults=<%= max_results %>">Previous page</a>
<a href="/feed/subscriptions?max_results=<%= max_results %>">Previous page</a>
<% end %>
</div>
<div class="pure-u-1 pure-u-md-3-5"></div>
<div style="text-align:right;" class="pure-u-1 pure-u-md-1-5">
<a href="/feed/subscriptions?maxResults=<%= max_results %>&page=<%= page + 1 %>">Next page</a>
<a href="/feed/subscriptions?max_results=<%= max_results %>&page=<%= page + 1 %>">Next page</a>
</div>
</div>