Fix incorrect API URL

This commit is contained in:
Foster Hangdaan 2023-12-04 15:01:49 -05:00
parent 2a34772457
commit 351b12131e
Signed by: foster
GPG key ID: E48D7F49A852F112

View file

@ -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}`,