[updated] Fixes freedns.afraid.org ddns provider

Message ID CAHoP+V-mkAxCEntnh=CV3opBtVYFExLm8h=1atyL4EaNE79OoA@mail.gmail.com
State Accepted
Headers
Series [updated] Fixes freedns.afraid.org ddns provider |

Commit Message

Kashif Iftikhar Jan. 22, 2021, 1:26 p.m. UTC
  Updated according to feedback.


------------------------BEGIN PATCH---------------------------
From ca4865f02594666fc7e1a4578db3465555aae860 Mon Sep 17 00:00:00 2001
From: Kashif Iftikhar <kashif@compulife.com.pk>
Date: Fri, 22 Jan 2021 18:24:03 +0500
Subject: [PATCH 1/1] fixes freedns.afraid.org provider.

The URL for syncing had changed and now does not require sending the ip
with the request.

Signed-off-by: Kashif Iftikhar <kashif@compulife.com.pk>
---
 src/ddns/providers.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

         # Handle error codes.
  

Patch

diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index 56e6620..98d2747 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -1186,26 +1186,22 @@  class DDNSProviderFreeDNSAfraidOrg(DDNSProvider):

     # No information about the request or response could be found on the vendor
     # page. All used values have been collected by testing.
-    url = "https://freedns.afraid.org/dynamic/update.php"
+    url = "https://sync.afraid.org/u/"
     can_remove_records = False
     supports_token_auth = True

     def update_protocol(self, proto):
-        data = {
-            "address" : self.get_address(proto),
-        }
-
         # Add auth token to the update url.
-        url = "%s?%s" % (self.url, self.token)
+        url = "%s%s/" % (self.url, self.token)

         # Send update to the server.
-        response = self.send_request(url, data=data)
+        response = self.send_request(url)

         # Get the full response message.
         output = response.read().decode()

         # Handle success messages.
-        if output.startswith("Updated") or "has not changed" in output:
+        if output.startswith("Updated") or output.startswith("No IP
change detected"):
             return