forked from x/icebergs
add some
This commit is contained in:
parent
338a0a08c0
commit
d41585e91c
@ -48,7 +48,7 @@ const USER = "user"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
USER: {Help: "用户", Actions: ice.MergeActions(ice.Actions{
|
USER: {Help: "用户", Icon: "Contacts.png", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch mdb.HashInputs(m, arg); arg[0] {
|
switch mdb.HashInputs(m, arg); arg[0] {
|
||||||
case USERNICK:
|
case USERNICK:
|
||||||
|
@ -449,7 +449,7 @@ func init() {
|
|||||||
}, StatsAction(), DreamAction(), DreamTablesAction(), mdb.ImportantHashAction(
|
}, StatsAction(), DreamAction(), DreamTablesAction(), mdb.ImportantHashAction(
|
||||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icons,repos,binary,template,restart,access",
|
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icons,repos,binary,template,restart,access",
|
||||||
html.BUTTON, kit.JoinWord(PORTAL, DESKTOP, ADMIN, MESSAGE, WORD, STATUS, VIMER, COMPILE, XTERM, DREAM),
|
html.BUTTON, kit.JoinWord(PORTAL, DESKTOP, ADMIN, MESSAGE, WORD, STATUS, VIMER, COMPILE, XTERM, DREAM),
|
||||||
ctx.TOOLS, kit.Simple(SPIDE, ROUTE, STORE, MATRIX),
|
ctx.TOOLS, kit.Simple(ROUTE, SPIDE, STORE, MATRIX),
|
||||||
)), Hand: func(m *ice.Message, arg ...string) {
|
)), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
simple := m.Option("dream.simple") == ice.TRUE
|
simple := m.Option("dream.simple") == ice.TRUE
|
||||||
|
@ -37,15 +37,24 @@ const (
|
|||||||
ApplicationForm = "application/x-www-form-urlencoded"
|
ApplicationForm = "application/x-www-form-urlencoded"
|
||||||
ApplicationOctet = "application/octet-stream"
|
ApplicationOctet = "application/octet-stream"
|
||||||
ApplicationJSON = "application/json"
|
ApplicationJSON = "application/json"
|
||||||
|
TEXT_PLAIN = "text/plain"
|
||||||
)
|
)
|
||||||
const (
|
const (
|
||||||
H1 = "h1"
|
H1 = "h1"
|
||||||
H2 = "h2"
|
H2 = "h2"
|
||||||
H3 = "h3"
|
H3 = "h3"
|
||||||
SPAN = "span"
|
SPAN = "span"
|
||||||
|
TEXT = "text"
|
||||||
|
PLUG = "plug"
|
||||||
|
TEXTAREA = "textarea"
|
||||||
|
PASSWORD = "password"
|
||||||
CHECKBOX = "checkbox"
|
CHECKBOX = "checkbox"
|
||||||
|
SELECT = "select"
|
||||||
|
BUTTON = "button"
|
||||||
|
CHROME = "chrome"
|
||||||
|
|
||||||
STYLE = "style"
|
STYLE = "style"
|
||||||
|
FLOAT = "float"
|
||||||
WIDTH = "width"
|
WIDTH = "width"
|
||||||
HEIGHT = "height"
|
HEIGHT = "height"
|
||||||
|
|
||||||
@ -58,39 +67,34 @@ const (
|
|||||||
WHITE = "white"
|
WHITE = "white"
|
||||||
BLACK = "black"
|
BLACK = "black"
|
||||||
SILVER = "silver"
|
SILVER = "silver"
|
||||||
|
DANGER = "danger"
|
||||||
|
|
||||||
PROJECT = "project"
|
PROJECT = "project"
|
||||||
CONTENT = "content"
|
CONTENT = "content"
|
||||||
PROFILE = "profile"
|
PROFILE = "profile"
|
||||||
DISPLAY = "display"
|
DISPLAY = "display"
|
||||||
|
|
||||||
TEXT = "text"
|
|
||||||
PLUG = "plug"
|
|
||||||
TEXTAREA = "textarea"
|
|
||||||
PASSWORD = "password"
|
|
||||||
SELECT = "select"
|
|
||||||
BUTTON = "button"
|
|
||||||
|
|
||||||
PLUGIN_STORY_JSON = "/plugin/story/json.js"
|
|
||||||
|
|
||||||
VIEW = "view"
|
VIEW = "view"
|
||||||
INPUT = "input"
|
|
||||||
VALUE = "value"
|
VALUE = "value"
|
||||||
|
INPUT = "input"
|
||||||
OUTPUT = "output"
|
OUTPUT = "output"
|
||||||
LAYOUT = "layout"
|
LAYOUT = "layout"
|
||||||
RESIZE = "resize"
|
RESIZE = "resize"
|
||||||
|
FILTER = "filter"
|
||||||
REFRESH = "refresh"
|
REFRESH = "refresh"
|
||||||
CONFIRM = "confirm"
|
CONFIRM = "confirm"
|
||||||
FILTER = "filter"
|
|
||||||
|
|
||||||
DANGER = "danger"
|
PLUGIN_STORY_JSON = "/plugin/story/json.js"
|
||||||
)
|
ICONS_MAIL = "usr/icons/Mail.png"
|
||||||
|
ICONS_DREAM = "usr/icons/Launchpad.png"
|
||||||
const (
|
ICONS_SETTINGS = "usr/icons/System Settings.png"
|
||||||
FLOAT = "float"
|
GetLocation = "getLocation"
|
||||||
CHROME = "chrome"
|
ConnectWifi = "ConnectWifi"
|
||||||
|
GetClipboardData = "getClipboardData"
|
||||||
TEXT_PLAIN = "text/plain"
|
ScanQRCode = "scanQRCode"
|
||||||
|
ChooseImage = "chooseImage"
|
||||||
|
Record1 = "record1"
|
||||||
|
Record2 = "record2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func IsImage(name, mime string) bool {
|
func IsImage(name, mime string) bool {
|
||||||
@ -103,16 +107,6 @@ func IsAudio(name, mime string) bool {
|
|||||||
return strings.HasPrefix(mime, "audio/")
|
return strings.HasPrefix(mime, "audio/")
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
GetLocation = "getLocation"
|
|
||||||
ConnectWifi = "ConnectWifi"
|
|
||||||
GetClipboardData = "getClipboardData"
|
|
||||||
ScanQRCode = "scanQRCode"
|
|
||||||
ChooseImage = "chooseImage"
|
|
||||||
Record1 = "record1"
|
|
||||||
Record2 = "record2"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Format(tag string, inner string, arg ...string) string {
|
func Format(tag string, inner string, arg ...string) string {
|
||||||
return kit.Format("<%s %s>%s</%s>", tag, kit.JoinProperty(arg...), inner, tag)
|
return kit.Format("<%s %s>%s</%s>", tag, kit.JoinProperty(arg...), inner, tag)
|
||||||
}
|
}
|
||||||
@ -123,13 +117,6 @@ func FormatDanger(value string) string {
|
|||||||
return Format(SPAN, value, STYLE, kit.JoinCSS(BG_COLOR, "var(--danger-bg-color)", FG_COLOR, "var(--danger-fg-color)"))
|
return Format(SPAN, value, STYLE, kit.JoinCSS(BG_COLOR, "var(--danger-bg-color)", FG_COLOR, "var(--danger-fg-color)"))
|
||||||
}
|
}
|
||||||
|
|
||||||
var SystemList = []string{
|
|
||||||
Android,
|
|
||||||
IPhone,
|
|
||||||
Mac,
|
|
||||||
Linux,
|
|
||||||
Windows,
|
|
||||||
}
|
|
||||||
var AgentList = []string{
|
var AgentList = []string{
|
||||||
MicroMessenger,
|
MicroMessenger,
|
||||||
Alipay,
|
Alipay,
|
||||||
@ -139,3 +126,10 @@ var AgentList = []string{
|
|||||||
Firefox,
|
Firefox,
|
||||||
"Go-http-client",
|
"Go-http-client",
|
||||||
}
|
}
|
||||||
|
var SystemList = []string{
|
||||||
|
Android,
|
||||||
|
IPhone,
|
||||||
|
Mac,
|
||||||
|
Linux,
|
||||||
|
Windows,
|
||||||
|
}
|
||||||
|
@ -12,7 +12,7 @@ const GROUP = "group"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
GROUP: {Help: "群组", Icon: "Contacts.png", Actions: ice.MergeActions(ice.Actions{
|
GROUP: {Help: "群组", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case mdb.NAME:
|
case mdb.NAME:
|
||||||
|
@ -21,10 +21,10 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
MESSAGE: {Name: "message", Help: "聊天", Icon: "Messages.png", Actions: ice.MergeActions(ice.Actions{
|
MESSAGE: {Name: "message", Help: "聊天", Icon: "Messages.png", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
MessageCreate(m, aaa.APPLY, "usr/icons/Mail.png")
|
MessageCreate(m, aaa.APPLY, html.ICONS_MAIL)
|
||||||
MessageCreate(m, web.DREAM, "usr/icons/Launchpad.png")
|
MessageCreate(m, web.DREAM, html.ICONS_DREAM)
|
||||||
MessageCreate(m, cli.SYSTEM, "usr/icons/System Settings.png")
|
MessageCreate(m, cli.SYSTEM, html.ICONS_SETTINGS)
|
||||||
MessageInsert(m, cli.SYSTEM, mdb.TYPE, html.TEXT, mdb.NAME, cli.RUNTIME, mdb.TEXT, m.Cmdx(cli.RUNTIME), ctx.DISPLAY, html.PLUGIN_STORY_JSON)
|
MessageInsert(m, cli.SYSTEM, mdb.TYPE, html.TEXT, mdb.NAME, cli.BOOTINFO, mdb.TEXT, m.Cmdx(cli.RUNTIME), ctx.DISPLAY, html.PLUGIN_STORY_JSON)
|
||||||
}},
|
}},
|
||||||
mdb.CREATE: {Name: "create type*=tech,void title icons target zone", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create type*=tech,void title icons target zone", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if strings.HasPrefix(m.Option(web.TARGET), "from.") {
|
if strings.HasPrefix(m.Option(web.TARGET), "from.") {
|
||||||
@ -38,7 +38,7 @@ func init() {
|
|||||||
mdb.INSERT: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INSERT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.ZoneInsert(m, kit.Simple(arg[0], tcp.DIRECT, tcp.SEND, arg[1:], aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.AVATAR, m.Option(ice.MSG_AVATAR)))
|
mdb.ZoneInsert(m, kit.Simple(arg[0], tcp.DIRECT, tcp.SEND, arg[1:], aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.AVATAR, m.Option(ice.MSG_AVATAR)))
|
||||||
mdb.HashSelectUpdate(m, arg[0], func(value ice.Map) { kit.Value(value, mdb.TIME, m.Time()) })
|
mdb.HashSelectUpdate(m, arg[0], func(value ice.Map) { kit.Value(value, mdb.TIME, m.Time()) })
|
||||||
web.StreamPushRefreshConfirm(m, m.Trans("refresh for new message ", "刷新列表查看新消息 "))
|
web.StreamPushRefreshConfirm(m, m.Trans("refresh for new message ", "刷新列表,查看最新消息 "))
|
||||||
}},
|
}},
|
||||||
tcp.SEND: {Hand: func(m *ice.Message, arg ...string) {
|
tcp.SEND: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd("", mdb.INSERT, arg, tcp.DIRECT, tcp.SEND)
|
m.Cmd("", mdb.INSERT, arg, tcp.DIRECT, tcp.SEND)
|
||||||
@ -48,6 +48,12 @@ func init() {
|
|||||||
m.Cmd("", mdb.INSERT, m.Option(ice.FROM_SPACE), arg, tcp.DIRECT, tcp.RECV)
|
m.Cmd("", mdb.INSERT, m.Option(ice.FROM_SPACE), arg, tcp.DIRECT, tcp.RECV)
|
||||||
mdb.HashSelectUpdate(m, m.Option(ice.FROM_SPACE), func(value ice.Map) { kit.Value(value, web.TARGET, m.Option(ice.FROM_SPACE)) })
|
mdb.HashSelectUpdate(m, m.Option(ice.FROM_SPACE), func(value ice.Map) { kit.Value(value, web.TARGET, m.Option(ice.FROM_SPACE)) })
|
||||||
}},
|
}},
|
||||||
|
web.OPEN: {Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.MergePod(m.Option(web.TARGET))) }},
|
||||||
|
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if ice.Info.Important {
|
||||||
|
MessageInsert(m, web.DREAM, mdb.TYPE, html.PLUG, ctx.INDEX, IFRAME, ctx.ARGS, web.S(m.Option(mdb.NAME)))
|
||||||
|
}
|
||||||
|
}},
|
||||||
aaa.USER_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
aaa.USER_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if ice.Info.Important {
|
if ice.Info.Important {
|
||||||
MessageInsert(m, aaa.APPLY, mdb.TYPE, html.PLUG, mdb.NAME, m.ActionKey(), ctx.INDEX, aaa.USER, ctx.ARGS, m.Option(aaa.USERNAME))
|
MessageInsert(m, aaa.APPLY, mdb.TYPE, html.PLUG, mdb.NAME, m.ActionKey(), ctx.INDEX, aaa.USER, ctx.ARGS, m.Option(aaa.USERNAME))
|
||||||
@ -56,12 +62,6 @@ func init() {
|
|||||||
aaa.USER_REMOVE: {Hand: func(m *ice.Message, arg ...string) {
|
aaa.USER_REMOVE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
MessageInsert(m, aaa.APPLY, mdb.TYPE, html.PLUG, mdb.NAME, m.ActionKey(), ctx.INDEX, aaa.USER, ctx.ARGS, m.Option(aaa.USERNAME))
|
MessageInsert(m, aaa.APPLY, mdb.TYPE, html.PLUG, mdb.NAME, m.ActionKey(), ctx.INDEX, aaa.USER, ctx.ARGS, m.Option(aaa.USERNAME))
|
||||||
}},
|
}},
|
||||||
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
if ice.Info.Important {
|
|
||||||
MessageInsert(m, web.DREAM, mdb.TYPE, html.PLUG, ctx.INDEX, IFRAME, ctx.ARGS, web.S(m.Option(mdb.NAME)))
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
web.OPEN: {Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.MergePod(m.Option(web.TARGET))) }},
|
|
||||||
ctx.COMMAND: {Hand: func(m *ice.Message, arg ...string) {
|
ctx.COMMAND: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(tcp.DIRECT) == tcp.RECV {
|
if m.Option(tcp.DIRECT) == tcp.RECV {
|
||||||
m.Cmdy(web.Space(m, m.Option(web.TARGET)), ctx.COMMAND, arg[0]).ProcessField(ctx.ACTION, ctx.RUN, m.Option(web.TARGET), arg[0])
|
m.Cmdy(web.Space(m, m.Option(web.TARGET)), ctx.COMMAND, arg[0]).ProcessField(ctx.ACTION, ctx.RUN, m.Option(web.TARGET), arg[0])
|
||||||
@ -88,13 +88,18 @@ func init() {
|
|||||||
})
|
})
|
||||||
m.Sort(mdb.TIME, ice.STR_R)
|
m.Sort(mdb.TIME, ice.STR_R)
|
||||||
} else {
|
} else {
|
||||||
|
if msg := mdb.ZoneSelects(m.Spawn(), arg[0]); !kit.IsIn(m.Option(ice.MSG_USERROLE), msg.Append(mdb.TYPE), aaa.TECH, aaa.ROOT) {
|
||||||
|
return
|
||||||
|
}
|
||||||
mdb.ZoneSelect(m, arg...).Sort(mdb.ID, ice.INT)
|
mdb.ZoneSelect(m, arg...).Sort(mdb.ID, ice.INT)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func MessageCreate(m *ice.Message, zone, icons string) {
|
func MessageCreate(m *ice.Message, zone, icons string) {
|
||||||
m.Cmd(MESSAGE, mdb.CREATE, mdb.TYPE, aaa.TECH, mdb.ICONS, icons, mdb.ZONE, zone)
|
if _, ok := m.CmdMap(MESSAGE, mdb.ZONE)[zone]; !ok {
|
||||||
|
m.Cmd(MESSAGE, mdb.CREATE, mdb.TYPE, aaa.TECH, mdb.ICONS, icons, mdb.ZONE, zone)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
func MessageInsert(m *ice.Message, zone string, arg ...string) {
|
func MessageInsert(m *ice.Message, zone string, arg ...string) {
|
||||||
m.Cmd(MESSAGE, mdb.INSERT, zone, tcp.DIRECT, tcp.RECV, arg)
|
m.Cmd(MESSAGE, mdb.INSERT, zone, tcp.DIRECT, tcp.RECV, arg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user