From 7a6c170e6912cfe7b84a34f3924aa3fd1c21fd0e Mon Sep 17 00:00:00 2001 From: Qwerty4401 <102785432+Qwerty4401@users.noreply.github.com> Date: Fri, 14 Apr 2023 10:00:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8C=89=E7=85=A7cloudflare=E7=9A=84API?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按照cloudflare的API格式更新脚本 --- cfddns/cfddns/scripts/cfddns_config.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cfddns/cfddns/scripts/cfddns_config.sh b/cfddns/cfddns/scripts/cfddns_config.sh index 13573e86..b1f67b31 100755 --- a/cfddns/cfddns/scripts/cfddns_config.sh +++ b/cfddns/cfddns/scripts/cfddns_config.sh @@ -29,16 +29,14 @@ get_bol() { } get_record_response() { - curl -kLsX GET "https://api.cloudflare.com/client/v4/zones/${cfddns_zid}/dns_records?type=${record_type}&name=${cfddns_name_domain}&order=type&direction=desc&match=all" \ - -H "X-Auth-Email: ${cfddns_email}" \ - -H "X-Auth-Key: ${cfddns_akey}" \ + curl -kLsX GET "https://api.cloudflare.com/client/v4/zones/${cfddns_zid}/dns_records?type=${record_type}&name=${cfddns_name_domain}" \ + -H "Authorization: Bearer ${cfddns_akey}" \ -H "Content-type: application/json" } update_record() { curl -kLsX PUT "https://api.cloudflare.com/client/v4/zones/${cfddns_zid}/dns_records/${cfddns_id}" \ - -H "X-Auth-Email: ${cfddns_email}" \ - -H "X-Auth-Key: ${cfddns_akey}" \ + -H "Authorization: Bearer ${cfddns_akey}" \ -H "Content-Type: application/json" \ --data '{"type":"'${record_type}'","name":"'${cfddns_name_domain}'","content":"'${update_to_ip}'","ttl":'${cfddns_ttl}',"proxied":'$(get_bol)'}' } From 392835692f2fbbdb4d0715b3a4885eb61ecaf8d9 Mon Sep 17 00:00:00 2001 From: Qwerty4401 <102785432+Qwerty4401@users.noreply.github.com> Date: Fri, 14 Apr 2023 16:58:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8C=89=E7=85=A7cloudflare=E7=9A=84API?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按照cloudflare的API格式更新脚本 --- cfddns/cfddns/scripts/cfddns_config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfddns/cfddns/scripts/cfddns_config.sh b/cfddns/cfddns/scripts/cfddns_config.sh index b1f67b31..41012c89 100755 --- a/cfddns/cfddns/scripts/cfddns_config.sh +++ b/cfddns/cfddns/scripts/cfddns_config.sh @@ -29,7 +29,7 @@ get_bol() { } get_record_response() { - curl -kLsX GET "https://api.cloudflare.com/client/v4/zones/${cfddns_zid}/dns_records?type=${record_type}&name=${cfddns_name_domain}" \ + curl -kLsX GET "https://api.cloudflare.com/client/v4/zones/${cfddns_zid}/dns_records?type=${record_type}&name=${cfddns_name_domain}&order=type&direction=desc&match=all" \ -H "Authorization: Bearer ${cfddns_akey}" \ -H "Content-type: application/json" }