Archived
Allow registration before first IP update
This commit is contained in:
1 parent
9f5cee8a0e
commit
c19e5170a0
5 files changed
+29
-20
No files matched your search
+13
-12
@@ -72,21 +72,21 @@ class DdnsService:
|
||||
ipaddr: str | None,
|
||||
myipv6: str | None,
|
||||
ip6addr: str | None,
|
||||
) -> None:
|
||||
) -> bool:
|
||||
if not dns_backend_configured(self.settings):
|
||||
return
|
||||
return False
|
||||
source_ip = client_ip(request, self.settings)
|
||||
source_fallback = source_ip if _is_global_ip(source_ip) else ""
|
||||
try:
|
||||
ipv4, ipv6, update_ipv4, update_ipv6 = parse_update_ips(
|
||||
source_fallback,
|
||||
myip,
|
||||
ipaddr,
|
||||
myipv6,
|
||||
ip6addr,
|
||||
)
|
||||
except BadIpError as exc:
|
||||
raise BadIpError("registration needs a public source IP or myip/myipv6 parameter") from exc
|
||||
supplied_ip = any(value and value.strip() for value in (myip, ipaddr, myipv6, ip6addr))
|
||||
if not supplied_ip and not source_fallback:
|
||||
return False
|
||||
ipv4, ipv6, update_ipv4, update_ipv6 = parse_update_ips(
|
||||
source_fallback,
|
||||
myip,
|
||||
ipaddr,
|
||||
myipv6,
|
||||
ip6addr,
|
||||
)
|
||||
lock = self._lock_for(hostname)
|
||||
with lock:
|
||||
planned = self.store.preview_update(hostname, ipv4, ipv6, update_ipv4=update_ipv4, update_ipv6=update_ipv6)
|
||||
@@ -115,6 +115,7 @@ class DdnsService:
|
||||
raise
|
||||
result = self.store.commit_update_result(planned)
|
||||
self.store.log_update_event(hostname, result.ipv4, result.ipv6, UPDATED, "initial dns registered", source_ip)
|
||||
return True
|
||||
|
||||
def apply_update(
|
||||
self,
|
||||
|
||||
Reference in new issue
Block a user