1
0
forked from x/ContextOS
This commit is contained in:
shaoying 2019-10-30 03:47:38 +08:00
parent ed9b9e8f41
commit 79c289c3f8
7 changed files with 52 additions and 32 deletions

View File

@ -1,6 +1,7 @@
#! /bin/bash -i #! /bin/bash -i
# 日志配置 # 日志配置
export ctx_err=${ctx_err:="/dev/null"}
export ctx_log=${ctx_log:="var/log"} export ctx_log=${ctx_log:="var/log"}
export ctx_log_debug=${ctx_log_debug:=false} export ctx_log_debug=${ctx_log_debug:=false}
export ctx_log_disable=${ctx_log_disable:=false} export ctx_log_disable=${ctx_log_disable:=false}
@ -58,7 +59,7 @@ main() {
trap HUP hup trap HUP hup
log "\nstarting..." log "\nstarting..."
while true; do while true; do
date && ${ctx_bin} "$@" 2>error.log && break date && ${ctx_bin} "$@" 2>${ctx_err} && break
log "\n\nrestarting..." && sleep 1 log "\n\nrestarting..." && sleep 1
done done
} }

View File

@ -7,5 +7,5 @@ var version = struct {
self int self int
}{ }{
[]string{"2017-11-01 01:02:03", "2019-07-13 18:02:21"}, []string{"2017-11-01 01:02:03", "2019-07-13 18:02:21"},
`2019-10-29 13:12:30`, `com`, 710, `2019-10-29 15:36:42`, `centos`, 653,
} }

View File

@ -14,7 +14,7 @@ kit dir "目录" private "ssh._route" _ "nfs.dir" _ time size line path \
feature display editor \ feature display editor \
exports dir "" dir exports dir "" dir
kit grep "搜索" public "nfs.grep" search _ _ "-rn" "--color" cmd_parse cut 3 ":" "file line word" \ kit grep "搜索" public "cli.system" grep _ _ "-rn" "--color" cmd_parse cut 3 ":" "file line word" \
text "" name txt imports plugin_editor_word \ text "" name txt imports plugin_editor_word \
text "usr/local/redis-5.0.5" name dir view long \ text "usr/local/redis-5.0.5" name dir view long \
button "搜索" \ button "搜索" \
@ -36,3 +36,30 @@ fun mark "标签" public \
end end
end end
fun blog "博客" public \
text "" name tag \
text "" name url view long \
button "保存" action auto
if $2 == ""
copy skip ssh.data show blog
else
copy ssh.data insert blog tag _ url _
end
end
fun note "记事本" public \
text "" name you imports plugin_you action auto \
text "" name tip imports plugin_tip view long action auto \
button "查看" action auto \
button "返回" cb Last \
exports tip file tip \
feature display inner
if $2 == "" || $2 ~ ".*/$"
copy ssh._route _ context wiki tree __ level local/wiki
else
copy ssh._route _ context wiki text __ level local/wiki
end
end

View File

@ -31,21 +31,6 @@ fun clip "剪切板" public \
end end
end end
fun note "记事本" public \
text "" name you imports plugin_you action auto \
text "" name tip imports plugin_tip view long action auto \
button "查看" action auto \
button "返回" cb Last \
exports tip file tip \
feature display inner
if $2 == "" || $2 ~ ".*/$"
copy ssh._route _ context wiki tree __ level local/wiki
else
copy ssh._route _ context wiki text __ level local/wiki
end
end
kit data "数据库" public "ssh.data" show \ kit data "数据库" public "ssh.data" show \
text "" name table imports plugin_table action auto view long \ text "" name table imports plugin_table action auto view long \
text "" name index imports plugin_index action auto \ text "" name index imports plugin_index action auto \
@ -59,7 +44,7 @@ kit save "导出" private "ssh.data" export \
kit load "导入" private "ssh.data" import \ kit load "导入" private "ssh.data" import \
text "love" name table imports plugin_table \ text "love" name table imports plugin_table \
text "list.csv" name file \ text "etc/list.csv" name file \
button "导入" button "导入"
kit push "上传" private "web./download/" \ kit push "上传" private "web./download/" \

View File

