diff --git a/ddnsto-openwrt/README.md b/ddnsto-openwrt/README.md new file mode 100644 index 000000000..4a67d2dcd --- /dev/null +++ b/ddnsto-openwrt/README.md @@ -0,0 +1,42 @@ +# 项目迁移了,请看: + +项目已经迁移到新地址:https://github.com/linkease/nas-packages + +# ddnsto-openwrt +ddnsto for openwrt + +## 使用方法 + +把文件夹 ddnsto 拷贝到 Openwrt 源代码的 package/network/services 里面,拷贝之后为: + +``` +tree package/network/services/ddnsto +package/network/services/ddnsto +├── files +│   ├── ddnsto.config +│   ├── ddnsto.init +│   └── ddnsto.uci-default +└── Makefile +``` + +### make menuconfig 选择方法 + +``` +make menuconfig + +Network ---> +Web Servers/Proxies ---> +<*> ddnsto....................................... DDNS.to - the reverse proxy + +LuCI ---> +3. Applications ---> +<*> luci-app-ddnsto.................................. LuCI support for ddnsto +``` + +### 部分 Openwrt 老版本兼容性问题 + +安装完成点击配置,需要手动运行命令: + +``` +/etc/init.d/ddnsto enable +``` diff --git a/ddnsto-openwrt/ddnsto/Makefile b/ddnsto-openwrt/ddnsto/Makefile new file mode 100644 index 000000000..fe292fba0 --- /dev/null +++ b/ddnsto-openwrt/ddnsto/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2015-2016 OpenWrt.org +# Copyright (C) 2020 jjm2473@gmail.com +# +# This is free software, licensed under the GNU General Public License v3. +# + +include $(TOPDIR)/rules.mk + +PKG_ARCH_DDNSTO:=$(ARCH) + +PKG_NAME:=ddnsto +PKG_VERSION:=0.3.0 +PKG_RELEASE:=1 +PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://firmware.koolshare.cn/binary/ddnsto/ +PKG_HASH:=cefd2494cb1c21e2c1616290f715dd6415cd460aafc107c38bb9910c13f42448 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION) + +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + TITLE:=DDNS.to - the reverse proxy + DEPENDS:= + URL:=https://www.ddnsto.com/ +endef + +define Package/$(PKG_NAME)/description + DDNS.to is a reverse proxy +endef + +define Package/$(PKG_NAME)/conffiles +/etc/config/ddnsto +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ddnsto.$(PKG_ARCH_DDNSTO) $(1)/usr/sbin/ddnsto + $(INSTALL_CONF) ./files/ddnsto.config $(1)/etc/config/ddnsto + $(INSTALL_BIN) ./files/ddnsto.init $(1)/etc/init.d/ddnsto + $(INSTALL_BIN) ./files/ddnsto.uci-default $(1)/etc/uci-defaults/ddnsto +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/ddnsto-openwrt/ddnsto/files/ddnsto.config b/ddnsto-openwrt/ddnsto/files/ddnsto.config new file mode 100644 index 000000000..61f645629 --- /dev/null +++ b/ddnsto-openwrt/ddnsto/files/ddnsto.config @@ -0,0 +1,3 @@ +config ddnsto + option 'token' '' + option 'enabled' '0' diff --git a/ddnsto-openwrt/ddnsto/files/ddnsto.init b/ddnsto-openwrt/ddnsto/files/ddnsto.init new file mode 100755 index 000000000..25e454751 --- /dev/null +++ b/ddnsto-openwrt/ddnsto/files/ddnsto.init @@ -0,0 +1,26 @@ +#!/bin/sh /etc/rc.common + +START=99 +USE_PROCD=1 + +get_config() { + config_get_bool enabled $1 enabled 1 + config_get_bool logger $1 logger 0 + config_get token $1 token +} + +start_service() { + config_load ddnsto + config_foreach get_config ddnsto + [ $enabled != 1 ] && return 1 + if [ -z "$token" ]; then + logger -t ddnsto -p warn "token not set" + return 1 + fi + + procd_open_instance + procd_set_param command /usr/sbin/ddnsto -u "$token" + [ "$logger" == 1 ] && procd_set_param stderr 1 + procd_set_param respawn + procd_close_instance +} diff --git a/ddnsto-openwrt/ddnsto/files/ddnsto.uci-default b/ddnsto-openwrt/ddnsto/files/ddnsto.uci-default new file mode 100755 index 000000000..9fda07581 --- /dev/null +++ b/ddnsto-openwrt/ddnsto/files/ddnsto.uci-default @@ -0,0 +1,12 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@ddnsto[-1] + add ucitrack ddnsto + set ucitrack.@ddnsto[-1].init=ddnsto + commit ucitrack +EOF + +/etc/init.d/ddnsto enable + +exit 0 \ No newline at end of file diff --git a/ddnsto-openwrt/luci-app-ddnsto/Makefile b/ddnsto-openwrt/luci-app-ddnsto/Makefile new file mode 100644 index 000000000..a4526436d --- /dev/null +++ b/ddnsto-openwrt/luci-app-ddnsto/Makefile @@ -0,0 +1,17 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for ddnsto +LUCI_DEPENDS:=ddnsto +LUCI_PKGARCH:=all +PKG_VERSION:=1.0.0 +PKG_RELEASE:=1 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + diff --git a/ddnsto-openwrt/luci-app-ddnsto/luasrc/controller/ddnsto.lua b/ddnsto-openwrt/luci-app-ddnsto/luasrc/controller/ddnsto.lua new file mode 100644 index 000000000..ccae6ca80 --- /dev/null +++ b/ddnsto-openwrt/luci-app-ddnsto/luasrc/controller/ddnsto.lua @@ -0,0 +1,22 @@ +module("luci.controller.ddnsto", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/ddnsto") then + return + end + + entry({"admin", "services", "ddnsto"}, cbi("ddnsto"), _("DDNS.to"), 20).dependent = true + + entry({"admin", "services", "ddnsto_status"}, call("ddnsto_status")) +end + +function ddnsto_status() + local sys = require "luci.sys" + + local status = { + running = (sys.call("pidof ddnsto >/dev/null") == 0) + } + + luci.http.prepare_content("application/json") + luci.http.write_json(status) +end diff --git a/ddnsto-openwrt/luci-app-ddnsto/luasrc/model/cbi/ddnsto.lua b/ddnsto-openwrt/luci-app-ddnsto/luasrc/model/cbi/ddnsto.lua new file mode 100644 index 000000000..60b427c41 --- /dev/null +++ b/ddnsto-openwrt/luci-app-ddnsto/luasrc/model/cbi/ddnsto.lua @@ -0,0 +1,23 @@ +--wulishui ,20200911 +--jjm2473 ,20210127 + +local m, s + +m = Map("ddnsto", translate("DDNS.to"), translate("DDNS.to is a reverse proxy.") + .. " " + .. translate("Official Website") + .. "") + +m:section(SimpleSection).template = "ddnsto_status" + +s=m:section(TypedSection, "ddnsto", translate("Global settings")) +s.addremove=false +s.anonymous=true + +s:option(Flag, "enabled", translate("Enable")).rmempty=false + +s:option(Value, "token", translate("Token")).rmempty=false + +return m + + diff --git a/ddnsto-openwrt/luci-app-ddnsto/luasrc/view/admin_status/index/ddnsto.htm b/ddnsto-openwrt/luci-app-ddnsto/luasrc/view/admin_status/index/ddnsto.htm new file mode 100644 index 000000000..718be04a0 --- /dev/null +++ b/ddnsto-openwrt/luci-app-ddnsto/luasrc/view/admin_status/index/ddnsto.htm @@ -0,0 +1 @@ +<%+ddnsto_status%> diff --git a/ddnsto-openwrt/luci-app-ddnsto/luasrc/view/ddnsto_status.htm b/ddnsto-openwrt/luci-app-ddnsto/luasrc/view/ddnsto_status.htm new file mode 100644 index 000000000..98b51a72f --- /dev/null +++ b/ddnsto-openwrt/luci-app-ddnsto/luasrc/view/ddnsto_status.htm @@ -0,0 +1,26 @@ + + +
+ <%:DDNS.to Status%> +

