From 10c1cfa4b5ba632b68e8550d9744d38f8ebf0775 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Tue, 3 Apr 2018 17:06:50 -0500 Subject: [PATCH] Use optional query for watch page --- src/invidious.cr | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 2d78ae46..7651612c 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -217,17 +217,13 @@ get "/watch" do |env| authorized = env.get? "authorized" if authorized - headers = HTTP::Headers.new - headers["Cookie"] = env.request.headers["Cookie"] - sid = env.get("sid").as(String) - user = get_user(sid, client, headers, PG_DB) - subscriptions = user.subscriptions - else - subscriptions = [] of String + subscriptions = PG_DB.query_one?("SELECT subscriptions FROM users WHERE id = $1", sid, as: Array(String)) end + subscriptions = [] of String + begin video = get_video(id, client, PG_DB) rescue ex