mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 18:45:13 +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,56 @@
|
||||
--[[
|
||||
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("git-config", "git-config")
|
||||
o.default = "git-config"
|
||||
|
||||
local data = {}
|
||||
o = s:option(Value, "username", "user.name")
|
||||
o.datatype = "string"
|
||||
o.placeholder = "username"
|
||||
o:depends("action", "git-config")
|
||||
|
||||
o = s:option(Value, "email", "user.email")
|
||||
o.datatype = "string"
|
||||
o.placeholder = "email@address"
|
||||
o:depends("action", "git-config")
|
||||
|
||||
local t=Template("codeserver/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 == "git-config" then
|
||||
local user = m:get(section, "username")
|
||||
local email = m:get(section, "email")
|
||||
if user ~= nil and email ~= nil then
|
||||
local cmd = string.format("/usr/libexec/istorec/codeserver.sh %s %s %s", action, user, email)
|
||||
cmd = "/etc/init.d/tasks task_add codeserver " .. luci.util.shellquote(cmd) .. " >/dev/null 2>&1"
|
||||
os.execute(cmd)
|
||||
t.show_log_taskid = "codeserver"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
|
||||
Reference in new issue
Block a user