This commit is contained in:
friehmaen 2026-05-25 09:22:00 +08:00 committed by GitHub
commit 6e767d94d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -30,6 +30,7 @@
<help>DynDNS Server hostname or uri to use (depending on the protocol).
When a URI is provided, the tag __MYIP__ will be replaced with the current detected address for this service
and __HOSTNAME__ will contain the (comma separated) list of hostnames provided.
If the current address is an IPv6 the tag __IPV6PREFIX__ will be replaced with the /64 prefix of the current address.
</help>
<style>optional_setting service_custom service_powerdns</style>
</field>

View file

@ -23,6 +23,7 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
"""
import ipaddress
import syslog
import requests
from requests.auth import HTTPBasicAuth
@ -71,6 +72,8 @@ class DynDNS2(BaseAccount):
url = self.settings.get('server')
url = url.replace('__MYIP__', self.current_address)
url = url.replace('__HOSTNAME__', self.settings.get('hostnames'))
if self.current_address.find(':') > 0:
url = url.replace('__IPV6PREFIX__', str(ipaddress.ip_network("%s/64" % self.current_address, strict=False)))
req = requests.request(
method=protocol,
url=url,