Skip to content

Commit

Permalink
update cloudflare ddns
Browse files Browse the repository at this point in the history
  • Loading branch information
sadoneli committed Nov 24, 2021
1 parent feb1741 commit 0db07a2
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 62 deletions.
2 changes: 1 addition & 1 deletion cfddns/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# build script for armsoft project

MODULE="cfddns"
VERSION="1.0"
VERSION="1.1"
TITLE="CloudFlare DDNS"
DESCRIPTION="CloudFlare DDNS"
HOME_URL="Module_cfddns.asp"
Expand Down
Binary file modified cfddns/cfddns.tar.gz
Binary file not shown.
26 changes: 12 additions & 14 deletions cfddns/cfddns/scripts/cfddns_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ LOGTIME=$(TZ=UTC-8 date -R "+%Y-%m-%d %H:%M:%S")
[ "$cfddns_ttl" = "" ] && cfddns_ttl="1"
get_type="A"

if [ "$cfddns_name" = "@" ];then
cfddns_name_domain=$cfddns_domain
else
cfddns_name_domain=$cfddns_name.$cfddns_domain
fi

get_bol() {
case "$cfddns_proxied" in
1)
Expand All @@ -21,16 +27,8 @@ get_bol() {
esac
}

get_json_value() {
local json=$1
local key=$2
if [ -z "$3" ]; then local num=1; else local num=$3; fi
local value=$(printf '%s' "$json" | awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'${key}'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p)
printf '%s' "$value"
}

