0.8.81: Fix uploads, the admin before_post should be before the global before_post
This commit is contained in:
parent
cea1982523
commit
69fe5a3c58
2 changed files with 9 additions and 11 deletions
|
@ -1,2 +0,0 @@
|
||||||
module LOGGER
|
|
||||||
end
|
|
|
@ -18,6 +18,12 @@ module Routing
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
before_post "/api/admin/*" do |env|
|
||||||
|
if env.request.headers.try &.["X-Api-Key"]? != CONFIG.adminApiKey || nil
|
||||||
|
halt env, status_code: 401, response: error401("Wrong API Key")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
before_post do |env|
|
before_post do |env|
|
||||||
if env.request.headers.try &.["X-Api-Key"]? == CONFIG.adminApiKey
|
if env.request.headers.try &.["X-Api-Key"]? == CONFIG.adminApiKey
|
||||||
# Skips Tor and Rate limits if the API key matches
|
# Skips Tor and Rate limits if the API key matches
|
||||||
|
@ -45,12 +51,6 @@ module Routing
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
before_post "/api/admin" do |env|
|
|
||||||
if env.request.headers.try &.["X-Api-Key"]? != CONFIG.adminApiKey || nil
|
|
||||||
error401 "Wrong API Key"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def register_all
|
def register_all
|
||||||
get "/" do |env|
|
get "/" do |env|
|
||||||
host = Utils.host(env)
|
host = Utils.host(env)
|
||||||
|
@ -91,9 +91,9 @@ module Routing
|
||||||
|
|
||||||
def register_admin
|
def register_admin
|
||||||
if CONFIG.adminEnabled
|
if CONFIG.adminEnabled
|
||||||
post "/api/admin/upload" do |env|
|
# post "/api/admin/upload" do |env|
|
||||||
Handling::Admin.delete_ip_limit(env)
|
# Handling::Admin.delete_ip_limit(env)
|
||||||
end
|
# end
|
||||||
post "/api/admin/delete" do |env|
|
post "/api/admin/delete" do |env|
|
||||||
Handling::Admin.delete_file(env)
|
Handling::Admin.delete_file(env)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue