update 2025-03-12 16:28:40

This commit is contained in:
kenzok8 2025-03-12 16:28:40 +08:00
parent 128372e743
commit b9331322bf
9 changed files with 89 additions and 8 deletions

View File

@ -1,3 +1,4 @@
config istoreenhance
option port '5443'
option enabled '1'
option enabled '0'
option port '5443'
option adminport '5003'

View File

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for iStoreEnhance
LUCI_DEPENDS:=+istoreenhance
LUCI_PKGARCH:=all
PKG_VERSION:=0.1.3-1
PKG_VERSION:=0.2.0-1
# PKG_RELEASE MUST be empty for luci.mk
PKG_RELEASE:=

View File

@ -13,11 +13,11 @@ 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 port = tonumber(uci:get_first("istoreenhance", "istoreenhance", "adminport"))
local status = {
running = (sys.call("pidof iStoreEnhance >/dev/null") == 0),
port = (port or 8897)
port = (port or 5003)
}
luci.http.prepare_content("application/json")

View File

@ -1,5 +1,7 @@
local m, s
local istoreenhance_model = require "luci.model.istoreenhance"
m = Map("istoreenhance", translate("iStoreEnhance"), translate("iStoreEnhance is a tool to fix network issues for iStore."))
m:section(SimpleSection).template = "istoreenhance_status"
@ -10,8 +12,23 @@ s.anonymous=true
s:option(Flag, "enabled", translate("Enable")).rmempty=false
s:option(Value, "adminport", translate("Admin Port")).rmempty=false
s:option(Value, "port", translate("Port")).rmempty=false
o = s:option(Value, "cache", translate("Cache Path").."<b>*</b>")
o.rmempty = false
o.datatype = "string"
local blocks = istoreenhance_model.blocks()
local home = istoreenhance_model.home()
local paths, default_path = istoreenhance_model.find_paths(blocks, home, "Configs")
for _, val in pairs(paths) do
o:value(val, val)
end
o.default = default_path
return m

View File

@ -0,0 +1,55 @@
local util = require "luci.util"
local jsonc = require "luci.jsonc"
local istoreenhance = {}
istoreenhance.blocks = function()
local f = io.popen("lsblk -s -f -b -o NAME,FSSIZE,MOUNTPOINT --json", "r")
local vals = {}
if f then
local ret = f:read("*all")
f:close()
local obj = jsonc.parse(ret)
for _, val in pairs(obj["blockdevices"]) do
local fsize = val["fssize"]
if fsize ~= nil and string.len(fsize) > 10 and val["mountpoint"] then
-- fsize > 1G
vals[#vals+1] = val["mountpoint"]
end
end
end
return vals
end
istoreenhance.home = function()
local uci = require "luci.model.uci".cursor()
local home_dirs = {}
home_dirs["main_dir"] = uci:get_first("quickstart", "main", "main_dir", "/root")
home_dirs["Configs"] = uci:get_first("quickstart", "main", "conf_dir", home_dirs["main_dir"].."/Configs")
home_dirs["Public"] = uci:get_first("quickstart", "main", "pub_dir", home_dirs["main_dir"].."/Public")
home_dirs["Downloads"] = uci:get_first("quickstart", "main", "dl_dir", home_dirs["Public"].."/Downloads")
home_dirs["Caches"] = uci:get_first("quickstart", "main", "tmp_dir", home_dirs["main_dir"].."/Caches")
return home_dirs
end
istoreenhance.find_paths = function(blocks, home_dirs, path_name)
local default_path = ''
local configs = {}
default_path = home_dirs[path_name] .. "/iStoreEnhance"
if #blocks == 0 then
table.insert(configs, default_path)
else
for _, val in pairs(blocks) do
table.insert(configs, val .. "/" .. path_name .. "/iStoreEnhance")
end
local without_conf_dir = "/root/" .. path_name .. "/iStoreEnhance"
if default_path == without_conf_dir then
default_path = configs[1]
end
end
return configs, default_path
end
return istoreenhance

View File

@ -7,7 +7,8 @@
{
if (st.running)
{
tb.innerHTML = '<br/><em style=\"color:green\"><%:The iStoreEnhance service is running.%></em>';
tb.innerHTML = '<br/><em style=\"color:green\"><%:The iStoreEnhance service is running.%></em>'
+ "<br/><br/><input class=\"btn cbi-button cbi-button-apply\" type=\"button\" value=\" <%:Click to open iStoreEnhance%> \" onclick=\"window.open('http://" + window.location.hostname + ":" + st.port + "/')\"/>";
}
else
{

View File

@ -10,6 +10,9 @@ msgstr "iStore增强插件可以有效的解决一些网络问题让 iStore
msgid "Port"
msgstr "端口"
msgid "Admin Port"
msgstr "管理端口"
msgid "The iStoreEnhance service is running."
msgstr "服务已启动"

View File

@ -0,0 +1,4 @@
#!/bin/sh
rm -f /tmp/luci-indexcache
exit 0

View File

@ -21,13 +21,13 @@ define Download/geoip
HASH:=83337c712b04d8c16351cf5a5394eae5cb9cfa257fb4773485945dce65dcea76
endef
GEOSITE_VER:=20250307074130
GEOSITE_VER:=20250312064659
GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
define Download/geosite
URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
URL_FILE:=dlc.dat
FILE:=$(GEOSITE_FILE)
HASH:=17d78a6b0a64e04f2362b2907788d9a192d41a340301e2e63daca415219cf752
HASH:=eb752838bf61a39f1e1d3962d0aeecae103e96f925755ee18f206490744c91a8
endef
GEOSITE_IRAN_VER:=202503100030