get_record_response() {
curl -kLsX GET "https://api.cloudflare.com/client/v4/zones/$cfddns_zid/dns_records?type=$get_type&name=$cfddns_name.$cfddns_domain&order=type&direction=desc&match=all" \
curl -kLsX GET "https://api.cloudflare.com/client/v4/zones/$cfddns_zid/dns_records?type=$get_type&name=${cfddns_name_domain}&order=type&direction=desc&match=all" \
-H "X-Auth-Email: $cfddns_email" \
-H "X-Auth-Key: $cfddns_akey" \
-H "Content-type: application/json"
Expand All @@ -41,17 +39,17 @@ update_record() {
-H "X-Auth-Email: $cfddns_email" \
-H "X-Auth-Key: $cfddns_akey" \
-H "Content-Type: application/json" \
--data '{"type":"'$get_type'","name":"'$cfddns_name.$cfddns_domain'","content":"'$update_to_ip'","ttl":'$cfddns_ttl',"proxied":'$(get_bol)'}'
--data '{"type":"'$get_type'","name":"'${cfddns_name_domain}'","content":"'$update_to_ip'","ttl":'$cfddns_ttl',"proxied":'$(get_bol)'}'
}

get_info(){
get_type="A"
cfddns_result=`get_record_response`
if [ $(get_json_value "$cfddns_result" "success") = "true" ];then
if [ $(echo $cfddns_result | grep -c "\"success\":true") -gt 0 ];then
# CFDDNS的A记录ID
cfddns_id=`get_json_value "$cfddns_result" "id"`
cfddns_id=`echo $cfddns_result | awk -F"","" '{print $1}' | sed 's/{.*://g' | sed 's/\"//g'`
# CFDDNS的A记录IP
current_ip=`get_json_value "$cfddns_result" "content"`
current_ip=`echo $cfddns_result | awk -F"","" '{print $6}' | grep -oE '([0-9]{1,3}\.?){4}'`
echo_date CloudFlare IP为 $current_ip
else
dbus set cfddns_status="$LOGTIME】:获取IPV4解析记录错误!"
Expand Down Expand Up @@ -82,7 +80,7 @@ get_info_ipv6(){
# CFDDNS的AAAA记录ID
cfddns_id=`echo $cfddns_result | awk -F"","" '{print $1}' | sed 's/{.*://g' | sed 's/\"//g'`
# CFDDNS的AAAA记录IP
current_ipv6=`echo $cfddns_result | awk -F"","" '{print $4}' | grep -oE '([a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){0,7}::[a-f0-9]{0,4}(:[a-f0-9]{1,4}){0,7})'`
current_ipv6=`echo $cfddns_result | awk -F"","" '{print $6}' | grep -oE '([a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){0,7}::[a-f0-9]{0,4}(:[a-f0-9]{1,4}){0,7})'`
echo_date CfddsnIP为 $current_ipv6
else
dbus set cfddns_status="$LOGTIME】:获取IPV6解析记录错误!"
Expand Down
2 changes: 1 addition & 1 deletion cfddns/cfddns/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0
1.1
33 changes: 9 additions & 24 deletions cfddns/cfddns/webs/Module_cfddns.asp
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,19 @@
padding: 10px 3.75px;
border-radius: 5px 5px 0px 0px;
width:8.42%;
/*--------rog--------*/
/*border: 1px solid #91071f;*/
/*background: none;*/
/*--------non rog--------*/
border-left: 1px solid #67767d;
border-top: 1px solid #67767d;
border-right: 1px solid #67767d;
border-bottom: none;
background: #67767d;
border: 1px solid #91071f; /* W3C rogcss */
background: none; /* W3C rogcss */
}
.active {
/*--------rog--------*/
/*border: 1px solid #91071f;*/
/*background: #91071f;*/
/*--------non rog--------*/
border: 1px solid #2f3a3e;
background: #2f3a3e;
border: 1px solid #91071f; /* W3C rogcss */
background: #91071f; /* W3C rogcss */
}
.ss_btn {
border: 1px solid #222;
Expand All @@ -55,10 +51,8 @@
padding: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
width:14%;
/*--------rog--------*/
/*background: linear-gradient(to bottom, #91071f 0%, #700618 100%);*/
/*--------non rog--------*/
background: linear-gradient(to bottom, #003333 0%, #000000 100%);
background: linear-gradient(to bottom, #91071f 0%, #700618 100%); /* W3C rogcss */
}
.ss_btn:hover, .active3 {
border: 1px solid #222;
Expand All @@ -67,10 +61,8 @@
padding: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
width:14%;
/*--------rog--------*/
/*background: linear-gradient(to bottom, #cf0a2c 0%, #91071f 100%);*/
/*--------non rog--------*/
background: linear-gradient(to bottom, #27c9c9 0%, #279fd9 100%);
background: linear-gradient(to bottom, #cf0a2c 0%, #91071f 100%); /* W3C rogcss */
}
#log_content1{
width:97%;
Expand All @@ -83,18 +75,11 @@
outline:none;
overflow-x:hidden;
border:0px solid #222;
/*--------rog--------*/
/*background:transparent;*/
/*--------non rog--------*/
background:#475A5F;
background:transparent; /* W3C rogcss */
}
/*#cfddns_switch, #cfddns_status, #cfddns_settings, #cfddns_log, #cfddns_help {
border:1px solid #91071f;
}*/
#log_content{
outline: 1px solid #222;
width:748px;
}
#cfddns_switch, #cfddns_status, #cfddns_settings, #cfddns_log, #cfddns_help { border:1px solid #91071f; } /* W3C rogcss */
#log_content{ outline: 1px solid #222;width:748px; }
input[type=button]:focus {
outline: none;
}
Expand Down
8 changes: 4 additions & 4 deletions cfddns/config.json.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"version":"1.0",
"md5":"fe1167c6fa013098c372523d9536cb06",
"version":"1.1",
"md5":"ef14adb89c43338a50e4c970b5345050",
"home_url":"Module_cfddns.asp",
"title":"CloudFlare DDNS",
"description":"CloudFlare DDNS",
"tags":"网络 DDNS",
"tags":"DDNS",
"author":"sadog",
"link":"",
"changelog":"",
"build_date":"2021-08-05_20:49:34"
"build_date":"2021-11-24_11:03:45"
}
4 changes: 2 additions & 2 deletions cfddns/version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1.0
fe1167c6fa013098c372523d9536cb06
1.1
ef14adb89c43338a50e4c970b5345050
8 changes: 4 additions & 4 deletions softcenter/app.json.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@
},
{
"author": "sadog",
"build_date": "2021-08-05_20:49:34",
"build_date": "2021-11-24_11:03:45",
"changelog": "",
"description": "CloudFlare DDNS",
"home_url": "Module_cfddns.asp",
"link": "",
"md5": "fe1167c6fa013098c372523d9536cb06",
"md5": "ef14adb89c43338a50e4c970b5345050",
"name": "cfddns",
"tags": "网络 DDNS",
"tags": "DDNS",
"tar_url": "cfddns/cfddns.tar.gz",
"title": "CloudFlare DDNS",
"version": "1.0"
"version": "1.1"
},
{
"author": "freexiaoyao",
Expand Down
44 changes: 32 additions & 12 deletions wifiboost/wifiboost/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ get_ui_type(){
ROG_RTAC86U=1
fi
# GT-AC2900
if [ "${MODEL}" == "GT-AC2900" ] && [ "{FW_TYPE_CODE}" == "3" -o "{FW_TYPE_CODE}" == "4" ];then
if [ "${MODEL}" == "GT-AC2900" ] && [ "${FW_TYPE_CODE}" == "3" -o "${FW_TYPE_CODE}" == "4" ];then
# GT-AC2900从386.1开始已经支持梅林固件,其UI是ASUSWRT
ROG_GTAC2900=0
fi
# GT-AX11000
if [ "${MODEL}" == "GT-AX11000" -o "${MODEL}" == "GT-AX11000_BO4" ] && [ "{FW_TYPE_CODE}" == "3" -o "{FW_TYPE_CODE}" == "4" ];then
if [ "${MODEL}" == "GT-AX11000" -o "${MODEL}" == "GT-AX11000_BO4" ] && [ "${FW_TYPE_CODE}" == "3" -o "${FW_TYPE_CODE}" == "4" ];then
# GT-AX11000从386.2开始已经支持梅林固件,其UI是ASUSWRT
ROG_GTAX11000=0
fi
Expand All @@ -98,6 +98,10 @@ exit_install(){
rm -rf /tmp/${module}* >/dev/null 2>&1
exit 1
;;
2)
rm -rf /tmp/${module}* >/dev/null 2>&1
exit 1
;;
0|*)
rm -rf /tmp/${module}* >/dev/null 2>&1
exit 0
Expand All @@ -110,9 +114,11 @@ install_ui(){
get_ui_type
if [ "${UI_TYPE}" == "ROG" ];then
echo_date "安装ROG皮肤!"
sed -i '/asuscss/d' /koolshare/webs/Module_${module}.asp >/dev/null 2>&1
fi
if [ "${UI_TYPE}" == "TUF" ];then
echo_date "安装TUF皮肤!"
sed -i '/asuscss/d' /koolshare/webs/Module_${module}.asp >/dev/null 2>&1
sed -i 's/3e030d/3e2902/g;s/91071f/92650F/g;s/680516/D0982C/g;s/cf0a2c/c58813/g;s/700618/74500b/g;s/530412/92650F/g' /koolshare/webs/Module_${module}.asp >/dev/null 2>&1
fi
if [ "${UI_TYPE}" == "ASUSWRT" ];then
Expand All @@ -128,14 +134,16 @@ install_now(){
local PLVER=$(cat ${DIR}/version)

# remove some useless file
if [ -f "/koolshare/res/wifiboost" ];then
rm -rf /koolshare/res/wifiboost
fi
rm -rf /koolshare/res/wifiboost >/dev/null 2>&1
rm -rf /koolshare/bin/wifiboost* >/dev/null 2>&1
rm -rf /koolshare/scripts/wifiboost* >/dev/null 2>&1
rm -rf /koolshare/scripts/*wifiboost* >/dev/null 2>&1

# isntall file
echo_date "安装插件相关文件..."
cd /tmp
cp -rf /tmp/${module}/bin/wifiboost /koolshare/bin/
[ -f /tmp/${module}/bin/wifiboost ] && cp -rf /tmp/${module}/bin/wifiboost /koolshare/bin/
[ -f /tmp/${module}/bin/wifiboost.sh ] && cp -rf /tmp/${module}/bin/wifiboost.sh /koolshare/bin/
cp -rf /tmp/${module}/res/* /koolshare/res/
cp -rf /tmp/${module}/scripts/* /koolshare/scripts/
cp -rf /tmp/${module}/webs/* /koolshare/webs/
Expand All @@ -145,6 +153,10 @@ install_now(){
cp -rf /tmp/${module}/bin/wl /koolshare/bin/
fi

if [ "${MODEL}" == "RAX80" -o "${MODEL}" == "RAX50" ];then
cp -rf /tmp/${module}/bin/xxd /koolshare/bin/
fi

# Permissions
chmod 755 /koolshare/bin/* >/dev/null 2>&1
chmod 755 /koolshare/scripts/* >/dev/null 2>&1
Expand All @@ -162,14 +174,22 @@ install_now(){
dbus set softcenter_module_${module}_description="${DESCR}"
dbus remove wifiboost_warn
sync
echo 1 > /proc/sys/vm/drop_caches
sleep 2
echo_date "${TITLE}】插件正在安装,请稍后!"
if [ -x "/koolshare/bin/start-stop-daemon" ];then
/koolshare/bin/start-stop-daemon -S -q -b -x /koolshare/bin/wifiboost -- install
else
/koolshare/bin/wifiboost install
fi

if [ -x "/koolshare/bin/wifiboost.sh" ];then
if [ -x "/koolshare/bin/start-stop-daemon" ];then
/koolshare/bin/start-stop-daemon -S -q -b -x /koolshare/bin/wifiboost.sh -- install
else
/koolshare/bin/wifiboost.sh install
fi
elif [ -x "/koolshare/bin/wifiboost" ];then
if [ -x "/koolshare/bin/start-stop-daemon" ];then
/koolshare/bin/start-stop-daemon -S -q -b -x /koolshare/bin/wifiboost -- install
else
/koolshare/bin/wifiboost install
fi
fi
# finish
echo_date "${TITLE}】插件安装完毕!"
exit_install
Expand Down

0 comments on commit 0db07a2

Please sign in to comment.