From 713694fd858b755e465a3e835a0161e5cb58ae9f Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Sun, 16 Feb 2020 16:53:20 +0000 Subject: [PATCH] - formating --- src/config.cr | 2 -- src/server.cr | 8 ++++---- src/{static.cr => static_handler.cr} | 0 src/util.cr | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) rename src/{static.cr => static_handler.cr} (100%) diff --git a/src/config.cr b/src/config.cr index a8fe279..0235556 100644 --- a/src/config.cr +++ b/src/config.cr @@ -1,6 +1,4 @@ require "yaml" -require "uuid" -require "base64" class Config include YAML::Serializable diff --git a/src/server.cr b/src/server.cr index ba860a5..6d7695b 100644 --- a/src/server.cr +++ b/src/server.cr @@ -3,7 +3,7 @@ require "./config" require "./library" require "./storage" require "./auth_handler" -require "./static" +require "./static_handler" require "./util" class Server @@ -53,9 +53,9 @@ class Server get "/admin/user/edit" do |env| username = env.params.query["username"]? - admin = env.params.query["admin"]? - if admin - admin = admin == "true" + admin = env.params.query["admin"]? + if admin + admin = admin == "true" end error = env.params.query["error"]? current_user = get_username env diff --git a/src/static.cr b/src/static_handler.cr similarity index 100% rename from src/static.cr rename to src/static_handler.cr diff --git a/src/util.cr b/src/util.cr index 3e28ac1..c7cb271 100644 --- a/src/util.cr +++ b/src/util.cr @@ -10,7 +10,7 @@ end macro get_username(env) # if the request gets here, its has gone through the auth handler, and - # we can be sure that a valid token exists, so we can use not_nil! here + # we can be sure that a valid token exists, so we can use not_nil! here cookie = {{env}}.request.cookies.find { |c| c.name == "token" }.not_nil! (storage.verify_token cookie.value).not_nil! end