forked from x/icebergs
opt some
This commit is contained in:
parent
beea49d5dd
commit
93a9591cf7
@ -113,7 +113,7 @@ const CACHE = "cache"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
CACHE: {Name: "cache hash auto write catch upload", Help: "缓存池", Actions: ice.MergeActions(ice.Actions{
|
CACHE: {Name: "cache hash auto upload", Help: "缓存池", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.RENDER_DOWNLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
ice.RENDER_DOWNLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo(_share_link(m, kit.Select(arg[0], arg, 1), ice.POD, m.Option(ice.MSG_USERPOD), nfs.FILENAME, kit.Select("", arg[0], len(arg) > 1)))
|
m.Echo(_share_link(m, kit.Select(arg[0], arg, 1), ice.POD, m.Option(ice.MSG_USERPOD), nfs.FILENAME, kit.Select("", arg[0], len(arg) > 1)))
|
||||||
}},
|
}},
|
||||||
|
@ -95,7 +95,7 @@ func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) boo
|
|||||||
}
|
}
|
||||||
func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.ResponseWriter, r *http.Request) {
|
func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.ResponseWriter, r *http.Request) {
|
||||||
debug := strings.Contains(r.URL.String(), "debug=true") || strings.Contains(r.Header.Get(Referer), "debug=true")
|
debug := strings.Contains(r.URL.String(), "debug=true") || strings.Contains(r.Header.Get(Referer), "debug=true")
|
||||||
m.Option(ice.LOG_TRACEID, r.Header.Get(ice.LOG_TRACEID))
|
m.Options(ice.LOG_TRACEID, r.Header.Get(ice.LOG_TRACEID), ice.MSG_LANGUAGE, "")
|
||||||
_log := func(level string, arg ...ice.Any) *ice.Message {
|
_log := func(level string, arg ...ice.Any) *ice.Message {
|
||||||
if debug || arg[0] == ice.MSG_CMDS {
|
if debug || arg[0] == ice.MSG_CMDS {
|
||||||
return m.Logs(strings.Title(level), arg...)
|
return m.Logs(strings.Title(level), arg...)
|
||||||
@ -166,24 +166,20 @@ func _serve_domain(m *ice.Message) string {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWriter, r *http.Request) ([]string, bool) {
|
func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWriter, r *http.Request) ([]string, bool) {
|
||||||
if len(cmds) > 0 {
|
kit.If(len(cmds) > 0, func() { cmds = append(kit.Split(cmds[0], ","), cmds[1:]...) })
|
||||||
cmds = append(kit.Split(cmds[0], ","), cmds[1:]...)
|
|
||||||
}
|
|
||||||
if r.URL.Path == PP(SPACE) {
|
if r.URL.Path == PP(SPACE) {
|
||||||
aaa.SessCheck(m, m.Option(ice.MSG_SESSID))
|
aaa.SessCheck(m, m.Option(ice.MSG_SESSID))
|
||||||
return cmds, true
|
return cmds, true
|
||||||
}
|
}
|
||||||
defer func() { m.Options(ice.MSG_CMDS, "", ice.MSG_SESSID, "") }()
|
defer func() { m.Options(ice.MSG_CMDS, "", ice.MSG_SESSID, "") }()
|
||||||
if aaa.SessCheck(m, m.Option(ice.MSG_SESSID)); m.Option(ice.MSG_USERNAME) == "" {
|
if aaa.SessCheck(m, m.Option(ice.MSG_SESSID)); m.Option(ice.MSG_USERNAME) == "" {
|
||||||
ls := kit.Simple(mdb.Cache(m, m.Option(ice.MSG_USERIP), func() ice.Any {
|
if ls := kit.Simple(mdb.Cache(m, m.Option(ice.MSG_USERIP), func() ice.Any {
|
||||||
if IsLocalHost(m) {
|
if !IsLocalHost(m) {
|
||||||
aaa.UserRoot(m)
|
|
||||||
return kit.Simple(m.Time(), m.OptionSplit(ice.MSG_USERNICK), m.OptionSplit(ice.MSG_USERNAME), m.OptionSplit(ice.MSG_USERROLE))
|
|
||||||
} else {
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}))
|
aaa.UserRoot(m)
|
||||||
if len(ls) > 0 {
|
return kit.Simple(m.Time(), m.OptionSplit(ice.MSG_USERNICK, ice.MSG_USERNAME, ice.MSG_USERROLE))
|
||||||
|
})); len(ls) > 0 {
|
||||||
aaa.SessAuth(m, kit.Dict(aaa.USERNICK, ls[1], aaa.USERNAME, ls[2], aaa.USERROLE, ls[3]), CACHE, ls[0])
|
aaa.SessAuth(m, kit.Dict(aaa.USERNICK, ls[1], aaa.USERNAME, ls[2], aaa.USERROLE, ls[3]), CACHE, ls[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user