From 15f4d95ab49b389a0b91275798ba4f93864eba9e Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sat, 24 Mar 2018 22:56:41 -0500 Subject: [PATCH] Add fix for testing authentication --- src/invidious.cr | 6 +++--- src/views/layout.ecr | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 8d3d1894..d78f8129 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -164,8 +164,8 @@ spawn do end end -before_get do |env| - if env.request.cookies["SID"]? +before_all do |env| + if env.request.cookies.has_key?("SID") env.set "authorized", true else env.set "authorized", false @@ -551,7 +551,7 @@ end # Get subscriptions for authorized user get "/feed/subscriptions" do |env| - authorized = env.get "authorized" + authorized = env.get? "authorized" if authorized max_results = env.params.query["maxResults"]?.try &.to_i diff --git a/src/views/layout.ecr b/src/views/layout.ecr index 872f9a05..b2f6e52e 100644 --- a/src/views/layout.ecr +++ b/src/views/layout.ecr @@ -25,7 +25,7 @@
- <% if env.get "authorized" %> + <% if env.get? "authorized" %>