diff --git a/base/log/log.go b/base/log/log.go index 2ea39223..7f3b927e 100644 --- a/base/log/log.go +++ b/base/log/log.go @@ -124,4 +124,4 @@ var Index = &ice.Context{Name: LOG, Help: "日志模块", Configs: ice.Configs{ ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {}}, }} -func init() { ice.Index.Register(Index, &Frame{}) } +func init() { ice.Index.Register(Index, &Frame{}, TAIL) } diff --git a/base/nfs/tail.go b/base/log/tail.go similarity index 84% rename from base/nfs/tail.go rename to base/log/tail.go index aa5a30ba..24d04368 100644 --- a/base/nfs/tail.go +++ b/base/log/tail.go @@ -1,4 +1,4 @@ -package nfs +package log import ( "bufio" @@ -6,13 +6,14 @@ import ( ice "shylinux.com/x/icebergs" "shylinux.com/x/icebergs/base/mdb" + "shylinux.com/x/icebergs/base/nfs" kit "shylinux.com/x/toolkits" ) func _tail_create(m *ice.Message, arg ...string) { h := mdb.HashCreate(m, arg) kit.Fetch(kit.Split(m.Option(FILE)), func(file string) { - m.Options("cmd_output", Pipe(m, func(text string) { mdb.ZoneInsert(m, h, FILE, file, SIZE, len(text), mdb.TEXT, text) }), mdb.CACHE_CLEAR_ON_EXIT, ice.TRUE) + m.Options("cmd_output", Pipe(m, func(text string) { mdb.ZoneInsert(m, h, FILE, file, nfs.SIZE, len(text), mdb.TEXT, text) }), mdb.CACHE_CLEAR_ON_EXIT, ice.TRUE) m.Cmd("cli.daemon", TAIL, "-n", "0", "-f", file) }) } @@ -32,7 +33,7 @@ func init() { case mdb.NAME: m.Push(arg[0], kit.Split(m.Option(FILE), ice.PS)) case FILE: - m.Cmdy(DIR, kit.Select(PWD, arg, 1), PATH).RenameAppend(PATH, FILE).ProcessAgain() + m.Cmdy(nfs.DIR, kit.Select(nfs.PWD, arg, 1), nfs.PATH).RenameAppend(nfs.PATH, FILE).ProcessAgain() } }}, mdb.CREATE: {Hand: func(m *ice.Message, arg ...string) { _tail_create(m, arg...) }}, diff --git a/base/nfs/nfs.go b/base/nfs/nfs.go index c6761456..39eba082 100644 --- a/base/nfs/nfs.go +++ b/base/nfs/nfs.go @@ -6,4 +6,6 @@ const NFS = "nfs" var Index = &ice.Context{Name: "nfs", Help: "存储模块"} -func init() { ice.Index.Register(Index, nil, CAT, DIR, PACK, DEFS, SAVE, PUSH, COPY, LINK, GREP, TAIL, TRASH) } +func init() { + ice.Index.Register(Index, nil, CAT, DIR, PACK, DEFS, SAVE, PUSH, COPY, LINK, GREP, TRASH) +} diff --git a/base/web/render.go b/base/web/render.go index 65315201..fdd351eb 100644 --- a/base/web/render.go +++ b/base/web/render.go @@ -21,6 +21,12 @@ const ( COOKIE = "cookie" STATUS = "status" ) +const ( + WEBSITE = "website" + + CODE_INNER = "web.code.inner" + WIKI_WORD = "web.wiki.word" +) func Render(m *ice.Message, cmd string, args ...ice.Any) bool { if cmd != "" { diff --git a/base/web/web.go b/base/web/web.go index 1250c49b..c307164c 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -47,9 +47,6 @@ func (frame *Frame) ServeHTTP(w http.ResponseWriter, r *http.Request) { frame.ServeMux.ServeHTTP(w, r) } } -func (frame *Frame) Spawn(m *ice.Message, c *ice.Context, arg ...string) ice.Server { - return &Frame{} -} func (frame *Frame) Begin(m *ice.Message, arg ...string) ice.Server { frame.send = ice.Messages{} return frame @@ -107,26 +104,16 @@ func (frame *Frame) Start(m *ice.Message, arg ...string) bool { func (frame *Frame) Close(m *ice.Message, arg ...string) bool { return true } +func (frame *Frame) Spawn(m *ice.Message, c *ice.Context, arg ...string) ice.Server { + return &Frame{} +} -const ( - WEBSITE = "website" - - CODE_INNER = "web.code.inner" - WIKI_WORD = "web.wiki.word" -) const WEB = "web" var Index = &ice.Context{Name: WEB, Help: "网络模块"} -func init() { - ice.Index.Register(Index, &Frame{}, - BROAD, SERVE, SPACE, DREAM, - SHARE, CACHE, SPIDE, ROUTE, - ) -} +func init() { ice.Index.Register(Index, &Frame{}, BROAD, SERVE, SPACE, DREAM, SHARE, CACHE, SPIDE, ROUTE) } -func ApiAction(arg ...string) ice.Actions { - return ice.Actions{kit.Select(ice.PS, arg, 0): {}} -} +func ApiAction(arg ...string) ice.Actions { return ice.Actions{kit.Select(ice.PS, arg, 0): {}} } func P(arg ...string) string { return path.Join(ice.PS, path.Join(arg...)) } func PP(arg ...string) string { return P(arg...) + ice.PS }