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
340ecea987
commit
1cf19fd581
1 changed files with 4 additions and 0 deletions
|
@ -109,6 +109,7 @@ end
|
|||
|
||||
|
||||
post '/key/:public_key' do
|
||||
params[:public_key] = Base64.decode64(params[:public_key])
|
||||
# Check params
|
||||
halt 400, { :error => "Please indicate a subdomain" }.to_json unless params.has_key?("subdomain")
|
||||
|
||||
|
@ -131,6 +132,7 @@ post '/key/:public_key' do
|
|||
end
|
||||
|
||||
put '/key/:public_key' do
|
||||
params[:public_key] = Base64.decode64(params[:public_key])
|
||||
entry = Entry.first(:public_key => params[:public_key])
|
||||
unless request.ip == entry.current_ip
|
||||
entry.ips << Ip.create(:ip_addr => request.ip)
|
||||
|
@ -144,6 +146,7 @@ put '/key/:public_key' do
|
|||
end
|
||||
|
||||
delete '/key/:public_key' do
|
||||
params[:public_key] = Base64.decode64(params[:public_key])
|
||||
if entry = Entry.first(:public_key => params[:public_key])
|
||||
if entry.destroy
|
||||
halt 200, "OK".to_json
|
||||
|
@ -174,6 +177,7 @@ get '/all/:domain' do
|
|||
end
|
||||
|
||||
get '/ips/:public_key' do
|
||||
params[:public_key] = Base64.decode64(params[:public_key])
|
||||
unless ALLOWED_IP.include? request.ip
|
||||
status 403
|
||||
return "Access denied"
|
||||
|
|
Loading…
Reference in a new issue