mirror of
https://shylinux.com/x/icebergs
synced 2025-05-01 19:19:24 +08:00
opt some
This commit is contained in:
parent
39d8d94a7a
commit
3a42c0aff2
@ -49,6 +49,14 @@ const USER = "user"
|
|||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
USER: {Name: "user username auto create", Help: "用户", Actions: ice.MergeActions(ice.Actions{
|
USER: {Name: "user username auto create", Help: "用户", Actions: ice.MergeActions(ice.Actions{
|
||||||
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
switch mdb.HashInputs(m, arg); arg[0] {
|
||||||
|
case USERNAME:
|
||||||
|
m.Push(arg[0], m.Option(ice.MSG_USERNAME))
|
||||||
|
case USERNICK:
|
||||||
|
m.Push(arg[0], m.Option(ice.MSG_USERNICK))
|
||||||
|
}
|
||||||
|
}},
|
||||||
mdb.CREATE: {Name: "create username* password usernick userzone userrole=void,tech", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create username* password usernick userzone userrole=void,tech", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_user_create(m, m.Option(USERNAME), m.Option(PASSWORD), m.OptionSimple(USERNICK, USERZONE, USERROLE)...)
|
_user_create(m, m.Option(USERNAME), m.Option(PASSWORD), m.OptionSimple(USERNICK, USERZONE, USERROLE)...)
|
||||||
}},
|
}},
|
||||||
|
@ -166,7 +166,7 @@ func init() {
|
|||||||
m.Split(m.Cmdx(SYSTEM, "ps", "u")).PushAction(PROCKILL).SortIntR("RSS")
|
m.Split(m.Cmdx(SYSTEM, "ps", "u")).PushAction(PROCKILL).SortIntR("RSS")
|
||||||
m.StatusTimeCount("nCPU", msg.Append("nCPU"), "MemTotal", msg.Append("MemTotal"), "MemFree", msg.Append("MemFree"))
|
m.StatusTimeCount("nCPU", msg.Append("nCPU"), "MemTotal", msg.Append("MemTotal"), "MemFree", msg.Append("MemFree"))
|
||||||
}},
|
}},
|
||||||
PROCKILL: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(gdb.SIGNAL, gdb.STOP, m.Option("PID")).ProcessRefresh() }},
|
PROCKILL: {Help: "结束进程", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(gdb.SIGNAL, gdb.STOP, m.Option("PID")).ProcessRefresh() }},
|
||||||
MAXPROCS: {Hand: func(m *ice.Message, arg ...string) {
|
MAXPROCS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
runtime.GOMAXPROCS(kit.Int(m.Conf(RUNTIME, kit.Keys(HOST, MAXPROCS), arg[0])))
|
runtime.GOMAXPROCS(kit.Int(m.Conf(RUNTIME, kit.Keys(HOST, MAXPROCS), arg[0])))
|
||||||
@ -175,27 +175,23 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
DISKINFO: {Hand: func(m *ice.Message, arg ...string) { _runtime_diskinfo(m) }},
|
DISKINFO: {Hand: func(m *ice.Message, arg ...string) { _runtime_diskinfo(m) }},
|
||||||
API: {Hand: func(m *ice.Message, arg ...string) {
|
API: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
for k, v := range ice.Info.Route {
|
kit.For(ice.Info.Route, func(k, v string) { m.Push(nfs.PATH, k).Push(nfs.FILE, v) })
|
||||||
m.Push(nfs.PATH, k).Push(nfs.FILE, v)
|
m.StatusTimeCount().Sort(nfs.PATH)
|
||||||
}
|
|
||||||
m.Sort(nfs.PATH).StatusTimeCount()
|
|
||||||
}},
|
}},
|
||||||
CLI: {Hand: func(m *ice.Message, arg ...string) {
|
CLI: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
for k, v := range ice.Info.File {
|
kit.For(ice.Info.File, func(k, v string) { m.Push(nfs.FILE, k).Push(mdb.NAME, v) })
|
||||||
m.Push(nfs.FILE, k).Push(mdb.NAME, v)
|
m.StatusTimeCount().Sort(nfs.FILE)
|
||||||
}
|
|
||||||
m.Sort(nfs.FILE).StatusTimeCount()
|
|
||||||
}},
|
}},
|
||||||
CMD: {Hand: func(m *ice.Message, arg ...string) {
|
CMD: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.OptionFields(ctx.INDEX, mdb.NAME, mdb.HELP, nfs.FILE)
|
m.OptionFields(ctx.INDEX, mdb.NAME, mdb.HELP, nfs.FILE)
|
||||||
m.Cmdy(ctx.COMMAND, mdb.SEARCH, ctx.COMMAND).StatusTimeCount()
|
m.Cmdy(ctx.COMMAND, mdb.SEARCH, ctx.COMMAND).StatusTimeCount()
|
||||||
}},
|
}},
|
||||||
ENV: {Hand: func(m *ice.Message, arg ...string) {
|
ENV: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
for _, v := range os.Environ() {
|
kit.For(os.Environ(), func(v string) {
|
||||||
ls := strings.SplitN(v, ice.EQ, 2)
|
ls := strings.SplitN(v, ice.EQ, 2)
|
||||||
m.Push(mdb.NAME, ls[0]).Push(mdb.VALUE, ls[1])
|
m.Push(mdb.NAME, ls[0]).Push(mdb.VALUE, ls[1])
|
||||||
}
|
})
|
||||||
m.StatusTimeCount()
|
m.StatusTimeCount().Sort(mdb.NAME)
|
||||||
}},
|
}},
|
||||||
MAKE_DOMAIN: {Hand: func(m *ice.Message, arg ...string) {
|
MAKE_DOMAIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if os.Getenv(CTX_DEV) == "" || os.Getenv(CTX_POD) == "" {
|
if os.Getenv(CTX_DEV) == "" || os.Getenv(CTX_POD) == "" {
|
||||||
@ -204,9 +200,7 @@ func init() {
|
|||||||
m.Echo(kit.MergePOD(os.Getenv(CTX_DEV), os.Getenv(CTX_POD)))
|
m.Echo(kit.MergePOD(os.Getenv(CTX_DEV), os.Getenv(CTX_POD)))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
"chain": {Hand: func(m *ice.Message, arg ...string) {
|
"chain": {Hand: func(m *ice.Message, arg ...string) { m.Echo(m.FormatChain()) }},
|
||||||
m.Echo(m.FormatChain())
|
|
||||||
}},
|
|
||||||
}, ctx.ConfAction("")), Hand: func(m *ice.Message, arg ...string) {
|
}, ctx.ConfAction("")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 0 && arg[0] == BOOTINFO {
|
if len(arg) > 0 && arg[0] == BOOTINFO {
|
||||||
arg = arg[1:]
|
arg = arg[1:]
|
||||||
|
@ -24,6 +24,7 @@ const (
|
|||||||
const (
|
const (
|
||||||
WEBSITE = "website"
|
WEBSITE = "website"
|
||||||
|
|
||||||
|
CODE_VIMER = "web.code.vimer"
|
||||||
CODE_INNER = "web.code.inner"
|
CODE_INNER = "web.code.inner"
|
||||||
WIKI_WORD = "web.wiki.word"
|
WIKI_WORD = "web.wiki.word"
|
||||||
)
|
)
|
||||||
|
@ -101,7 +101,7 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
|
|||||||
m.Option(ice.MSG_USERPOD, m.Option(ice.POD))
|
m.Option(ice.MSG_USERPOD, m.Option(ice.POD))
|
||||||
}
|
}
|
||||||
u := OptionUserWeb(m)
|
u := OptionUserWeb(m)
|
||||||
m.Option(ice.MSG_USERHOST, u.Scheme+"//"+u.Host)
|
m.Option(ice.MSG_USERHOST, tcp.PublishLocalhost(m, u.Scheme+"://"+u.Host))
|
||||||
m.Option(ice.MSG_SESSID, kit.Select(m.Option(ice.MSG_SESSID), m.Option(CookieName(m.Option(ice.MSG_USERWEB)))))
|
m.Option(ice.MSG_SESSID, kit.Select(m.Option(ice.MSG_SESSID), m.Option(CookieName(m.Option(ice.MSG_USERWEB)))))
|
||||||
if m.Optionv(ice.MSG_CMDS) == nil {
|
if m.Optionv(ice.MSG_CMDS) == nil {
|
||||||
if p := strings.TrimPrefix(r.URL.Path, key); p != "" {
|
if p := strings.TrimPrefix(r.URL.Path, key); p != "" {
|
||||||
@ -230,7 +230,7 @@ func init() {
|
|||||||
PP(ice.REQUIRE, ice.SRC): {Name: "/require/src/", Help: "源代码", Hand: func(m *ice.Message, arg ...string) {
|
PP(ice.REQUIRE, ice.SRC): {Name: "/require/src/", Help: "源代码", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_share_local(m, ice.SRC, path.Join(arg...))
|
_share_local(m, ice.SRC, path.Join(arg...))
|
||||||
}},
|
}},
|
||||||
PP(ice.HELP): {Name: "/help/", Help: "帮助", Actions: aaa.WhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
PP(ice.HELP): {Name: "/help/", Help: "帮助", Actions: ice.MergeActions(ctx.CmdAction(), aaa.WhiteAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
arg = append(arg, "tutor.shy")
|
arg = append(arg, "tutor.shy")
|
||||||
}
|
}
|
||||||
|
@ -99,10 +99,14 @@ func _webpack_build(m *ice.Message, file string) {
|
|||||||
if f, p, e := nfs.CreateFile(m, kit.Keys(file, HTML)); m.Assert(e) {
|
if f, p, e := nfs.CreateFile(m, kit.Keys(file, HTML)); m.Assert(e) {
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
defer m.Echo(p)
|
defer m.Echo(p)
|
||||||
|
main_js := _volcanos(m, PAGE_INDEX_JS)
|
||||||
|
if nfs.ExistsFile(m, ice.SRC_MAIN_JS) {
|
||||||
|
main_js = ice.SRC_MAIN_JS
|
||||||
|
}
|
||||||
fmt.Fprintf(f, _webpack_template,
|
fmt.Fprintf(f, _webpack_template,
|
||||||
m.Cmdx(nfs.CAT, _volcanos(m, PAGE_INDEX_CSS)), m.Cmdx(nfs.CAT, _volcanos(m, PAGE_CACHE_CSS)),
|
m.Cmdx(nfs.CAT, _volcanos(m, PAGE_INDEX_CSS)), m.Cmdx(nfs.CAT, _volcanos(m, PAGE_CACHE_CSS)),
|
||||||
m.Cmdx(nfs.CAT, _volcanos(m, ice.PROTO_JS)), m.Cmdx(nfs.CAT, kit.Keys(file, JS)),
|
m.Cmdx(nfs.CAT, _volcanos(m, ice.PROTO_JS)), m.Cmdx(nfs.CAT, kit.Keys(file, JS)),
|
||||||
m.Cmdx(nfs.CAT, _volcanos(m, PAGE_CACHE_JS)), m.Cmdx(nfs.CAT, _volcanos(m, PAGE_INDEX_JS)),
|
m.Cmdx(nfs.CAT, _volcanos(m, PAGE_CACHE_JS)), m.Cmdx(nfs.CAT, main_js),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user