Skip to content

Commit

Permalink
up ddns-go 1.3.0 增加WEB页登陆链接
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpdboy authored Jun 24, 2023
1 parent 53fa7c4 commit 87285f6
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 21 deletions.
8 changes: 4 additions & 4 deletions ddns-go/file/ddns-go.init
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ get_config() {
config_get_bool logger $1 logger 1
config_get port $1 port 9876
}
ddns-go_prepare() {
prepare() {
pgrep -f /usr/bin/ddns-go | xargs kill -9 >/dev/null 2>&1
logger -t ddns-go -p warn "ddns-go is stop."
}
Expand All @@ -31,13 +31,13 @@ init_yaml(){
}

stop_service() {
ddns-go_prepare
prepare
}

start_service() {
ddns-go_prepare
prepare
config_load ddns-go
config_foreach get_config ddns-go
config_foreach get_config basic
[ x$enabled == x1 ] || return 1
[ -s ${CONF} ] || init_yaml
logger -t ddns-go -p warn "ddns-go is start."
Expand Down
2 changes: 1 addition & 1 deletion luci-app-ddns-go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-ddns-go
PKG_VERSION:=1.2.2
PKG_VERSION:=1.3.0
PKG_RELEASE:=9

LUCI_TITLE:=LuCI Support for Dynamic ddns-go Client
Expand Down
4 changes: 1 addition & 3 deletions luci-app-ddns-go/luasrc/controller/ddns-go.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ function index()
entry({"admin", "services", "ddns-go"}, alias("admin", "services", "ddns-go", "setting"),_("DDNS-GO"), 58).dependent = true
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"), 30).leaf = true
entry({"admin", "services", "ddns-go_status"}, call("act_status"))
entry({"admin", "services", "ddnsgo_status"}, call("act_status"))
end

function act_status()
local sys = require "luci.sys"
local port = tonumber(uci:get_first("ddns-go", "ddns-go", "port"))
local e = { }
e.running = sys.call("pidof ddns-go >/dev/null") == 0
e.port = (port or 9876)
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
2 changes: 1 addition & 1 deletion luci-app-ddns-go/luasrc/model/cbi/ddns-go.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ m.description = translate("DDNS-GO automatically obtains your public IPv4 or IPv

m:section(SimpleSection).template = "ddns-go_status"

s = m:section(TypedSection, "ddns-go", translate("Global Settings"))
s = m:section(TypedSection, "basic", translate("Global Settings"))
s.addremove = false
s.anonymous = true

Expand Down
8 changes: 4 additions & 4 deletions luci-app-ddns-go/luasrc/view/ddns-go.htm
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
<%+header%>
<div class="cbi-map">

<iframe id="ddns-go" style="width: 100%; min-height: 780px; border: none; border-radius: .375rem;box-shadow: rgba(0, 0, 0, 0.75) 0px 0px 15px -5px;"><br/><em style=\"color:red\">
<iframe id="ddnsgo" style="width: 100%; min-height: 780px; 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("ddns-go").src = window.location.protocol + "//" + window.location.hostname + ":<%=luci.model.uci.cursor():get("ddns-go", "ddns-go", "port") %>";
document.getElementById("ddns-go").height = document.documentElement.clientHeight;
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("ddns-go").height = document.documentElement.clientHeight;
document.getElementById("ddnsgo").height = document.documentElement.clientHeight;
}
</script>
<%+footer%>
10 changes: 5 additions & 5 deletions luci-app-ddns-go/luasrc/view/ddns-go_status.htm
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[ddns-go_status]])%>', null,
XHR.poll(3, '<%=url([[admin]], [[services]], [[ddnsgo_status]])%>', null,
function(x, data) {
var tb = document.getElementById('ddns-go_status');
var tb = document.getElementById('ddnsgo_status');
if (data && tb)
{
if (data.running)
{
var URL = ""+ window.location.protocol + "//" + window.location.hostname +":"+ data.port"";
var URL = ""+ window.location.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 Lucky%> <a href="' +URL+'"'+' target="_blank">' + URL + ' </a><br/> </em>';
tb.innerHTML +='<em> <br/><br/>' + ' <b > <%:Click the new page to open ddns-go%> <a href="' +URL+'"'+' target="_blank">' + URL + ' </a><br/> </em>';
}
else
{
Expand All @@ -21,7 +21,7 @@
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<legend><%:DDNS-GO Status%></legend>
<p id="ddns-go_status">
<p id="ddnsgo_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>
8 changes: 6 additions & 2 deletions luci-app-ddns-go/po/zh-cn/ddns-go.po
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ msgstr "DDNS-GO服务未启动"
msgid "DDNS-GO Status"
msgstr "DDNS-GO服务状态"

msgid "Collecting data..."
msgstr "收集数据..."
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 "收集数据..."

2 changes: 1 addition & 1 deletion luci-app-ddns-go/root/etc/config/ddns-go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config ddns-go 'ddns-go'
config basic
option enabled '0'
option logger '1'
option port 9876

0 comments on commit 87285f6

Please sign in to comment.