1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
shaoying 2019-10-29 10:56:08 +08:00
parent a4add25381
commit c0dc093c4f
9 changed files with 67 additions and 9 deletions

View File

@ -7,5 +7,5 @@ var version = struct {
self int
}{
[]string{"2017-11-01 01:02:03", "2019-07-13 18:02:21"},
`2019-10-28 07:31:43`, `com`, 703,
`2019-10-28 17:53:02`, `centos`, 651,
}

View File

@ -32,6 +32,7 @@ func (c *Context) Register(s *Context, x Server, args ...interface{}) *Context {
c.contexts[name] = s
s.context = c
s.Server = x
s.root = c.root
return s
}
func (c *Context) Plugin(s *Context, args []string) string {

View File

@ -26,7 +26,7 @@ Plugin["mind/index.js"] = function(field, option, output) {return {
switch (event.key) {
case "Enter":
var s = td.parentNode[event.shiftKey?"previousSibling":"nextSibling"]
s? s.querySelector("td").click(): plugin.Runs(event)
s && s.querySelector("td").click()
break
case "Tab":
if (event.shiftKey) {

View File

@ -5,3 +5,12 @@ kit xls "表格" "index.js" "index.css" private context find "web.wiki" xls \
button "返回" cb Last \
feature style "mind" \
exports xls_id id
kit dir "目录" private "ssh._route" _ "nfs.dir" _ time size line path \
text "" name pod imports plugin_pod action auto \
text "usr/script" name dir imports plugin_dir action auto view long \
button "浏览" action auto \
button "返回" cb Last \
feature display editor \
exports dir "" dir

View File

@ -1,13 +1,33 @@
fun clip "粘贴板" public \
fun buffer "粘贴板" private \
text "0" name index imports plugin_tmux_bindex action auto \
text "" name txt view long \
button "查看" action auto \
button "返回" cb Last \
exports tmux_bindex cur
if $1 == ""
copy cli.system tmux "list-buffer" cmd_parse cut 3 ":" "cur bytes text"
return
end
if $2 == ""
copy cli.system tmux "show-buffer" "-b"
return
end
copy cli.system tmux "set-buffer" "-b"
end
fun clip "剪切板" public \
text "" name you imports plugin_you action auto \
text "" name tag \
text "" name txt view long \
button "保存" action auto
if $2 == ""
copy ssh._route _ data show clip
if $3 == ""
copy skip ssh._route _ data show clip
else
copy ssh._route _ data insert clip txt $2
copy ssh._route _ data insert clip tag _ txt _
end
end

View File

@ -174,6 +174,15 @@ var Index = &ctx.Context{Name: "tmux", Help: "终端管理",
}
switch arg[3] {
case "split":
ls := strings.Split(m.Cmdx("cli.system", "tmux", "capture-pane", "-t", target, "-p"), "\n")
for i := 1; i < len(ls)-1; i++ {
for j, v := range strings.Split(ls[i], " ") {
m.Push(kit.Format(j), v)
}
}
m.Table()
case "run":
m.Cmd("cli.system", "tmux", "send-keys", "-t", target, "clear", "Enter")
time.Sleep(kit.Duration(m.Conf("mux", "cmd_timeout")))

View File

@ -48,6 +48,12 @@ kit cmd "命令" private mux _ _ _ r \
text "pwd" view full imports plugin_tmux_cmd \
button "执行"
kit list "内容" private mux _ _ _ split \
text "context" imports plugin_tmux_sess \
text "docker" imports plugin_tmux_wins \
text "4" imports plugin_tmux_pane action auto view tiny \
button "查看"
kit json "解析" private "nfs.json" \
text "" view full \
button "执行"

View File

@ -157,7 +157,7 @@ ctx = context = (function(kit) {var ctx = {__proto__: kit,
xhr.send(args.join("&"))
++arguments.callee.meta.order
}),
WSS: shy("响应后端", {order: 0, wssid: ""}, function(cb, onerror, onclose) {var meta = arguments.callee.meta
WSS: shy("响应后端", {order: 0, wssid: ""}, function(cb, onerror, onclose, onopen) {var meta = arguments.callee.meta
var s = new WebSocket(location.protocol.replace("http", "ws")+"//"+location.host+"/wss?wssid="+meta.wssid)
s.onopen = function(event) {kit.Tip("wss open"), ctx.Event(event, {}, {name: [document.title, "wss", "open"]})}
s.onerror = function(event) {kit.Log("wss", "error", event), kit._call(onerror, [event])}

View File

@ -347,7 +347,7 @@ function Page(page) {
return kit._call(page[args[0]], args.slice(1)) || page.Zone("function", args[0])
}
}),
WSS: function(cb, onerror, onclose) {
WSS: function(cb, onerror, onclose, onopen) {
return page.socket || (page.socket = ctx.WSS(cb || (function(event, m) {
if (m.detail) {
page.action.Pane.Core(event, m, ["_cmd", m.detail], m.Reply)
@ -362,6 +362,7 @@ function Page(page) {
delete(page.socket), setTimeout(function() {
page.WSS(cb, onerror, onclose)
}, 1000)
}), onopen || (function() {
})))
},
@ -1206,7 +1207,7 @@ function Plugin(page, pane, field, inits, runs) {
var list = arguments.callee.list
for (var i = 0; i < list.length; i += 3) {
(list[1] && line[list[1]] || list[i+1] && line[list[i+1]]) &&
(list[1] && line[list[1]] || list[i+1] && line[list[i+1]] || list[i+2]) &&
page.Sync("plugin_"+list[i]).set(meta[list[i+2]||""](list[i+1]? line[list[i+1]]: value, list[i+1]||name, line, list))
}
}),
@ -1281,7 +1282,19 @@ function Inputs(plugin, meta, item, target, option) {
})
}), item.type == "button" && item.action == "auto" && target.click()
}),
clear: function() {
target.value = ""
},
onchoice: shy("菜单列表", {
"清空": "clear",
}, ["清空", "清空", "清空", "清空", "清空"], function(event, value, meta) {
kit._call(input, input[meta[value]])
return true
}),
onaction: shy("事件列表", {
oncontextmenu: function(event) {
plugin.oncarte(event, input.onchoice)
},
onfocus: function(event) {plugin.Select(target)},
onblur: function(event) {type == "text" && input.which.set(target.value)},
onclick: function(event) {plugin.Select()