@@ -9,7 +9,7 @@ Issues: github.com/acmesh-official/acme.sh/issues/3998
9
9
Author: Timur Umarov <[email protected] >
10
10
'
11
11
12
- FORNEX_API_URL=" https://fornex.com/api/dns/v0.1 "
12
+ FORNEX_API_URL=" https://fornex.com/api"
13
13
14
14
# ####### Public functions #####################
15
15
@@ -30,12 +30,10 @@ dns_fornex_add() {
30
30
fi
31
31
32
32
_info " Adding record"
33
- if _rest POST " $_domain /entry_set/add/ " " host= $ fulldomain& type= TXT& value= $ txtvalue&apikey= $FORNEX_API_KEY " ; then
33
+ if _rest POST " dns/domain/ $_domain /entry_set/" " { \" host\" : \" ${ fulldomain} \" , \" type\" : \" TXT\" , \" value\" : \" ${ txtvalue} \" , \" ttl \" : null} " ; then
34
34
_debug _response " $response "
35
- if _contains " $response " ' "ok": true' || _contains " $response " ' Такая запись уже существует.' ; then
36
- _info " Added, OK"
37
- return 0
38
- fi
35
+ _info " Added, OK"
36
+ return 0
39
37
fi
40
38
_err " Add txt record error."
41
39
return 1
@@ -58,21 +56,21 @@ dns_fornex_rm() {
58
56
fi
59
57
60
58
_debug " Getting txt records"
61
- _rest GET " $_domain /entry_set.json?apikey= $FORNEX_API_KEY "
59
+ _rest GET " dns/domain/ $_domain /entry_set?type=TXT&q= $fulldomain "
62
60
63
61
if ! _contains " $response " " $txtvalue " ; then
64
62
_err " Txt record not found"
65
63
return 1
66
64
fi
67
65
68
- _record_id=" $( echo " $response " | _egrep_o " {[^{]*\" value\" *:*\" $txtvalue \" [^}]*}" | sed -n -e ' s#.*"id": \([0-9]*\).*#\1#p' ) "
66
+ _record_id=" $( echo " $response " | _egrep_o " \ {[^\ {]*\" value\" *:*\" $txtvalue \" [^\ }]*\ }" | sed -n -e ' s#.*"id":\([0-9]*\).*#\1#p' ) "
69
67
_debug " _record_id" " $_record_id "
70
68
if [ -z " $_record_id " ]; then
71
69
_err " can not find _record_id"
72
70
return 1
73
71
fi
74
72
75
- if ! _rest POST " $_domain /entry_set/$_record_id /delete/ " " apikey= $FORNEX_API_KEY " ; then
73
+ if ! _rest DELETE " dns/domain/ $_domain /entry_set/$_record_id /" ; then
76
74
_err " Delete record error."
77
75
return 1
78
76
fi
@@ -90,18 +88,18 @@ _get_root() {
90
88
91
89
i=1
92
90
while true ; do
93
- h=$( printf " %s" " $domain " | cut -d . -f " $i " -100)
91
+ h=$( printf " %s" " $domain " | cut -d . -f $i -100)
94
92
_debug h " $h "
95
93
if [ -z " $h " ]; then
96
94
# not valid
97
95
return 1
98
96
fi
99
97
100
- if ! _rest GET " domain_list.json?q= $h &apikey= $FORNEX_API_KEY " ; then
98
+ if ! _rest GET " dns/domain/ " ; then
101
99
return 1
102
100
fi
103
101
104
- if _contains " $response " " \" $h \" " > /dev/null; then
102
+ if _contains " $response " " \" name \" : \" $h \" " > /dev/null; then
105
103
_domain=$h
106
104
return 0
107
105
else
@@ -134,7 +132,9 @@ _rest() {
134
132
data=" $3 "
135
133
_debug " $ep "
136
134
137
- export _H1=" Accept: application/json"
135
+ export _H1=" Authorization: Api-Key $FORNEX_API_KEY "
136
+ export _H2=" Content-Type: application/json"
137
+ export _H3=" Accept: application/json"
138
138
139
139
if [ " $m " != " GET" ]; then
140
140
_debug data " $data "
0 commit comments