mirror of
https://shylinux.com/x/icebergs
synced 2025-04-25 17:18:05 +08:00
add mdb.DevDataAction
This commit is contained in:
parent
7eb7d7b708
commit
dc9f44f90e
@ -38,7 +38,7 @@ func init() {
|
||||
m.EchoIFrame(p).ProcessInner()
|
||||
}
|
||||
}},
|
||||
SEND: {Name: "send from=admin to*='shy@shylinux.com' cc subject*=hi content*:textarea=hello", Help: "发送", Hand: func(m *ice.Message, arg ...string) {
|
||||
SEND: {Name: "send from=admin to*='shy@shylinux.com' cc subject*=hi content*:textarea=hello", Help: "发送", Icon: "bi bi-send-plus", Hand: func(m *ice.Message, arg ...string) {
|
||||
msg := mdb.HashSelects(m.Spawn(), m.OptionDefault(FROM, ADMIN))
|
||||
if m.Warn(msg.Append(SERVICE) == "", ice.ErrNotValid, SERVICE) {
|
||||
return
|
||||
@ -49,12 +49,11 @@ func init() {
|
||||
auth := smtp.PlainAuth("", msg.Append(USERNAME), msg.Append(PASSWORD), kit.Split(msg.Append(SERVICE), ice.DF)[0])
|
||||
m.Logs(EMAIL, SEND, string(content)).Warn(smtp.SendMail(msg.Append(SERVICE), auth, msg.Append(USERNAME), kit.Split(m.Option(TO)), content))
|
||||
}},
|
||||
LOGIN: {Role: VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo("input email: ")
|
||||
}},
|
||||
}, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,service,username", ice.ACTION, SEND)), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, mdb.DevDataAction("name,service,username,password"), mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,service,username", ice.ACTION, SEND)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.HashSelect(m, arg...); len(arg) == 0 && m.Length() == 0 {
|
||||
m.EchoInfoButton("please add admin email", mdb.CREATE)
|
||||
m.EchoInfoButton("please add admin email", mdb.CREATE, mdb.DEV_REQUEST)
|
||||
} else if len(arg) == 0 {
|
||||
m.Action(mdb.CREATE, mdb.DEV_REQUEST)
|
||||
}
|
||||
}},
|
||||
})
|
||||
|
@ -38,9 +38,7 @@ func init() {
|
||||
}
|
||||
}},
|
||||
}, mdb.ImportantHashAction(EMAIL, ADMIN, mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,status,invite,email,title,content")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmd(EMAIL, mdb.Config(m, EMAIL)).Length() == 0 {
|
||||
m.Echo("please add admin email")
|
||||
} else if !m.Warn(len(arg) == 0 && m.Option(ice.MSG_USERROLE) == VOID, ice.ErrNotRight) {
|
||||
if !m.Warn(len(arg) == 0 && m.Option(ice.MSG_USERROLE) == VOID, ice.ErrNotRight) {
|
||||
kit.If(mdb.HashSelect(m, arg...).FieldsIsDetail(), func() {
|
||||
m.Option(ice.MSG_USERHOST, strings.Split(m.Option(ice.MSG_USERHOST), "://")[1])
|
||||
m.SetAppend().EchoInfoButton(ice.Render(m, ice.RENDER_TEMPLATE, SUBJECT_HTML), ACCEPT)
|
||||
|
@ -70,10 +70,6 @@ func (s apply) Email(m *ice.Message, arg ...string) {
|
||||
ctx.DisplayStoryForm(m.Message, "email*", s.Login).Echo("please auth login in mailbox, after email sent")
|
||||
}
|
||||
func (s apply) List(m *ice.Message, arg ...string) *ice.Message {
|
||||
if m.Cmd(aaa.EMAIL, mdb.Config(m.Message, aaa.EMAIL)).Length() == 0 {
|
||||
m.Echo("please add admin email")
|
||||
return m
|
||||
}
|
||||
kit.If(m.Option(_cookie_key(m)), func(p string) { arg = []string{p} })
|
||||
s.Hash.List(m, arg...).Table(func(value ice.Maps) {
|
||||
switch value[mdb.STATUS] {
|
||||
|
@ -3,6 +3,7 @@ package mdb
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
@ -188,6 +189,44 @@ func ExportHashAction(arg ...Any) ice.Actions {
|
||||
}, HashAction(arg...))
|
||||
}
|
||||
|
||||
const (
|
||||
DEV_REQUEST = "dev.request"
|
||||
DEV_CHOOSE = "dev.choose"
|
||||
DEV_RESPONSE = "dev.response"
|
||||
DEV_CONFIRM = "dev.confirm"
|
||||
DEV_CREATE = "dev.create"
|
||||
)
|
||||
|
||||
func DevDataAction(fields ...string) ice.Actions {
|
||||
const (
|
||||
DAEMON = "daemon"
|
||||
ORIGIN = "origin"
|
||||
BACK = "back"
|
||||
)
|
||||
return ice.Actions{
|
||||
DEV_REQUEST: {Name: "request origin*", Help: "请求", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(m.Options(ice.MSG_USERWEB, m.Option(ORIGIN)).MergePodCmd("", m.PrefixKey(), ACTION, DEV_CHOOSE, BACK, m.Option(ice.MSG_USERHOST), DAEMON, m.Option(ice.MSG_DAEMON)))
|
||||
}},
|
||||
DEV_CHOOSE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
HashSelect(m.Options(ice.MSG_FIELDS, kit.Join(fields))).PushAction(DEV_RESPONSE).Options(ice.MSG_ACTION, "")
|
||||
}},
|
||||
DEV_RESPONSE: {Help: "选择", Hand: func(m *ice.Message, arg ...string) {
|
||||
if !m.Warn(m.Option(ice.MSG_METHOD) != http.MethodPost, ice.ErrNotAllow) {
|
||||
m.ProcessReplace(m.Options(ice.MSG_USERWEB, m.Option(BACK)).MergePodCmd("", m.PrefixKey(), ACTION, DEV_CONFIRM, m.OptionSimple(DAEMON), m.OptionSimple(fields...)))
|
||||
}
|
||||
}},
|
||||
DEV_CONFIRM: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.EchoInfoButton(kit.JoinWord(m.PrefixKey(), DEV_CONFIRM, DEV_CREATE, m.Option(kit.Split(fields[0])[0])), DEV_CREATE)
|
||||
}},
|
||||
DEV_CREATE: {Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||
if !m.Warn(m.Option(ice.MSG_METHOD) != http.MethodPost, ice.ErrNotAllow) {
|
||||
defer kit.If(m.Option(DAEMON), func(p string) { m.Cmd("space", p, "refresh") })
|
||||
HashCreate(m.ProcessClose(), m.OptionSimple(fields...))
|
||||
}
|
||||
}},
|
||||
}
|
||||
}
|
||||
|
||||
func HashKey(m *ice.Message) string {
|
||||
if m.Option(HASH) != "" {
|
||||
return HASH
|
||||
|
@ -292,6 +292,8 @@ func init() {
|
||||
m.Push(arg[0], "shylinux@163.com")
|
||||
case aaa.PASSWORD:
|
||||
m.SetAppend()
|
||||
case "origin":
|
||||
m.Cmdy(SPIDE, kit.Dict(ice.MSG_FIELDS, CLIENT_ORIGIN)).CutTo(CLIENT_ORIGIN, arg[0])
|
||||
}
|
||||
})
|
||||
ctx.PodCmd = func(m *ice.Message, arg ...ice.Any) bool {
|
||||
|
@ -99,7 +99,7 @@ func init() {
|
||||
mdb.CREATE: {Name: "create type*=plugin,qrcode,oauth name* icons link order space index args", Hand: func(m *ice.Message, arg ...string) { mdb.HashCreate(m, m.OptionSimple()) }},
|
||||
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) { mdb.HashRemove(m, m.OptionSimple(mdb.NAME)) }},
|
||||
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) { mdb.HashModify(m, m.OptionSimple(mdb.NAME), arg) }},
|
||||
ice.DEMO: {Help: "体验", Hand: func(m *ice.Message, arg ...string) {
|
||||
ice.DEMO: {Help: "体验", Icon: "bi bi-shield-fill-check", Hand: func(m *ice.Message, arg ...string) {
|
||||
if kit.IsIn(m.Option(ice.MSG_USERROLE), aaa.TECH, aaa.ROOT) {
|
||||
m.Cmd("", mdb.CREATE, mdb.TYPE, mdb.PLUGIN, mdb.NAME, "免登录体验", mdb.ORDER, "12", ctx.INDEX, HEADER, ctx.ARGS, ice.DEMO)
|
||||
mdb.Config(m, ice.DEMO, ice.TRUE)
|
||||
|
@ -2,6 +2,7 @@ package chat
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
@ -13,7 +14,7 @@ const IFRAME = "iframe"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
IFRAME: {Name: "iframe hash@key auto", Help: "浏览器", Icon: "Safari.png", Actions: ice.MergeActions(ice.Actions{
|
||||
IFRAME: {Name: "iframe hash@key auto", Help: "浏览器", Icon: "Safari.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
switch mdb.HashInputs(m, arg); arg[0] {
|
||||
case mdb.NAME:
|
||||
@ -64,8 +65,7 @@ func init() {
|
||||
kit.If(m.Option(mdb.TYPE) == web.LINK, func() { ctx.ProcessField(m, m.PrefixKey(), m.Option(mdb.TEXT)) })
|
||||
}},
|
||||
}, FavorAction(), mdb.HashAction(mdb.SHORT, web.LINK, mdb.FIELD, "time,hash,type,name,link")), Hand: func(m *ice.Message, arg ...string) {
|
||||
list := []string{m.MergePodCmd("", web.WIKI_PORTAL)}
|
||||
list = append(list, m.MergePodCmd("", web.ADMIN))
|
||||
list := []string{m.MergePodCmd("", web.PORTAL), m.MergePodCmd("", web.ADMIN)}
|
||||
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
||||
for _, link := range list {
|
||||
if u := kit.ParseURL(link); u != nil {
|
||||
|
@ -47,6 +47,7 @@ fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item:last
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action>div.item:last-child { margin-right:100px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action>* { margin:var(--button-margin) var(--input-margin); }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action>div.tabs { display:none; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output { min-height:240px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output>table.content { width:100%; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output>table.content th { padding:var(--table-padding); }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output>table.content td { padding:var(--table-padding); }
|
||||
|
@ -2,6 +2,7 @@ package macos
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
)
|
||||
|
||||
@ -9,7 +10,7 @@ const FINDER = "finder"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
FINDER: {Name: "finder list", Help: "应用", Actions: ice.MergeActions(ice.Actions{
|
||||
FINDER: {Name: "finder list", Help: "应用", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(APPLICATIONS, mdb.INPUTS, arg) }},
|
||||
mdb.INSERT: {Name: "insert space index* args name* icon*@icon", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(APPLICATIONS, mdb.CREATE, arg) }},
|
||||
}, CmdHashAction(mdb.NAME))},
|
||||
|
@ -2,6 +2,7 @@ package macos
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/gdb"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
@ -13,7 +14,7 @@ const NOTIFICATIONS = "notifications"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
NOTIFICATIONS: {Help: "消息", Actions: ice.MergeActions(ice.Actions{
|
||||
NOTIFICATIONS: {Help: "消息", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
Notify(m, "Launchpad.png", m.Option(mdb.NAME), "空间创建成功", ctx.INDEX, web.CHAT_IFRAME, ctx.ARGS, m.MergePod(m.Option(mdb.NAME)))
|
||||
}},
|
||||
|
@ -2,6 +2,7 @@ package macos
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
@ -10,7 +11,7 @@ const SEARCHS = "searchs"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
SEARCHS: {Name: "searchs keyword list", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||
SEARCHS: {Name: "searchs keyword list", Help: "搜索", Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(mdb.SEARCH, mdb.FOREACH, kit.Select("", arg, 0), "ctx,cmd,type,name,text")
|
||||
}},
|
||||
})
|
||||
|
@ -44,8 +44,8 @@ type Client struct {
|
||||
short string `data:"domain,client_id"`
|
||||
field string `data:"time,hash,domain,client_id,client_secret,oauth_url,grant_url,token_url,users_url,scope,user_key,nick_key,api_prefix,token_prefix"`
|
||||
sso string `name:"sso name* icons*" help:"登录"`
|
||||
auth string `name:"auth" help:"授权"`
|
||||
user string `name:"user" help:"用户"`
|
||||
auth string `name:"auth" help:"授权" icon:"bi bi-person-check"`
|
||||
user string `name:"user" help:"用户" icon:"bi bi-person-vcard"`
|
||||
orgs string `name:"orgs" help:"组织"`
|
||||
repo string `name:"repo" help:"资源"`
|
||||
list string `name:"list hash auto" help:"授权" icon:"oauth.png"`
|
||||
|
@ -72,7 +72,7 @@ type relay struct {
|
||||
list string `name:"list machine auto" help:"机器" icon:"relay.png"`
|
||||
install string `name:"install dream param" help:"安装"`
|
||||
pushbin string `name:"pushbin dream param" help:"部署"`
|
||||
adminCmd string `name:"adminCmd cmd" help:"命令"`
|
||||
adminCmd string `name:"adminCmd cmd" help:"命令" icon:"bi bi-terminal-plus"`
|
||||
}
|
||||
|
||||
func (s relay) StatsTables(m *ice.Message, arg ...string) {
|
||||
|
@ -126,4 +126,4 @@ func (m *Message) ProcessBack() { m.Process(PROCESS_BACK) }
|
||||
func (m *Message) ProcessRich(arg ...Any) { m.Process(PROCESS_RICH, arg...) }
|
||||
func (m *Message) ProcessGrow(arg ...Any) { m.Process(PROCESS_GROW, arg...) }
|
||||
func (m *Message) ProcessOpen(url string) { kit.If(url, func() { m.Process(PROCESS_OPEN, url) }) }
|
||||
func (m *Message) ProcessClose() { m.Process(PROCESS_CLOSE) }
|
||||
func (m *Message) ProcessClose() *Message { return m.Process(PROCESS_CLOSE) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user