diff --git a/base/web/share.go b/base/web/share.go index bb5f487a..e46ab9ac 100644 --- a/base/web/share.go +++ b/base/web/share.go @@ -169,14 +169,14 @@ func ShareLocalFile(m *ice.Message, arg ...string) { return } } - if m.Option(ice.POD) == "" || (strings.HasPrefix(p, ice.USR_ICONS) && nfs.Exists(m, p)) { + if m.Option(ice.POD) == "" || (kit.HasPrefix(p, ice.USR_ICONS, ice.USR_VOLCANOS, ice.USR_ICEBERGS, ice.USR_INTSHELL) && nfs.Exists(m, p)) { m.RenderDownload(p) - } else if pp := kit.Path(ice.USR_LOCAL_WORK, kit.Select("", kit.Split(m.Option(ice.POD), nfs.PT), -1), p); nfs.Exists(m, pp) { + } else if pp := kit.Path(ice.USR_LOCAL_WORK, m.Option(ice.POD), p); nfs.Exists(m, pp) { + m.RenderDownload(pp) + } else if pp := ProxyUpload(m, m.Option(ice.POD), p); nfs.Exists(m, pp) { m.RenderDownload(pp) - } else if pp := kit.Path(ice.USR_LOCAL_WORK, m.Option(ice.POD)); nfs.Exists(m, pp) { - m.RenderDownload(p) } else { - m.RenderDownload(ProxyUpload(m, m.Option(ice.POD), p)) + m.RenderDownload(p) } } func ShareLocal(m *ice.Message, p string) string { diff --git a/core/chat/macos/applications.go b/core/chat/macos/applications.go index b8f8298c..8a2d9ace 100644 --- a/core/chat/macos/applications.go +++ b/core/chat/macos/applications.go @@ -2,6 +2,7 @@ package macos import ( "path" + "strings" ice "shylinux.com/x/icebergs" "shylinux.com/x/icebergs/base/aaa" @@ -24,14 +25,20 @@ func init() { }, PodCmdAction(), CmdHashAction("space,index,args"), mdb.ClearOnExitHashAction())}, }) } -func install(m *ice.Message, cmd, icon, index string, arg ...string) { +func install(m *ice.Message, cmd, icon, index string, arg ...string) string { if icon == "" { - return + return "" + } else if !kit.HasPrefix(icon, nfs.PS, web.HTTP) && !nfs.Exists(m, icon) && !nfs.Exists(m, ice.USR_ICONS+icon, func(p string) { icon = p }) { + if strings.Contains(kit.Path(""), nfs.USR_LOCAL_WORK) && nfs.Exists(m, path.Join(strings.Split(kit.Path(""), nfs.USR_LOCAL_WORK)[0], ice.USR_ICONS+icon)) { + icon = ice.USR_ICONS + icon + } else { + icon = path.Join(path.Dir(ctx.GetCmdFile(m, m.PrefixKey())), icon) + } } - kit.If(!kit.HasPrefix(icon, nfs.PS, web.HTTP) && !nfs.Exists(m, icon), func() { icon = ice.USR_ICONS + icon }) name := kit.TrimExt(path.Base(icon), nfs.PNG, nfs.JPG, nfs.JPEG) m.Cmd(Prefix(cmd), mdb.CREATE, mdb.NAME, name, mdb.ICON, icon, ctx.INDEX, index, arg) + return icon } -func AppInstall(m *ice.Message, icon, index string, arg ...string) { - install(m, APPLICATIONS, icon, index, arg...) +func AppInstall(m *ice.Message, icon, index string, arg ...string) string { + return install(m, APPLICATIONS, icon, index, arg...) } diff --git a/core/chat/macos/desktop.go b/core/chat/macos/desktop.go index f3a394ac..22d55c69 100644 --- a/core/chat/macos/desktop.go +++ b/core/chat/macos/desktop.go @@ -1,9 +1,6 @@ package macos import ( - "path" - "strings" - ice "shylinux.com/x/icebergs" "shylinux.com/x/icebergs/base/aaa" "shylinux.com/x/icebergs/base/cli" @@ -18,14 +15,11 @@ const DESKTOP = "desktop" func init() { Index.MergeCommands(ice.Commands{ - ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { - m.Cmd(web.BINPACK, mdb.INSERT, nfs.USR_ICONS) - }}, + ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { m.Cmd(web.BINPACK, mdb.INSERT, nfs.USR_ICONS) }}, ice.CTX_OPEN: {Hand: func(m *ice.Message, arg ...string) { if m.Cmd(DESKTOP).Length() == 0 { DeskAppend(m, "Books.png", web.WIKI_WORD) DeskAppend(m, "Photos.png", web.WIKI_FEEL) - DeskAppend(m, "Grapher.png", web.WIKI_DRAW) DeskAppend(m, "Calendar.png", web.TEAM_PLAN) DeskAppend(m, "Messages.png", web.CHAT_MESSAGE) } @@ -37,14 +31,8 @@ func init() { DockAppend(m, "git.png", web.CODE_GIT_STATUS) DockAppend(m, "vimer.png", web.CODE_VIMER) } - AppInstall(m, "App Store.png", web.STORE) m.Travel(func(p *ice.Context, c *ice.Context, key string, cmd *ice.Command) { - kit.If(cmd.Icon, func() { - if !kit.HasPrefix(cmd.Icon, nfs.PS, web.HTTP) { - nfs.Exists(m, path.Join(path.Dir(strings.TrimPrefix(ctx.GetCmdFile(m, m.PrefixKey()), kit.Path(""))), cmd.Icon), func(p string) { cmd.Icon = p }) - } - AppInstall(m, cmd.Icon, m.PrefixKey()) - }) + kit.If(cmd.Icon, func() { cmd.Icon = AppInstall(m, cmd.Icon, m.PrefixKey()) }) }) Notify(m, "usr/icons/Infomation.png", cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME) }}, diff --git a/core/code/publish.go b/core/code/publish.go index cd5a40fd..34195601 100644 --- a/core/code/publish.go +++ b/core/code/publish.go @@ -91,7 +91,7 @@ func init() { }}, }) Index.MergeCommands(ice.Commands{ - PUBLISH: {Name: "publish path auto create volcanos icebergs intshell", Help: "发布", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{ + PUBLISH: {Name: "publish path auto create volcanos icebergs intshell", Help: "发布", Icon: "QuickTime Player.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{ ice.VOLCANOS: {Help: "火山架", Hand: func(m *ice.Message, arg ...string) { _publish_list(m, kit.ExtReg(HTML, CSS, JS)) }}, ice.ICEBERGS: {Help: "冰山架", Hand: func(m *ice.Message, arg ...string) { _publish_bin_list(m).Cmdy("", ice.CONTEXTS) }}, ice.INTSHELL: {Help: "神农架", Hand: func(m *ice.Message, arg ...string) { _publish_list(m, kit.ExtReg(SH, VIM, CONF)) }}, diff --git a/core/team/asset.go b/core/team/asset.go index d26fded4..dc2d74d2 100644 --- a/core/team/asset.go +++ b/core/team/asset.go @@ -56,7 +56,7 @@ const ASSET = "asset" func init() { Index.MergeCommands(ice.Commands{ - ASSET: {Name: "asset account id auto", Help: "资产", Meta: kit.Dict( + ASSET: {Name: "asset account id auto", Help: "资产", Icon: "Stocks.png", Meta: kit.Dict( ice.CTX_TRANS, kit.Dict( html.INPUT, kit.Dict( ACCOUNT, "账户", AMOUNT, "金额", FROM, "转出", TO, "转入", mdb.NAME, "商家", mdb.TEXT, "备注", diff --git a/core/team/house.go b/core/team/house.go index 79e17055..73a8c027 100644 --- a/core/team/house.go +++ b/core/team/house.go @@ -19,7 +19,7 @@ func init() { BUILD = "build" ) Index.MergeCommands(ice.Commands{ - HOUSE: {Help: "房子", Meta: kit.Dict(ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict( + HOUSE: {Help: "房子", Icon: "Home.png", Meta: kit.Dict(ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict( mdb.ZONE, "区域", mdb.NAME, "小区", AREA, "面积", ROOM, "户型", PRICE, "总价", BUILD, "建成时间", ))), Actions: ice.MergeActions(ice.Actions{ mdb.CREATE: {Name: "create zone* type* price* area* room* name* build text link image=9@img"}, diff --git a/core/wiki/wiki.go b/core/wiki/wiki.go index 4875db13..b310b008 100644 --- a/core/wiki/wiki.go +++ b/core/wiki/wiki.go @@ -41,8 +41,11 @@ func _wiki_list(m *ice.Message, arg ...string) bool { m.Copy(m.Cmd(nfs.DIR, kit.Slice(arg, 0, 1), kit.Dict(nfs.DIR_TYPE, nfs.CAT, nfs.DIR_REG, mdb.Config(m, lex.REGEXP))).SortStr(nfs.PATH)) return true } else { - m.Display(m.FileURI(nfs.Relative(m, ctx.GetCmdFile(m, m.ShortKey())))) - // ctx.DisplayLocal(m, path.Join(kit.PathName(2), kit.Keys(kit.FileName(2), nfs.JS))) + m.Debug("what %v", ctx.GetCmdFile(m, m.ShortKey())) + m.Debug("what %v", nfs.Relative(m, ctx.GetCmdFile(m, m.ShortKey()))) + m.Debug("what %v", m.FileURI(nfs.Relative(m, ctx.GetCmdFile(m, m.ShortKey())))) + // m.Display(m.FileURI(nfs.Relative(m, ctx.GetCmdFile(m, m.ShortKey())))) + ctx.DisplayLocal(m, path.Join(kit.PathName(-1), kit.Keys(kit.FileName(-1), nfs.JS))) return false } }