1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-25 09:08:06 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-08-02 18:41:44 +08:00
parent 2f4e941aa0
commit 704519e336
10 changed files with 39 additions and 23 deletions

View File

@ -25,7 +25,7 @@ func init() {
HAPPEN: {Name: "happen event*", Help: "触发", Hand: func(m *ice.Message, arg ...string) {
defer m.Cost()
m.OptionCB(mdb.SELECT, "")
mdb.ZoneSelect(m.Spawn(ice.OptionFields("")), arg[1]).Table(func(value ice.Maps) {
mdb.ZoneSelectAll(m.Spawn(ice.OptionFields("")), arg[1]).Table(func(value ice.Maps) {
m.Cmdy(kit.Split(value[ice.CMD]), arg[1], arg[2:], ice.OptionFields(""))
})
_waitMap.Range(func(key, cb ice.Any) bool { cb.(func(*ice.Message, ...string))(m, arg...); return true })

View File

@ -147,27 +147,33 @@ func _dream_start(m *ice.Message, name string) {
}
func _dream_check(m *ice.Message, name string) string {
p := path.Join(ice.USR_LOCAL_WORK, name)
msg := m.Spawn(kit.Dict(ice.MSG_USERROLE, aaa.ROOT))
if pp := path.Join(p, ice.VAR_LOG_ICE_PID); nfs.Exists(m, pp) {
for i := 0; i < 5; i++ {
pid := m.Cmdx(nfs.CAT, pp, kit.Dict(ice.MSG_USERROLE, aaa.TECH))
for i := 0; i < 10; i++ {
pid := msg.Cmdx(nfs.CAT, pp)
if pid == "" {
return p
}
if runtime.GOOS == cli.LINUX && !kit.HasPrefix(m.Cmdx(nfs.CAT, "/proc/"+pid+"/cmdline"), kit.Path("bin/ice.bin"), kit.Path(p, "bin/ice.bin")) {
return p
}
if nfs.Exists(m, "/proc/"+pid) {
m.Info("already exists %v", pid)
} else if gdb.SignalProcess(m, pid) {
m.Info("already exists %v", pid)
} else if m.Cmd(SPACE, name).Length() > 0 {
m.Sleep("1s")
if m.Cmd(SPACE, name).Length() > 0 {
m.Info("already exists %v", name)
} else {
return ""
}
if runtime.GOOS == cli.LINUX && !nfs.Exists(m, "/proc/"+pid) {
return p
}
m.Sleep300ms()
if nfs.Exists(m, "/proc/"+pid) && runtime.GOOS == cli.LINUX {
if !kit.HasPrefix(msg.Cmdx(nfs.CAT, "/proc/"+pid+"/cmdline"), kit.Path("bin/ice.bin"), kit.Path(p, "bin/ice.bin")) {
return p
} else {
return ""
}
}
if gdb.SignalProcess(m, pid) {
m.Info("already exists %v", pid)
return ""
}
}
return ""
}
return p
}

View File

@ -169,6 +169,7 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
m.Options(ice.MSG_METHOD, r.Method, ice.MSG_COUNT, "0")
m.Options(ice.MSG_REFERER, r.Header.Get(html.Referer))
m.Options(ice.MSG_USERWEB, _serve_domain(m), ice.MSG_USERPOD, m.Option(ice.POD))
// m.Option(ice.POD, "")
m.Options(ice.MSG_USERUA, r.Header.Get(html.UserAgent), ice.MSG_USERIP, r.Header.Get(ice.MSG_USERIP))
m.Options(ice.MSG_SESSID, kit.Select(m.Option(ice.MSG_SESSID), m.Option(CookieName(m.Option(ice.MSG_USERWEB)))))
kit.If(m.Optionv(ice.MSG_CMDS) == nil, func() {

View File

@ -365,6 +365,7 @@ func init() {
cli.START: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("", tcp.DIAL, arg) }},
tcp.DIAL: {Name: "dial dev=ops name", Hand: func(m *ice.Message, arg ...string) {
_space_dial(m, m.Option(ice.DEV), kit.Select(ice.Info.NodeName, m.Option(mdb.NAME)), arg...)
ice.Info.Important = ice.HasVar()
}},
cli.CLOSE: {Hand: func(m *ice.Message, arg ...string) { mdb.HashRemove(m, m.OptionSimple(mdb.NAME)) }},
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) {

View File

@ -123,9 +123,6 @@ func Toast(m *ice.Message, text string, arg ...ice.Any) *ice.Message { // [title
}
kit.If(len(arg) == 0, func() { arg = append(arg, "") })
kit.If(len(arg) > 0 && arg[0] == "", func() { arg[0] = toastTitle(m) })
if m.IsDebug() {
// arg[0] = kit.Format(arg[0]) + "\t" + kit.FileLine(-1, 3)
}
PushNoticeToast(m, text, arg)
return m
}

View File

@ -136,7 +136,7 @@ func (s Client) User(m *ice.Message, arg ...string) {
func (s Client) Orgs(m *ice.Message, arg ...string) {}
func (s Client) Repo(m *ice.Message, arg ...string) {}
func init() { ice.ChatCtxCmd(Client{}) }
func init() { ice.Cmd("web.chat.oauth.client", Client{}) }
func (s Client) Login(m *ice.Message, arg ...string) {
if state, code := m.Option(STATE), m.Option(CODE); !m.WarnNotValid(state == "" || code == "") {

View File

@ -4,4 +4,4 @@ import "shylinux.com/x/ice"
type Server struct{ ice.Hash }
func init() { ice.ChatCtxCmd(Client{}) }
func init() { ice.Cmd("web.chat.oauth.server", Server{}) }

10
lock.go
View File

@ -85,7 +85,15 @@ func (m *Message) Optionv(key string, arg ...Any) Any {
case nil:
delete(m._meta, key)
case string:
m._meta[key] = kit.Simple(arg...)
func() {
for i := 0; i < len(arg); i++ {
if _, ok := arg[i].(string); !ok {
m._data[key] = arg
return
}
}
m._meta[key] = kit.Simple(arg...)
}()
case []string:
m._meta[key] = v
default:

View File

@ -40,9 +40,12 @@ func init() {
Index.MergeCommands(ice.Commands{
AGENT: {Name: "agent auto", Help: "代理", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
chat.HEADER_AGENT: {Hand: func(m *ice.Message, arg ...string) {
m.Info("what %v", m.Option(ice.MSG_USERUA))
kit.If(strings.Index(m.Option(ice.MSG_USERUA), "MicroMessenger") > -1, func() {
m.Info("what %v", m.Option(ice.MSG_USERUA))
m.Optionv(mdb.PLUGIN, m.PrefixKey(), mdb.Config(m, web.SPACE))
})
m.Info("what %v", m.FormatMeta())
}},
"getLocation": {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(location.LOCATION, mdb.CREATE, arg) }},
"scanQRCode1": {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(chat.FAVOR, mdb.CREATE, arg) }},

View File

@ -37,10 +37,10 @@ Volcanos(chat.ONIMPORT, {
wx.updateTimelineShareData({title: title, link: location.href, imgUrl: icons})
}
var p = can.misc.Resource(can, can.user.info.favicon); can.base.beginWith(p, "/") && (p = location.origin + p)
can.user.agent.init = function(can, content) { if (!can) { return }
p = can.misc.Resource(can, can.Conf(mdb.ICONS))||p; can.base.beginWith(p, "/") && (p = location.origin + p)
can.user.agent.init = function(can, content, icons) { if (!can) { return }
p = can.misc.Resource(can, icons||can.Conf(mdb.ICONS))||p; can.base.beginWith(p, "/") && (p = location.origin + p)
share(document.title, p, content)
}, can.user.agent.init(can.user.agent.cmd, can.user.agent._init_content)
}, can.user.agent.init(can.user.agent.cmd, can.user.agent._init_content, can.user.agent._init_icons)
})
})
},