From 1a0f7ec2a65b8b87da0400683224ab7d678cee65 Mon Sep 17 00:00:00 2001 From: kenzok8 Date: Mon, 24 Jun 2024 20:34:31 +0800 Subject: [PATCH] update 2024-06-24 20:34:31 --- istoreenhance/Makefile | 63 +++++++++++++++++++ istoreenhance/files/istoreenhance.config | 3 + istoreenhance/files/istoreenhance.init | 26 ++++++++ istoreenhance/files/istoreenhance.uci-default | 22 +++++++ luci-app-istoreenhance/Makefile | 18 ++++++ .../luasrc/controller/istoreenhance.lua | 26 ++++++++ .../luasrc/model/cbi/istoreenhance.lua | 17 +++++ .../luasrc/view/istoreenhance_status.htm | 26 ++++++++ .../po/zh-cn/istoreenhance.po | 24 +++++++ luci-app-istoreenhance/po/zh_Hans | 1 + 10 files changed, 226 insertions(+) create mode 100644 istoreenhance/Makefile create mode 100644 istoreenhance/files/istoreenhance.config create mode 100755 istoreenhance/files/istoreenhance.init create mode 100755 istoreenhance/files/istoreenhance.uci-default create mode 100644 luci-app-istoreenhance/Makefile create mode 100644 luci-app-istoreenhance/luasrc/controller/istoreenhance.lua create mode 100644 luci-app-istoreenhance/luasrc/model/cbi/istoreenhance.lua create mode 100644 luci-app-istoreenhance/luasrc/view/istoreenhance_status.htm create mode 100644 luci-app-istoreenhance/po/zh-cn/istoreenhance.po create mode 120000 luci-app-istoreenhance/po/zh_Hans diff --git a/istoreenhance/Makefile b/istoreenhance/Makefile new file mode 100644 index 000000000..30ac2daf1 --- /dev/null +++ b/istoreenhance/Makefile @@ -0,0 +1,63 @@ +# +# 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_ISTOREENHANCE:=$(ARCH) + +PKG_NAME:=istoreenhance +PKG_VERSION:=0.1.3 +PKG_RELEASE:=$(PKG_ARCH_ISTOREENHANCE)-1 +PKG_SOURCE:=iStoreEnhance-binary-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://fw.koolcenter.com/binary/iStoreEnhance/ +PKG_HASH:=c32a28503ce7e53a578b02b948caa2479659f73feb50c6ec82201e3175af34e5 + +PKG_BUILD_DIR:=$(BUILD_DIR)/iStoreEnhance-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:=iStoreEnhance - Fix some net issues for istore + URL:=https://www.istoreos.com/ +endef + +define Package/$(PKG_NAME)/description + Fix some net issues for istore +endef + +define Package/$(PKG_NAME)/conffiles +/etc/config/istoreenhance +endef + +define Package/$(PKG_NAME)/postinst +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + [ -f /etc/uci-defaults/istoreenhance ] && /etc/uci-defaults/istoreenhance && rm -f /etc/uci-defaults/istoreenhance +fi +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)/iStoreEnhance.$(PKG_ARCH_ISTOREENHANCE) $(1)/usr/sbin/iStoreEnhance + $(INSTALL_CONF) ./files/istoreenhance.config $(1)/etc/config/istoreenhance + $(INSTALL_BIN) ./files/istoreenhance.init $(1)/etc/init.d/istoreenhance + $(INSTALL_BIN) ./files/istoreenhance.uci-default $(1)/etc/uci-defaults/istoreenhance +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/istoreenhance/files/istoreenhance.config b/istoreenhance/files/istoreenhance.config new file mode 100644 index 000000000..a178e694b --- /dev/null +++ b/istoreenhance/files/istoreenhance.config @@ -0,0 +1,3 @@ +config istoreenhance + option port '8443' + option enabled '1' diff --git a/istoreenhance/files/istoreenhance.init b/istoreenhance/files/istoreenhance.init new file mode 100755 index 000000000..c6aef5c63 --- /dev/null +++ b/istoreenhance/files/istoreenhance.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 port $1 port 8443 +} + +start_service() { + config_load istoreenhance + config_foreach get_config istoreenhance + [ $enabled != 1 ] && return 1 + + procd_open_instance + procd_set_param limits nofile="65535 65535" + procd_set_param command /usr/sbin/iStoreEnhance + [ -n "$port" ] && procd_append_param command --localAddr ":$port" + procd_set_param respawn + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger "istoreenhance" +} diff --git a/istoreenhance/files/istoreenhance.uci-default b/istoreenhance/files/istoreenhance.uci-default new file mode 100755 index 000000000..0727ad67b --- /dev/null +++ b/istoreenhance/files/istoreenhance.uci-default @@ -0,0 +1,22 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@istoreenhance[-1] + add ucitrack istoreenhance + set ucitrack.@istoreenhance[-1].init=istoreenhance + commit ucitrack + + delete firewall.istoreenhance + set firewall.istoreenhance=rule + set firewall.istoreenhance.name="istoreenhance" + set firewall.istoreenhance.target="ACCEPT" + set firewall.istoreenhance.src="wan" + set firewall.istoreenhance.proto="tcp" + set firewall.istoreenhance.dest_port="8443" + commit firewall +EOF + +/etc/init.d/istoreenhance enable +/etc/init.d/istoreenhance start + +exit 0 diff --git a/luci-app-istoreenhance/Makefile b/luci-app-istoreenhance/Makefile new file mode 100644 index 000000000..1d632ad1a --- /dev/null +++ b/luci-app-istoreenhance/Makefile @@ -0,0 +1,18 @@ +# 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 iStoreEnhance +LUCI_DEPENDS:=+istoreenhance +LUCI_PKGARCH:=all +PKG_VERSION:=0.1.3-1 +# PKG_RELEASE MUST be empty for luci.mk +PKG_RELEASE:= + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + diff --git a/luci-app-istoreenhance/luasrc/controller/istoreenhance.lua b/luci-app-istoreenhance/luasrc/controller/istoreenhance.lua new file mode 100644 index 000000000..30619799e --- /dev/null +++ b/luci-app-istoreenhance/luasrc/controller/istoreenhance.lua @@ -0,0 +1,26 @@ +module("luci.controller.istoreenhance", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/istoreenhance") then + return + end + + entry({"admin", "services", "istoreenhance"}, cbi("istoreenhance"), _("iStoreEnhance"), 20).dependent = true + + entry({"admin", "services", "istoreenhance_status"}, call("istoreenhance_status")) +end + +function istoreenhance_status() + local sys = require "luci.sys" + local uci = require "luci.model.uci".cursor() + local port = tonumber(uci:get_first("istoreenhance", "istoreenhance", "port")) + + local status = { + running = (sys.call("pidof iStoreEnhance >/dev/null") == 0), + port = (port or 8897) + } + + luci.http.prepare_content("application/json") + luci.http.write_json(status) +end + diff --git a/luci-app-istoreenhance/luasrc/model/cbi/istoreenhance.lua b/luci-app-istoreenhance/luasrc/model/cbi/istoreenhance.lua new file mode 100644 index 000000000..3025ce1cc --- /dev/null +++ b/luci-app-istoreenhance/luasrc/model/cbi/istoreenhance.lua @@ -0,0 +1,17 @@ +local m, s + +m = Map("istoreenhance", translate("iStoreEnhance"), translate("iStoreEnhance is a tool to fix network issues for iStore.")) + +m:section(SimpleSection).template = "istoreenhance_status" + +s=m:section(TypedSection, "istoreenhance", translate("Global settings")) +s.addremove=false +s.anonymous=true + +s:option(Flag, "enabled", translate("Enable")).rmempty=false + +s:option(Value, "port", translate("Port")).rmempty=false + +return m + + diff --git a/luci-app-istoreenhance/luasrc/view/istoreenhance_status.htm b/luci-app-istoreenhance/luasrc/view/istoreenhance_status.htm new file mode 100644 index 000000000..d7e9d878e --- /dev/null +++ b/luci-app-istoreenhance/luasrc/view/istoreenhance_status.htm @@ -0,0 +1,26 @@ + + +
+ <%:iStoreEnhance Status%> +

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

