From 85e1f1dcb695b5bd43db965aae412ffc3504657b Mon Sep 17 00:00:00 2001 From: shy Date: Tue, 4 Feb 2025 10:26:51 +0800 Subject: [PATCH] add some --- base/nfs/dir.go | 1 + core/wiki/image.go | 5 +++-- core/wiki/video.go | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/base/nfs/dir.go b/base/nfs/dir.go index ed5e0766..50b9a6e6 100644 --- a/base/nfs/dir.go +++ b/base/nfs/dir.go @@ -162,6 +162,7 @@ const ( USR_LOCAL = ice.USR_LOCAL USR_LOCAL_WORK = ice.USR_LOCAL_WORK USR_IMAGE = "usr/image/" + USR_MATERIAL = "usr/material/" USR_LOCAL_IMAGE = "usr/local/image/" USR_LEARNING_PORTAL = "usr/learning/portal/" USR_MODULES = "usr/node_modules/" diff --git a/core/wiki/image.go b/core/wiki/image.go index 19b6121b..d4ccd1ae 100644 --- a/core/wiki/image.go +++ b/core/wiki/image.go @@ -22,8 +22,9 @@ func init() { Index.MergeCommands(ice.Commands{ IMAGE: {Name: "image path", Help: "图片", Actions: ice.Actions{ "material": {Hand: func(m *ice.Message, arg ...string) { - m.Info("what %v", m.FormatChain()) - m.Cmdy(IMAGE, path.Join("usr/material", strings.TrimPrefix(path.Dir(m.Option("_script")), "usr/"), arg[0])) + if nfs.Exists(m, nfs.USR_MATERIAL) { + m.Cmdy(IMAGE, path.Join(nfs.USR_MATERIAL, strings.TrimPrefix(path.Dir(m.Option("_script")), nfs.USR), arg[0])) + } }}, }, Hand: func(m *ice.Message, arg ...string) { arg = _name(m, arg) diff --git a/core/wiki/video.go b/core/wiki/video.go index e62b932c..6cd8a5c2 100644 --- a/core/wiki/video.go +++ b/core/wiki/video.go @@ -5,6 +5,7 @@ import ( "strings" ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/base/nfs" ) const VIDEO = "video" @@ -13,7 +14,9 @@ func init() { Index.MergeCommands(ice.Commands{ VIDEO: {Name: "video path", Help: "视频", Actions: ice.Actions{ "material": {Hand: func(m *ice.Message, arg ...string) { - m.Cmdy(VIDEO, path.Join("usr/material", strings.TrimPrefix(path.Dir(m.Option("_script")), "usr/"), arg[0])) + if nfs.Exists(m, nfs.USR_MATERIAL) { + m.Cmdy(VIDEO, path.Join(nfs.USR_MATERIAL, strings.TrimPrefix(path.Dir(m.Option("_script")), nfs.USR), arg[0])) + } }}, }, Hand: func(m *ice.Message, arg ...string) { arg = _name(m, arg)