summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-07-17 08:19:45 -0500
committerOmar Roth <omarroth@hotmail.com>2018-07-17 08:19:45 -0500
commit7119395045fa92462bee43c778032c9d03015f31 (patch)
tree7b321db4c8bfac60977ef03d4884eee43a6dc874 /src
parentcecb93f832940598f3a257bca96a95c9de5cdae8 (diff)
downloadinvidious-7119395045fa92462bee43c778032c9d03015f31.tar.gz
invidious-7119395045fa92462bee43c778032c9d03015f31.tar.bz2
invidious-7119395045fa92462bee43c778032c9d03015f31.zip
Refresh account for subscription feed and manager
Diffstat (limited to 'src')
-rw-r--r--src/invidious.cr15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 1428e95d..618386ea 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -750,6 +750,13 @@ get "/feed/subscriptions" do |env|
if user
user = user.as(User)
+ # Refresh account
+ headers = HTTP::Headers.new
+ headers["Cookie"] = env.request.headers["Cookie"]
+
+ client = make_client(YT_URL)
+ user = get_user(user.id, client, headers, PG_DB)
+
max_results = user.preferences.max_results
max_results ||= env.params.query["maxResults"]?.try &.to_i
max_results ||= 40
@@ -848,6 +855,14 @@ get "/subscription_manager" do |env|
end
user = user.as(User)
+
+ # Refresh account
+ headers = HTTP::Headers.new
+ headers["Cookie"] = env.request.headers["Cookie"]
+
+ client = make_client(YT_URL)
+ user = get_user(user.id, client, headers, PG_DB)
+
subscriptions = user.subscriptions
subscriptions ||= [] of String