1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-09-18 13:32:50 +08:00
parent 0eac777f6f
commit 15a79273ac
4 changed files with 66 additions and 36 deletions

View File

@ -236,7 +236,13 @@ const (
CHAT_CMD = "web.chat.cmd"
TEAM_PLAN = "web.team.plan"
TEAM_GONGANXITONG_USER = "web.team.gonganxitong.user"
TEAM_GONGANXITONG_DOMAIN = "web.team.gonganxitong.domain"
TEAM_RENZHENGSHOUQUAN_PORTAL = "web.team.renzhengshouquan.portal"
TEAM_RENZHENGSHOUQUAN_AUTH = "web.team.renzhengshouquan.auth"
TEAM_DASHBOARD_PORTAL = "web.team.dashboard.portal"
TEAM_DASHBOARD_SUMMARY = "web.team.dashboard.summary"
TEAM_STORAGE_PORTAL = "web.team.storage.portal"
TEAM_STORAGE_FILE = "web.team.storage.file"
)
func MessageInsertJSON(m *ice.Message, zone, name, text string, arg ...string) {

View File

@ -107,8 +107,11 @@ func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) boo
if kit.Contains(r.URL.String(), "render=replace") {
return false
}
p := strings.TrimPrefix(r.URL.Path, nfs.P)
p := path.Join(strings.TrimPrefix(r.URL.Path, nfs.P))
if pp := path.Join(nfs.USR_LOCAL_WORK, msg.Option(ice.POD)); ispod && nfs.Exists(msg, pp) {
if kit.HasPrefix(p, "var/", "usr/local/") {
return false
}
if pp = path.Join(pp, p); nfs.Exists(msg, pp) {
return Render(msg, ice.RENDER_DOWNLOAD, pp)
} else {

View File

@ -169,6 +169,16 @@ func ShareLocalFile(m *ice.Message, arg ...string) {
} else if m.Option(ice.POD) == "" && !aaa.Right(m, ls) {
return
} else {
if m.Option(ice.POD) != "" && !strings.Contains(p, "/src/") && !strings.HasPrefix(p, "src/") {
if strings.HasPrefix(p, "usr/local/storage/") {
if m.Cmd(SPACE, "20240903-operation", "web.team.storage.file", aaa.RIGHT, ls[3:]).IsErr() {
return
}
} else if m.WarnNotRight(m.Cmdx(SPACE, m.Option(ice.POD), aaa.ROLE, aaa.RIGHT, aaa.VOID, p) != ice.OK) {
return
}
}
}
}
if m.Option(ice.POD) != "" && nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(ice.POD))) {

View File

@ -1,7 +1,10 @@
package code
import (
"path"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
kit "shylinux.com/x/toolkits"
@ -16,8 +19,16 @@ const JSON = "json"
func init() {
Index.MergeCommands(ice.Commands{
JSON: {Actions: ice.MergeActions(ice.Actions{
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {}},
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {}},
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
m.FieldsSetDetail()
kit.For(kit.KeyValue(nil, "", kit.UnMarshal(m.Cmdx(nfs.CAT, path.Join(arg[2], arg[1])))), func(key, value string) {
m.Push(key, value)
})
}},
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1]))
ctx.DisplayStoryJSON(m)
}},
TEMPLATE: {Hand: func(m *ice.Message, arg ...string) {
m.Echo(kit.Format(nfs.Template(m, DEMO_JSON)))
}},