mirror of
https://github.com/YunoHost/dynette.git
synced 2024-09-03 20:06:17 +02:00
route fix
This commit is contained in:
parent
35ae88c705
commit
6eacfb61ba
2 changed files with 16 additions and 5 deletions
|
@ -12,17 +12,16 @@ for url in urls:
|
|||
domains = json.loads(str(urlopen(url +'/domains').read()))
|
||||
|
||||
for domain in domains:
|
||||
result = json.loads(str(urlopen(url +'/all').read()))
|
||||
|
||||
result = json.loads(str(urlopen(url +'/all/'+ domain).read()))
|
||||
lines.extend([
|
||||
'zone "'+ domain +'" {',
|
||||
' type master;',
|
||||
' file "/var/named/data/yoyoyo.fr.db"; ',
|
||||
' file "/var/named/data/'+ domain +'.db"; ',
|
||||
' update-policy {',
|
||||
])
|
||||
|
||||
for entry in result:
|
||||
fqdn = entry['subdomain'] +'.'+ domain +'.'
|
||||
fqdn = entry['subdomain'] +'.'
|
||||
lines.extend([
|
||||
' grant '+ fqdn +' name '+ fqdn +' A TXT;',
|
||||
' grant '+ fqdn +' name pubsub.'+ fqdn +' A;',
|
||||
|
@ -38,7 +37,7 @@ for url in urls:
|
|||
])
|
||||
|
||||
for entry in result:
|
||||
fqdn = entry['subdomain'] +'.'+ domain +'.'
|
||||
fqdn = entry['subdomain'] +'.'
|
||||
lines.extend([
|
||||
'key '+ fqdn +' {',
|
||||
' algorithm hmac-md5;',
|
||||
|
|
12
dynette.rb
12
dynette.rb
|
@ -161,6 +161,18 @@ get '/all' do
|
|||
Entry.all.to_json
|
||||
end
|
||||
|
||||
get '/all/:domain' do
|
||||
unless request.ip == ALLOWED_IP
|
||||
status 403
|
||||
return "Access denied"
|
||||
end
|
||||
result = []
|
||||
Entry.all.each do |entry|
|
||||
result.push(entry) if params[:domain] == entry.subdomain.gsub(entry.subdomain.split('.')[0]+'.', '')
|
||||
end
|
||||
halt 200, result.to_json
|
||||
end
|
||||
|
||||
get '/ips/:public_key' do
|
||||
unless request.ip == ALLOWED_IP
|
||||
status 403
|
||||
|
|
Loading…
Reference in a new issue