diff --git a/blog/posts/2023-12-02_make-your-own-ddns/index.md b/blog/posts/2023-12-02_make-your-own-ddns/index.md index af00d3f..7b3aaed 100644 --- a/blog/posts/2023-12-02_make-your-own-ddns/index.md +++ b/blog/posts/2023-12-02_make-your-own-ddns/index.md @@ -146,7 +146,11 @@ ## The Script // https://api.ipify.org const publicIpUrl = "https://ipme.fosterhangdaan.com"; -const goDaddyUrl = `https://api.godaddy.com/v1/domains/${domain}/records/A/@`; +const domainParts = domain.split("."); +const domainRoot = domainParts.slice(-2).join("."); +const domainName = domainParts.slice(0,-2).join(".") || "@"; + +const goDaddyUrl = `https://api.godaddy.com/v1/domains/${domainRoot}/records/A/${domainName}`; const goDaddyRequestHeaders = new Headers({ Authorization: `sso-key ${GODADDY_API_KEY}:${GODADDY_API_SECRET}`,