@ -413,17 +413,8 @@ var page = Page({
], ],
} }
}, },
initStorm: function(page, field, option, output) { initStorm: function(page, field, option, output) {var river = ""
var river = ""
return { return {
Next: function() {
var next = output.querySelector("div.item.select").nextSibling
next? next.click(): output.firstChild.click()
},
Prev: function() {
var prev = output.querySelector("div.item.select").previousSibling
prev? prev.click(): output.lastChild.click()
},
Show: function(which) {var pane = field.Pane Show: function(which) {var pane = field.Pane
var data = river && field.Pane.Load(river, output) var data = river && field.Pane.Load(river, output)
if (data) {return pane.which.set(data.which)} if (data) {return pane.which.set(data.which)}

View File

@ -288,6 +288,9 @@ function Page(page) {
break break
} }
}, },
title: function(title) {
document.title = title
},
Require: function(file, cb) { Require: function(file, cb) {
if (!file || Plugin[file]) {return kit._call(cb, [Plugin[file]])} if (!file || Plugin[file]) {return kit._call(cb, [Plugin[file]])}
@ -691,6 +694,15 @@ function Pane(page, field) {
}) })
}), }),
Next: function() {
var next = output.querySelector(itemkeys).nextSibling
next? next.click(): output.firstChild.click()
},
Prev: function() {
var prev = output.querySelector(itemkeys).previousSibling
prev? prev.click(): output.lastChild.click()
},
Show: function() { Show: function() {
kit.ModifyView(field, {display: "block"}) kit.ModifyView(field, {display: "block"})
}, },
@ -1452,7 +1464,8 @@ function Output(plugin, type, msg, cb, target, option) {
if (msg.file) { if (msg.file) {
target.style.maxHeight = "500px" target.style.maxHeight = "500px"
var code = kit.AppendChild(target, [{view: ["code", "table"], list: kit.List(msg.result, function(line, index) { var code = kit.AppendChild(target, [{view: ["code", "table"], list: kit.List(msg.result, function(line, index) {
return {view: ["line"+ (current == index+1? " select": ""), "tr"], list: [{view: ["number", "td", index+1]}, {view: ["code", "td", kit.Color(line)], style: {"white-space": "pre"}}], click: function(event) { return {view: ["line"+ (current == index+1? " select": ""), "tr"],
list: [{view: ["number", "td", index+1]}, {view: ["code", "td", kit.Origin(kit.Color(line))], style: {"white-space": "pre"}}], click: function(event) {
page.Sync("plugin_editor_file").set(msg.file[0]) page.Sync("plugin_editor_file").set(msg.file[0])
page.Sync("plugin_editor_index").set(index+1) page.Sync("plugin_editor_index").set(index+1)
page.Sync("plugin_editor_line").set(line) page.Sync("plugin_editor_line").set(line)

View File

@ -530,6 +530,11 @@ kit = toolkit = (function() {var kit = {__proto__: document,
notNone: function(c) {return !kit.isNone(c)}, notNone: function(c) {return !kit.isNone(c)},
isSpace: function(c) {return c == " " || c == "Enter"}, isSpace: function(c) {return c == " " || c == "Enter"},
Format: function(objs) {return JSON.stringify(objs)}, Format: function(objs) {return JSON.stringify(objs)},
Origin: function(s) {
s = s.replace(/</g, "&lt;")
s = s.replace(/>/g, "&gt;")
return s
},
Color: function(s) {if (!s) {return s} Color: function(s) {if (!s) {return s}
s = s.replace(/\033\[1m/g, "<span style='font-weight:bold'>") s = s.replace(/\033\[1m/g, "<span style='font-weight:bold'>")
s = s.replace(/\033\[36m/g, "<span style='color:#0ff'>") s = s.replace(/\033\[36m/g, "<span style='color:#0ff'>")
@ -539,8 +544,6 @@ kit = toolkit = (function() {var kit = {__proto__: document,
s = s.replace(/\033\[31m/g, "<span style='color:#f00'>") s = s.replace(/\033\[31m/g, "<span style='color:#f00'>")
s = s.replace(/\033\[0m/g, "</span>") s = s.replace(/\033\[0m/g, "</span>")
s = s.replace(/\033\[m/g, "</span>") s = s.replace(/\033\[m/g, "</span>")
// s = s.replace(/</g, "&lt;")
// s = s.replace(/>/g, "&gt;")
return s return s
}, },
Value: function() { Value: function() {