mirror of
https://github.com/YunoHost/dynette.git
synced 2024-09-03 20:06:17 +02:00
base64 dns key
This commit is contained in:
parent
1cf19fd581
commit
42173c579c
1 changed files with 4 additions and 3 deletions
|
@ -4,6 +4,7 @@ require 'rubygems'
|
||||||
require 'sinatra'
|
require 'sinatra'
|
||||||
require 'data_mapper'
|
require 'data_mapper'
|
||||||
require 'json'
|
require 'json'
|
||||||
|
require 'base64'
|
||||||
|
|
||||||
DataMapper.setup(:default, ENV['DATABASE_URL'] || "postgres://postgres:yayaya@localhost/dynette")
|
DataMapper.setup(:default, ENV['DATABASE_URL'] || "postgres://postgres:yayaya@localhost/dynette")
|
||||||
DOMAINS = ["nohost.me", "noho.st"]
|
DOMAINS = ["nohost.me", "noho.st"]
|
||||||
|
@ -70,9 +71,9 @@ end
|
||||||
['/test/:subdomain', '/key/:public_key', '/ips/:public_key', '/ban/:ip', '/unban/:ip' ].each do |path|
|
['/test/:subdomain', '/key/:public_key', '/ips/:public_key', '/ban/:ip', '/unban/:ip' ].each do |path|
|
||||||
before path do
|
before path do
|
||||||
if params.has_key?("public_key")
|
if params.has_key?("public_key")
|
||||||
params[:public_key] = Base64.decode64(params[:public_key])
|
public_key = Base64.decode64(params[:public_key])
|
||||||
unless params[:public_key].length = 24
|
unless public_key.length = 24
|
||||||
halt 400, { :error => "Key is invalid: #{params[:public_key]}" }.to_json
|
halt 400, { :error => "Key is invalid: #{public_key}" }.to_json
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if params.has_key?("subdomain")
|
if params.has_key?("subdomain")
|
||||||
|
|
Loading…
Reference in a new issue