mirror of
https://github.com/kenzok8/openwrt-packages
synced 2025-01-07 07:06:45 +08:00
update 2024-04-22 02:00:41
This commit is contained in:
parent
ca66e67fb5
commit
c01da4d0e8
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2017 chenhw2
|
Copyright (c) 2017-2024 honwen
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2018-2021 chenhw2 <https://github.com/chenhw2/>
|
# Copyright (C) 2018-2024 honwen <https://github.com/honwen/>
|
||||||
#
|
#
|
||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
#
|
#
|
||||||
@ -7,12 +7,12 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-aliddns
|
PKG_NAME:=luci-app-aliddns
|
||||||
PKG_VERSION:=0.4.1
|
PKG_VERSION:=0.4.2
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_LICENSE:=MIT
|
PKG_LICENSE:=MIT
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
PKG_MAINTAINER:=chenhw2 <https://github.com/chenhw2/>
|
PKG_MAINTAINER:=honwen <https://github.com/honwen/>
|
||||||
|
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ tar axvf lede-sdk-17.01.*-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64.tar.
|
|||||||
cd lede-sdk-17.01.*-ar71xx-*
|
cd lede-sdk-17.01.*-ar71xx-*
|
||||||
# Clone 项目
|
# Clone 项目
|
||||||
mkdir -p package/feeds
|
mkdir -p package/feeds
|
||||||
git clone https://github.com/chenhw2/luci-app-aliddns.git package/feeds/luci-app-aliddns
|
git clone https://github.com/honwen/luci-app-aliddns.git package/feeds/luci-app-aliddns
|
||||||
# 编译 po2lmo (如果有po2lmo可跳过)
|
# 编译 po2lmo (如果有po2lmo可跳过)
|
||||||
pushd package/feeds/luci-app-aliddns/tools/po2lmo
|
pushd package/feeds/luci-app-aliddns/tools/po2lmo
|
||||||
make && sudo make install
|
make && sudo make install
|
||||||
|
@ -19,6 +19,9 @@ msgstr "启用 IPv6"
|
|||||||
msgid "Base"
|
msgid "Base"
|
||||||
msgstr "基本设置"
|
msgstr "基本设置"
|
||||||
|
|
||||||
|
msgid "Internet"
|
||||||
|
msgstr "Internet(ip-api.com)"
|
||||||
|
|
||||||
msgid "WAN-IP Source"
|
msgid "WAN-IP Source"
|
||||||
msgstr "WAN-IP来源"
|
msgstr "WAN-IP来源"
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
local a = require"luci.sys"
|
local a = require("luci.sys")
|
||||||
local e = luci.model.uci.cursor()
|
local e = luci.model.uci.cursor()
|
||||||
local e = require"nixio.fs"
|
local e = require("nixio.fs")
|
||||||
require("luci.sys")
|
require("luci.sys")
|
||||||
local t, e ,o
|
local t, e, o
|
||||||
|
|
||||||
t = Map("aliddns", translate("AliDDNS"))
|
t = Map("aliddns", translate("AliDDNS"))
|
||||||
|
|
||||||
@ -15,25 +15,35 @@ enable.rmempty = false
|
|||||||
enable = e:option(Flag, "clean", translate("Clean Before Update"))
|
enable = e:option(Flag, "clean", translate("Clean Before Update"))
|
||||||
enable.rmempty = false
|
enable.rmempty = false
|
||||||
|
|
||||||
ipv4 = e:option(Flag,"ipv4",translate("Enabled IPv4"))
|
ipv4 = e:option(Flag, "ipv4", translate("Enabled IPv4"))
|
||||||
ipv4.rmempty=false
|
ipv4.rmempty = false
|
||||||
|
|
||||||
ipv6 = e:option(Flag,"ipv6",translate("Enabled IPv6"))
|
ipv6 = e:option(Flag, "ipv6", translate("Enabled IPv6"))
|
||||||
ipv6.rmempty=false
|
ipv6.rmempty = false
|
||||||
|
|
||||||
token = e:option(Value, "app_key", translate("Access Key ID"))
|
token = e:option(Value, "app_key", translate("Access Key ID"))
|
||||||
|
|
||||||
email = e:option(Value, "app_secret", translate("Access Key Secret"))
|
email = e:option(Value, "app_secret", translate("Access Key Secret"))
|
||||||
|
|
||||||
iface = e:option(ListValue, "interface", translate("WAN-IP Source"), translate("Select the WAN-IP Source for AliDDNS, like wan/internet"))
|
iface = e:option(
|
||||||
|
ListValue,
|
||||||
|
"interface",
|
||||||
|
translate("WAN-IP Source"),
|
||||||
|
translate("Select the WAN-IP Source for AliDDNS, like wan/internet")
|
||||||
|
)
|
||||||
iface:value("", translate("Select WAN-IP Source"))
|
iface:value("", translate("Select WAN-IP Source"))
|
||||||
iface:value("internet")
|
iface:value("internet", translate("Internet"))
|
||||||
iface:value("wan")
|
iface:value("wan")
|
||||||
iface.rmempty = false
|
iface.rmempty = false
|
||||||
|
|
||||||
iface6 = e:option(ListValue, "interface6", translate("WAN6-IP Source"),translate("Select the WAN6-IP Source for AliDDNS, like wan6/internet"))
|
iface6 = e:option(
|
||||||
iface6:value("",translate("Select WAN6-IP Source"))
|
ListValue,
|
||||||
iface6:value("internet")
|
"interface6",
|
||||||
|
translate("WAN6-IP Source"),
|
||||||
|
translate("Select the WAN6-IP Source for AliDDNS, like wan6/internet")
|
||||||
|
)
|
||||||
|
iface6:value("", translate("Select WAN6-IP Source"))
|
||||||
|
iface6:value("internet", translate("Internet"))
|
||||||
iface6:value("wan")
|
iface6:value("wan")
|
||||||
iface6:value("wan6")
|
iface6:value("wan6")
|
||||||
iface6:value("wan_6")
|
iface6:value("wan_6")
|
||||||
@ -51,21 +61,20 @@ time.rmempty = false
|
|||||||
e = t:section(TypedSection, "base", translate("Update Log"))
|
e = t:section(TypedSection, "base", translate("Update Log"))
|
||||||
e.anonymous = true
|
e.anonymous = true
|
||||||
local a = "/var/log/aliddns.log"
|
local a = "/var/log/aliddns.log"
|
||||||
tvlog = e:option(TextValue,"sylogtext")
|
tvlog = e:option(TextValue, "sylogtext")
|
||||||
tvlog.rows = 16
|
tvlog.rows = 16
|
||||||
tvlog.readonly = "readonly"
|
tvlog.readonly = "readonly"
|
||||||
tvlog.wrap = "off"
|
tvlog.wrap = "off"
|
||||||
|
|
||||||
function tvlog.cfgvalue(e,e)
|
function tvlog.cfgvalue(e, e)
|
||||||
sylogtext = ""
|
sylogtext = ""
|
||||||
if a and nixio.fs.access(a) then
|
if a and nixio.fs.access(a) then
|
||||||
sylogtext = luci.sys.exec("tail -n 100 %s"%a)
|
sylogtext = luci.sys.exec("tail -n 100 %s" % a)
|
||||||
end
|
end
|
||||||
return sylogtext
|
return sylogtext
|
||||||
end
|
end
|
||||||
|
|
||||||
tvlog.write = function(e,e,e)
|
tvlog.write = function(e, e, e) end
|
||||||
end
|
|
||||||
|
|
||||||
local e = luci.http.formvalue("cbi.apply")
|
local e = luci.http.formvalue("cbi.apply")
|
||||||
if e then
|
if e then
|
||||||
|
@ -10,35 +10,38 @@ uci_get_by_name() {
|
|||||||
|
|
||||||
uci_bool_by_name() {
|
uci_bool_by_name() {
|
||||||
case "$(uci_get_by_name $1 $2)" in
|
case "$(uci_get_by_name $1 $2)" in
|
||||||
1|on|true|yes|enabled) return 0;;
|
1 | on | true | yes | enabled) return 0 ;;
|
||||||
esac
|
esac
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
intelnetip() {
|
intelnetip() {
|
||||||
tmp_ip=`curl -sL --connect-timeout 3 members.3322.org/dyndns/getip`
|
tmp_ip=$(curl -sL --connect-timeout 3 members.3322.org/dyndns/getip)
|
||||||
if [ "Z$tmp_ip" == "Z" ]; then
|
if [ "Z$tmp_ip" == "Z" ]; then
|
||||||
tmp_ip=`curl -sL --connect-timeout 3 api-ipv4.ip.sb/ip`
|
tmp_ip=$(curl -sL --connect-timeout 3 api-ipv4.ip.sb/ip)
|
||||||
fi
|
fi
|
||||||
if [ "Z$tmp_ip" == "Z" ]; then
|
if [ "Z$tmp_ip" == "Z" ]; then
|
||||||
tmp_ip=`curl -sL --connect-timeout 3 v4.myip.la`
|
tmp_ip=$(curl -sL --connect-timeout 3 v4.myip.la)
|
||||||
fi
|
fi
|
||||||
if [ "Z$tmp_ip" == "Z" ]; then
|
if [ "Z$tmp_ip" == "Z" ]; then
|
||||||
tmp_ip=`curl -sL --connect-timeout 3 whatismyip.akamai.com`
|
tmp_ip=$(curl -sL --connect-timeout 3 whatismyip.akamai.com)
|
||||||
fi
|
fi
|
||||||
echo -n $tmp_ip
|
echo -n $tmp_ip
|
||||||
}
|
}
|
||||||
|
|
||||||
intelnetip6() {
|
intelnetip6() {
|
||||||
tmp_ip6=`curl -sL --connect-timeout 3 ipv6.whatismyip.akamai.com`
|
tmp_ip6=$(curl -sL --connect-timeout 3 ipv6.testipv6.cn/ip | sed 's+"+\n+g' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})' | head -n1)
|
||||||
if [ "Z$tmp_ip6" == "Z" ]; then
|
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||||
tmp_ip6=`curl -sL --connect-timeout 3 speed.neu6.edu.cn/getIP.php`
|
tmp_ip6=$(curl -sL --connect-timeout 3 ip6only.me/api | sed 's+,+\n+g' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})' | head -n1)
|
||||||
fi
|
fi
|
||||||
if [ "Z$tmp_ip6" == "Z" ]; then
|
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||||
tmp_ip6=`curl -sL --connect-timeout 3 v6.ident.me`
|
tmp_ip6=$(curl -sL --connect-timeout 3 speed.neu6.edu.cn/getIP.php)
|
||||||
fi
|
fi
|
||||||
if [ "Z$tmp_ip6" == "Z" ]; then
|
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||||
tmp_ip6=`curl -sL --connect-timeout 3 api-ipv6.ip.sb/ip`
|
tmp_ip6=$(curl -sL --connect-timeout 3 v6.ident.me)
|
||||||
|
fi
|
||||||
|
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||||
|
tmp_ip6=$(curl -sL --connect-timeout 3 api-ipv6.ip.sb/ip)
|
||||||
fi
|
fi
|
||||||
echo -n $tmp_ip6
|
echo -n $tmp_ip6
|
||||||
}
|
}
|
||||||
@ -46,15 +49,15 @@ intelnetip6() {
|
|||||||
resolve2ip() {
|
resolve2ip() {
|
||||||
# resolve2ip domain<string>
|
# resolve2ip domain<string>
|
||||||
domain=$1
|
domain=$1
|
||||||
tmp_ip=`nslookup $domain ns1.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tail -n1`
|
tmp_ip=$(nslookup $domain ns1.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tail -n1)
|
||||||
if [ "Z$tmp_ip" == "Z" ]; then
|
if [ "Z$tmp_ip" == "Z" ]; then
|
||||||
tmp_ip=`nslookup $domain ns2.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tail -n1`
|
tmp_ip=$(nslookup $domain ns2.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tail -n1)
|
||||||
fi
|
fi
|
||||||
if [ "Z$tmp_ip" == "Z" ]; then
|
if [ "Z$tmp_ip" == "Z" ]; then
|
||||||
tmp_ip=`nslookup $domain 114.114.115.115 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tail -n1`
|
tmp_ip=$(nslookup $domain 114.114.115.115 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tail -n1)
|
||||||
fi
|
fi
|
||||||
if [ "Z$tmp_ip" == "Z" ]; then
|
if [ "Z$tmp_ip" == "Z" ]; then
|
||||||
tmp_ip=`curl -sL --connect-timeout 3 "119.29.29.29/d?dn=$domain"`
|
tmp_ip=$(curl -sL --connect-timeout 3 "119.29.29.29/d?dn=$domain")
|
||||||
fi
|
fi
|
||||||
echo -n $tmp_ip
|
echo -n $tmp_ip
|
||||||
}
|
}
|
||||||
@ -62,15 +65,15 @@ resolve2ip() {
|
|||||||
resolve2ip6() {
|
resolve2ip6() {
|
||||||
# resolve2ip6 domain<string>
|
# resolve2ip6 domain<string>
|
||||||
domain=$1
|
domain=$1
|
||||||
tmp_ip6=`nslookup $domain ns1.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})' | tail -n1`
|
tmp_ip6=$(nslookup $domain ns1.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})' | tail -n1)
|
||||||
if [ "Z$tmp_ip6" == "Z" ]; then
|
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||||
tmp_ip6=`nslookup $domain ns2.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})' | tail -n1`
|
tmp_ip6=$(nslookup $domain ns2.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})' | tail -n1)
|
||||||
fi
|
fi
|
||||||
if [ "Z$tmp_ip6" == "Z" ]; then
|
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||||
tmp_ip6=`nslookup $domain 114.114.115.115 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})' | tail -n1`
|
tmp_ip6=$(nslookup $domain 114.114.115.115 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})' | tail -n1)
|
||||||
fi
|
fi
|
||||||
if [ "Z$tmp_ip6" == "Z" ]; then
|
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||||
tmp_ip6=`curl -sL --connect-timeout 3 "119.29.29.29/d?dn=$domain&type=AAAA"`
|
tmp_ip6=$(curl -sL --connect-timeout 3 "119.29.29.29/d?dn=$domain&type=AAAA")
|
||||||
fi
|
fi
|
||||||
echo -n $tmp_ip6
|
echo -n $tmp_ip6
|
||||||
}
|
}
|
||||||
@ -91,6 +94,7 @@ check_aliddns() {
|
|||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
echo "$DATE UPDATING..."
|
echo "$DATE UPDATING..."
|
||||||
|
ip6_escape=$(urlencode "$current_ip")
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -102,14 +106,12 @@ check_aliddns6() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
current_ip6=$(resolve2ip6 "$dm_real")
|
current_ip6=$(resolve2ip6 "$dm_real")
|
||||||
|
echo "$DATE DOMAIN-IP6: ${current_ip6}"
|
||||||
|
|
||||||
#urlencode current_ip6
|
if [ "Z$current_ip6" == "Z" ]; then
|
||||||
current_ip6_urlencode=$(urlencode "$current_ip6")
|
|
||||||
if [ "Z$current_ip6_urlencode" == "Z" ]; then
|
|
||||||
rrid6='' # NO Resolve IP Means new Record_ID
|
rrid6='' # NO Resolve IP Means new Record_ID
|
||||||
fi
|
fi
|
||||||
echo "$DATE DOMAIN-IP6: ${current_ip6_urlencode}"
|
if [ "Z$ip6" == "Z$current_ip6" ]; then
|
||||||
if [ "Z$ip6" == "Z$current_ip6_urlencode" ]; then
|
|
||||||
echo "$DATE IPv6 dont need UPDATE..."
|
echo "$DATE IPv6 dont need UPDATE..."
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
@ -118,14 +120,13 @@ check_aliddns6() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
urlencode() {
|
urlencode() {
|
||||||
# urlencode url<string>
|
# urlencode url<string>
|
||||||
out=''
|
out=''
|
||||||
for c in $(echo -n $1 | sed 's/[^\n]/&\n/g'); do
|
for c in $(echo -n $1 | sed 's/[^\n]/&\n/g'); do
|
||||||
case $c in
|
case $c in
|
||||||
[a-zA-Z0-9._-]) out="$out$c" ;;
|
[a-zA-Z0-9._-]) out="$out$c" ;;
|
||||||
*) out="$out$(printf '%%%02X' "'$c")" ;;
|
*) out="$out$(printf '%%%02X' "'$c")" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
echo -n $out
|
echo -n $out
|
||||||
@ -171,7 +172,7 @@ del_record() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_ddns_record() {
|
do_ddns_record() {
|
||||||
if uci_bool_by_name base clean ; then
|
if uci_bool_by_name base clean; then
|
||||||
query_recordid | get_recordid | while read rr; do
|
query_recordid | get_recordid | while read rr; do
|
||||||
echo "$DATE Clean record $dm_show: $rr"
|
echo "$DATE Clean record $dm_show: $rr"
|
||||||
del_record $rr >/dev/null
|
del_record $rr >/dev/null
|
||||||
@ -180,10 +181,10 @@ do_ddns_record() {
|
|||||||
rrid=''
|
rrid=''
|
||||||
fi
|
fi
|
||||||
if [ "Z$rrid" == "Z" ]; then
|
if [ "Z$rrid" == "Z" ]; then
|
||||||
rrid=`query_recordid | get_recordid`
|
rrid=$(query_recordid | get_recordid)
|
||||||
fi
|
fi
|
||||||
if [ "Z$rrid" == "Z" ]; then
|
if [ "Z$rrid" == "Z" ]; then
|
||||||
rrid=`add_record | get_recordid`
|
rrid=$(add_record | get_recordid)
|
||||||
echo "$DATE ADD record $rrid"
|
echo "$DATE ADD record $rrid"
|
||||||
else
|
else
|
||||||
update_record $rrid >/dev/null 2>&1
|
update_record $rrid >/dev/null 2>&1
|
||||||
@ -201,7 +202,7 @@ do_ddns_record() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_ddns_record6() {
|
do_ddns_record6() {
|
||||||
if uci_bool_by_name base clean ; then
|
if uci_bool_by_name base clean; then
|
||||||
query_recordid6 | get_recordid | while read rr; do
|
query_recordid6 | get_recordid | while read rr; do
|
||||||
echo "$DATE Clean record $dm_show: $rr"
|
echo "$DATE Clean record $dm_show: $rr"
|
||||||
del_record $rr >/dev/null
|
del_record $rr >/dev/null
|
||||||
@ -210,10 +211,10 @@ do_ddns_record6() {
|
|||||||
rrid6=''
|
rrid6=''
|
||||||
fi
|
fi
|
||||||
if [ "Z$rrid6" == "Z" ]; then
|
if [ "Z$rrid6" == "Z" ]; then
|
||||||
rrid6=`query_recordid6 | get_recordid`
|
rrid6=$(query_recordid6 | get_recordid)
|
||||||
fi
|
fi
|
||||||
if [ "Z$rrid6" == "Z" ]; then
|
if [ "Z$rrid6" == "Z" ]; then
|
||||||
rrid6=`add_record6 | get_recordid`
|
rrid6=$(add_record6 | get_recordid)
|
||||||
echo "$DATE ADD record $rrid6"
|
echo "$DATE ADD record $rrid6"
|
||||||
else
|
else
|
||||||
update_record6 $rrid6 >/dev/null 2>&1
|
update_record6 $rrid6 >/dev/null 2>&1
|
||||||
@ -231,25 +232,25 @@ do_ddns_record6() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clean_log() {
|
clean_log() {
|
||||||
if [ $(cat $log_file 2>/dev/null | wc -l) -ge 16 ]; then
|
if [ $(cat $log_file 2>/dev/null | wc -l) -ge 240 ]; then
|
||||||
rm -f $log_file && touch $log_file
|
rm -f $log_file && touch $log_file
|
||||||
echo "$DATE Log Cleaned"
|
echo "$DATE Log Cleaned"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -x /usr/bin/openssl -a -x /usr/bin/curl -a -x /bin/sed ] || {
|
[ -x /usr/bin/openssl -a -x /usr/bin/curl -a -x /bin/sed ] || {
|
||||||
echo "Need [ openssl + curl + sed ]"
|
echo "Need [ openssl + curl + sed ]"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
ipv4=$(uci_get_by_name base ipv4)
|
ipv4=$(uci_get_by_name base ipv4)
|
||||||
ipv6=$(uci_get_by_name base ipv6)
|
ipv6=$(uci_get_by_name base ipv6)
|
||||||
ak_id=$(uci_get_by_name base app_key)
|
ak_id=$(uci_get_by_name base app_key)
|
||||||
ak_sec=$(uci_get_by_name base app_secret)
|
ak_sec=$(uci_get_by_name base app_secret)
|
||||||
rrid=$(uci_get_by_name base record_id)
|
rrid=$(uci_get_by_name base record_id)
|
||||||
rrid6=$(uci_get_by_name base record_id6)
|
rrid6=$(uci_get_by_name base record_id6)
|
||||||
main_dm=$(uci_get_by_name base main_domain)
|
main_dm=$(uci_get_by_name base main_domain)
|
||||||
sub_dm=$(uci_get_by_name base sub_domain)
|
sub_dm=$(uci_get_by_name base sub_domain)
|
||||||
|
|
||||||
if [ "Z$sub_dm" == "Z@" -o "Z$sub_dm" == "Z" ]; then
|
if [ "Z$sub_dm" == "Z@" -o "Z$sub_dm" == "Z" ]; then
|
||||||
dm_real="$main_dm"
|
dm_real="$main_dm"
|
||||||
@ -257,9 +258,10 @@ else
|
|||||||
dm_real="$sub_dm.$main_dm"
|
dm_real="$sub_dm.$main_dm"
|
||||||
fi
|
fi
|
||||||
dm_show="$sub_dm.$main_dm"
|
dm_show="$sub_dm.$main_dm"
|
||||||
dm_escape=`urlencode "$sub_dm.$main_dm"`
|
dm_escape=$(urlencode "$sub_dm.$main_dm")
|
||||||
sub_dm_escape=`urlencode "$sub_dm"`
|
sub_dm_escape=$(urlencode "$sub_dm")
|
||||||
|
|
||||||
|
# ================================================== ddns v4 ==================================================
|
||||||
iface=$(uci_get_by_name base interface)
|
iface=$(uci_get_by_name base interface)
|
||||||
if [ "Z$iface" == "Zinternet" -o "Z$iface" == "Z" ]; then
|
if [ "Z$iface" == "Zinternet" -o "Z$iface" == "Z" ]; then
|
||||||
ip=$(intelnetip)
|
ip=$(intelnetip)
|
||||||
@ -270,14 +272,13 @@ fi
|
|||||||
DATE=$(date +'%Y-%m-%d %H:%M:%S')
|
DATE=$(date +'%Y-%m-%d %H:%M:%S')
|
||||||
timestamp=$(date -u "+%Y-%m-%dT%H%%3A%M%%3A%SZ")
|
timestamp=$(date -u "+%Y-%m-%dT%H%%3A%M%%3A%SZ")
|
||||||
|
|
||||||
clean_log
|
|
||||||
# uci_bool_by_name base ipv4 && check_aliddns || do_ddns_record
|
# uci_bool_by_name base ipv4 && check_aliddns || do_ddns_record
|
||||||
if [ $ipv4 -eq 1 ]; then
|
if [ $ipv4 -eq 1 ]; then
|
||||||
check_aliddns || do_ddns_record
|
check_aliddns || do_ddns_record
|
||||||
fi
|
fi
|
||||||
|
# ================================================== ddns v4 ==================================================
|
||||||
|
|
||||||
# exit if ipv6 not-enabled
|
# ================================================== ddns v6 ==================================================
|
||||||
# uci_bool_by_name base ipv6 || exit 0
|
|
||||||
|
|
||||||
iface6=$(uci_get_by_name base interface6)
|
iface6=$(uci_get_by_name base interface6)
|
||||||
if [ "Z$iface6" == "Zinternet" -o "Z$iface6" == "Z" ]; then
|
if [ "Z$iface6" == "Zinternet" -o "Z$iface6" == "Z" ]; then
|
||||||
@ -285,10 +286,12 @@ if [ "Z$iface6" == "Zinternet" -o "Z$iface6" == "Z" ]; then
|
|||||||
else
|
else
|
||||||
ip6=$(ubus call network.interface.$iface6 status | grep '"address"' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){4})' | head -1)
|
ip6=$(ubus call network.interface.$iface6 status | grep '"address"' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){4})' | head -1)
|
||||||
fi
|
fi
|
||||||
ip6_escape=`urlencode "$ip6"`
|
ip6_escape=$(urlencode "$ip6")
|
||||||
|
|
||||||
# clean_log
|
|
||||||
# uci_bool_by_name base ipv6 && check_aliddns6 || do_ddns_record6
|
# uci_bool_by_name base ipv6 && check_aliddns6 || do_ddns_record6
|
||||||
if [ $ipv6 -eq 1 ]; then
|
if [ $ipv6 -eq 1 ]; then
|
||||||
check_aliddns6 || do_ddns_record6
|
check_aliddns6 || do_ddns_record6
|
||||||
fi
|
fi
|
||||||
|
# ================================================== ddns v6 ==================================================
|
||||||
|
|
||||||
|
clean_log
|
||||||
|
Loading…
Reference in New Issue
Block a user