Repository: kyriosli/koolshare-aliddns
Branch: master
Commit: 5daaeb84c620
Files: 5
Total size: 12.5 KB
Directory structure:
gitextract_h_u9_asb/
├── aliddns/
│ ├── install.sh
│ ├── scripts/
│ │ ├── aliddns_config.sh
│ │ └── aliddns_update.sh
│ └── webs/
│ └── Module_aliddns.asp
└── build.sh
================================================
FILE CONTENTS
================================================
================================================
FILE: aliddns/install.sh
================================================
#!/bin/sh
cp -r /tmp/aliddns/* /koolshare/
chmod a+x /koolshare/scripts/aliddns_*
# 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"
================================================
FILE: aliddns/scripts/aliddns_config.sh
================================================
#!/bin/sh
if [ "`dbus get aliddns_enable`" = "1" ]; then
dbus delay aliddns_timer `dbus get aliddns_interval` /koolshare/scripts/aliddns_update.sh
else
dbus remove __delay__aliddns_timer
fi
================================================
FILE: aliddns/scripts/aliddns_update.sh
================================================
#!/bin/sh
eval `dbus export aliddns_`
if [ "$aliddns_enable" != "1" ]; then
echo "not enable"
exit
fi
now=`date`
die () {
echo $1
dbus ram aliddns_last_act="$now: failed($1)"
}
[ "$aliddns_curl" = "" ] && aliddns_curl="curl -s whatismyip.akamai.com"
[ "$aliddns_dns" = "" ] && aliddns_dns="223.5.5.5"
[ "$aliddns_ttl" = "" ] && aliddns_ttl="600"
ip=`$aliddns_curl 2>&1` || die "$ip"
current_ip=`nslookup $aliddns_name.$aliddns_domain $aliddns_dns 2>&1`
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)"
exit 0
fi
fi
timestamp=`date -u "+%Y-%m-%dT%H%%3A%M%%3A%SZ"`
urlencode() {
# urlencode <string>
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_name.$aliddns_domain&Timestamp=$timestamp"
}
update_record() {
send_request "UpdateDomainRecord" "RR=$aliddns_name&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_name&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&TTL=$aliddns_ttl&Timestamp=$timestamp&Type=A&Value=$ip"
}
if [ "$aliddns_record_id" = "" ]
then
aliddns_record_id=`query_recordid | get_recordid`
fi
if [ "$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 [ "$aliddns_record_id" = "" ]; then
# failed
dbus ram aliddns_last_act="$now: failed"
else
dbus ram aliddns_record_id=$aliddns_record_id
dbus ram aliddns_last_act="$now: success($ip)"
fi
================================================
FILE: aliddns/webs/Module_aliddns.asp
================================================
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
<meta HTTP-EQUIV="Expires" CONTENT="-1"/>
<link rel="shortcut icon" href="images/favicon.png"/>
<link rel="icon" href="images/favicon.png"/>
<title>Aliddns</title>
<link rel="stylesheet" type="text/css" href="index_style.css"/>
<link rel="stylesheet" type="text/css" href="form_style.css"/>
<link rel="stylesheet" type="text/css" href="usp_style.css"/>
<link rel="stylesheet" type="text/css" href="css/element.css">
<script type="text/javascript" src="/js/jquery.js"></script>
<script src="/state.js"></script>
<script src="/help.js"></script>
</head>
<body>
<div id="TopBanner"></div>
<div id="Loading" class="popup_bg"></div>
<table class="content" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="17"> </td>
<td valign="top" width="202">
<div id="mainMenu"></div>
<div id="subMenu"></div>
</td>
<td valign="top">
<div id="tabMenu" class="submenuBlock"></div>
<!--=====Beginning of Main Content=====-->
<table width="98%" border="0" align="left" cellpadding="0" cellspacing="0" style="display: block;">
<tr>
<td align="left" valign="top">
<div>
<table width="760px" border="0" cellpadding="5" cellspacing="0" bordercolor="#6b8fa3" class="FormTitle" id="FormTitle">
<tr>
<td bgcolor="#4D595D" colspan="3" valign="top">
<div> </div>
<div style="float:left;" class="formfonttitle" style="padding-top: 12px">Aliddns - 设置</div>
<div style="float:right; width:15px; height:25px;margin-top:10px"><img id="return_btn" onclick="reload_Soft_Center();" align="right" style="cursor:pointer;position:absolute;margin-left:-30px;margin-top:-25px;" title="返回软件中心" src="/images/backprev.png" onMouseOver="this.src='/images/backprevclick.png'" onMouseOut="this.src='/images/backprev.png'"></img></div>
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px"><img src="/images/New_ui/export/line_export.png"></div>
<div class="SimpleNote" id="head_illustrate"><i></i><em>Aliddns</em>是一款基于阿里云解析的私人ddns解决方案。<a href='http://koolshare.cn/thread-64703-1-1.html' target='_blank'><i> <u>点击查看插件详情</u></i></a></div>
<table style="margin:20px 0px 0px 0px;" width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable">
<thead>
<tr>
<td colspan="2">Aliddns - 设置面板</td>
</tr>
</thead>
<tr id="switch_tr">
<th>
<label>开启Aliddns</label>
</th>
<td colspan="2">
<div class="switch_field" style="display:table-cell">
<label for="switch">
<input id="switch" class="switch" type="checkbox" style="display: none;">
<div class="switch_container" >
<div class="switch_bar"></div>
<div class="switch_circle transition_style">
<div></div>
</div>
</div>
</label>
</div>
<div id="koolproxy_install_show" style="padding-top:5px;margin-left:80px;margin-top:-30px;float: left;"></div>
</td>
</tr>
<tr id="last_act_tr">
<th>上次运行</th>
<td>
<% dbus_get_def("aliddns_last_act", "--"); %>
</td>
</tr>
<tr id="ak_tr">
<th>app key</th>
<td>
<input type="text" id="aliddns_ak" value="<% dbus_get_def("aliddns_ak", ""); %>" class="input_ss_table">
</td>
</tr>
<tr id="sk_tr">
<th>app secret</th>
<td><input type="password" id="aliddns_sk" value="<% dbus_get_def("aliddns_sk", ""); %>" class="input_ss_table"></td>
</tr>
<tr id="interval_tr">
<th>检查周期</th>
<td><input type="text" style="width: 2.5em" id="aliddns_interval" value="<% dbus_get_def("aliddns_interval", "120"); %>" class="input_ss_table">s</td>
</tr>
<tr id="name_tr">
<th>域名</th>
<td>
<input type="text" style="width: 4em" id="aliddns_name" placeholder="子域名" value="<% dbus_get_def("aliddns_name", "home"); %>" class="input_ss_table"
>.<input type="text" id="aliddns_domain" placeholder="主域名" value="<% dbus_get_def("aliddns_domain", "example.com"); %>" class="input_ss_table">
</td>
</tr>
<tr id="dns_tr">
<th title="查询域名当前IP时使用的DNS解析服务器,默认为阿里云DNS">DNS服务器(?)</th>
<td><input id="aliddns_dns" class="input_ss_table" value="<% dbus_get_def("aliddns_dns", "223.5.5.5"); %>"></td>
</tr>
<tr id="curl_tr">
<th title="可自行修改命令行,以获得正确的公网IP。如添加 '--interface vlan2' 以指定多播情况下的端口支持">获得IP命令(?)</th>
<td><textarea id="aliddns_curl" class="input_ss_table" style="width: 94%; height: 2.4em"><% dbus_get_def("aliddns_curl", "curl -s whatismyip.akamai.com"); %></textarea></td>
</tr>
<tr id="ttl_tr">
<th title="设置解析TTL,默认10分钟,免费版的范围是600-86400">TTL(?)</th>
<td><input id="aliddns_ttl" style="width: 4.5em" class="input_ss_table" value="<% dbus_get_def("aliddns_ttl", "600"); %>">s (1~86400)</td>
</tr>
</table>
<div class="apply_gen">
<input class="button_gen" type="button" value="提交">
</div>
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px"><img src="/images/New_ui/export/line_export.png"/></div>
<div class="KoolshareBottom" style="margin-top:540px;">
论坛技术支持: <a href="http://www.koolshare.cn" target="_blank"> <i><u>www.koolshare.cn</u></i> </a> <br/>
Github项目: <a href="https://github.com/koolshare/koolshare.github.io/tree/acelan_softcenter_ui" target="_blank"> <i><u>github.com/koolshare</u></i> </a> <br/>
Shell by: <i>kyrios</i> , Web by: <i>kyrios</i>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<!--=====end of Main Content=====-->
</td>
</tr>
</table>
<div id="footer"></div>
<script>
$(function () {
show_menu(menu_hook);
var enable = "<% dbus_get_def("aliddns_enable", "0"); %>";
$('#switch').prop('checked', enable === "1");
buildswitch();
update_visibility();
var posting = false;
var inputs = ['ak', 'sk', 'name', 'domain', 'interval', 'dns', 'curl', 'ttl'];
$('.button_gen').click(function () {
if(posting) return;
posting = true; // save
var data = {
aliddns_enable: $('#switch').prop('checked') | 0,
action_mode: ' Refresh ',
current_page: 'Module_aliddns.asp',
next_page: 'Module_aliddns.asp',
SystemCmd: 'aliddns_config.sh'
};
for(var i = 0; i< inputs.length; i++) {
var key = 'aliddns_' + inputs[i];
data['aliddns_' + inputs[i]] = $('#aliddns_' + inputs[i]).val()
}
$.ajax({
type: 'POST',
url: 'applydb.cgi?p=aliddns_',
data: $.param(data)
}).then(function () {
posting = false;
alert('saved');
}, function () {
posting = false;
alert('failed');
})
})
})
var enable_ss = "<% nvram_get("enable_ss"); %>";
var enable_soft = "<% nvram_get("enable_soft"); %>";
function menu_hook(title, tab) {
if(enable_ss == "1" && enable_soft == "1"){
tabtitle[17] = new Array("", "Aliddns");
tablink[17] = new Array("", "Module_aliddns.asp");
}else{
tabtitle[16] = new Array("", "Aliddns");
tablink[16] = new Array("", "Module_aliddns.asp");
}
}
function reload_Soft_Center(){
location.href = "/Main_Soft_center.asp";
}
function buildswitch(){
$("#switch").click(
function(){
update_visibility();
});
}
function update_visibility(){
if(document.getElementById('switch').checked){
document.getElementById("last_act_tr").style.display = "";
document.getElementById("ak_tr").style.display = "";
document.getElementById("sk_tr").style.display = "";
document.getElementById("interval_tr").style.display = "";
document.getElementById("name_tr").style.display = "";
}else{
document.getElementById("last_act_tr").style.display = "none";
document.getElementById("ak_tr").style.display = "none";
document.getElementById("sk_tr").style.display = "none";
document.getElementById("interval_tr").style.display = "none";
document.getElementById("name_tr").style.display = "none";
}
}
</script>
</body>
</html>
================================================
FILE: build.sh
================================================
#!/bin/sh
tar zcvf aliddns.tar.gz aliddns
gitextract_h_u9_asb/ ├── aliddns/ │ ├── install.sh │ ├── scripts/ │ │ ├── aliddns_config.sh │ │ └── aliddns_update.sh │ └── webs/ │ └── Module_aliddns.asp └── build.sh
Condensed preview — 5 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (15K chars).
[
{
"path": "aliddns/install.sh",
"chars": 271,
"preview": "#!/bin/sh\n\ncp -r /tmp/aliddns/* /koolshare/\nchmod a+x /koolshare/scripts/aliddns_*\n\n# add icon into softerware center\ndb"
},
{
"path": "aliddns/scripts/aliddns_config.sh",
"chars": 199,
"preview": "#!/bin/sh\n\nif [ \"`dbus get aliddns_enable`\" = \"1\" ]; then\n dbus delay aliddns_timer `dbus get aliddns_interval` /kool"
},
{
"path": "aliddns/scripts/aliddns_update.sh",
"chars": 2625,
"preview": "#!/bin/sh\n\neval `dbus export aliddns_`\n\nif [ \"$aliddns_enable\" != \"1\" ]; then\n echo \"not enable\"\n exit\nfi\n\nnow=`da"
},
{
"path": "aliddns/webs/Module_aliddns.asp",
"chars": 9663,
"preview": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\""
},
{
"path": "build.sh",
"chars": 43,
"preview": "#!/bin/sh\n\ntar zcvf aliddns.tar.gz aliddns\n"
}
]
About this extraction
This page contains the full source code of the kyriosli/koolshare-aliddns GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 5 files (12.5 KB), approximately 3.9k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.