forked from x/ContextOS
add note_view
Change-Id: Ie516fe41861bd2fc0ca3277e2478542319a3a5d9
This commit is contained in:
parent
91594beb2c
commit
d8a1434ba0
@ -42,14 +42,14 @@ bind i display-panes
|
|||||||
bind x confirm-before -p "kill-pane #P? (y/n)" kill-pane
|
bind x confirm-before -p "kill-pane #P? (y/n)" kill-pane
|
||||||
|
|
||||||
bind b break-pane
|
bind b break-pane
|
||||||
bind u split-window
|
# bind u split-window
|
||||||
bind v split-window -h
|
# bind v split-window -h
|
||||||
bind C-u split-window -f
|
# bind C-u split-window -f
|
||||||
bind C-v split-window -f -h
|
# bind C-v split-window -f -h
|
||||||
# bind u split-window -c "#{pane_current_path}"
|
bind u split-window -c "#{pane_current_path}"
|
||||||
# bind v split-window -h -c "#{pane_current_path}"
|
bind v split-window -h -c "#{pane_current_path}"
|
||||||
# bind C-u split-window -f -c "#{pane_current_path}"
|
bind C-u split-window -f -c "#{pane_current_path}"
|
||||||
# bind C-v split-window -f -h -c "#{pane_current_path}"
|
bind C-v split-window -f -h -c "#{pane_current_path}"
|
||||||
|
|
||||||
bind h select-pane -L
|
bind h select-pane -L
|
||||||
bind l select-pane -R
|
bind l select-pane -R
|
||||||
|
@ -78,8 +78,9 @@ let g:syntastic_quiet_messages = { "regex": [
|
|||||||
\ ] }
|
\ ] }
|
||||||
|
|
||||||
Plug 'Valloric/YouCompleteMe'
|
Plug 'Valloric/YouCompleteMe'
|
||||||
let g:syntastic_enable_signs = 1
|
let g:ycm_confirm_extra_conf=1
|
||||||
let g:ycm_confirm_extra_conf=0
|
let g:syntastic_enable_signs=1
|
||||||
|
let g:ycm_python_binary_path='/usr/bin/python'
|
||||||
nnoremap gd :YcmCompleter GoToDeclaration<CR>
|
nnoremap gd :YcmCompleter GoToDeclaration<CR>
|
||||||
nnoremap gD :YcmCompleter GoToReferences<CR>
|
nnoremap gD :YcmCompleter GoToReferences<CR>
|
||||||
|
|
||||||
@ -136,6 +137,7 @@ nnoremap j gj
|
|||||||
nnoremap k gk
|
nnoremap k gk
|
||||||
|
|
||||||
nnoremap <C-M> :make<CR>
|
nnoremap <C-M> :make<CR>
|
||||||
|
inoremap <C-M> <ESC>:make<CR>i
|
||||||
|
|
||||||
nnoremap df :FZF<CR>
|
nnoremap df :FZF<CR>
|
||||||
inoremap df _
|
inoremap df _
|
||||||
@ -161,6 +163,8 @@ function! Config(type)
|
|||||||
set filetype=xml
|
set filetype=xml
|
||||||
elseif a:type == "css"
|
elseif a:type == "css"
|
||||||
set filetype=css
|
set filetype=css
|
||||||
|
elseif a:type == "txt"
|
||||||
|
set noexpandtab
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -173,6 +177,7 @@ autocmd BufNewFile,BufReadPost *.json call Config("json")
|
|||||||
|
|
||||||
autocmd BufNewFile,BufReadPost *.wxml call Config("xml")
|
autocmd BufNewFile,BufReadPost *.wxml call Config("xml")
|
||||||
autocmd BufNewFile,BufReadPost *.wxss call Config("css")
|
autocmd BufNewFile,BufReadPost *.wxss call Config("css")
|
||||||
|
autocmd BufNewFile,BufReadPost *.txt call Config("txt")
|
||||||
|
|
||||||
command! RR wa | source ~/.vimrc |e
|
command! RR wa | source ~/.vimrc |e
|
||||||
command! SS mksession! etc/session.vim
|
command! SS mksession! etc/session.vim
|
||||||
|
@ -7,6 +7,8 @@ syntax match shyCache "\(^\|\t\| \|$(\)cache\>"
|
|||||||
syntax match shyString "'[^']*'"
|
syntax match shyString "'[^']*'"
|
||||||
syntax match shyString "\"[^\"]*\""
|
syntax match shyString "\"[^\"]*\""
|
||||||
syntax match shyNumber "-\=\<\d\+\>#\="
|
syntax match shyNumber "-\=\<\d\+\>#\="
|
||||||
|
syntax match shyNumber "false"
|
||||||
|
syntax match shyNumber "true"
|
||||||
syntax match shVariable "\$[_a-zA-Z0-9]\+\>"
|
syntax match shVariable "\$[_a-zA-Z0-9]\+\>"
|
||||||
syntax match shVariable "@[_a-zA-Z0-9]\+\>"
|
syntax match shVariable "@[_a-zA-Z0-9]\+\>"
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
m.Conf("runtime", "host.pid", os.Getpid())
|
m.Conf("runtime", "host.pid", os.Getpid())
|
||||||
|
|
||||||
if name, e := os.Hostname(); e == nil {
|
if name, e := os.Hostname(); e == nil {
|
||||||
m.Conf("runtime", "boot.hostname", name)
|
m.Conf("runtime", "boot.hostname", kit.Select(name, os.Getenv("HOSTNAME")))
|
||||||
}
|
}
|
||||||
if name, e := os.Getwd(); e == nil {
|
if name, e := os.Getwd(); e == nil {
|
||||||
_, file := path.Split(name)
|
_, file := path.Split(name)
|
||||||
@ -308,8 +308,10 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
|
|
||||||
m.GoFunc(m, func(m *ctx.Message) {
|
m.GoFunc(m, func(m *ctx.Message) {
|
||||||
if e := cmd.Start(); e != nil {
|
if e := cmd.Start(); e != nil {
|
||||||
|
m.Log("fuck", "%v", e)
|
||||||
m.Echo("error: ").Echo("%s\n", e)
|
m.Echo("error: ").Echo("%s\n", e)
|
||||||
} else if e := cmd.Wait(); e != nil {
|
} else if e := cmd.Wait(); e != nil {
|
||||||
|
m.Log("fuck", "%v", e)
|
||||||
m.Echo("error: ").Echo("%s\n", e)
|
m.Echo("error: ").Echo("%s\n", e)
|
||||||
}
|
}
|
||||||
m.Conf("daemon", []string{h, "finish_time"}, time.Now().Format(m.Conf("time_format")))
|
m.Conf("daemon", []string{h, "finish_time"}, time.Now().Format(m.Conf("time_format")))
|
||||||
|
@ -1178,7 +1178,7 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{},
|
|||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
"select": &Command{Name: "select key value field",
|
"select": &Command{Name: "select key value field",
|
||||||
Form: map[string]int{"eq": 2, "parse": 2, "hide": -1, "fields": -1, "group": 1, "order": 2, "limit": 1, "offset": 1, "format": -1, "trans_map": -1, "vertical": 0},
|
Form: map[string]int{"eq": 2, "expand": 2, "hide": -1, "fields": -1, "group": 1, "order": 2, "limit": 1, "offset": 1, "format": -1, "trans_map": -1, "vertical": 0},
|
||||||
Help: "选取数据", Hand: func(m *Message, c *Context, key string, arg ...string) (e error) {
|
Help: "选取数据", Hand: func(m *Message, c *Context, key string, arg ...string) (e error) {
|
||||||
msg := m.Set("result").Spawn()
|
msg := m.Set("result").Spawn()
|
||||||
|
|
||||||
@ -1189,11 +1189,11 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{},
|
|||||||
nrow := len(m.Meta[m.Meta["append"][0]])
|
nrow := len(m.Meta[m.Meta["append"][0]])
|
||||||
keys := []string{}
|
keys := []string{}
|
||||||
for i := 0; i < nrow; i++ {
|
for i := 0; i < nrow; i++ {
|
||||||
for j := 0; j < len(m.Meta["parse"]); j += 2 {
|
for j := 0; j < len(m.Meta["expand"]); j += 2 {
|
||||||
var value interface{}
|
var value interface{}
|
||||||
json.Unmarshal([]byte(m.Meta[m.Meta["parse"][j]][i]), &value)
|
json.Unmarshal([]byte(m.Meta[m.Meta["expand"][j]][i]), &value)
|
||||||
if m.Meta["parse"][j+1] != "" {
|
if m.Meta["expand"][j+1] != "" {
|
||||||
value = kit.Chain(value, m.Meta["parse"][j+1])
|
value = kit.Chain(value, m.Meta["expand"][j+1])
|
||||||
}
|
}
|
||||||
|
|
||||||
switch val := value.(type) {
|
switch val := value.(type) {
|
||||||
@ -1202,7 +1202,7 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{},
|
|||||||
keys = append(keys, k)
|
keys = append(keys, k)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
keys = append(keys, m.Meta["parse"][j+1])
|
keys = append(keys, m.Meta["expand"][j+1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1212,11 +1212,11 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{},
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i := 0; i < nrow; i++ {
|
for i := 0; i < nrow; i++ {
|
||||||
for j := 0; j < len(m.Meta["parse"]); j += 2 {
|
for j := 0; j < len(m.Meta["expand"]); j += 2 {
|
||||||
var value interface{}
|
var value interface{}
|
||||||
json.Unmarshal([]byte(m.Meta[m.Meta["parse"][j]][i]), &value)
|
json.Unmarshal([]byte(m.Meta[m.Meta["expand"][j]][i]), &value)
|
||||||
if m.Meta["parse"][j+1] != "" {
|
if m.Meta["expand"][j+1] != "" {
|
||||||
value = kit.Chain(value, m.Meta["parse"][j+1])
|
value = kit.Chain(value, m.Meta["expand"][j+1])
|
||||||
}
|
}
|
||||||
|
|
||||||
switch val := value.(type) {
|
switch val := value.(type) {
|
||||||
@ -1233,12 +1233,12 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{},
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case string:
|
case string:
|
||||||
m.Meta[m.Meta["parse"][j+1]][i] = val
|
m.Meta[m.Meta["expand"][j+1]][i] = val
|
||||||
case float64:
|
case float64:
|
||||||
m.Meta[m.Meta["parse"][j+1]][i] = fmt.Sprintf("%d", int(val))
|
m.Meta[m.Meta["expand"][j+1]][i] = fmt.Sprintf("%d", int(val))
|
||||||
default:
|
default:
|
||||||
b, _ := json.Marshal(val)
|
b, _ := json.Marshal(val)
|
||||||
m.Meta[m.Meta["parse"][j+1]][i] = string(b)
|
m.Meta[m.Meta["expand"][j+1]][i] = string(b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,11 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
"temp": &ctx.Config{Name: "temp", Value: map[string]interface{}{}, Help: "缓存数据"},
|
"temp": &ctx.Config{Name: "temp", Value: map[string]interface{}{}, Help: "缓存数据"},
|
||||||
"temp_view": &ctx.Config{Name: "temp_view", Value: map[string]interface{}{}, Help: "缓存数据"},
|
"temp_view": &ctx.Config{Name: "temp_view", Value: map[string]interface{}{}, Help: "缓存数据"},
|
||||||
|
|
||||||
|
"note_view": &ctx.Config{Name: "note_view", Value: map[string]interface{}{
|
||||||
|
"default": []interface{}{"key", "create_time", "type", "name", "value"},
|
||||||
|
"base": []interface{}{"key", "create_time", "type", "name", "value"},
|
||||||
|
"full": []interface{}{"key", "create_time", "access_time", "type", "name", "model", "value", "view", "data", "ship"},
|
||||||
|
}, Help: "数据视图"},
|
||||||
"note": &ctx.Config{Name: "note", Value: map[string]interface{}{
|
"note": &ctx.Config{Name: "note", Value: map[string]interface{}{
|
||||||
"faa01a8fc2fc92dae3fbc02ac1b4ec75": map[string]interface{}{
|
"faa01a8fc2fc92dae3fbc02ac1b4ec75": map[string]interface{}{
|
||||||
"create_time": "1990-07-30 07:08:09", "access_time": "2017-11-01 02:03:04",
|
"create_time": "1990-07-30 07:08:09", "access_time": "2017-11-01 02:03:04",
|
||||||
@ -82,7 +87,7 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
"prev": map[string]interface{}{"type": "model", "data": ""},
|
"prev": map[string]interface{}{"type": "model", "data": ""},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, Help: "缓存数据"},
|
}, Help: "数据结构"},
|
||||||
},
|
},
|
||||||
Commands: map[string]*ctx.Command{
|
Commands: map[string]*ctx.Command{
|
||||||
"temp": &ctx.Command{Name: "temp [type [meta [data]]] [tid [node|ship|data] [chain... [select ...]]]", Form: map[string]int{"select": -1, "limit": 1}, Help: "缓存数据", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"temp": &ctx.Command{Name: "temp [type [meta [data]]] [tid [node|ship|data] [chain... [select ...]]]", Form: map[string]int{"select": -1, "limit": 1}, Help: "缓存数据", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
@ -482,7 +487,11 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
|
||||||
"note": &ctx.Command{Name: "note [model name [type name]...]|[index name data...]|[value name data...]|[name model data...]", Form: map[string]int{"limit": 1}, Help: "记事", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"note": &ctx.Command{Name: "note [model [name [type name]...]]|[index [name data...]]|[value name data...]|[name model data...]",
|
||||||
|
Form: map[string]int{"offset": 1, "limit": 1}, Help: "记事", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
offset := kit.Int(kit.Select(m.Conf("page_offset"), m.Option("offset")))
|
||||||
|
limit := kit.Int(kit.Select(m.Conf("page_limit"), m.Option("limit")))
|
||||||
|
|
||||||
// 节点列表
|
// 节点列表
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
m.CopyFuck(m.Cmd("mdb.config", "note", "format", "table", "fields", "create_time", "access_time", "type", "name", "data", "ship"), "append").Set("result").Table()
|
m.CopyFuck(m.Cmd("mdb.config", "note", "format", "table", "fields", "create_time", "access_time", "type", "name", "data", "ship"), "append").Set("result").Table()
|
||||||
@ -506,9 +515,8 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
hm = m.Conf("note", []string{hm, "ship", "note", "data"})
|
hm = m.Conf("note", []string{hm, "ship", "note", "data"})
|
||||||
arg = arg[1:]
|
arg = arg[1:]
|
||||||
}
|
}
|
||||||
|
if len(arg) == 1 && arg[0] != "show" {
|
||||||
if len(arg) == 1 {
|
for i := offset; hm != "" && i < limit; hm, i = m.Conf("note", []string{hm, "ship", "prev", "data"}), i+1 {
|
||||||
for i := 0; hm != "" && i < kit.Int(kit.Select(m.Conf("page_limit"), m.Option("limit"))); hm, i = m.Conf("note", []string{hm, "ship", "prev", "data"}), i+1 {
|
|
||||||
model := m.Confm("note", hm)
|
model := m.Confm("note", hm)
|
||||||
m.Add("append", "key", hm)
|
m.Add("append", "key", hm)
|
||||||
m.Add("append", "create_time", model["create_time"])
|
m.Add("append", "create_time", model["create_time"])
|
||||||
@ -524,15 +532,45 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case "search":
|
case "show":
|
||||||
|
if len(arg) == 1 {
|
||||||
|
m.Cmdy("mdb.note", "index")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if len(arg) == 2 {
|
||||||
|
if arg[1] == "model" {
|
||||||
|
m.Cmdy("mdb.note", "model")
|
||||||
|
} else {
|
||||||
|
m.Cmdy("mdb.note", "value", arg[1])
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
fields := kit.View(arg[3:], m.Confm("note_view"))
|
||||||
|
|
||||||
hv, _ := kit.Hash("type", "value", "name", arg[1], "data", kit.Select(m.Option(arg[1]), arg, 2))
|
hv, _ := kit.Hash("type", "value", "name", arg[1], "data", kit.Select(m.Option(arg[1]), arg, 2))
|
||||||
hn := m.Conf("note", []string{hv, "ship", "note", "data"})
|
hn := m.Conf("note", []string{hv, "ship", "note", "data"})
|
||||||
|
if arg[1] == "model" {
|
||||||
|
hm, _ := kit.Hash("type", "model", "name", arg[2])
|
||||||
|
hv, hn = "prev", m.Conf("note", []string{hm, "ship", "note", "data"})
|
||||||
|
}
|
||||||
|
|
||||||
for i := 0; hn != "" && i < kit.Int(kit.Select(m.Conf("page_limit"), m.Option("limit"))); hn, i = m.Conf("note", []string{hn, "ship", hv, "data"}), i+1 {
|
for i := offset; hn != "" && i < limit; hn, i = m.Conf("note", []string{hn, "ship", hv, "data"}), i+1 {
|
||||||
note := m.Confm("note", hn)
|
note := m.Confm("note", hn)
|
||||||
hvs := kit.Trans(note["data"])
|
hvs := kit.Trans(note["data"])
|
||||||
hm := kit.Format(kit.Chain(note, "ship.model.data"))
|
hm := kit.Format(kit.Chain(note, "ship.model.data"))
|
||||||
|
|
||||||
|
for i := 0; i < len(fields); i++ {
|
||||||
|
switch fields[i] {
|
||||||
|
case "key":
|
||||||
|
m.Add("append", "key", hn)
|
||||||
|
case "create_time", "access_time", "type", "name":
|
||||||
|
m.Add("append", fields[i], note[fields[i]])
|
||||||
|
case "model":
|
||||||
|
m.Add("append", "model", m.Conf("note", []string{hm, "name"}))
|
||||||
|
case "view":
|
||||||
|
m.Add("append", "view", kit.Format(m.Conf("note", []string{hm, "view"})))
|
||||||
|
case "value":
|
||||||
value := []interface{}{}
|
value := []interface{}{}
|
||||||
m.Confm("note", []string{hm, "data"}, func(i int, model map[string]interface{}) {
|
m.Confm("note", []string{hm, "data"}, func(i int, model map[string]interface{}) {
|
||||||
value = append(value, map[string]interface{}{
|
value = append(value, map[string]interface{}{
|
||||||
@ -540,17 +578,11 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
"value": m.Conf("note", []string{hvs[i], "data"}),
|
"value": m.Conf("note", []string{hvs[i], "data"}),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
m.Add("append", "key", hn)
|
|
||||||
m.Add("append", "create_time", note["create_time"])
|
|
||||||
m.Add("append", "access_time", note["access_time"])
|
|
||||||
m.Add("append", "type", note["type"])
|
|
||||||
m.Add("append", "name", note["name"])
|
|
||||||
m.Add("append", "model", m.Conf("note", []string{hm, "name"}))
|
|
||||||
m.Add("append", "view", kit.Format(m.Conf("note", []string{hm, "view"})))
|
|
||||||
m.Add("append", "value", kit.Format(value))
|
m.Add("append", "value", kit.Format(value))
|
||||||
m.Add("append", "data", kit.Format(note["data"]))
|
case "data", "ship":
|
||||||
m.Add("append", "ship", kit.Format(note["ship"]))
|
m.Add("append", fields[i], kit.Format(note[fields[i]]))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m.Table()
|
m.Table()
|
||||||
|
|
||||||
@ -585,7 +617,7 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
m.Confv("note", []string{hm, "access_time"}, m.Time())
|
m.Confv("note", []string{hm, "access_time"}, m.Time())
|
||||||
}
|
}
|
||||||
|
|
||||||
// 操作元素
|
if len(data) == 0 { // 操作元素
|
||||||
for i := 2; i < len(arg)-1; i += 2 {
|
for i := 2; i < len(arg)-1; i += 2 {
|
||||||
data = append(data, map[string]interface{}{"name": arg[i], "type": arg[i+1]})
|
data = append(data, map[string]interface{}{"name": arg[i], "type": arg[i+1]})
|
||||||
|
|
||||||
@ -594,6 +626,8 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
m.Cmd("mdb.note", "index", arg[i+1])
|
m.Cmd("mdb.note", "index", arg[i+1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m.Confv("note", []string{hm, "data"}, data)
|
m.Confv("note", []string{hm, "data"}, data)
|
||||||
m.Echo(hm)
|
m.Echo(hm)
|
||||||
|
|
||||||
@ -640,6 +674,9 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
m.Echo(hv)
|
m.Echo(hv)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if len(arg) == 2 {
|
||||||
|
}
|
||||||
|
|
||||||
hm, _ := kit.Hash("type", "model", "name", arg[1])
|
hm, _ := kit.Hash("type", "model", "name", arg[1])
|
||||||
hn, _ := kit.Hash("type", "note", "name", arg[0], "uniq")
|
hn, _ := kit.Hash("type", "note", "name", arg[0], "uniq")
|
||||||
ship := map[string]interface{}{
|
ship := map[string]interface{}{
|
||||||
|
@ -1274,6 +1274,10 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
|
|||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
if len(arg) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
m.Confm("paths", func(index int, value string) bool {
|
m.Confm("paths", func(index int, value string) bool {
|
||||||
p := path.Join(value, arg[0])
|
p := path.Join(value, arg[0])
|
||||||
if _, e := os.Stat(p); e == nil {
|
if _, e := os.Stat(p); e == nil {
|
||||||
|
@ -385,12 +385,6 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
"site": "",
|
"site": "",
|
||||||
"index": "/code/",
|
"index": "/code/",
|
||||||
}, Help: "服务配置"},
|
}, Help: "服务配置"},
|
||||||
"login": &ctx.Config{Name: "login", Value: map[string]interface{}{
|
|
||||||
"check": true,
|
|
||||||
"sess_void": false,
|
|
||||||
"cas_url": "",
|
|
||||||
"cas_uuid": "email",
|
|
||||||
}, Help: "认证配置"},
|
|
||||||
"route": &ctx.Config{Name: "route", Value: map[string]interface{}{
|
"route": &ctx.Config{Name: "route", Value: map[string]interface{}{
|
||||||
"index": "/render",
|
"index": "/render",
|
||||||
"template_dir": "usr/template",
|
"template_dir": "usr/template",
|
||||||
@ -400,6 +394,12 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
"top": 96, "left": 472, "width": 600, "height": 300,
|
"top": 96, "left": 472, "width": 600, "height": 300,
|
||||||
},
|
},
|
||||||
}, Help: "功能配置"},
|
}, Help: "功能配置"},
|
||||||
|
"login": &ctx.Config{Name: "login", Value: map[string]interface{}{
|
||||||
|
"check": true,
|
||||||
|
"sess_void": false,
|
||||||
|
"cas_url": "",
|
||||||
|
"cas_uuid": "email",
|
||||||
|
}, Help: "认证配置"},
|
||||||
"componet": &ctx.Config{Name: "componet", Value: map[string]interface{}{
|
"componet": &ctx.Config{Name: "componet", Value: map[string]interface{}{
|
||||||
"login": []interface{}{},
|
"login": []interface{}{},
|
||||||
"index": []interface{}{
|
"index": []interface{}{
|
||||||
@ -577,24 +577,27 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
m.Log("warn", "%v", e)
|
m.Log("warn", "%v", e)
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
if kit.Right(client["logheaders"]) {
|
|
||||||
for k, v := range res.Header {
|
|
||||||
m.Log("info", "%s: %v", k, v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, v := range res.Cookies() {
|
|
||||||
m.Conf("spide", []string{which, "cookie", v.Name}, v.Value)
|
|
||||||
m.Log("info", "get-cookie %s: %v", v.Name, v.Value)
|
|
||||||
}
|
|
||||||
if res.StatusCode != http.StatusOK {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var result interface{}
|
var result interface{}
|
||||||
ct := res.Header.Get("Content-Type")
|
ct := res.Header.Get("Content-Type")
|
||||||
parse := kit.Select(kit.Format(client["parse"]), m.Option("parse"))
|
parse := kit.Select(kit.Format(client["parse"]), m.Option("parse"))
|
||||||
m.Log("info", "status %s parse: %s content: %s", res.Status, parse, ct)
|
m.Log("info", "status %s parse: %s content: %s", res.Status, parse, ct)
|
||||||
|
|
||||||
|
if kit.Right(client["logheaders"]) {
|
||||||
|
for k, v := range res.Header {
|
||||||
|
m.Log("info", "%s: %v", k, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range res.Cookies() {
|
||||||
|
m.Conf("spide", []string{which, "cookie", v.Name}, v.Value)
|
||||||
|
m.Log("info", "get-cookie %s: %v", v.Name, v.Value)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.StatusCode != http.StatusOK {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case parse == "json" || strings.HasPrefix(ct, "application/json") || strings.HasPrefix(ct, "application/javascript"):
|
case parse == "json" || strings.HasPrefix(ct, "application/json") || strings.HasPrefix(ct, "application/javascript"):
|
||||||
if json.NewDecoder(res.Body).Decode(&result); !m.Has("temp") {
|
if json.NewDecoder(res.Body).Decode(&result); !m.Has("temp") {
|
||||||
@ -871,10 +874,6 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
|
||||||
"/MP_verify_0xp0zkW3fIzIq2Bo.txt": &ctx.Command{Name: "/proxy/which/method/url", Help: "服务代理", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
|
||||||
m.Echo("0xp0zkW3fIzIq2Bo")
|
|
||||||
return
|
|
||||||
}},
|
|
||||||
"/proxy/": &ctx.Command{Name: "/proxy/which/method/url", Help: "服务代理", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"/proxy/": &ctx.Command{Name: "/proxy/which/method/url", Help: "服务代理", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
fields := strings.Split(key, "/")
|
fields := strings.Split(key, "/")
|
||||||
m.Cmdy("web.get", "which", fields[2], "method", fields[3], strings.Join(fields, "/"))
|
m.Cmdy("web.get", "which", fields[2], "method", fields[3], strings.Join(fields, "/"))
|
||||||
|
@ -475,6 +475,21 @@ func Chain(root interface{}, args ...interface{}) interface{} {
|
|||||||
|
|
||||||
return root
|
return root
|
||||||
}
|
}
|
||||||
|
func View(args []string, conf map[string]interface{}) []string {
|
||||||
|
if len(args) == 0 {
|
||||||
|
args = append(args, "default")
|
||||||
|
}
|
||||||
|
|
||||||
|
keys := []string{}
|
||||||
|
for _, k := range args {
|
||||||
|
if v, ok := conf[k]; ok {
|
||||||
|
keys = append(keys, Trans(v)...)
|
||||||
|
} else {
|
||||||
|
keys = append(keys, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return keys
|
||||||
|
}
|
||||||
|
|
||||||
func Link(name string, url string) string {
|
func Link(name string, url string) string {
|
||||||
return fmt.Sprintf("<a href=\"%s\" target=\"_blank\">%s</a>", url, name)
|
return fmt.Sprintf("<a href=\"%s\" target=\"_blank\">%s</a>", url, name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user