update 2025-05-12 04:21:56

This commit is contained in:
kenzok8 2025-05-12 04:21:56 +08:00
parent da61b94f11
commit 15d5d77448
19 changed files with 513 additions and 462 deletions

View File

@ -1,14 +1,17 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021-2024 sirpdboy <herboy2008@gmail.com>
# Copyright (C) 2021-2025 sirpdboy <herboy2008@gmail.com>
# https://github.com/sirpdboy/luci-app-ddns-go
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ddns-go
PKG_VERSION:=1.4.5
PKG_RELEASE:=20240409
PKG_VERSION:=1.5.0
PKG_RELEASE:=20250511
PKG_MAINTAINER:=sirpdboy <herboy2008@gmail.com>
PKG_CONFIG_DEPENDS:=
LUCI_TITLE:=LuCI Support for Dynamic ddns-go Client
LUCI_DEPENDS:=+ddns-go
@ -20,4 +23,5 @@ define Package/$(PKG_NAME)/conffiles
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -1,118 +0,0 @@
## 访问数:![hello](https://views.whatilearened.today/views/github/sirpdboy/deplives.svg)[![](https://img.shields.io/badge/TG群-点击加入-FFFFFF.svg)](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ)
### 访问数:[![](https://visitor-badge.glitch.me/badge?page_id=sirpdboy-visitor-badge)] [![](https://img.shields.io/badge/TG群-点击加入-FFFFFF.svg)](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ)
欢迎来到sirpdboy的源码仓库
=
# luci-app-ddns-go
luci-app-ddns-go 自动获得你的公网 IPv4 或 IPv6 地址,并解析到对应的域名服务。支持的域名服务商 Alidns(阿里云) Dnspod(腾讯云) Cloudflare 华为云 Callback 百度云 porkbun GoDaddy
[![若部分图片无法正常显示,请挂上机场浏览或点这里到末尾看修复教程](https://visitor-badge.glitch.me/badge?page_id=sirpdboy-visitor-badge)](#解决-github-网页上图片显示失败的问题) [![](https://img.shields.io/badge/TG群-点击加入-FFFFFF.svg)](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ)
[luci-app-ddns-go ddns-go动态域名插件](https://github.com/sirpdboy/luci-app-ddns-go)
======================
**认真阅读完毕** 本页面,本页面包含注意事项和如何使用。
## 功能说明:
### ddns-go动态域名插件
#### 自动获得你的公网 IPv4 或 IPv6 地址,并解析到对应的域名服务。
<!-- TOC -->
- [ddns-go](#ddns-go)
- [特性](#特性)
- [使用方法](#使用方法)
- [说明](#说明)
- [界面](#界面)
- [捐助](#捐助)
<!-- /TOC -->
## 特性
- 支持Mac、Windows、Linux系统支持ARM、x86架构
- 支持的域名服务商 `Alidns(阿里云)` `Dnspod(腾讯云)` `Cloudflare` `华为云` `Callback` `百度云` `porkbun` `GoDaddy`
- 支持接口/网卡获取IP
- 支持以服务的方式运行
- 默认间隔5分钟同步一次
- 支持多个域名同时解析,公司必备
- 支持多级域名
- 网页中配置,简单又方便,可设置 `登录用户名和密码` / `禁止从公网访问`
- 网页中方便快速查看最近50条日志不需要跑docker中查看
- 支持webhook通知
- 支持TTL
- 支持部分dns服务商传递自定义参数实现地域解析等功能
## 使用方法
- 将luci-app-ddns-go添加至 LEDE/OpenWRT 源码的方法。
### 下载源码方法:
```Brach
# 下载源码
git clone https://github.com/sirpdboy/luci-app-ddns-go.git package/ddns-go
make menuconfig
```
### 配置菜单
```Brach
make menuconfig
# 找到 LuCI -> Applications, 选择 luci-app-ddns-go, 保存后退出。
```
### 编译
```Brach
# 编译固件
make package/ddns-go/luci-app-ddns-go/compile V=s
```
## 说明
-源码来源https://github.com/sirpdboy/luci-app-ddns-go
-你可以随意使用其中的源码,但请注明出处。
============================
## 界面
![screenshots](https://raw.githubusercontent.com/jeessy2/ddns-go/master/ddns-web.png)
# My other project
网络速度测试 https://github.com/sirpdboy/NetSpeedTest
定时设置插件 : https://github.com/sirpdboy/luci-app-autotimeset
关机功能插件 : https://github.com/sirpdboy/luci-app-poweroffdevice
opentopd主题 : https://github.com/sirpdboy/luci-theme-opentopd
opentoks 主题: https://github.com/sirpdboy/luci-theme-opentoks [仿KOOLSAHRE主题]
btmob 主题: https://github.com/sirpdboy/luci-theme-btmob
系统高级设置 : https://github.com/sirpdboy/luci-app-advanced
## 捐助
-如果你觉得此项目对你有帮助,请捐助我们,以使项目能持续发展,更加完善。··请作者喝杯咖啡~~~**
-你们的支持就是我的动力!**
| <img src="https://img.shields.io/badge/-支付宝-F5F5F5.svg" href="#赞助支持本项目-" height="25" alt="图飞了😂"/> | <img src="https://img.shields.io/badge/-微信-F5F5F5.svg" height="25" alt="图飞了😂" href="#赞助支持本项目-"/> |
| :-----------------: | :-------------: |
|![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/支付宝.png) | ![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/微信.png) |
<a href="#readme">
<img src="https://img.shields.io/badge/-返回顶部-orange.svg" alt="图飞了😂" title="返回顶部" align="right"/>
</a>

View File

@ -0,0 +1,131 @@
/* Copyright (C) 2021-2025 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-ddns-go */
'use strict';
'require view';
'require fs';
'require ui';
'require uci';
'require form';
'require poll';
function checkProcess() {
return fs.exec('/bin/pidof', ['ddns-go']).then(function(res) {
return {
running: res.code === 0,
pid: res.code === 0 ? res.stdout.trim() : null
};
}).catch(function() {
return { running: false, pid: null };
});
}
function renderStatus(isRunning, listen_port, noweb) {
var statusText = isRunning ? _('RUNNING') : _('NOT RUNNING');
var color = isRunning ? 'green' : 'red';
var icon = isRunning ? '✓' : '✗';
var html = String.format(
'<em><span style="color:%s">%s <strong>%s %s</strong></span></em>',
color, icon, _('DDNS-Go'), statusText
);
if (isRunning && res.pid) {
html += ' <small>(PID: ' + res.pid + ')</small>';
}
if (isRunning && noweb !== '1') {
html += String.format(
'&#160;<a class="btn cbi-button" href="%s:%s" target="_blank">%s</a>',
window.location.origin,
listen_port,
_('Open Web Interface')
);
}
return html;
}
return view.extend({
load: function() {
return Promise.all([
uci.load('ddns-go')
]);
},
render: function(data) {
var m, s, o;
var listen_port = (uci.get(data[0], 'basic', 'port') || '[::]:9876').split(':').slice(-1)[0];
var noweb = uci.get(data[0], 'basic', 'noweb') || '0';
m = new form.Map('ddns-go', _('DDNS-GO'),
_('DDNS-GO automatically obtains your public IPv4 or IPv6 address and resolves it to the corresponding domain name service.'));
// 状态显示部分
s = m.section(form.TypedSection);
s.anonymous = true;
s.render = function() {
var statusView = E('p', { id: 'control_status' },
'<span class="spinning">⏳</span> ' + _('Checking status...'));
var pollInterval = poll.add(function() {
return checkProcess()
.then(function(res) {
statusView.innerHTML = renderStatus(res.running, listen_port, noweb);
})
.catch(function(err) {
console.error('Status check failed:', err);
statusView.innerHTML = '<span style="color:orange">⚠ ' + _('Status check error') + '</span>';
});
}, 5); // 每5秒检查一次
return E('div', { class: 'cbi-section', id: 'status_bar' }, [
statusView,
E('div', { 'style': 'text-align: right; font-style: italic;' }, [
E('span', {}, [
_('© github '),
E('a', {
'href': 'https://github.com/sirpdboy',
'target': '_blank',
'style': 'text-decoration: none;'
}, 'by sirpdboy')
])
])
]);
}
s = m.section(form.NamedSection, 'config', 'basic');
o = s.option(form.Flag, 'enabled', _('Enable'));
o.default = o.disabled;
o.rmempty = false;
o = s.option(form.Value, 'port', _('Listen port'));
o.default = '[::]:9876';
o.rmempty = false;
o = s.option(form.Value, 'time', _('Update interval'));
o.default = '300';
o = s.option(form.Value, 'ctimes', _('Compare with service provider N times intervals'));
o.default = '5';
o = s.option(form.Value, 'skipverify', _('Skip verifying certificates'));
o.default = '0';
o = s.option(form.Value, 'dns', _('Specify DNS resolution server'));
o.value('223.5.5.5', _('Ali DNS 223.5.5.5'));
o.value('223.6.6.6', _('Ali DNS 223.6.6.6'));
o.value('119.29.29.29', _('Tencent DNS 119.29.29.29'));
o.value('1.1.1.1', _('CloudFlare DNS 1.1.1.1'));
o.value('8.8.8.8', _('Google DNS 8.8.8.8'));
o.value('8.8.4.4', _('Google DNS 8.8.4.4'));
o.datatype = 'ipaddr';
o = s.option(form.Flag, 'noweb', _('Do not start web services'));
o.default = '0';
o = s.option(form.Value, 'delay', _('Delayed Start (seconds)'));
o.default = '60';
return m.render();
}
});

View File

@ -0,0 +1,66 @@
/* Copyright (C) 2021-2025 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-ddns-go */
'use strict';
'require view';
'require fs';
'require ui';
'require uci';
'require form';
'require poll';
return view.extend({
handleSaveApply: null,
handleSave: null,
handleReset: null,
load: function() {
return uci.load('ddns-go');
},
render: function() {
return fs.exec('/bin/pidof', ['ddns-go']).then(function(res) {
var isRunning = res.code === 0;
var port = uci.get('ddns-go', 'basic', 'port') || '[::]:9876';
var noweb = uci.get('ddns-go', 'basic', 'noweb') || '0';
port = port.split(':').pop();
var container = E('div');
var status = E('div', { style: 'text-align: center; padding: 2em;' }, [
E('img', {
src: 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMjQiIGhlaWdodD0iMTAyNCIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCI+PHBhdGggZmlsbD0iI2RmMDAwMCIgZD0iTTk0Mi40MjEgMjM0LjYyNGw4MC44MTEtODAuODExLTE1My4wNDUtMTUzLjA0NS04MC44MTEgODAuODExYy03OS45NTctNTEuNjI3LTE3NS4xNDctODEuNTc5LTI3Ny4zNzYtODEuNTc5LTI4Mi43NTIgMC01MTIgMjI5LjI0OC01MTIgNTEyIDAgMTAyLjIyOSAyOS45NTIgMTk3LjQxOSA4MS41NzkgMjc3LjM3NmwtODAuODExIDgwLjgxMSAxNTMuMDQ1IDE1My4wNDUgODAuODExLTgwLjgxMWM3OS45NTcgNTEuNjI3IDE3NS4xNDcgODEuNTc5IDI3Ny4zNzYgODEuNTc5IDI4Mi43NTIgMCA1MTItMjI5LjI0OCA1MTItNTEyIDAtMTAyLjIyOS0yOS45NTItMTk3LjQxOS04MS41NzktMjc3LjM3NnpNMTk0Ljk0NCA1MTJjMC0xNzUuMTA0IDE0MS45NTItMzE3LjA1NiAzMTcuMDU2LTMxNy4wNTYgNDggMCA5My40ODMgMTAuNjY3IDEzNC4yMjkgMjkuNzgxbC00MjEuNTQ3IDQyMS41NDdjLTE5LjA3Mi00MC43ODktMjkuNzM5LTg2LjI3Mi0yOS43MzktMTM0LjI3MnpNNTEyIDgyOS4wNTZjLTQ4IDAtOTMuNDgzLTEwLjY2Ny0xMzQuMjI5LTI5Ljc4MWw0MjEuNTQ3LTQyMS41NDdjMTkuMDcyIDQwLjc4OSAyOS43ODEgODYuMjcyIDI5Ljc4MSAxMzQuMjI5LTAuMDQzIDE3NS4xNDctMTQxLjk5NSAzMTcuMDk5LTMxNy4wOTkgMzE3LjA5OXoiLz48L3N2Zz4=',
style: 'width: 100px; height: 100px; margin-bottom: 1em;'
}),
E('h2', {}, _('DDNS-GO Service Not Running')),
E('p', {}, _('Please enable the DDNS-GO service'))
]);
if (isRunning && noweb !== '1') {
var iframe = E('iframe', {
src: window.location.origin + ':' + port,
style: 'width: 100%; min-height: 100vh; border: none; border-radius: 3px;'
});
container.appendChild(iframe);
} else
{
container.appendChild(status);
}
// Add polling to refresh status
poll.add(function() {
return fs.exec('/bin/pidof', ['ddns-go']).then(function(res) {
var newIsRunning = res.code === 0;
if (newIsRunning !== isRunning) {
window.location.reload();
}
});
}, 5);
poll.start();
return container;
}).catch(function(err) {
return E('div', { class: 'error' }, _('Error checking DDNS-Go status: ') + err.message);
});
}
});

View File

@ -0,0 +1,117 @@
/* Copyright (C) 2021-2025 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-ddns-go */
'use strict';
'require dom';
'require fs';
'require poll';
'require uci';
'require view';
'require form';
return view.extend({
render: function () {
var css = `
/* 日志框文本区域 */
#log_textarea pre {
padding: 10px; /* 内边距 */
border-bottom: 1px solid #ddd; /* 边框颜色 */
font-size: small;
line-height: 1.3; /* 行高 */
white-space: pre-wrap;
word-wrap: break-word;
overflow-y: auto;
}
/* 5s 自动刷新文字 */
.cbi-section small {
margin-left: 1rem;
font-size: small;
color: #666; /* 深灰色文字 */
}
`;
var log_textarea = E('div', { 'id': 'log_textarea' },
E('img', {
'src': L.resource(['icons/loading.gif']),
'alt': _('Loading...'),
'style': 'vertical-align:middle'
}, _('Collecting data ...'))
);
var log_path = '/var/log/ddns-go.log';
var lastLogContent = '';
var clear_log_button = E('div', {}, [
E('button', {
'class': 'cbi-button cbi-button-remove',
'click': function (ev) {
ev.preventDefault();
var button = ev.target;
button.disabled = true;
button.textContent = _('Clear Logs...');
fs.exec_direct('/usr/libexec/ddns-go-call', ['clear_log'])
.then(function () {
button.textContent = _('Logs cleared successfully!');
button.disabled = false;
button.textContent = _('Clear Logs');
// 立即刷新日志显示框
var log = E('pre', { 'wrap': 'pre' }, [_('Log is clean.')]);
dom.content(log_textarea, log);
lastLogContent = '';
})
.catch(function () {
button.textContent = _('Failed to clear log.');
button.disabled = false;
button.textContent = _('Clear Logs');
});
}
}, _('Clear Logs'))
]);
poll.add(L.bind(function () {
return fs.read_direct(log_path, 'text')
.then(function (res) {
var newContent = res.trim() || _('Log is clean.');
if (newContent !== lastLogContent) {
var log = E('pre', { 'wrap': 'pre' }, [newContent]);
dom.content(log_textarea, log);
log.scrollTop = log.scrollHeight;
lastLogContent = newContent;
}
}).catch(function (err) {
var log;
if (err.toString().includes('NotFoundError')) {
log = E('pre', { 'wrap': 'pre' }, [_('Log file does not exist.')]);
} else {
log = E('pre', { 'wrap': 'pre' }, [_('Unknown error: %s').format(err)]);
}
dom.content(log_textarea, log);
});
}));
return E('div', { 'class': 'cbi-map' }, [
E('style', [css]),
E('div', { 'class': 'cbi-section' }, [
clear_log_button,
log_textarea,
E('small', {}, _('Refresh every 5 seconds.').format(L.env.pollinterval)),
E('div', { 'class': 'cbi-section-actions cbi-section-actions-right' })
]),
E('div', { 'style': 'text-align: right; font-style: italic;' }, [
E('span', {}, [
_('© github '),
E('a', {
'href': 'https://github.com/sirpdboy',
'target': '_blank',
'style': 'text-decoration: none;'
}, 'by sirpdboy')
])
])
]);
},
handleSaveApply: null,
handleSave: null,
handleReset: null
});

View File

@ -1,45 +0,0 @@
-- Copyright (C) 2021-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-ddns-go
-- Licensed to the public under the Apache License 2.0.
module("luci.controller.ddns-go", package.seeall)
function index()
if not nixio.fs.access("/etc/config/ddns-go") then
return
end
local e=entry({"admin", "services", "ddns-go"}, alias("admin", "services", "ddns-go", "setting"),_("DDNS-GO"), 58)
e.dependent=false
e.acl_depends={ "luci-app-ddns-go" }
entry({"admin", "services", "ddns-go", "setting"}, cbi("ddns-go"), _("Base Setting"), 20).leaf=true
entry({"admin", "services", "ddns-go", "ddns-go"}, template("ddns-go/ddns-go"), _("DDNS-GO Control panel"), 30).leaf = true
entry({"admin", "services", "ddnsgo_status"}, call("act_status"))
entry({"admin", "services", "ddns-go", "log"}, template("ddns-go/ddns-go_log"), _("Log"), 40).leaf = true
entry({"admin", "services", "ddns-go", "fetch_log"}, call("fetch_log"), nil).leaf = true
entry({"admin", "services", "ddns-go", "clear_log"}, call("clear_log")).leaf = true
end
function act_status()
local sys = require "luci.sys"
local e = { }
e.running = sys.call("pidof ddns-go >/dev/null") == 0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
function fetch_log()
local fs = require "nixio.fs"
local log_file = "/var/log/ddns-go.log"
local log_content = fs.readfile(log_file) or "No Log."
luci.http.write(log_content)
end
function clear_log()
local fs = require "nixio.fs"
local log_file = "/var/log/ddns-go.log"
local f = io.open(log_file, "w")
if f then
f:close()
luci.http.status(204, "No Content")
else
luci.http.status(500, "Internal Server Error")
end
end

View File

@ -1,52 +0,0 @@
-- Copyright (C) 2021-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-ddns-go
local m, s ,o
m = Map("ddns-go")
m.title = translate("DDNS-GO")
m.description = translate("DDNS-GO automatically obtains your public IPv4 or IPv6 address and resolves it to the corresponding domain name service.")..translate("</br>For specific usage, see:")..translate("<a href=\'https://github.com/sirpdboy/luci-app-ddns-go.git' target=\'_blank\'>GitHub @sirpdboy/luci-app-ddns-go </a>")
m:section(SimpleSection).template = "ddns-go/ddns-go_status"
s = m:section(TypedSection, "basic", translate("Global Settings"))
s.addremove = false
s.anonymous = true
o = s:option(Flag,"enabled",translate("Enable"))
o.default = 0
o = s:option(Value, "port",translate("Set the DDNS-TO access port"))
o.datatype = "uinteger"
o.default=9876
o = s:option(Value, "time",translate("update interval"))
o.default=600
o = s:option(Value, "ctimes",translate("Compare with service provider N times intervals"))
o.default=5
o = s:option(Flag,"skipverify",translate("Skip verifying certificates"))
o.default = 0
o = s:option(Value, "dns",translate("Specify DNS resolution server"))
o:value("223.5.5.5", ""..translate("Ali").." DNS (223.5.5.5)")
o:value("223.6.6.6", ""..translate("Ali").." DNS (223.6.6.6)")
o:value("119.29.29.29", ""..translate("Tencent").." DNS (119.29.29.29)")
o:value("1.1.1.1", translate("CloudFlare DNS(1.1.1.1)"))
o:value("8.8.4.4", ""..translate("Google").." DNS(8.8.4.4)")
o:value("8.8.8.8", ""..translate("Google").." DNS(8.8.8.8)")
o.default = "223.5.5.5"
o = s:option(Flag,"noweb",translate("Do not start web services"))
o.default = 0
o = s:option(Value, "delay", translate("Delayed Start (seconds)"))
o.datatype = "and(uinteger,min(0))"
o.default = "60"
m.apply_on_parse = true
m.on_after_apply = function(self,map)
luci.sys.exec("/etc/init.d/ddns-go restart")
end
return m

View File

@ -1,34 +0,0 @@
<%#
Copyright 2008-2024 by sirpdboy <herboy2008@gmail.com>
https://github.com/sirpdboy/luci-app-ddns-go
Licensed to the public under the Apache License 2.0.
-%>
<%
local running = luci.sys.exec("pidof ddns-go | awk -F ' ' '{print $1}'")
%>
<%+header%>
<div class="cbi-map">
<% if tonumber(running) ~= nil then %>
<iframe id="ddnsgo" style="width: 100%; min-height: 580px; border: none; border-radius: .375rem;box-shadow: rgba(0, 0, 0, 0.75) 0px 0px 15px -5px;"><br/><em style=\"color:red\">
<p ><em><%:The DDNS-GO service is not running.%></em></p>
</iframe>
</div>
<script type="text/javascript">
document.getElementById("ddnsgo").src = window.location.protocol + "//" + window.location.hostname + ":<%=luci.model.uci.cursor():get_first("ddns-go", "basic", "port") %>";
document.getElementById("ddnsgo").height = document.documentElement.clientHeight;
window.onresize = function(){
document.getElementById("ddnsgo").height = document.documentElement.clientHeight;
}
</script>
<% else %>
<style>.running{text-align: center;} .running>h1{font-size: 25px; color: #333; margin: 1rem;} .running>p{ font-size: 1.2rem; color: #8391a2; margin: 1rem;}</style>
<div class="running">
<img src="data:image/svg+xml;base64,PCEtLSBHZW5lcmF0ZWQgYnkgSWNvTW9vbi5pbyAtLT4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMjQiIGhlaWdodD0iMTAyNCIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCI+Cjx0aXRsZT48L3RpdGxlPgo8ZyBpZD0iaWNvbW9vbi1pZ25vcmUiPgo8L2c+CjxwYXRoIGZpbGw9IiNkZjAwMDAiIGQ9Ik05NDIuNDIxIDIzNC42MjRsODAuODExLTgwLjgxMS0xNTMuMDQ1LTE1My4wNDUtODAuODExIDgwLjgxMWMtNzkuOTU3LTUxLjYyNy0xNzUuMTQ3LTgxLjU3OS0yNzcuMzc2LTgxLjU3OS0yODIuNzUyIDAtNTEyIDIyOS4yNDgtNTEyIDUxMiAwIDEwMi4yMjkgMjkuOTUyIDE5Ny40MTkgODEuNTc5IDI3Ny4zNzZsLTgwLjgxMSA4MC44MTEgMTUzLjA0NSAxNTMuMDQ1IDgwLjgxMS04MC44MTFjNzkuOTU3IDUxLjYyNyAxNzUuMTQ3IDgxLjU3OSAyNzcuMzc2IDgxLjU3OSAyODIuNzUyIDAgNTEyLTIyOS4yNDggNTEyLTUxMiAwLTEwMi4yMjktMjkuOTUyLTE5Ny40MTktODEuNTc5LTI3Ny4zNzZ6TTE5NC45NDQgNTEyYzAtMTc1LjEwNCAxNDEuOTUyLTMxNy4wNTYgMzE3LjA1Ni0zMTcuMDU2IDQ4IDAgOTMuNDgzIDEwLjY2NyAxMzQuMjI5IDI5Ljc4MWwtNDIxLjU0NyA0MjEuNTQ3Yy0xOS4wNzItNDAuNzg5LTI5LjczOS04Ni4yNzItMjkuNzM5LTEzNC4yNzJ6TTUxMiA4MjkuMDU2Yy00OCAwLTkzLjQ4My0xMC42NjctMTM0LjIyOS0yOS43ODFsNDIxLjU0Ny00MjEuNTQ3YzE5LjA3MiA0MC43ODkgMjkuNzgxIDg2LjI3MiAyOS43ODEgMTM0LjIyOS0wLjA0MyAxNzUuMTQ3LTE0MS45OTUgMzE3LjA5OS0zMTcuMDk5IDMxNy4wOTl6Ij48L3BhdGg+Cjwvc3ZnPgo=" height="100">
<h1><font color="color:red"><%:The DDNS-GO service is not running.%></font></h1>
<p><%:Please enable the DDNS-GO service%></p>
</div>
<% end -%>
</div>
<%+footer%>

View File

@ -1,90 +0,0 @@
<%+header%>
<div>
<input class="btn cbi-button-action" type="button" onclick="clearLog()" value="清空日志">
<input class="btn cbi-button-action" type="button" onclick="toggleRefresh()" value="停止刷新">
</div>
<pre id="logContent">
<%
local fs = require "nixio.fs"
local log_file_path = "/var/log/ddns-go.log"
local raw_log_content = fs.readfile(log_file_path) or "No Log."
local log_lines = {}
for line in raw_log_content:gmatch("[^\r\n]+") do
table.insert(log_lines, line)
end
for i=1, math.floor(#log_lines / 2) do
log_lines[i], log_lines[#log_lines - i + 1] = log_lines[#log_lines - i + 1], log_lines[i]
end
local log_content = table.concat(log_lines, "\n")
%>
<%=log_content%>
</pre>
<%+footer%>
<style>
#logContent {
background-color: #ffffff;
border: 1px solid #ddd;
padding: 15px;
padding-top: 0px;
margin-top: 5px;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
white-space: pre-wrap;
height: 100vh;
overflow-y: auto;
}
</style>
<script>
var refreshInterval = null;
function fetchLog() {
var xhr = new XMLHttpRequest();
xhr.open('GET', '/cgi-bin/luci/admin/services/ddns-go/fetch_log', true);
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
var logLines = xhr.responseText.split("\n").reverse().join("\n");
document.getElementById('logContent').textContent = logLines;
} else {
document.getElementById('logContent').textContent = 'Failed to load log.';
}
};
xhr.onerror = function () {
document.getElementById('logContent').textContent = 'Error loading log.';
};
xhr.send();
}
function clearLog() {
var xhr = new XMLHttpRequest();
xhr.open('POST', '/cgi-bin/luci/admin/services/ddns-go/clear_log', true);
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
fetchLog(); // 刷新日志内容
} else {
alert('Failed to clear log.');
}
};
xhr.onerror = function () {
alert('Error clearing log.');
};
xhr.send();
}
function toggleRefresh() {
var refreshButton = document.querySelector("input[onclick='toggleRefresh()']");
if (refreshInterval) {
clearInterval(refreshInterval);
refreshInterval = null;
refreshButton.value = '开始刷新';
} else {
fetchLog(); // 立即获取一次日志
refreshInterval = setInterval(fetchLog, 1000);
refreshButton.value = '停止刷新';
}
}
// 页面加载完成后开始刷新日志
document.addEventListener('DOMContentLoaded', function () {
toggleRefresh();
});
</script>

View File

@ -1,33 +0,0 @@
<%
protocol="http://"
%>
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[ddnsgo_status]])%>', null,
function(x, data) {
var tb = document.getElementById('ddnsgo_status');
if (data && tb)
{
if (data.running)
{
var URL = "<%=protocol%>" + window.location.hostname +":<%=luci.model.uci.cursor():get_first("ddns-go", "basic", "port") %>";
tb.innerHTML = '<em><b style=\"color:green\"><%:The DDNS-GO service is running.%></b></em>';
tb.innerHTML +='<em> <br/><br/>' + ' <b > <%:Click the new page to open ddns-go%> </em>';
tb.innerHTML += "<input class=\"cbi-button cbi-button-reload \" type=\"button\" value=\" "+ URL+ "\" onclick=\"window.open('"+ URL+ "/')\"/>";
}
else
{
tb.innerHTML = '<em style=\"color:red\"><%:The DDNS-GO service is not running.%></em><br/>';
}
}
}
);
//]]></script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<legend><%:DDNS-GO Status%></legend>
<p id="ddnsgo_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,74 @@
msgid ""
msgstr ""
msgid "DDNS-GO"
msgstr ""
msgid "DDNS-GO automatically obtains your public IPv4 or IPv6 address and resolves it to the corresponding domain name service."
msgstr ""
msgid "Base Setting"
msgstr ""
msgid "Status check error:"
msgstr ""
msgid "Checking status..."
msgstr ""
msgid "DDNS-GO Control panel"
msgstr ""
msgid "Open Web Interface"
msgstr ""
msgid "Log"
msgstr ""
msgid "Clear Logs..."
msgstr ""
msgid "Logs cleared successfully!"
msgstr ""
msgid "Clear Logs"
msgstr ""
msgid "NOT RUNNING"
msgstr ""
msgid "RUNNING"
msgstr ""
msgid "DDNS-GO Service Not Running"
msgstr ""
msgid "Please enable the DDNS-GO service"
msgstr ""
msgid "Open Web Interface"
msgstr ""
msgid "Set the DDNS-TO access port"
msgstr ""
msgid "Collecting data..."
msgstr ""
msgid "update interval"
msgstr ""
msgid "Skip verifying certificates"
msgstr ""
msgid "Compare with service provider N times intervals"
msgstr ""
msgid "Specify DNS resolution server"
msgstr ""
msgid "Do not start web services"
msgstr ""
msgid "Delayed Start (seconds)"
msgstr ""

1
luci-app-ddns-go/po/zh-cn Symbolic link
View File

@ -0,0 +1 @@
zh_Hans

View File

@ -1,62 +0,0 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "DDNS-GO"
msgstr "DDNS-GO"
msgid "DDNS-GO automatically obtains your public IPv4 or IPv6 address and resolves it to the corresponding domain name service."
msgstr "DDNS-GO自动获得你的公网 IPv4 或 IPv6 地址,并解析到对应的域名服务."
msgid "Base Setting"
msgstr "基本设置"
msgid "Running state"
msgstr "运行状态"
msgid "DDNS-GO Control panel"
msgstr "DDNS-GO操作台"
msgid "Log"
msgstr "日志"
msgid "The DDNS-GO service is running."
msgstr "DDNS-GO服务已启动"
msgid "The DDNS-GO service is not running."
msgstr "DDNS-GO服务未启动"
msgid "DDNS-GO Status"
msgstr "DDNS-GO服务状态"
msgid "Please enable the DDNS-GO service"
msgstr "请将DDNS-GO服务启用"
msgid "Click the new page to open ddns-go"
msgstr "点击打开ddns-go后台"
msgid "Set the DDNS-TO access port"
msgstr "设置访问端口"
msgid "</br>For specific usage, see:"
msgstr "</br>具体使用方法参见:"
msgid "Collecting data..."
msgstr "收集数据..."
msgid "update interval"
msgstr "更新间隔"
msgid "Skip verifying certificates"
msgstr "跳过验证证书"
msgid "Compare with service provider N times intervals"
msgstr "间隔N次与服务商比对"
msgid "Specify DNS resolution server"
msgstr "指定DNS解析服务器"
msgid "Do not start web services"
msgstr "不启动web服务"
msgid "Delayed Start (seconds)"
msgstr "开机延时启动(秒)"

View File

@ -10,36 +10,48 @@ msgstr "DDNS-GO自动获得你的公网 IPv4 或 IPv6 地址,并解析到对应
msgid "Base Setting"
msgstr "基本设置"
msgid "Running state"
msgstr "运行状态"
msgid "Status check error:"
msgstr "状态检查错误:"
msgid "Checking status..."
msgstr "检查状态..."
msgid "DDNS-GO Control panel"
msgstr "DDNS-GO操作台"
msgid "Open Web Interface"
msgstr "打开 Web 界面"
msgid "Log"
msgstr "日志"
msgid "The DDNS-GO service is running."
msgstr "DDNS-GO服务已启动"
msgid "Clear Logs..."
msgstr "清除日志..."
msgid "The DDNS-GO service is not running."
msgstr "DDNS-GO服务未启动"
msgid "Logs cleared successfully!"
msgstr "日志清除成功!"
msgid "DDNS-GO Status"
msgstr "DDNS-GO服务状态"
msgid "Clear Logs"
msgstr "清除日志"
msgid "NOT RUNNING"
msgstr "未运行"
msgid "RUNNING"
msgstr "运行中"
msgid "DDNS-GO Service Not Running"
msgstr "DDNS-GO服务未启用"
msgid "Please enable the DDNS-GO service"
msgstr "请将DDNS-GO服务启用"
msgid "Click the new page to open ddns-go"
msgstr "点击打开ddns-go后台"
msgid "Open Web Interface"
msgstr "打开Web界面"
msgid "Set the DDNS-TO access port"
msgstr "设置访问端口"
msgid "</br>For specific usage, see:"
msgstr "</br>具体使用方法参见:"
msgid "Collecting data..."
msgstr "收集数据..."

View File

@ -1,5 +1,9 @@
config basic
option enabled '0'
option logger '1'
option port 9876
option time 300
config basic 'config'
option enabled '0'
option logger '1'
option port '9876'
option time '300'
option ctimes '5'
option skipverify '0'
option delay '0'
option dns '223.5.5.5'

View File

@ -0,0 +1,32 @@
#!/bin/sh
#
# Copyright (C) 2023-2025 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-ddns-go
#
logfile="/var/log/ddns-go.log"
lang=$(uci get luci.main.lang 2>/dev/null)
if [ -z "$lang" ] || [[ "$lang" == "auto" ]]; then
lang=$(echo "${LANG:-${LANGUAGE:-${LC_ALL:-${LC_MESSAGES:-zh_cn}}}}" | awk -F'[ .@]' '{print tolower($1)}' | sed 's/-/_/' 2>/dev/null)
fi
translate() {
# 处理特殊字符
local lua_script=$(cat <<LUA
require "luci.i18n".setlanguage("$lang")
print(require "luci.i18n".translate([==[$1]==]))
LUA
)
lua -e "$lua_script"
}
if [ "$1" == "clear_log" ]; then
# 清空日志
>"${logfile}"
elif [ "$1" == "child" ]; then
shift
command_name=$1
shift
"$command_name" "$@"
fi

View File

@ -0,0 +1,41 @@
{
"admin/services/ddns-go": {
"title": "DDNS-GO",
"order": 58,
"action": {
"type": "firstchild"
},
"depends": {
"acl": [ "luci-app-ddns-go" ],
"uci": { "ddns-go": true }
}
},
"admin/services/ddns-go/config": {
"title": "Base Setting",
"order": 10,
"action": {
"type": "view",
"path": "ddns-go/config"
}
},
"admin/services/ddns-go/ddns-go": {
"title": "DDNS-GO Control panel",
"order": 20,
"action": {
"type": "view",
"path": "ddns-go/ddns-go"
}
},
"admin/services/ddns-go/log": {
"title": "Log",
"order": 30,
"action": {
"type": "view",
"path": "ddns-go/log"
}
}
}

View File

@ -2,10 +2,13 @@
"luci-app-ddns-go": {
"description": "Grant UCI access for luci-app-ddns-go",
"read": {
"uci": [ "ddns-go" ]
"ubus": {
"service": [ "list" ]
},
"uci": [ "ddns-go" ,"ddns-go" ]
},
"write": {
"uci": [ "ddns-go" ]
"uci": [ "ddns-go" ,"ddns-go" ]
}
}
}

View File

@ -21,23 +21,23 @@ endif
ifeq ($(ARCH),aarch64)
PKG_SOURCE:=$(PKG_SOURCE_HEADER).aarch64-$(PKG_SOURCE_BODY).$(PKG_SOURCE_FOOTER)
PKG_HASH:=8462ec05ead8cb6e13dfdc22a813518859da790dbab9a3f716f236a198103aac
PKG_HASH:=acf2eb5df9cb23192cb7e9a4998cf0dd178c5e8c85be3710b7eec7fa489baadd
else ifeq ($(ARCH),arm)
# Referred to golang/golang-values.mk
ARM_CPU_FEATURES:=$(word 2,$(subst +,$(space),$(call qstrip,$(CONFIG_CPU_TYPE))))
ifeq ($(ARM_CPU_FEATURES),)
PKG_SOURCE:=$(PKG_SOURCE_HEADER).arm-$(PKG_SOURCE_BODY)eabi.$(PKG_SOURCE_FOOTER)
PKG_HASH:=bc07650d508fd4e558bc5aae95edf80e98f5453dc7fac9a2d0a53fb032e8dc3e
PKG_HASH:=2b492ee8239b2cd097526635934d6744a982a654984c739197dbf858e3a794f3
else
PKG_SOURCE:=$(PKG_SOURCE_HEADER).arm-$(PKG_SOURCE_BODY)eabihf.$(PKG_SOURCE_FOOTER)
PKG_HASH:=b1b11b6ee6562075f7948f3386adb5b9dbf49701dda2298c56c1a211be1b9324
PKG_HASH:=e2e571ab24734996352c40250e6eef381ddaa069a05a0811e0cececdb06cdcd3
endif
else ifeq ($(ARCH),i386)
PKG_SOURCE:=$(PKG_SOURCE_HEADER).i686-$(PKG_SOURCE_BODY).$(PKG_SOURCE_FOOTER)
PKG_HASH:=9ba74e19d3ad0baf1c28b4cd46cafc8dbce5ce839ff589e16c1be2d64ddc29e4
PKG_HASH:=366664f894259ad49b7dc58bdb3414af997aee0c8b370319fbd0f7a8792da174
else ifeq ($(ARCH),x86_64)
PKG_SOURCE:=$(PKG_SOURCE_HEADER).x86_64-$(PKG_SOURCE_BODY).$(PKG_SOURCE_FOOTER)
PKG_HASH:=c4d528b32639c0da77e93a8ec1cc19f01143af7105ad352f9a6c6257d90a9a17
PKG_HASH:=b98a70c9c9aa324ed4e50912209f3c4e3f1b9956a58e58ceb5746ff411464c80
else ifeq ($(ARCH),mips)
PKG_SOURCE:=$(PKG_SOURCE_HEADER).mips-$(PKG_SOURCE_BODY).$(PKG_SOURCE_FOOTER)
PKG_HASH:=6ec59eee83cfca1d9220bc845690655cf6c36b2510c856c059f444a05630414a