+ <%:Collecting data...%> +

+
diff --git a/ddnsto-openwrt/luci-app-ddnsto/po/zh-cn/ddnsto.po b/ddnsto-openwrt/luci-app-ddnsto/po/zh-cn/ddnsto.po new file mode 100644 index 000000000..a6ad57484 --- /dev/null +++ b/ddnsto-openwrt/luci-app-ddnsto/po/zh-cn/ddnsto.po @@ -0,0 +1,32 @@ +msgid "DDNS.to" +msgstr "DDNS.to内网穿透" + +msgid "Running state" +msgstr "运行状态" + +msgid "Click to open DDNS.to" +msgstr "点击打开DDNS.to" + +msgid "DDNS.to is a reverse proxy." +msgstr "DDNS.to是一个内网穿透工具。" + +msgid "Official Website" +msgstr "官网" + +msgid "Token" +msgstr "令牌" + +msgid "The DDNS.to service is running." +msgstr "DDNS.to服务已启动" + +msgid "The DDNS.to service is not running." +msgstr "DDNS.to服务未启动" + +msgid "DDNS.to Status" +msgstr "DDNS.to服务状态" + +msgid "Collecting data..." +msgstr "收集数据..." + +msgid "Global settings" +msgstr "全局设置" diff --git a/ddnsto-openwrt/luci-app-ddnsto/root/etc/uci-defaults/50_luci-ddnsto b/ddnsto-openwrt/luci-app-ddnsto/root/etc/uci-defaults/50_luci-ddnsto new file mode 100755 index 000000000..d7bfee271 --- /dev/null +++ b/ddnsto-openwrt/luci-app-ddnsto/root/etc/uci-defaults/50_luci-ddnsto @@ -0,0 +1,4 @@ +#!/bin/sh + +rm -f /tmp/luci-indexcache +exit 0