mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-10 11:09:57 +08:00
luci-app-233ddns: add package
This commit is contained in:
parent
aa384df6c9
commit
fee3e57c81
21
package/ctcgfw/luci-app-233ddns/Makefile
Normal file
21
package/ctcgfw/luci-app-233ddns/Makefile
Normal file
@ -0,0 +1,21 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is a free software, use it under GNU General Public License v3.0.
|
||||
#
|
||||
# Created By [CTCGFW]Project-OpenWrt
|
||||
# https://github.com/project-openwrt
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-233ddns
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
LUCI_TITLE:=LuCI support for 233DDNS
|
||||
LUCI_DEPENDS:=+busybox +curl
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_MAINTAINER:=[CTCGFW]Project-OpenWrt
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
@ -0,0 +1,14 @@
|
||||
-- This is a free software, use it under GNU General Public License v3.0.
|
||||
-- Created By [CTCGFW]Project OpenWRT
|
||||
-- https://github.com/project-openwrt
|
||||
|
||||
module("luci.controller.233ddns", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/233ddns") then
|
||||
return
|
||||
end
|
||||
local page
|
||||
page = entry({"admin", "services", "233ddns"}, cbi("233ddns"), _("233DDNS"), 100)
|
||||
page.dependent = true
|
||||
end
|
34
package/ctcgfw/luci-app-233ddns/luasrc/model/cbi/233ddns.lua
Normal file
34
package/ctcgfw/luci-app-233ddns/luasrc/model/cbi/233ddns.lua
Normal file
@ -0,0 +1,34 @@
|
||||
-- Created By [CTCGFW]Project-OpenWrt
|
||||
-- https://github.com/project-openwrt
|
||||
|
||||
conf_token = luci.sys.exec("uci get 233ddns.@233ddns[0].token 2>/dev/null")
|
||||
if (conf_token == nil or conf_token == '') then
|
||||
conf_token = luci.sys.exec("cat /dev/urandom | head -n 10 | md5sum | head -c 10")
|
||||
end
|
||||
ddns_domain = luci.sys.exec("/etc/init.d/233ddns gen_subdomain " .. conf_token)
|
||||
|
||||
mp = Map("233ddns", translate("233DDNS"))
|
||||
mp.description = translate("A simple, fast, security DDNS client, powered by Oxygen233.") .. "<br/>" .. translate("Please add u.233.ro to your whitelist if you use proxies program.")
|
||||
|
||||
s = mp:section(TypedSection, "233ddns")
|
||||
s.anonymous=true
|
||||
s.addremove=false
|
||||
|
||||
enable = s:option(Flag, "enable", translate("Enable"))
|
||||
enable.description = translate("Your DDNS domain is") .. " " .. ddns_domain .. translate(".ddns.233.ro")
|
||||
enable.default = 0
|
||||
enable.rmempty = false
|
||||
|
||||
push_ipv6 = s:option(Flag, "push_ipv6", translate("Push IPv6 address"))
|
||||
push_ipv6.description = translate("Push IPv6 record to remote instead of IPv4.")
|
||||
push_ipv6.default = 0
|
||||
push_ipv6.rmempty = false
|
||||
|
||||
token = s:option(Value, "token", translate("Token"))
|
||||
token.description = translate("Must be 10 in length.")
|
||||
token.default = conf_token
|
||||
token.placeholder = conf_token
|
||||
token.datatype = "string"
|
||||
token.rmempty = false
|
||||
|
||||
return mp
|
29
package/ctcgfw/luci-app-233ddns/po/zh_Hans/233ddns.po
Normal file
29
package/ctcgfw/luci-app-233ddns/po/zh_Hans/233ddns.po
Normal file
@ -0,0 +1,29 @@
|
||||
msgid "233DDNS"
|
||||
msgstr "233DDNS"
|
||||
|
||||
msgid "A simple, fast, security DDNS client, powered by Oxygen233."
|
||||
msgstr "由 Oxygen233 驱动的一个简单、快速、安全的 DDNS 客户端。"
|
||||
|
||||
msgid "Please add u.233.ro to your whitelist if you use proxies program."
|
||||
msgstr "如果您使用了代理程序,请将 u.233.ro 添加至白名单。"
|
||||
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "Your DDNS domain is"
|
||||
msgstr "您的DDNS域名是"
|
||||
|
||||
msgid ".ddns.233.ro"
|
||||
msgstr ".ddns.233.ro"
|
||||
|
||||
msgid "Push IPv6 address"
|
||||
msgstr "推送IPv6地址"
|
||||
|
||||
msgid "Push IPv6 record to remote instead of IPv4."
|
||||
msgstr "将IPv6地址推送到远程而不是IPv4。"
|
||||
|
||||
msgid "Token"
|
||||
msgstr "令牌"
|
||||
|
||||
msgid "Must be 10 in length."
|
||||
msgstr "长度必须为10。"
|
5
package/ctcgfw/luci-app-233ddns/root/etc/config/233ddns
Normal file
5
package/ctcgfw/luci-app-233ddns/root/etc/config/233ddns
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
config 233ddns
|
||||
option enable '0'
|
||||
option push_ipv6 '0'
|
||||
option token ''
|
40
package/ctcgfw/luci-app-233ddns/root/etc/init.d/233ddns
Executable file
40
package/ctcgfw/luci-app-233ddns/root/etc/init.d/233ddns
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Created By [CTCGFW]Project OpenWRT
|
||||
# https://github.com/project-openwrt
|
||||
|
||||
START=80
|
||||
STOP=10
|
||||
|
||||
EXTRA_COMMANDS="gen_subdomain"
|
||||
EXTRA_HELP=" gen_subdomain Generate a subdomain by token"
|
||||
|
||||
enable="$(uci get 233ddns.@233ddns[0].enable)"
|
||||
push_ipv6="$(uci get 233ddns.@233ddns[0].push_ipv6)"
|
||||
[ "${push_ipv6}" -eq "0" ] && curl_arg="-4" || curl_arg="-6"
|
||||
token="$(uci get 233ddns.@233ddns[0].token)"
|
||||
|
||||
start()
|
||||
{
|
||||
stop
|
||||
|
||||
[ "${enable}" -ne "1" ] && exit 0
|
||||
curl "${curl_arg}" -b "a=a" "https://u.233.ro/u/${token}"
|
||||
echo "* * * * * curl ${curl_arg} -b \"a=a\" \"https://u.233.ro/u/${token}\"" >> "/etc/crontabs/root"
|
||||
/etc/init.d/cron restart
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
sed -i '/u.233.ro/d' "/etc/crontabs/root"
|
||||
/etc/init.d/cron restart
|
||||
}
|
||||
|
||||
restart()
|
||||
{
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
gen_subdomain() {
|
||||
echo -n "$1" |sha512sum |head -c 10
|
||||
}
|
11
package/ctcgfw/luci-app-233ddns/root/etc/uci-defaults/luci_233ddns
Executable file
11
package/ctcgfw/luci-app-233ddns/root/etc/uci-defaults/luci_233ddns
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@233ddns[-1]
|
||||
add ucitrack 233ddns
|
||||
set ucitrack.@233ddns[-1].init=233ddns
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
Loading…
x
Reference in New Issue
Block a user