Merge branch 'master' of github.com:asmaps/nsupdate.info
Conflicts: nsupdate/main/urls.py
This commit is contained in:
commit
abe8ee41ff
@ -24,7 +24,8 @@ def DetectIpView(request):
|
||||
af = dns.inet.af_for_address(ipaddr)
|
||||
key = 'ipv4' if af == dns.inet.AF_INET else 'ipv6'
|
||||
request.session[key] = ipaddr
|
||||
image_data = open(settings.STATIC_ROOT+"/1px.gif", "rb").read()
|
||||
with open(os.path.join(settings.STATIC_ROOT, "1px.gif"), "rb") as f:
|
||||
image_data = f.read()
|
||||
return HttpResponse(image_data, mimetype="image/png")
|
||||
|
||||
|
||||
|
@ -21,6 +21,15 @@ class SameIpError(ValueError):
|
||||
|
||||
|
||||
def update(fqdn, ipaddr, ttl=60):
|
||||
"""
|
||||
intelligent dns updater - first does a lookup on the master server to find
|
||||
the current ip and only sends a dynamic update if we have a different ip.
|
||||
|
||||
:param fqdn: fully qualified domain name (str)
|
||||
:param ipaddr: new ip address
|
||||
:param ttl: time to live, default 60s (int)
|
||||
:raises: SameIpError if new and old IP is the same
|
||||
"""
|
||||
af = dns.inet.af_for_address(ipaddr)
|
||||
rdtype = 'A' if af == dns.inet.AF_INET else 'AAAA'
|
||||
try:
|
||||
|
@ -1,12 +1,9 @@
|
||||
from django.conf.urls import patterns, include, url
|
||||
from main.views import (
|
||||
HomeView, OverviewView, HostView, DeleteHostView,
|
||||
)
|
||||
from api.views import (
|
||||
MyIpView, DetectIpView, NicUpdateView
|
||||
)
|
||||
from main.views import HomeView, OverviewView, HostView, DeleteHostView
|
||||
from api.views import MyIpView, DetectIpView, NicUpdateView
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^$', HomeView.as_view(), name="home"),
|
||||
url(r'^overview/$', OverviewView.as_view(), name='overview'),
|
||||
url(r'^host/(?P<pk>\d+)/$', HostView.as_view(), name='host_view'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user