From 00d0a3f449bd057c516d1d70963fd07ac9222031 Mon Sep 17 00:00:00 2001 From: shy Date: Fri, 31 Jan 2025 10:26:51 +0800 Subject: [PATCH] add some --- base/web/serve.go | 9 +++++++-- base/web/share.go | 5 ++++- misc/git/status.go | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/base/web/serve.go b/base/web/serve.go index 69fe4709..258ff464 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -116,11 +116,16 @@ func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) boo } if pp = path.Join(pp, p); nfs.Exists(msg, pp) { return Render(msg, ice.RENDER_DOWNLOAD, pp) - } else { + } else if nfs.Exists(msg, p) { return Render(msg, ice.RENDER_DOWNLOAD, p) } } - return (!ispod && kit.HasPrefix(p, nfs.SRC) || kit.HasPrefix(p, ice.USR_ICEBERGS, ice.USR_ICONS)) && nfs.Exists(msg, p) && Render(msg, ice.RENDER_DOWNLOAD, p) + if kit.HasPrefix(p, ice.USR_ICEBERGS, ice.USR_ICONS) && nfs.Exists(msg, p) { + return Render(msg, ice.RENDER_DOWNLOAD, p) + } + if !ispod { + return (kit.HasPrefix(p, nfs.SRC) && nfs.Exists(msg, p)) && Render(msg, ice.RENDER_DOWNLOAD, p) + } } else if kit.HasPrefix(r.URL.Path, nfs.M) { p := nfs.USR_MODULES + strings.TrimPrefix(r.URL.Path, nfs.M) return nfs.Exists(msg, p) && Render(msg, ice.RENDER_DOWNLOAD, p) diff --git a/base/web/share.go b/base/web/share.go index af3a1f44..6342ecce 100644 --- a/base/web/share.go +++ b/base/web/share.go @@ -184,10 +184,13 @@ func ShareLocalFile(m *ice.Message, arg ...string) { if m.Option(ice.POD) != "" && nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(ice.POD))) { if pp := kit.Path(ice.USR_LOCAL_WORK, m.Option(ice.POD), p); nfs.Exists(m, pp) { m.RenderDownload(pp) + return } else if nfs.Exists(m, p) { m.RenderDownload(p) + return } - } else if m.Option(ice.POD) == "" || (kit.HasPrefix(p, ice.USR_ICONS, ice.USR_VOLCANOS, ice.USR_ICEBERGS, ice.USR_INTSHELL) && 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, m.Option(ice.POD), p); nfs.Exists(m, pp) { m.RenderDownload(pp) diff --git a/misc/git/status.go b/misc/git/status.go index 0f372441..eb86370a 100644 --- a/misc/git/status.go +++ b/misc/git/status.go @@ -1,6 +1,7 @@ package git import ( + "path" "strings" "shylinux.com/x/go-git/v5/config" @@ -59,8 +60,7 @@ func init() { m.ProcessHold() }}, web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { - // if !m.IsDebug() || !aaa.IsTechOrRoot(m) || !nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), _GIT)) { - if !m.IsDebug() || !aaa.IsTechOrRoot(m) { + if !m.IsDebug() || !aaa.IsTechOrRoot(m) || !nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), _GIT)) { m.Push(mdb.TEXT, "") return }