mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 21:13:56 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
]]--
|
||||
|
||||
local taskd = require "luci.model.tasks"
|
||||
local webvirtcloud_model = require "luci.model.webvirtcloud"
|
||||
local m, s, o
|
||||
|
||||
m = taskd.docker_map("webvirtcloud", "webvirtcloud", "/usr/libexec/istorec/webvirtcloud.sh",
|
||||
translate("KVM WebVirtCloud"),
|
||||
translate("KVM web manager in iStoreOS using webvirtcloud.") .. " login: admin/admin. "
|
||||
.. translate("Official website:") .. ' <a href=\"https://webvirt.cloud/\" target=\"_blank\">https://webvirt.cloud/</a>')
|
||||
|
||||
s = m:section(SimpleSection, translate("Service Status"), translate("WebVirtCloud status:"))
|
||||
s:append(Template("webvirtcloud/status"))
|
||||
|
||||
s = m:section(TypedSection, "webvirtcloud", translate("Setup"), translate("The following parameters will only take effect during installation or upgrade:"))
|
||||
s.addremove=false
|
||||
s.anonymous=true
|
||||
|
||||
o = s:option(Value, "http_port", translate("HTTP Port").."<b>*</b>")
|
||||
o.default = "6009"
|
||||
o.datatype = "port"
|
||||
|
||||
o = s:option(Value, "image_name", translate("Image").."<b>*</b>")
|
||||
o.rmempty = false
|
||||
o.datatype = "string"
|
||||
o:value("linkease/webvirtcloud:latest", "linkease/webvirtcloud:latest")
|
||||
o:value("linkease/webvirtcloud:0.8.5", "linkease/webvirtcloud:0.8.5")
|
||||
o:value("linkease/webvirtcloud:0.3.6", "linkease/webvirtcloud:0.3.6")
|
||||
o.default = "linkease/webvirtcloud:latest"
|
||||
|
||||
local blocks = webvirtcloud_model.blocks()
|
||||
local home = webvirtcloud_model.home()
|
||||
|
||||
o = s:option(Value, "config_path", translate("Config path").."<b>*</b>")
|
||||
o.rmempty = false
|
||||
o.datatype = "string"
|
||||
|
||||
local paths, default_path = webvirtcloud_model.find_paths(blocks, home, "Configs")
|
||||
for _, val in pairs(paths) do
|
||||
o:value(val, val)
|
||||
end
|
||||
o.default = default_path
|
||||
|
||||
o = s:option(Value, "time_zone", translate("Timezone"))
|
||||
o.datatype = "string"
|
||||
o:value("Asia/Shanghai", "Asia/Shanghai")
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
]]--
|
||||
|
||||
local http = require 'luci.http'
|
||||
|
||||
m=SimpleForm("Tools")
|
||||
m.submit = false
|
||||
m.reset = false
|
||||
|
||||
s = m:section(SimpleSection)
|
||||
|
||||
o = s:option(Value, "action", translate("Action").."<b>*</b>")
|
||||
o.rmempty = false
|
||||
o.datatype = "string"
|
||||
o:value("gpu-passthrough", "gpu-passthrough")
|
||||
o.default = "gpu-passthrough"
|
||||
|
||||
local t=Template("webvirtcloud/tool")
|
||||
m:append(t)
|
||||
|
||||
local btn_do = s:option(Button, "_do")
|
||||
btn_do.render = function(self, section, scope)
|
||||
self.inputstyle = "add"
|
||||
self.title = " "
|
||||
self.inputtitle = translate("Execute")
|
||||
Button.render(self, section, scope)
|
||||
end
|
||||
|
||||
btn_do.write = function(self, section, value)
|
||||
local action = m:get(section, "action")
|
||||
if action == "gpu-passthrough" then
|
||||
local cmd = string.format("/usr/libexec/istorec/webvirtcloud.sh %s", action)
|
||||
cmd = "/etc/init.d/tasks task_add webvirtcloud " .. luci.util.shellquote(cmd) .. " >/dev/null 2>&1"
|
||||
os.execute(cmd)
|
||||
t.show_log_taskid = "webvirtcloud"
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
|
||||
Reference in new issue
Block a user