2023-01-27 16:01:21 +08:00
-- Copyright (C) 2021-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-ddns-go
local m , s , o
2023-06-24 16:24:41 +08:00
m = Map ( " ddns-go " )
2023-01-27 16:01:21 +08:00
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> " )
2023-06-24 16:24:41 +08:00
m : section ( SimpleSection ) . template = " ddns-go_status "
2023-01-27 16:01:21 +08:00
2023-06-24 23:35:32 +08:00
s = m : section ( TypedSection , " basic " , translate ( " Global Settings " ) )
2023-01-27 16:01:21 +08:00
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
2023-06-24 23:35:32 +08:00
o = s : option ( Value , " time " , translate ( " update interval " ) )
2023-11-14 23:36:46 +08:00
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
2024-02-27 15:28:09 +08:00
o = s : option ( ListValue , " dns " , translate ( " Specify DNS resolution server " ) )
2023-11-14 23:36:46 +08:00
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.default = " 223.5.5.5 "
o = s : option ( Flag , " noweb " , translate ( " Do not start web services " ) )
o.default = 0
2023-06-24 23:35:32 +08:00
2023-01-27 16:01:21 +08:00
m.apply_on_parse = true
m.on_after_apply = function ( self , map )
2023-06-24 16:24:41 +08:00
luci.sys . exec ( " /etc/init.d/ddns-go restart " )
2023-01-27 16:01:21 +08:00
end
return m