diff --git a/aliddns/Changelog.txt b/aliddns/Changelog.txt new file mode 100644 index 0000000..a80c48a --- /dev/null +++ b/aliddns/Changelog.txt @@ -0,0 +1,22 @@ +Koolshare Asuswrt-Merlin aliddns Changelog +=========================================== +1.2 + - fix fix interval time scale +1.1 +- fix fix won't work in X7.9.1 fw + +0.7 + - fix add * and @ support + +0.6 + - fix fix some column won't hide when toggle switch off + +0.5 + - update default use interface ppp0 to update ip + - fix fix the exclamation point prompt in the network map + +0.4 + - update sync aliddns + +0.2 + - add add aliddns diff --git a/aliddns/README.md b/aliddns/README.md new file mode 100644 index 0000000..e77d6a4 --- /dev/null +++ b/aliddns/README.md @@ -0,0 +1,14 @@ +# merlin_thunder +this is a standalone aliddns Repository for merlin xiaobao firmware software center + +#### how to build + +1. change code in aliddns folder +2. update version in config.json.js +3. run build.py to package +4. commit your change + +* the merlin software center sync server always use the code to packet a new tar file when detect version change. +* so, when change version number, make sure the code is workable. + + diff --git a/aliddns/aliddns.tar.gz b/aliddns/aliddns.tar.gz new file mode 100644 index 0000000..665f534 Binary files /dev/null and b/aliddns/aliddns.tar.gz differ diff --git a/aliddns/aliddns/install.sh b/aliddns/aliddns/install.sh new file mode 100644 index 0000000..a990963 --- /dev/null +++ b/aliddns/aliddns/install.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +cp -r /tmp/aliddns/* /jffs/softcenter/ +chmod a+x /jffs/softcenter/scripts/aliddns_* + +rm -rf /jffs/softcenter/install.sh + +# add icon into softerware center +# dbus set softcenter_module_aliddns_install=1 +# dbus set softcenter_module_aliddns_version=0.4 +# dbus set softcenter_module_aliddns_description="阿里云解析自动更新IP" diff --git a/aliddns/aliddns/res/icon-aliddns.png b/aliddns/aliddns/res/icon-aliddns.png new file mode 100644 index 0000000..5af96b8 Binary files /dev/null and b/aliddns/aliddns/res/icon-aliddns.png differ diff --git a/aliddns/aliddns/scripts/aliddns_config.sh b/aliddns/aliddns/scripts/aliddns_config.sh new file mode 100644 index 0000000..e0c1cfb --- /dev/null +++ b/aliddns/aliddns/scripts/aliddns_config.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +source /jffs/softcenter/scripts/base.sh +eval `dbus export aliddns` + +start_aliddns(){ + aliddns_interval=$(($aliddns_interval / 60)) + cru a aliddns_checker "*/$aliddns_interval * * * * /jffs/softcenter/scripts/aliddns_update.sh" + sh /jffs/softcenter/scripts/aliddns_update.sh + + if [ ! -L "/jffs/softcenter/init.d/S98Aliddns.sh" ]; then + ln -sf /jffs/softcenter/scripts/aliddns_config.sh /jffs/jffs/softcenter/init.d/S98Aliddns.sh + fi +} + +stop_aliddns(){ + jobexist=`cru l|grep aliddns_checker` + # kill crontab job + if [ -n "$jobexist" ];then + sed -i '/aliddns_checker/d' /var/spool/cron/crontabs/* >/dev/null 2>&1 + fi + nvram set ddns_hostname_x=`nvram get ddns_hostname_old` +} + +case $ACTION in +start) + if [ "$aliddns_enable" == "1" ];then + logger "[软件中心]: 启动阿里DDNS!" + start_aliddns + else + logger "[软件中心]: 阿里DDNS未设置开机启动,跳过!" + fi + ;; +stop) + stop_aliddns + ;; +*) + if [ "$aliddns_enable" == "1" ];then + start_aliddns + else + stop_aliddns + fi + http_response "$1" + ;; +esac + diff --git a/aliddns/aliddns/scripts/aliddns_update.sh b/aliddns/aliddns/scripts/aliddns_update.sh new file mode 100644 index 0000000..c0df2e6 --- /dev/null +++ b/aliddns/aliddns/scripts/aliddns_update.sh @@ -0,0 +1,136 @@ +#!/bin/sh + +source /jffs/softcenter/scripts/base.sh +eval `dbus export aliddns_` +alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】' +https_lanport=`nvram get https_lanport` +if [ "$aliddns_enable" != "1" ]; then + nvram set ddns_hostname_x=`nvram get ddns_hostname_old` + echo "not enable" + exit +fi + +now=`echo_date` + +die () { + echo $1 + dbus set aliddns_last_act="$now: failed($1)" +} + +[ "$aliddns_curl" = "" ] && aliddns_curl="curl -s --interface ppp0 whatismyip.akamai.com" +[ "$aliddns_dns" = "" ] && aliddns_dns="223.5.5.5" +[ "$aliddns_ttl" = "" ] && aliddns_ttl="600" + +ip=`$aliddns_curl 2>&1` || die "$ip" + +#support @ record nslookup +if [ "$aliddns_name" = "@" ];then + current_ip=`nslookup $aliddns_domain $aliddns_dns 2>&1` +else + current_ip=`nslookup $aliddns_name.$aliddns_domain $aliddns_dns 2>&1` +fi + +if [ "$?" -eq "0" ];then + current_ip=`echo "$current_ip" | grep 'Address 1' | tail -n1 | awk '{print $NF}'` + if [ "$ip" = "$current_ip" ] + then + echo "skipping" + dbus set aliddns_last_act="$now: skipped($ip)" + nvram set ddns_enable_x=1 + #web ui show without @. + if [ "$aliddns_name" = "@" ] ;then + nvram set ddns_hostname_x="$aliddns_domain" + else + nvram set ddns_hostname_x="$aliddns_name"."$aliddns_domain" + ddns_custom_updated 1 + exit 0 + fi + fi +else + # fix when A record removed by manual dns is always update error + unset aliddns_record_id +fi + +timestamp=`date -u "+%Y-%m-%dT%H%%3A%M%%3A%SZ"` +urlencode() { + # urlencode + out="" + while read -n1 c + do + case $c in + [a-zA-Z0-9._-]) out="$out$c" ;; + *) out="$out`printf '%%%02X' "'$c"`" ;; + esac + done + echo -n $out +} + +enc() { + echo -n "$1" | urlencode +} + +send_request() { + local args="AccessKeyId=$aliddns_ak&Action=$1&Format=json&$2&Version=2015-01-09" + local hash=$(echo -n "GET&%2F&$(enc "$args")" | openssl dgst -sha1 -hmac "$aliddns_sk&" -binary | openssl base64) + curl -s "http://alidns.aliyuncs.com/?$args&Signature=$(enc "$hash")" +} + +get_recordid() { + grep -Eo '"RecordId":"[0-9]+"' | cut -d':' -f2 | tr -d '"' +} + +query_recordid() { + send_request "DescribeSubDomainRecords" "SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&SubDomain=$aliddns_name1.$aliddns_domain&Timestamp=$timestamp" +} + +update_record() { + send_request "UpdateDomainRecord" "RR=$aliddns_name1&RecordId=$1&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&TTL=$aliddns_ttl&Timestamp=$timestamp&Type=A&Value=$ip" +} + +add_record() { + send_request "AddDomainRecord&DomainName=$aliddns_domain" "RR=$aliddns_name1&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&TTL=$aliddns_ttl&Timestamp=$timestamp&Type=A&Value=$ip" +} + +#add support */%2A and @/%40 record +case "$aliddns_name" in + \*) + aliddns_name1=%2A + ;; + \@) + aliddns_name1=%40 + ;; + *) + aliddns_name1="$aliddns_name" + ;; +esac + +if [ -z "$aliddns_record_id" ];then + aliddns_record_id=`query_recordid | get_recordid` +fi + +if [ -z "$aliddns_record_id" ];then + aliddns_record_id=`add_record | get_recordid` + echo "added record $aliddns_record_id" +else + update_record "$aliddns_record_id" + echo "updated record $aliddns_record_id" +fi + +# save to file +if [ -z "$aliddns_record_id" ]; then + # failed + dbus set aliddns_last_act="$now: failed" + nvram set ddns_hostname_x=`nvram get ddns_hostname_old` +else + dbus set aliddns_record_id="$aliddns_record_id" + dbus set aliddns_last_act="$now: success($ip)" + nvram set ddns_enable_x=1 + #web ui show without @. + if [ "$aliddns_name" = "@" ] ;then + nvram set ddns_hostname_x="$aliddns_domain" + ddns_custom_updated 1 + else + nvram set ddns_hostname_x="$aliddns_name"."$aliddns_domain" + ddns_custom_updated 1 + fi +fi diff --git a/aliddns/aliddns/webs/Module_aliddns.asp b/aliddns/aliddns/webs/Module_aliddns.asp new file mode 100644 index 0000000..fbe6dab --- /dev/null +++ b/aliddns/aliddns/webs/Module_aliddns.asp @@ -0,0 +1,216 @@ + + + + + + + + + +Aliddns + + + + + + + + + +
+ + + + + + + +
  + + + + + + + + + +
