public inbox for ddns@lists.ipfire.org
 help / color / mirror / Atom feed
From: Franco Masotti <solvecomputersciencecollabs@gmail.com>
To: ddns@lists.ipfire.org
Cc: Franco Masotti <franco.masotti@tutanota.com>
Subject: [PATCH 001/001] ddns: Add 1984.hosting Free DNS (DDNS) provider
Date: Sun, 25 Oct 2026 16:01:19 +0100	[thread overview]
Message-ID: <20261025150119.26418-1-solvecomputersciencecollabs@gmail.com> (raw)

From: Franco Masotti <franco.masotti@tutanota.com>

This patch adds support for 1984.hosting Free DNS to the ddns service.
This provider uses token authorization and a GET request with inline
parameters.

Signed-off-by: Franco Masotti <franco.masotti@tutanota.com>
---
 ddns.conf.sample      |  4 +++
 src/ddns/providers.py | 68 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+)

diff --git a/ddns.conf.sample b/ddns.conf.sample
index f1adf5d..a8f6ac8 100644
--- a/ddns.conf.sample
+++ b/ddns.conf.sample
@@ -14,6 +14,10 @@
 
 # Accounts are its own sections.
 # These are some examples.
+#
+# [test.1984.hosting]
+# provider = 1984.hosting
+# token = token
 
 # [test.all-inkl.com]
 # provider = all-inkl.com
diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index 59f9665..e5e3a7b 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -2017,3 +2017,71 @@ class DDNSProviderInfomaniak(DDNSProtocolDynDNS2, DDNSProvider):
 	# https://www.infomaniak.com/de/support/faq/2376/dyndns-aktualisieren-eines-dynamischen-dns-uber-die-api
 
 	url = "https://infomaniak.com/nic/update"
+
+
+class DDNSProvider1984Hosting(DDNSProvider):
+	handle    = "1984.hosting"
+	name      = "1984 Hosting Free DNS"
+	website   = "http://1984.hosting"
+	protocols = ("ipv6", "ipv4",)
+
+	# Information about the format of the request is to be found after logging
+	# in. The account and usage it totally free of cost
+	# https://1984.hosting/domains/freednsapi/
+	#
+	# General information on FreeDNS
+	# https://1984.hosting/knowledge-base/freedns/
+	#
+	# examples: https://api.1984.is/1.0/freedns/?apikey=apikey&domain=domain&ip=
+	#           https://api.1984.is/1.0/freedns/?apikey=apikey&domain=domain&ip=213.x.x.x
+	url = "https://api.1984.is/1.0/freedns/"
+	can_remove_records = False
+	supports_token_auth = True
+
+	def update_protocol(self, proto):
+		# Raise an error if no auth details are given.
+		if not self.token:
+			raise DDNSConfigurationError
+
+		address = self.get_address(proto)
+		data = {
+			"domain" : self.hostname,
+			"apikey" : self.token,
+			"ip"     : address,
+		}
+
+		# Send update to the server.
+		response = self.send_request(self.url, data=data)
+
+		# Get the full response message.
+		output = response.read().decode()
+
+		try:
+			# JSON Response official documentation:
+			#
+			# {
+			#   "ok": true or false depending on if the request was successful or not, if the ip is the same as before this will be true,
+			#   "msg": successes or why it is not working,
+			#   "lookup": if domain or subdomain was not found lookup will contain a list of names tried
+			# }
+			res = json.loads(output)
+		except json.JSONDecodeError:
+			raise DDNSUpdateError(_("Unable to decode server response, assuming request failed"))
+
+		if res.get("ok", False):
+			return
+		else:
+			# API reurns an undocumented 'error' JSON key-value if key is wrong.
+			error = res.get("error", "")
+			if error:
+				raise DDNSAuthenticationError
+			else:
+				message = res.get("msg", "")
+				if "record does not exist" in message:
+					raise DDNSRequestError(_("Invalid hostname specified"))
+				else:
+					raise DDNSUpdateError(_("Server response: %s") % message)
+
+		# If we got here, some other update error happened.
+		raise DDNSUpdateError
+
-- 
2.47.3



                 reply	other threads:[~2026-10-25 15:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261025150119.26418-1-solvecomputersciencecollabs@gmail.com \
    --to=solvecomputersciencecollabs@gmail.com \
    --cc=ddns@lists.ipfire.org \
    --cc=franco.masotti@tutanota.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox