mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 01:04:06 +08:00
tce clear log
This commit is contained in:
parent
e5d0dabb7f
commit
c380ca2ad4
@ -128,7 +128,7 @@ nnoremap <C-H> <C-W>h
|
||||
nnoremap <C-J> <C-W>j
|
||||
nnoremap <C-K> <C-W>k
|
||||
nnoremap <C-L> <C-W>l
|
||||
nnoremap <C-M> :make<CR>
|
||||
" nnoremap <C-M> :make<CR>
|
||||
nnoremap <Space> :
|
||||
|
||||
nnoremap j gj
|
||||
|
@ -480,7 +480,6 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
|
||||
IsCA: true,
|
||||
KeyUsage: x509.KeyUsageCertSign,
|
||||
}
|
||||
m.Log("fuck", "what %#v", template)
|
||||
cert, e := x509.CreateCertificate(crand.Reader, &template, &template, &keys.PublicKey, keys)
|
||||
m.Assert(e)
|
||||
|
||||
@ -569,8 +568,7 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
|
||||
}
|
||||
case "check":
|
||||
defer func() {
|
||||
e := recover()
|
||||
m.Log("fuck", "what %v", e)
|
||||
recover()
|
||||
}()
|
||||
|
||||
root, e := x509.ParseCertificate(aaa.Decode(arg[1]))
|
||||
@ -582,15 +580,10 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
|
||||
// ee := cert.CheckSignatureFrom(root)
|
||||
// m.Echo("%v", ee)
|
||||
//
|
||||
m.Log("fuck", "----")
|
||||
pool := &x509.CertPool{}
|
||||
m.Log("fuck", "----")
|
||||
m.Echo("%c", pool)
|
||||
m.Log("fuck", "----")
|
||||
pool.AddCert(root)
|
||||
m.Log("fuck", "----")
|
||||
c, e := cert.Verify(x509.VerifyOptions{Roots: pool})
|
||||
m.Log("fuck", "----")
|
||||
m.Echo("%c", c)
|
||||
}
|
||||
}
|
||||
|
@ -1414,8 +1414,6 @@ func (m *Message) Cmd(args ...interface{}) *Message {
|
||||
}
|
||||
if len(args) > 0 {
|
||||
m.Set("detail", Trans(args...)...)
|
||||
m.Log("what", "waht %v", m.Meta)
|
||||
m.Log("what", "waht %v", len(m.Meta["detail"]))
|
||||
}
|
||||
key, arg := m.Meta["detail"][0], m.Meta["detail"][1:]
|
||||
|
||||
@ -1467,9 +1465,7 @@ func (m *Message) Confx(key string, arg ...interface{}) string {
|
||||
switch v := arg[0].(type) {
|
||||
case map[string]interface{}:
|
||||
conf = v[key].(string)
|
||||
m.Log("fuck", "conf %v", conf)
|
||||
value = m.Option(key)
|
||||
m.Log("fuck", "value %v", value)
|
||||
arg = arg[1:]
|
||||
case string:
|
||||
value, arg = v, arg[1:]
|
||||
@ -3517,13 +3513,10 @@ var Index = &Context{Name: "ctx", Help: "模块中心",
|
||||
v := Chain(m, value, arg[1])
|
||||
value = v
|
||||
}
|
||||
m.Log("fuck", "info %T", value)
|
||||
m.Log("fuck", "info %v", value)
|
||||
|
||||
switch val := value.(type) {
|
||||
case map[string]interface{}:
|
||||
for k, v := range val {
|
||||
m.Log("fuck", "info %v %v", k, v)
|
||||
m.Add("append", "key", k)
|
||||
m.Add("append", "value", v)
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
)
|
||||
|
||||
type LOG struct {
|
||||
nfs *ctx.Message
|
||||
out *os.File
|
||||
*ctx.Context
|
||||
}
|
||||
@ -17,6 +16,7 @@ type LOG struct {
|
||||
func (log *LOG) Spawn(m *ctx.Message, c *ctx.Context, arg ...string) ctx.Server {
|
||||
c.Caches = map[string]*ctx.Cache{}
|
||||
c.Configs = map[string]*ctx.Config{}
|
||||
|
||||
s := new(LOG)
|
||||
s.Context = c
|
||||
return s
|
||||
@ -28,8 +28,7 @@ func (log *LOG) Begin(m *ctx.Message, arg ...string) ctx.Server {
|
||||
return log
|
||||
}
|
||||
func (log *LOG) Start(m *ctx.Message, arg ...string) bool {
|
||||
log.nfs = m.Sess("nfs").Cmd("open", m.Confx("bench.log", arg, 0))
|
||||
log.out = log.nfs.Optionv("out").(*os.File)
|
||||
log.out = m.Sess("nfs").Cmd("open", m.Confx("bench.log", arg, 0)).Optionv("out").(*os.File)
|
||||
log.out.Truncate(0)
|
||||
fmt.Fprintln(log.out, "\n\n")
|
||||
return false
|
||||
@ -64,8 +63,6 @@ var Index = &ctx.Context{Name: "log", Help: "日志中心",
|
||||
"log_name": &ctx.Config{Name: "log_name", Value: "dump", Help: "日志屏蔽类型"},
|
||||
},
|
||||
Commands: map[string]*ctx.Command{
|
||||
"open": &ctx.Command{Name: "open file", Help: "打开日志文件", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||
}},
|
||||
"log": &ctx.Command{Name: "log level string...", Help: "输出日志, level: 日志类型, string: 日志内容", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||
if log, ok := m.Target().Server.(*LOG); m.Assert(ok) && log.out != nil {
|
||||
if m.Confs("silent", arg[0]) {
|
||||
@ -92,9 +89,6 @@ var Index = &ctx.Context{Name: "log", Help: "日志中心",
|
||||
}
|
||||
}
|
||||
}},
|
||||
"pwd": &ctx.Command{Name: "pwd", Help: "打开日志文件", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||
m.Echo("nice")
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1133,6 +1133,12 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
|
||||
Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||
conf := m.Confv("dir_conf")
|
||||
|
||||
m.Log("info", "option %s", m.Option("dir"))
|
||||
if len(arg) > 0 {
|
||||
m.Log("info", "arg0 %s", arg[0])
|
||||
}
|
||||
m.Log("info", "elect %s", ctx.Elect(m.Option("dir"), arg, 0))
|
||||
|
||||
m.Option("dir", path.Clean(ctx.Elect(m.Option("dir"), arg, 0)))
|
||||
d := path.Join(m.Confx("dir_root", conf), m.Option("dir"))
|
||||
if s, e := os.Stat(d); m.Assert(e) && !s.IsDir() {
|
||||
|
@ -279,37 +279,18 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
"index": []interface{}{
|
||||
map[string]interface{}{"name": "head", "template": "head"},
|
||||
map[string]interface{}{"name": "clipbaord", "help": "clipbaord", "template": "clipboard"},
|
||||
map[string]interface{}{"name": "prompt", "help": "prompt", "template": "componet",
|
||||
"context": "nfs.stdio", "command": "prompt", "arguments": []interface{}{"@string"},
|
||||
"inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "string", "label": "string"},
|
||||
map[string]interface{}{"type": "button", "label": "refresh"},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{"name": "exec", "help": "exec", "template": "componet",
|
||||
"context": "nfs.stdio", "command": "exec", "arguments": []interface{}{"@string"},
|
||||
"inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "string"},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{"name": "show", "help": "show", "template": "componet",
|
||||
"context": "nfs.stdio", "command": "show", "arguments": []interface{}{"\n", "@string", "\n"},
|
||||
"inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "string", "label": "string"},
|
||||
map[string]interface{}{"type": "button", "label": "refresh"},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{"name": "buffer", "help": "buffer", "template": "componet",
|
||||
"context": "cli", "command": "tmux", "arguments": []interface{}{"buffer"}, "inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "limit", "label": "limit", "value": "3"},
|
||||
map[string]interface{}{"type": "text", "name": "index", "label": "index"},
|
||||
map[string]interface{}{"type": "button", "label": "refresh"},
|
||||
},
|
||||
"pre_run": true,
|
||||
},
|
||||
map[string]interface{}{"name": "command", "help": "command", "template": "componet",
|
||||
"context": "cli.shell1", "command": "source", "arguments": []interface{}{"@cmd"},
|
||||
"inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "pwd",
|
||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "",
|
||||
"class": "cmd", "clipstack": "clistack",
|
||||
},
|
||||
},
|
||||
@ -331,14 +312,21 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
map[string]interface{}{"type": "button", "label": "refresh"},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{"name": "upload", "help": "upload", "template": "componet",
|
||||
"form_type": "upload",
|
||||
"inputs": []interface{}{
|
||||
map[string]interface{}{"type": "file", "name": "upload"},
|
||||
map[string]interface{}{"type": "submit", "value": "submit"},
|
||||
},
|
||||
"display_result": "",
|
||||
},
|
||||
map[string]interface{}{"name": "dir", "help": "dir", "template": "componet",
|
||||
"context": "nfs", "command": "dir", "arguments": []interface{}{"@dir",
|
||||
"dir_deep", "no", "dir_name", "name", "dir_info", "",
|
||||
"dir_link", "<a class='download' data-type='%s'>%s<a>",
|
||||
},
|
||||
"form_type": "upload",
|
||||
"pre_run": true,
|
||||
"inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "dir", "label": "dir"},
|
||||
map[string]interface{}{"type": "choice", "name": "dir_type",
|
||||
"label": "dir_type", "value": "both", "choice": []interface{}{
|
||||
map[string]interface{}{"name": "both", "value": "both"},
|
||||
@ -365,8 +353,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
map[string]interface{}{"name": "time_r", "value": "time_r"},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{"type": "file", "name": "upload"},
|
||||
map[string]interface{}{"type": "submit", "value": "submit"},
|
||||
map[string]interface{}{"type": "text", "name": "dir", "label": "dir"},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{"name": "web_site", "help": "web_site", "template": "componet",
|
||||
@ -375,6 +362,26 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
},
|
||||
"display_result": "",
|
||||
},
|
||||
map[string]interface{}{"name": "prompt", "help": "prompt", "template": "componet",
|
||||
"context": "nfs.stdio", "command": "prompt", "arguments": []interface{}{"@string"},
|
||||
"inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "string", "label": "string"},
|
||||
map[string]interface{}{"type": "button", "label": "refresh"},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{"name": "exec", "help": "exec", "template": "componet",
|
||||
"context": "nfs.stdio", "command": "exec", "arguments": []interface{}{"@string"},
|
||||
"inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "string"},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{"name": "show", "help": "show", "template": "componet",
|
||||
"context": "nfs.stdio", "command": "show", "arguments": []interface{}{"\n", "@string", "\n"},
|
||||
"inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "string", "label": "string"},
|
||||
map[string]interface{}{"type": "button", "label": "refresh"},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{"name": "tail", "template": "tail"},
|
||||
},
|
||||
}, Help: "组件列表"},
|
||||
@ -470,7 +477,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
m.Log("info", "%s %s", req.Method, req.URL)
|
||||
m.Echo("%s: %s\n", req.Method, req.URL)
|
||||
for k, v := range req.Header {
|
||||
m.Log("fuck", "%s: %s", k, v)
|
||||
m.Log("info", "%s: %s", k, v)
|
||||
}
|
||||
|
||||
if web.Client == nil {
|
||||
@ -757,7 +764,6 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
m.Log("upload", "file(%d): %s", h.Size, p)
|
||||
m.Append("redirect", m.Option("referer"))
|
||||
}},
|
||||
|
||||
"/render": &ctx.Command{Name: "/render template", Help: "渲染模板, template: 模板名称", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||
if _, ok := m.Target().Server.(*WEB); m.Assert(ok) {
|
||||
accept_json := strings.HasPrefix(m.Option("accept"), "application/json")
|
||||
@ -870,8 +876,10 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
}
|
||||
}
|
||||
|
||||
if val["command"] != nil {
|
||||
msg.Cmd(val["command"], args)
|
||||
if order != "" || (val["pre_run"] != nil && val["pre_run"].(bool)) {
|
||||
if val["command"] != nil {
|
||||
msg.Cmd(val["command"], args)
|
||||
}
|
||||
}
|
||||
|
||||
if accept_json {
|
||||
|
@ -35,6 +35,10 @@ function send_command(form, cb) {
|
||||
data[form[i].name] = form[i].value
|
||||
}
|
||||
|
||||
if (data["dir"]) {
|
||||
context.Cookie("dir", data["dir"])
|
||||
}
|
||||
|
||||
context.GET("", data, function(msg) {
|
||||
msg = msg[0]
|
||||
|
||||
@ -79,7 +83,6 @@ function check_argument(form, target) {
|
||||
function onaction(event, action) {
|
||||
switch (action) {
|
||||
case "submit":
|
||||
return false
|
||||
break
|
||||
case "click":
|
||||
if (event.target.nodeName == "INPUT") {
|
||||
@ -249,7 +252,7 @@ function init_download(event) {
|
||||
|
||||
document.querySelector("form.option.dir input[name=dir]").value = context.Search("download_dir")
|
||||
|
||||
option["dir"].value && send_command(option)
|
||||
option["dir"].value && option["dir"].value != context.Cookie("dir") && send_command(option)
|
||||
|
||||
var append = document.querySelector("table.append.dir")
|
||||
append.onchange =
|
||||
|
@ -111,6 +111,9 @@
|
||||
{{define "componet"}}
|
||||
<fieldset><legend title="{{option .Meta "help"}}">{{option .Meta "help"}}({{option .Meta "context"}}.{{option .Meta "command"}})</legend>
|
||||
{{$form_type := option . "form_type"|meta}}
|
||||
|
||||
{{if eq $form_type "upload"}}
|
||||
{{end}}
|
||||
<form class="option {{option .Meta "name"}}"
|
||||
data-last_componet_group="{{option . "last_componet_group"|meta}}"
|
||||
data-last_componet_order="{{option . "last_componet_order"|meta}}"
|
||||
@ -120,8 +123,8 @@
|
||||
data-componet_help="{{option . "help"|meta}}"
|
||||
{{if eq $form_type "upload"}}
|
||||
method="POST" action="/upload" enctype="multipart/form-data"
|
||||
onsubmit="onaction(event,'upload')"
|
||||
{{end}}
|
||||
onsubmit="onaction(event,'submit')"
|
||||
>
|
||||
<input style="display:none"></input>
|
||||
{{range $index, $input := option . "inputs"}}
|
||||
@ -165,6 +168,8 @@
|
||||
{{end}}
|
||||
<hr/>
|
||||
</form>
|
||||
{{if eq $form_type "upload"}}
|
||||
{{end}}
|
||||
|
||||
{{if index .Meta "display_append"}}
|
||||
{{option .Meta "display_append"}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user