mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 03:53:56 +08:00
🤞 Sync 2026-05-22 14:40:31
This commit is contained in:
1 parent
5635d6c1ec
commit
b307c4b992
6 files changed
+14
-91
No files matched your search
@@ -7,9 +7,9 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
LUCI_TITLE:=kai
|
LUCI_TITLE:=kai
|
||||||
PKG_VERSION:=1.0.1
|
PKG_VERSION:=1.0.0
|
||||||
PKG_RELEASE:=5
|
PKG_RELEASE:=6
|
||||||
LUCI_DEPENDS:=+kai +kai_session +luci-compat
|
LUCI_DEPENDS:=+kai +kai_session
|
||||||
LUCI_MINIFY_CSS:=0
|
LUCI_MINIFY_CSS:=0
|
||||||
LUCI_MINIFY_JS:=0
|
LUCI_MINIFY_JS:=0
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ define Package/luci-app-kai/conffiles
|
|||||||
/etc/config/kai
|
/etc/config/kai
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/luci-app-kai/postrm
|
define Package/luci-nginxer/postrm
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
rm -f /tmp/luci-indexcache
|
rm -f /tmp/luci-indexcache
|
||||||
exit 0
|
exit 0
|
||||||
@@ -25,4 +25,4 @@ endef
|
|||||||
|
|
||||||
include $(TOPDIR)/feeds/luci/luci.mk
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
# call BuildPackage - OpenWrt buildroot signature
|
# call BuildPackage - OpenWrt buildroot signature
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
local m, s
|
local m, s
|
||||||
|
|
||||||
m = Map("kai", translate("KAI"), translate("KAI is an efficient AI tool."))
|
m = Map("kai", translate("KAI"), translate("KAI is an efficient data transfer tool."))
|
||||||
m:section(SimpleSection).template = "kai/kai_status"
|
m:section(SimpleSection).template = "kai/kai_status"
|
||||||
|
|
||||||
s=m:section(TypedSection, "kai", translate("Global settings"))
|
s=m:section(TypedSection, "kai", translate("Global settings"))
|
||||||
@@ -8,25 +8,6 @@ s.addremove=false
|
|||||||
s.anonymous=true
|
s.anonymous=true
|
||||||
|
|
||||||
s:option(Flag, "enabled", translate("Enable")).rmempty=false
|
s:option(Flag, "enabled", translate("Enable")).rmempty=false
|
||||||
|
|
||||||
local kai_model = require "luci.model.kai"
|
|
||||||
local blocks = kai_model.blocks()
|
|
||||||
local home = kai_model.home()
|
|
||||||
|
|
||||||
local data_dir = s:option(Value, "data_dir", translate("Data directory"))
|
|
||||||
data_dir.rmempty = false
|
|
||||||
data_dir.description = translate("Required. KAI session will store cwd/cache/data/config/state under this directory (subfolders: cwd, cache, data, config, state).")
|
|
||||||
|
|
||||||
local paths, default_path = kai_model.find_paths(blocks, home, "Configs")
|
|
||||||
for _, val in pairs(paths) do
|
|
||||||
data_dir:value(val, val)
|
|
||||||
end
|
|
||||||
data_dir.default = default_path
|
|
||||||
|
|
||||||
local port = s:option(Value, "port", translate("API port"))
|
|
||||||
port.default = "8197"
|
|
||||||
port.rmempty = false
|
|
||||||
port.datatype = "port"
|
|
||||||
port.description = translate("Port for KAI HTTP server (kai_bin). kai_session will read OPENCODE_CONFIG via 127.0.0.1:<port>.")
|
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
|
||||||
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
local jsonc = require "luci.jsonc"
|
|
||||||
|
|
||||||
local kai = {}
|
|
||||||
|
|
||||||
kai.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 and obj["blockdevices"] or {}) do
|
|
||||||
local fsize = val["fssize"]
|
|
||||||
if fsize ~= nil and string.len(fsize) > 10 and val["mountpoint"] then
|
|
||||||
vals[#vals + 1] = val["mountpoint"]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return vals
|
|
||||||
end
|
|
||||||
|
|
||||||
kai.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
|
|
||||||
|
|
||||||
kai.find_paths = function(blocks, home_dirs, path_name)
|
|
||||||
local default_path = ""
|
|
||||||
local paths = {}
|
|
||||||
|
|
||||||
default_path = home_dirs[path_name] .. "/KAI"
|
|
||||||
if #blocks == 0 then
|
|
||||||
table.insert(paths, default_path)
|
|
||||||
else
|
|
||||||
for _, val in pairs(blocks) do
|
|
||||||
table.insert(paths, val .. "/" .. path_name .. "/KAI")
|
|
||||||
end
|
|
||||||
local without_conf_dir = "/root/" .. path_name .. "/KAI"
|
|
||||||
if default_path == without_conf_dir then
|
|
||||||
default_path = paths[1]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return paths, default_path
|
|
||||||
end
|
|
||||||
|
|
||||||
return kai
|
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ XHR.poll(5, '<%=url("admin/services/kai_status")%>', null,function(x, st){
|
|||||||
//]]></script>
|
//]]></script>
|
||||||
|
|
||||||
<fieldset class="cbi-section">
|
<fieldset class="cbi-section">
|
||||||
<legend><%:Status%></legend>
|
<legend>状态</legend>
|
||||||
<p id="kai_status">
|
<p id="kai_status">
|
||||||
<em><%:Collecting data...%></em>
|
<em><%:Collecting data...%></em>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
LUCI_TITLE:=Nginxer
|
LUCI_TITLE:=Nginxer
|
||||||
LUCI_DESCRIPTION:=Standard OpenWrt set including full admin with ppp support and the default Bootstrap theme
|
LUCI_DESCRIPTION:=Standard OpenWrt set including full admin with ppp support and the default Bootstrap theme
|
||||||
PKG_VERSION:=0.0.2
|
PKG_VERSION:=0.0.1
|
||||||
PKG_RELEASE:=3
|
PKG_RELEASE:=4
|
||||||
LUCI_DEPENDS:=+luci-nginx
|
LUCI_DEPENDS:=+luci-nginx
|
||||||
|
|
||||||
define Package/luci-nginxer/postrm
|
define Package/luci-nginxer/postrm
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
/etc/init.d/uhttpd enable
|
/etc/init.d/uhttpd enabled
|
||||||
/etc/init.d/uhttpd start
|
/etc/init.d/uhttpd start
|
||||||
exit 0
|
exit 0
|
||||||
endef
|
endef
|
||||||
|
|
||||||
include $(TOPDIR)/feeds/luci/luci.mk
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
# call BuildPackage - OpenWrt buildroot signature
|
# call BuildPackage - OpenWrt buildroot signature
|
||||||
@@ -8,11 +8,7 @@ if [ "$nginxer" != 1 ]; then
|
|||||||
uci set nginx._redirect2ssl.access_log='off; # logd openwrt'
|
uci set nginx._redirect2ssl.access_log='off; # logd openwrt'
|
||||||
uci set nginx.global.nginxer='1'
|
uci set nginx.global.nginxer='1'
|
||||||
uci commit nginx
|
uci commit nginx
|
||||||
|
|
||||||
# fix firmware upload failed
|
|
||||||
sed -i 's/client_max_body_size 128M;/client_max_body_size 256M;/g' /etc/nginx/uci.conf.template
|
|
||||||
|
|
||||||
# /etc/init.d/uhttpd running || /etc/init.d/uhttpd disable
|
# /etc/init.d/uhttpd running || /etc/init.d/uhttpd disable
|
||||||
/etc/init.d/nginx reload
|
/etc/init.d/nginx reload
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
Reference in new issue
Block a user