1
0
forked from x/ContextOS

tce add run.sh

This commit is contained in:
shaoying 2018-10-24 23:42:21 +08:00
parent 4fe19b1818
commit ed98ff1795
6 changed files with 36 additions and 13 deletions

View File

@ -20,6 +20,9 @@ install_all: install
build:
go build $(BENCH)
run:
etc/run.sh
win64:
GOARCH=amd64 GOOS=windows go build $(BENCH)
mv bench.exe bench_1.0_win64.exe

8
etc/run.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
while true; do
bench && break
echo "bench run error"
echo "restarting..."
sleep 3
done

View File

@ -813,6 +813,15 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
"tmux": &ctx.Command{Name: "tmux", Help: "", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
m.Copy(m.Spawn().Cmd("system", "tmux", arg), "result")
}},
"exit": &ctx.Command{Name: "exit code", Help: "exit", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
code := 0
if len(arg) > 0 {
i, e := strconv.Atoi(arg[0])
m.Assert(e)
code = i
}
os.Exit(code)
}},
"buffer": &ctx.Command{Name: "buffer", Help: "", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
bufs := strings.Split(m.Spawn().Cmd("system", "tmux", "list-buffers").Result(0), "\n")
@ -829,10 +838,10 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
if len(bs) > 1 {
m.Add("append", "buffer", bs[0][:len(bs[0])])
m.Add("append", "length", bs[1][:len(bs[1])-6])
m.Add("append", "string", bs[2][1:len(bs[2])-1])
m.Add("append", "strings", bs[2][1:len(bs[2])-1])
}
}
m.Echo(m.Append("string"))
m.Echo(m.Append("strings"))
}},
},
Index: map[string]*ctx.Context{

View File

@ -256,6 +256,8 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
m.Meta[m.Option("extra_field")][i] = ""
case float64:
m.Meta[m.Option("extra_field")][i] = fmt.Sprintf(format, int(v))
case nil:
m.Meta[m.Option("extra_field")][i] = ""
default:
m.Meta[m.Option("extra_field")][i] = fmt.Sprintf(format, v)
}
@ -295,15 +297,17 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
"set": &ctx.Command{Name: "set table [field value] where condition", Help: "查看或选择数据库信息", Form: map[string]int{"where": 1}, Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
if mdb, ok := m.Target().Server.(*MDB); m.Assert(ok) && mdb.DB != nil {
sql := []string{"update", arg[0], "set"}
fields := []string{}
for i := 1; i < len(arg)-1; i += 2 {
sql = append(sql, fmt.Sprintf("%s='%s'", arg[i], arg[i+1]))
fields = append(fields, arg[i])
if i < len(arg)-2 {
sql = append(sql, ",")
}
}
sql = append(sql, fmt.Sprintf("where %s", m.Option("where")))
m.Spawn().Cmd("exec", strings.Join(sql, " "))
msg := m.Spawn().Cmd("show", arg[0], "where", m.Option("where"))
msg := m.Spawn().Cmd("show", arg[0], fields, "where", m.Option("where"))
m.Copy(msg, "result").Copy(msg, "append")
}
}},

View File

@ -238,6 +238,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
"nroute": &ctx.Cache{Name: "nroute", Value: "0", Help: "路由数量"},
},
Configs: map[string]*ctx.Config{
"login_right": &ctx.Config{Name: "login_right", Value: "1", Help: "缓存大小"},
"multipart_bsize": &ctx.Config{Name: "multipart_bsize", Value: "102400", Help: "缓存大小"},
"body_response": &ctx.Config{Name: "body_response", Value: "response", Help: "响应缓存"},
"method": &ctx.Config{Name: "method", Value: "GET", Help: "请求方法"},
@ -309,8 +310,8 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
"label": "limit", "value": "3",
},
map[string]interface{}{
"type": "button", "name": "string",
"label": "string", "value": "refresh",
"type": "button", "name": "refresh",
"label": "refresh", "value": "refresh",
},
},
},
@ -844,6 +845,9 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
group := m.Option("componet_group")
order := m.Option("componet_order")
right := group == "login"
if !right {
right = !m.Confs("login_right")
}
login := m
login = nil

View File

@ -68,14 +68,9 @@ function onaction(event, action) {
case "click":
if (event.target.nodeName == "INPUT") {
if (event.altKey) {
event.target.focus()
event.target.select()
console.log("fuck")
console.log(document.execCommand("paste"))
// var clipboard = document.querySelector("#clipboard")
// clipboard.value = text
// clipboard.select()
// document.execCommand("copy")
var board = document.querySelector("#clipboard")
event.target.value = board.value
}
}
break
@ -179,7 +174,7 @@ function init_download(event) {
option["dir"].value = option["dir"].value+"/"+event.target.innerText
send_command(option, function(msg) {
option["dir"].value = msg.dir.join("")
context.Cookie("download_dir", option["dir"].value = msg.dir.join(""))
})
} else if (event.target.tagName == "TD") {
copy_to_clipboard(event.target.innerText)