+
+ + + + +
+
 
+
Aliddns - 设置
+
+
+
Aliddns是一款基于阿里云解析的私人ddns解决方案。  点击查看插件详情
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Aliddns - 设置面板
+ + +
+ +
+
+
上次运行 + <% dbus_get_def("aliddns_last_act", "--"); %> +
app key + " class="input_ss_table"> +
app secret" class="input_ss_table">
检查周期" class="input_ss_table">s
域名 + " class="input_ss_table" + >." class="input_ss_table"> +
DNS服务器(?)">
获得IP命令(?)
TTL(?)">s (1~86400)
+
+ +
+
+
+ 论坛技术支持: www.koolshare.cn
+ Github项目: github.com/koolshare
+ Shell by: kyrios , Web by: kyrios +
+
+
+
+ +
+ + + + + diff --git a/aliddns/backup.sh b/aliddns/backup.sh new file mode 100755 index 0000000..dd1d4ab --- /dev/null +++ b/aliddns/backup.sh @@ -0,0 +1,25 @@ +#! /bin/sh + +# you can do something here +# this shell scripts will run at the end of build.py scripts + + + +mkdir -p history +if [ ! -f ./history/version ];then + touch ./history/version +fi + +version_old=`cat history/version | awk '{print $1}' | sort -rn |sed -n 1p` +version_new=`cat config.json.js |grep "version"|cut -d"\"" -f 4` +md5_old=`cat history/version | sort -nk1 | awk '{print $1}' |sed -n 1p` +md5_new=` md5sum aliddns.tar.gz | awk '{print $1}'` + +if [ -f ./aliddns.tar.gz ];then + if [ "$version_old" != "$version_new" ];then + mkdir ./history/$version_new/ + cp ./aliddns.tar.gz ./history/$version_new/ + echo $version_new $md5_new >> ./history/version + fi +fi + diff --git a/aliddns/build.sh b/aliddns/build.sh new file mode 100755 index 0000000..045cc61 --- /dev/null +++ b/aliddns/build.sh @@ -0,0 +1,32 @@ +#!/bin/sh + + +MODULE=aliddns +VERSION=1.2 +TITLE=aliddns +DESCRIPTION=阿里云解析自动更新IP +HOME_URL=Module_aliddns.asp + +# Check and include base +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +if [ "$MODULE" == "" ]; then + echo "module not found" + exit 1 +fi + +if [ -f "$DIR/$MODULE/$MODULE/install.sh" ]; then + echo "install script not found" + exit 2 +fi + +# now include build_base.sh +. $DIR/../softcenter/build_base.sh + +# change to module directory +cd $DIR + +# do something here + +do_build_result + +sh backup.sh $MODULE diff --git a/aliddns/config.json.js b/aliddns/config.json.js new file mode 100644 index 0000000..4027f2e --- /dev/null +++ b/aliddns/config.json.js @@ -0,0 +1,8 @@ +{ +"version":"1.2", +"md5":"1224296f69904c8073e9de60fe23cac5", +"home_url":"Module_aliddns.asp", +"title":"aliddns", +"description":"阿里云解析自动更新IP", +"build_date":"2019-01-12_22:09:07" +} diff --git a/aliddns/history/1.0/aliddns.tar.gz b/aliddns/history/1.0/aliddns.tar.gz new file mode 100644 index 0000000..cdd1bc8 Binary files /dev/null and b/aliddns/history/1.0/aliddns.tar.gz differ diff --git a/aliddns/history/1.2/aliddns.tar.gz b/aliddns/history/1.2/aliddns.tar.gz new file mode 100644 index 0000000..bc9a372 Binary files /dev/null and b/aliddns/history/1.2/aliddns.tar.gz differ diff --git a/aliddns/history/version b/aliddns/history/version new file mode 100644 index 0000000..511ccc7 --- /dev/null +++ b/aliddns/history/version @@ -0,0 +1,2 @@ +1.0 c3f3e869f271f51aba85951ec57aacf4 +1.2 4e1007c77e98486bcc5e83a80c697139 diff --git a/aliddns/version b/aliddns/version new file mode 100644 index 0000000..2aad6d9 --- /dev/null +++ b/aliddns/version @@ -0,0 +1,2 @@ +1.2 +1224296f69904c8073e9de60fe23cac5 diff --git a/softcenter/app.json.js b/softcenter/app.json.js index ab9cab1..ca24350 100644 --- a/softcenter/app.json.js +++ b/softcenter/app.json.js @@ -72,15 +72,14 @@ "version": "1.5" }, { - "build_date": "2016-09-27_18:43:33", + "build_date": "2019-01-12_22:09:07", "description": "阿里云解析自动更新IP", "home_url": "Module_aliddns.asp", - "md5": "00c97793e5b7195dd1d1def15f506883", - "module": "aliddns", + "md5": "1224296f69904c8073e9de60fe23cac5", "name": "aliddns", "tar_url": "aliddns/aliddns.tar.gz", "title": "aliddns", - "version": "1.0" + "version": "1.2" }, { "build_date": "2016-09-01_17:20:40", diff --git a/softcenter/softcenter/webs/Main_Soft_setting.asp b/softcenter/softcenter/webs/Main_Soft_setting.asp index 7c43048..4817784 100644 --- a/softcenter/softcenter/webs/Main_Soft_setting.asp +++ b/softcenter/softcenter/webs/Main_Soft_setting.asp @@ -1,4 +1,4 @@ - + @@ -24,43 +24,18 @@ - -
-
- - + + + @@ -191,41 +168,28 @@ function checkCmdRet(){
-
  • 此页面功能需要在7.0及其以上的固件才能使用。
  • -
  • 通过本页面,你可以上传插件的离线安装包来安装插件;
  • +
  • 通过本页面,你可以上传插件的离线安装包来安装插件,此功能需要在7.0及以上的固件才能使用;
  • 离线安装会自动解压tar.gz后缀的压缩包,识别压缩包一级目录下的install.sh文件并执行;
  • 建议开发者将插件版本号,md5等信息在install.sh文件内进行写入;
  • 此页面也能用来安装SS离线安装包,方便用户进行回滚操作,上传前需要将历史文件包改名为shadowsocks.tar.gz,建议安装时关闭SS,安装后需要重新提交才能看到安装的版本号;
  • +
  • 此功能暂时不可能,待修复;
  • -
    - - - + + + - - - - - - - - - - - - - + + + +
    软件中心 - 高级设置
    软件中心 - 高级设置
    安装包版本号 - -
    离线安装插件 - - - - - -
    离线安装插件 + + + + +
    @@ -235,8 +199,8 @@ function checkCmdRet(){
    论坛技术支持: www.koolshare.cn
    后台技术支持: Xiaobao
    Shell, Web by: Sadoneli
    +
    修改版 by: paldier
    - @@ -252,6 +216,3 @@ function checkCmdRet(){ - - -