mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-29 16:55:13 +08:00
🎨 Sync 2026-08-05 00:15:00
This commit is contained in:
1 parent
9b522ebf42
commit
e40fd6d46b
72 files changed
+1246
-78
No files matched your search
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=KaiPlus
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=4
|
||||
LUCI_DEPENDS:=+kaiplus +luci-compat
|
||||
LUCI_MINIFY_CSS:=0
|
||||
LUCI_MINIFY_JS:=0
|
||||
|
||||
@@ -15,10 +15,12 @@ end
|
||||
function kaiplus_status()
|
||||
local sys = require "luci.sys"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local port = uci:get_first("kaiplus", "kaiplus", "port", "8198")
|
||||
local port = uci:get_first("kaiplus", "kaiplus", "port", "8189")
|
||||
local base_path = uci:get_first("kaiplus", "kaiplus", "base_path", "/apps/kaiplus/")
|
||||
local status = {
|
||||
running = (sys.call("pidof kaiplus_bin >/dev/null") == 0),
|
||||
port = port
|
||||
port = port,
|
||||
base_path = base_path
|
||||
}
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(status)
|
||||
|
||||
@@ -5,7 +5,10 @@ m = Map("kaiplus", translate("KaiPlus"), translate("KaiPlus is an AI workspace a
|
||||
m:section(SimpleSection).template = "kaiplus/kaiplus_status"
|
||||
|
||||
m.on_after_commit = function(self)
|
||||
sys.call("/etc/init.d/kaiplus restart >/dev/null 2>&1 &")
|
||||
sys.call("/etc/init.d/kaiplus restart >/dev/null 2>&1")
|
||||
if sys.call("[ -x /etc/init.d/linkease ]") == 0 then
|
||||
sys.call("/etc/init.d/linkease restart >/dev/null 2>&1 &")
|
||||
end
|
||||
end
|
||||
|
||||
s = m:section(TypedSection, "kaiplus", translate("Global settings"))
|
||||
@@ -29,7 +32,7 @@ end
|
||||
data_dir.default = default_path
|
||||
|
||||
local port = s:option(Value, "port", translate("Web port"))
|
||||
port.default = "8198"
|
||||
port.default = "8189"
|
||||
port.rmempty = false
|
||||
port.datatype = "port"
|
||||
port.description = translate("Port for the KaiPlus web service.")
|
||||
|
||||
@@ -6,8 +6,15 @@ XHR.poll(5, '<%=url("admin/services/kaiplus_status")%>', null, function(x, st) {
|
||||
el.innerHTML = '<br/><em style=\"color:red\"><%:The KaiPlus service is not running.%></em>';
|
||||
}
|
||||
if (st.running) {
|
||||
var basePath = st.base_path || "/apps/kaiplus/";
|
||||
if (basePath.charAt(0) !== "/") {
|
||||
basePath = "/" + basePath;
|
||||
}
|
||||
if (basePath.charAt(basePath.length - 1) !== "/") {
|
||||
basePath = basePath + "/";
|
||||
}
|
||||
el.innerHTML = '<br/><em style=\"color:green\"><%:The KaiPlus service is running.%></em>'
|
||||
+ "<br/><br/><input class=\"btn cbi-button cbi-button-apply\" type=\"button\" value=\" <%:Click to open KaiPlus%> \" onclick=\"window.open('http://" + window.location.hostname + ":" + st.port + "/')\"/>";
|
||||
+ "<br/><br/><input class=\"btn cbi-button cbi-button-apply\" type=\"button\" value=\" <%:Click to open KaiPlus%> \" onclick=\"window.open('http://' + window.location.hostname + ':' + st.port + basePath)\"/>";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user