From 7119395045fa92462bee43c778032c9d03015f31 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Tue, 17 Jul 2018 08:19:45 -0500 Subject: [PATCH] Refresh account for subscription feed and manager --- src/invidious.cr | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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