forked from x/icebergs
opt trans
This commit is contained in:
parent
3c7a731381
commit
ee1a9a432c
@ -213,6 +213,9 @@ func init() {
|
||||
TRASH: {Name: "trash", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(TRASH, m.Option(kit.MDB_PATH))
|
||||
}},
|
||||
mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||
os.Remove(m.Option(kit.MDB_PATH))
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if m.Option(DIR_ROOT) != "" {
|
||||
m.Info("dir_root: %v", m.Option(DIR_ROOT))
|
||||
|
@ -210,6 +210,8 @@ func _serve_login(msg *ice.Message, key string, cmds []string, w http.ResponseWr
|
||||
if msg.Option(ice.MSG_USERNAME) == "" && msg.Option(SHARE) != "" {
|
||||
switch share := msg.Cmd(SHARE, msg.Option(SHARE)); share.Append(kit.MDB_TYPE) {
|
||||
case LOGIN:
|
||||
msg.Option(ice.MSG_USERNAME, share.Append(aaa.USERNAME))
|
||||
msg.Option(ice.MSG_USERROLE, share.Append(aaa.USERROLE))
|
||||
// Render(msg, aaa.SessCreate(msg, share.Append(aaa.USERNAME)))
|
||||
case FIELD:
|
||||
msg.Option(ice.MSG_USERNAME, share.Append(aaa.USERNAME))
|
||||
|
@ -28,7 +28,7 @@ func _share_repos(m *ice.Message, repos string, arg ...string) {
|
||||
}
|
||||
m.RenderDownload(path.Join(prefix, repos, path.Join(arg...)))
|
||||
}
|
||||
func _share_proxy(m *ice.Message, arg ...string) {
|
||||
func _share_proxy(m *ice.Message) {
|
||||
switch p := path.Join(ice.VAR_PROXY, m.Option(ice.POD), m.Option(kit.MDB_PATH)); m.R.Method {
|
||||
case http.MethodGet: // 下发文件
|
||||
m.RenderDownload(path.Join(p, m.Option(kit.MDB_NAME)))
|
||||
@ -75,7 +75,7 @@ func _share_local(m *ice.Message, arg ...string) {
|
||||
}
|
||||
|
||||
// 上传文件
|
||||
m.Cmdy(SPACE, m.Option(ice.POD), SPIDE, ice.DEV, SPIDE_RAW, kit.MergeURL2(m.Option(ice.MSG_USERWEB), "/share/proxy/"),
|
||||
m.Cmdy(SPACE, m.Option(ice.POD), SPIDE, ice.DEV, SPIDE_RAW, kit.MergeURL2(m.Option(ice.MSG_USERWEB), "/share/proxy"),
|
||||
SPIDE_PART, m.OptionSimple(ice.POD), kit.MDB_PATH, p, CACHE, cache.Format(ice.MOD_TIME), UPLOAD, "@"+p)
|
||||
|
||||
if s, e := os.Stat(pp); e == nil && !s.IsDir() {
|
||||
@ -134,7 +134,9 @@ func init() {
|
||||
}},
|
||||
}, mdb.HashAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if m.PodCmd(SHARE, arg) {
|
||||
return
|
||||
if m.Length() > 0 {
|
||||
return
|
||||
}
|
||||
}
|
||||
if mdb.HashSelect(m, arg...); len(arg) > 0 {
|
||||
link := _share_link(m, "/share/"+arg[0])
|
||||
@ -159,8 +161,8 @@ func init() {
|
||||
"/share/repos/": {Name: "/share/repos/", Help: "代码库", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
_share_repos(m, path.Join(arg[0], arg[1], arg[2]), arg[3:]...)
|
||||
}},
|
||||
"/share/proxy/": {Name: "/share/proxy/", Help: "文件流", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
_share_proxy(m, arg...)
|
||||
"/share/proxy": {Name: "/share/proxy", Help: "文件流", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
_share_proxy(m)
|
||||
}},
|
||||
"/share/cache/": {Name: "/share/cache/", Help: "缓存池", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
_share_cache(m, arg...)
|
||||
|
@ -41,7 +41,7 @@ func _plan_scope(m *ice.Message, tz int, arg ...string) (time.Time, time.Time) {
|
||||
}
|
||||
func _plan_list(m *ice.Message, begin_time, end_time time.Time) *ice.Message {
|
||||
m.Option(ice.CACHE_LIMIT, "100")
|
||||
m.Fields(0, "begin_time,close_time,zone,id,level,status,score,type,name,text,extra")
|
||||
m.Fields(0, "begin_time,close_time,zone,id,level,status,score,type,name,text,pod,extra")
|
||||
m.Option(kit.Keycb(mdb.SELECT), func(key string, fields []string, value, val map[string]interface{}) {
|
||||
begin, _ := time.ParseInLocation(ice.MOD_TIME, kit.Format(value[BEGIN_TIME]), time.Local)
|
||||
if begin_time.After(begin) || begin.After(end_time) {
|
||||
@ -86,9 +86,6 @@ func init() {
|
||||
m.Option(ice.POD, pod)
|
||||
}
|
||||
m.Debug(msg.FormatMeta())
|
||||
m.Debug("what %v", kit.KeyExtra(ice.CTX))
|
||||
m.Debug("what %v", msg.Append(kit.KeyExtra(ice.CTX)))
|
||||
m.Debug("what %v", msg.Append(kit.KeyExtra(ice.CMD)))
|
||||
args := kit.Simple(kit.Keys(msg.Append(kit.KeyExtra(ice.CTX)), msg.Append(kit.KeyExtra(ice.CMD))), arg[2:])
|
||||
if !m.PodCmd(args) {
|
||||
m.Cmdy(args)
|
||||
|
14
misc.go
14
misc.go
@ -78,8 +78,18 @@ func (m *Message) Split(str string, field string, sp string, nl string) *Message
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *Message) Display(plugin string) *Message {
|
||||
m.Option(MSG_DISPLAY, Display0(2, plugin)["display"])
|
||||
func (m *Message) Display(file string) *Message {
|
||||
m.Option(MSG_DISPLAY, Display0(2, file)["display"])
|
||||
return m
|
||||
}
|
||||
func (m *Message) DisplayLocal(file string) *Message {
|
||||
if file == "" {
|
||||
file = path.Join(kit.PathName(2), kit.FileName(2)+".js")
|
||||
}
|
||||
if !strings.HasPrefix(file, "/") {
|
||||
file = path.Join("/plugin/local", file)
|
||||
}
|
||||
m.Option(MSG_DISPLAY, Display0(2, file)["display"])
|
||||
return m
|
||||
}
|
||||
func (m *Message) FieldsIsDetail() bool {
|
||||
|
@ -42,7 +42,7 @@ func init() {
|
||||
home = kit.MergeURL(home, kit.MDB_BACK, back)
|
||||
}
|
||||
// 登录页面
|
||||
m.RenderRedirect(kit.MergeURL2(m.Conf(APP, kit.Keym(LARK)), "/open-apis/authen/v1/index"),
|
||||
m.RenderRedirect(kit.MergeURL2(m.Cmd(web.SPIDE, LARK).Append("client.url"), "/open-apis/authen/v1/index"),
|
||||
"redirect_uri", home, APP_ID, m.Cmd(APP).Append(APPID))
|
||||
}},
|
||||
}})
|
||||
|
10
render.go
10
render.go
@ -146,11 +146,10 @@ func (m *Message) PushAction(list ...interface{}) {
|
||||
})
|
||||
}
|
||||
func (m *Message) PushPodCmd(cmd string, arg ...string) {
|
||||
if strings.Contains(m.OptionFields(), POD) {
|
||||
m.Table(func(index int, value map[string]string, head []string) {
|
||||
m.Push(POD, m.Option(MSG_USERPOD))
|
||||
})
|
||||
}
|
||||
m.Table(func(index int, value map[string]string, head []string) {
|
||||
m.Push(POD, m.Option(MSG_USERPOD))
|
||||
})
|
||||
m.Debug(m.FormatMeta())
|
||||
|
||||
m.Cmd("space").Table(func(index int, value map[string]string, head []string) {
|
||||
switch value[kit.MDB_TYPE] {
|
||||
@ -162,6 +161,7 @@ func (m *Message) PushPodCmd(cmd string, arg ...string) {
|
||||
val[POD] = kit.Keys(value[kit.MDB_NAME], val[POD])
|
||||
m.Push("", val, head)
|
||||
})
|
||||
m.Debug(m.FormatMeta())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user