+
diff --git a/luci-app-istoreenhance/po/zh-cn/istoreenhance.po b/luci-app-istoreenhance/po/zh-cn/istoreenhance.po new file mode 100644 index 000000000..d717d1596 --- /dev/null +++ b/luci-app-istoreenhance/po/zh-cn/istoreenhance.po @@ -0,0 +1,24 @@ +msgid "iStoreEnhance" +msgstr "iStore增强" + +msgid "Running state" +msgstr "运行状态" + +msgid "iStoreEnhance is a tool to fix network issues for iStore." +msgstr "iStore增强插件可以有效的解决一些网络问题,让 iStore 更好用。当然不安装也不会影响 iStore 基本功能。" + +msgid "Port" +msgstr "端口" + +msgid "The iStoreEnhance service is running." +msgstr "服务已启动" + +msgid "The iStoreEnhance service is not running." +msgstr "服务未启动" + +msgid "iStoreEnhance Status" +msgstr "服务状态" + +msgid "Collecting data..." +msgstr "收集数据..." + diff --git a/luci-app-istoreenhance/po/zh_Hans b/luci-app-istoreenhance/po/zh_Hans new file mode 120000 index 000000000..41451e4a1 --- /dev/null +++ b/luci-app-istoreenhance/po/zh_Hans @@ -0,0 +1 @@ +zh-cn \ No newline at end of file