diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-04-03 16:52:58 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-04-03 16:52:58 -0500 |
| commit | e2c50d4d1f4941501585dc1e53fba1faf47b04aa (patch) | |
| tree | 38f6ab2f4e9c8e951aa353b295b4af0cded8ef44 /src | |
| parent | 8d66493c016853937c4595b4c380ec03c5aa1b3c (diff) | |
| download | invidious-e2c50d4d1f4941501585dc1e53fba1faf47b04aa.tar.gz invidious-e2c50d4d1f4941501585dc1e53fba1faf47b04aa.tar.bz2 invidious-e2c50d4d1f4941501585dc1e53fba1faf47b04aa.zip | |
Use get_user for watch page
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious.cr | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 55fe2334..2d78ae46 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -193,8 +193,6 @@ before_all do |env| notifications = PG_DB.query_one?("SELECT cardinality(notifications) FROM users WHERE id = $1", sid, as: Int32) notifications ||= 0 env.set "notifications", notifications - else - env.set "authorized", false end end @@ -219,9 +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) - subscriptions = PG_DB.query_one("SELECT subscriptions FROM users WHERE id = $1", sid, as: Array(String)) + user = get_user(sid, client, headers, PG_DB) + subscriptions = user.subscriptions else subscriptions = [] of String end |
