update 2024-06-24 20:34:31

This commit is contained in:
kenzok8 2024-06-24 20:34:31 +08:00
parent 95bba7dfb8
commit 1a0f7ec2a6
10 changed files with 226 additions and 0 deletions

63
istoreenhance/Makefile Normal file
View File

@ -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)))

View File

@ -0,0 +1,3 @@
config istoreenhance
option port '8443'
option enabled '1'

View File

@ -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"
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,26 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(5, '<%=url("admin/services/istoreenhance_status")%>', null,
function(x, st)
{
var tb = document.getElementById('istoreenhance_status');
if (st && tb)
{
if (st.running)
{
tb.innerHTML = '<br/><em style=\"color:green\"><%:The iStoreEnhance service is running.%></em>';
}
else
{
tb.innerHTML = '<br/><em style=\"color:red\"><%:The iStoreEnhance service is not running.%></em>';
}
}
}
);
//]]></script>
<fieldset class="cbi-section">
<legend><%:iStoreEnhance Status%></legend>
<p id="istoreenhance_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -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 "收集数据..."

View File

@ -0,0 +1 @@
zh-cn