mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
add some
This commit is contained in:
parent
8ad2fd8e32
commit
ac660c4f04
@ -61,18 +61,17 @@ func init() {
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, arg ...string) {
|
||||
switch m.Option(ice.MSG_THEME) {
|
||||
case "black":
|
||||
m.Option(FG, kit.Select(CYAN, arg, 1))
|
||||
m.Option(BG, kit.Select(BLACK, arg, 2))
|
||||
case "light", "white":
|
||||
m.Option(FG, kit.Select(BLACK, arg, 1))
|
||||
m.Option(BG, kit.Select(WHITE, arg, 2))
|
||||
default:
|
||||
dark := kit.IndexOf([]string{BLACK, "dark"}, m.Option(ice.MSG_THEME)) > -1
|
||||
m.Option(FG, kit.Select(kit.Select(BLACK, SILVER, dark), arg, 1))
|
||||
m.Option(BG, kit.Select(kit.Select(WHITE, BLACK, dark), arg, 2))
|
||||
m.Option(FG, kit.Select(kit.Select(BLACK, m.Option("--plugin-fg-color")), arg, 1))
|
||||
m.Option(BG, kit.Select(kit.Select(WHITE, m.Option("--plugin-bg-color")), arg, 2))
|
||||
}
|
||||
if m.IsCliUA() {
|
||||
_qrcode_cli(m, kit.Select(kit.Select(ice.Info.Make.Domain, ice.Info.Domain), arg, 0))
|
||||
} else {
|
||||
m.Option(SIZE, kit.Select(kit.Format(kit.Max(240, kit.Min(480, kit.Int(m.Option(ice.MSG_HEIGHT)), kit.Int(m.Option(ice.MSG_WIDTH))))), arg, 3))
|
||||
m.OptionDefault(SIZE, "480")
|
||||
m.StatusTime(mdb.LINK, _qrcode_web(m, tcp.PublishLocalhost(m, kit.Select(m.Option(ice.MSG_USERWEB), arg, 0))))
|
||||
}
|
||||
}},
|
||||
|
@ -179,7 +179,6 @@ func init() {
|
||||
if len(arg) == 1 {
|
||||
arg = append(arg, "")
|
||||
}
|
||||
m.Option(CMD_ENV, "COLUMNS", kit.Int(kit.Select("1920", m.Option(ice.MSG_WIDTH)))/12)
|
||||
m.Echo(SystemCmds(m, "man %s %s|col -b", kit.Select("", arg[1], arg[1] != "1"), arg[0]))
|
||||
}},
|
||||
}, mdb.HashAction(mdb.SHORT, "cmd", mdb.FIELD, "time,cmd,arg")), Hand: func(m *ice.Message, arg ...string) {
|
||||
|
@ -43,7 +43,9 @@ func DisplayStorySpide(m displayMessage, arg ...ice.Any) displayMessage {
|
||||
}
|
||||
func DisplayStudio(m *ice.Message, cmd ...string) displayMessage {
|
||||
for i, k := range cmd {
|
||||
cmd[i] = m.Prefix(k)
|
||||
if !strings.Contains(cmd[i], nfs.PT) {
|
||||
cmd[i] = m.Prefix(k)
|
||||
}
|
||||
}
|
||||
return DisplayStory(m.Cmdy(COMMAND, cmd), "studio.js")
|
||||
}
|
||||
|
@ -65,6 +65,8 @@ func _split_list(m *ice.Message, file string, arg ...string) ice.Map {
|
||||
cb(ls)
|
||||
case func(string, []string):
|
||||
cb(text, ls)
|
||||
case func(int, string, []string):
|
||||
cb(indent, text, ls)
|
||||
case nil:
|
||||
default:
|
||||
m.ErrorNotImplement(cb)
|
||||
|
@ -141,6 +141,7 @@ const (
|
||||
BIN = "bin/"
|
||||
USR = "usr/"
|
||||
USR_PORTAL = ice.USR_PORTAL
|
||||
USR_PUBLISH = ice.USR_PUBLISH
|
||||
USR_LOCAL_WORK = ice.USR_LOCAL_WORK
|
||||
SRC_DOCUMENT = ice.SRC_DOCUMENT
|
||||
REQUIRE = "/require/"
|
||||
@ -190,7 +191,7 @@ func init() {
|
||||
if !aaa.Right(m, path.Join(root, dir)) {
|
||||
return
|
||||
}
|
||||
m.Logs(FIND, DIR_ROOT, root, PATH, dir, DIR_TYPE, m.Option(DIR_TYPE))
|
||||
m.Logs(FIND, DIR_ROOT, root, PATH, dir, m.OptionSimple(DIR_TYPE, DIR_REG))
|
||||
fields := kit.Split(kit.Select(kit.Select(DIR_DEF_FIELDS, m.OptionFields()), kit.Join(kit.Slice(arg, 1))))
|
||||
size, last := _dir_list(m, root, dir, 0, m.Option(DIR_DEEP) == ice.TRUE, kit.Select(TYPE_BOTH, m.Option(DIR_TYPE)), regexp.MustCompile(m.Option(DIR_REG)), fields)
|
||||
m.Status(mdb.TIME, last, mdb.COUNT, kit.Split(m.FormatSize())[0], SIZE, kit.FmtSize(size), DIR_ROOT, m.Option(DIR_ROOT), kit.MDB_COST, m.FormatCost())
|
||||
|
@ -3,6 +3,7 @@ package web
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
@ -24,18 +25,21 @@ func _dream_list(m *ice.Message) *ice.Message {
|
||||
mdb.HashSelect(m).Table(func(value ice.Maps) {
|
||||
if space, ok := list[value[mdb.NAME]]; ok {
|
||||
msg := gdb.Event(m.Spawn(value, space), DREAM_TABLES).Copy(m.Spawn().PushButton(cli.STOP))
|
||||
m.Push(nfs.VERSION, space[nfs.VERSION])
|
||||
m.Push(mdb.TYPE, space[mdb.TYPE])
|
||||
m.Push(cli.STATUS, cli.START)
|
||||
m.Push(mdb.TEXT, msg.Append(mdb.TEXT))
|
||||
m.PushButton(strings.Join(msg.Appendv(ctx.ACTION), ""))
|
||||
stats[cli.START]++
|
||||
} else if nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, value[mdb.NAME])) {
|
||||
m.Push(nfs.VERSION, "")
|
||||
m.Push(mdb.TYPE, WORKER)
|
||||
m.Push(cli.STATUS, cli.STOP)
|
||||
m.Push(mdb.TEXT, "")
|
||||
m.PushButton(cli.START, nfs.TRASH)
|
||||
stats[cli.STOP]++
|
||||
} else {
|
||||
m.Push(nfs.VERSION, "")
|
||||
m.Push(mdb.TYPE, WORKER)
|
||||
m.Push(cli.STATUS, cli.STOP)
|
||||
m.Push(mdb.TEXT, "")
|
||||
@ -122,7 +126,7 @@ const DREAM = "dream"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
DREAM: {Name: "dream name@key auto create", Help: "梦想家", Actions: ice.MergeActions(ice.Actions{
|
||||
DREAM: {Name: "dream name@key auto create startall stopall", Help: "梦想家", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.IsSearchPreview(m, arg) {
|
||||
m.Cmds("", func(value ice.Maps) { m.PushSearch(mdb.TEXT, m.MergePod(value[mdb.NAME]), value) })
|
||||
@ -171,13 +175,57 @@ func init() {
|
||||
kit.Switch(m.Option(mdb.TYPE), []string{SERVER, WORKER}, func() { m.PushButton(OPEN) })
|
||||
}},
|
||||
OPEN: {Hand: func(m *ice.Message, arg ...string) { ctx.ProcessOpen(m, m.MergePod(m.Option(mdb.NAME))) }},
|
||||
"startall": {Name: "startall name", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||
reg, err := regexp.Compile(m.Option(mdb.NAME))
|
||||
if m.Warn(err) {
|
||||
return
|
||||
}
|
||||
list := []string{}
|
||||
m.Spawn().Cmds("").Table(func(value ice.Maps) {
|
||||
if value[mdb.STATUS] == cli.STOP && reg.MatchString(value[mdb.NAME]) {
|
||||
list = append(list, value[mdb.NAME])
|
||||
}
|
||||
})
|
||||
if len(list) == 0 {
|
||||
return
|
||||
}
|
||||
GoToast(m, "", func(toast func(string, int, int)) []string {
|
||||
kit.For(list, func(index int, name string) {
|
||||
toast(name, index, len(list))
|
||||
m.Cmd("", cli.START, ice.Maps{mdb.NAME: name, ice.MSG_DAEMON: ""})
|
||||
})
|
||||
return nil
|
||||
})
|
||||
}},
|
||||
"stopall": {Name: "stopall name", Help: "停止", Hand: func(m *ice.Message, arg ...string) {
|
||||
reg, err := regexp.Compile(m.Option(mdb.NAME))
|
||||
if m.Warn(err) {
|
||||
return
|
||||
}
|
||||
list := []string{}
|
||||
m.Spawn().Cmds("").Table(func(value ice.Maps) {
|
||||
if value[mdb.STATUS] == cli.START && reg.MatchString(value[mdb.NAME]) {
|
||||
list = append(list, value[mdb.NAME])
|
||||
}
|
||||
})
|
||||
if len(list) == 0 {
|
||||
return
|
||||
}
|
||||
GoToast(m, "", func(toast func(string, int, int)) []string {
|
||||
kit.For(list, func(index int, name string) {
|
||||
toast(name, index, len(list))
|
||||
m.Cmd("", cli.STOP, ice.Maps{mdb.NAME: name, ice.MSG_DAEMON: ""})
|
||||
})
|
||||
return nil
|
||||
})
|
||||
}},
|
||||
"button": {Hand: func(m *ice.Message, arg ...string) {
|
||||
for _, cmd := range kit.Reverse(arg) {
|
||||
m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_TABLES, ice.CMD, cmd)
|
||||
m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_ACTION, ice.CMD, cmd)
|
||||
}
|
||||
}},
|
||||
}, ctx.CmdAction(), DreamAction(), mdb.ImportantHashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,repos,binary,template")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, ctx.CmdAction(), DreamAction(), mdb.ImportantHashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icon,repos,binary,template")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
_dream_list(m)
|
||||
ctx.DisplayTableCard(m)
|
||||
|
@ -73,7 +73,7 @@ func PushPodCmd(m *ice.Message, cmd string, arg ...string) {
|
||||
GoToast(m, "", func(toast func(string, int, int)) []string {
|
||||
kit.For(list, func(index int, space string) {
|
||||
toast(space, index, len(list))
|
||||
m.Cmd(SPACE, space, kit.Select(m.PrefixKey(), cmd), arg).Table(func(index int, val ice.Maps, head []string) {
|
||||
m.Cmd(SPACE, space, kit.Dict(ice.MSG_USERPOD, space), kit.Select(m.PrefixKey(), cmd), arg).Table(func(index int, val ice.Maps, head []string) {
|
||||
val[SPACE] = kit.Keys(space, val[SPACE])
|
||||
m.Push("", val, head)
|
||||
})
|
||||
|
@ -101,7 +101,6 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
|
||||
}
|
||||
m.Option(ice.MSG_COUNT, "0")
|
||||
kit.For(r.Cookies(), func(k, v string) { m.Optionv(k, v) })
|
||||
m.OptionDefault(ice.MSG_HEIGHT, "480", ice.MSG_WIDTH, "320")
|
||||
m.Options(ice.MSG_USERWEB, _serve_domain(m), ice.MSG_USERPOD, m.Option(ice.POD))
|
||||
m.Options(ice.MSG_USERUA, r.Header.Get(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)))))
|
||||
|
@ -162,6 +162,6 @@ func ShareLocalFile(m *ice.Message, arg ...string) {
|
||||
cache, size = s.ModTime(), s.Size()
|
||||
}
|
||||
kit.If(p == ice.BIN_ICE_BIN, func() { m.Option(ice.MSG_USERROLE, aaa.TECH) })
|
||||
m.Cmd(SPACE, m.Option(ice.POD), SPIDE, ice.DEV, SPIDE_RAW, MergeLink(m, PP(SHARE, PROXY)), SPIDE_PART, m.OptionSimple(ice.POD), nfs.PATH, p, nfs.SIZE, size, CACHE, cache.Format(ice.MOD_TIME), UPLOAD, mdb.AT+p)
|
||||
m.Cmd(SPACE, m.Option(ice.POD), SPIDE, ice.DEV, SPIDE_RAW, http.MethodPost, MergeLink(m, PP(SHARE, PROXY)), SPIDE_PART, m.OptionSimple(ice.POD), nfs.PATH, p, nfs.SIZE, size, CACHE, cache.Format(ice.MOD_TIME), UPLOAD, mdb.AT+p)
|
||||
m.RenderDownload(kit.Select(p, pp, file.ExistsFile(pp)))
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ func _space_fork(m *ice.Message) {
|
||||
name := kit.ReplaceAll(kit.Select(addr, m.Option(mdb.NAME)), "[", "_", "]", "_", nfs.DF, "_", nfs.PT, "_")
|
||||
text := kit.Select(addr, m.Option(mdb.TEXT))
|
||||
if kit.IsIn(m.Option(mdb.TYPE), CHROME) && m.Option(mdb.NAME) != CHROME || !(ice.Info.Localhost && tcp.IsLocalHost(m, m.R.RemoteAddr) ||
|
||||
m.Option(TOKEN) != "" && m.Cmdv(TOKEN, m.Option(TOKEN), mdb.TIME) > m.Time()) {
|
||||
m.Option(TOKEN) != "" && m.Cmdv(TOKEN, m.Option(TOKEN), mdb.TIME) > m.Time()) || mdb.HashSelect(m.Spawn(), name).Length() > 0 {
|
||||
name, text = kit.Hashs(name), kit.Select(addr, m.Option(mdb.NAME), m.Option(mdb.TEXT))
|
||||
}
|
||||
args := kit.Simple(mdb.TYPE, kit.Select(WORKER, m.Option(mdb.TYPE)), mdb.NAME, name, mdb.TEXT, text, m.OptionSimple(cli.DAEMON, ice.MSG_USERUA), m.OptionSimple(nfs.MODULE, nfs.VERSION))
|
||||
|
10
conf.go
10
conf.go
@ -210,18 +210,16 @@ const ( // MSG
|
||||
MSG_LANGUAGE = "user.lang"
|
||||
|
||||
MSG_MODE = "sess.mode"
|
||||
MSG_TITLE = "sess.title"
|
||||
MSG_THEME = "sess.theme"
|
||||
MSG_TITLE = "sess.title"
|
||||
MSG_RIVER = "sess.river"
|
||||
MSG_STORM = "sess.storm"
|
||||
MSG_WIDTH = "sess.width"
|
||||
MSG_HEIGHT = "sess.height"
|
||||
MSG_DAEMON = "sess.daemon"
|
||||
MSG_COUNT = "sess.count"
|
||||
MSG_DAEMON = "sess.daemon"
|
||||
MSG_FILES = "file.system"
|
||||
YAC_STACK = "yac.stack"
|
||||
YAC_MESSAGE = "yac.message"
|
||||
LOG_DISABLE = "log.disable"
|
||||
YAC_MESSAGE = "yac.message"
|
||||
YAC_STACK = "yac.stack"
|
||||
)
|
||||
const ( // RENDER
|
||||
RENDER_BUTTON = "_button"
|
||||
|
@ -83,14 +83,12 @@ func init() {
|
||||
}},
|
||||
}, mdb.HashAction(mdb.SHORT, web.LINK, mdb.FIELD, "time,hash,type,name,link"), FavorAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
list := []string{m.MergePodCmd("", "web.wiki.portal")}
|
||||
if m.Option(ice.MSG_USERPOD) == "" {
|
||||
list = append(list, web.MergeLink(m, "/chat/portal/"))
|
||||
} else {
|
||||
list = append(list, web.MergeLink(m, "/chat/portal/", ice.POD, m.Option(ice.MSG_USERPOD)))
|
||||
}
|
||||
list = append(list, web.MergeLink(m, "/chat/portal/", ice.POD, m.Option(ice.MSG_USERPOD)))
|
||||
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
||||
for _, link := range list {
|
||||
m.Push("", kit.Dict(mdb.TIME, m.Time(), mdb.HASH, kit.Hashs(link), mdb.TYPE, web.LINK, web.LINK, link))
|
||||
if u := kit.ParseURL(link); u != nil {
|
||||
m.Push("", kit.Dict(mdb.TIME, m.Time(), mdb.HASH, kit.Hashs(link), mdb.TYPE, web.LINK, mdb.NAME, u.Path, web.LINK, link))
|
||||
}
|
||||
}
|
||||
if m.Length() == 0 {
|
||||
m.Action(mdb.CREATE)
|
||||
|
@ -22,9 +22,9 @@ fieldset.macos.desktop>div.output>div.desktop>fieldset>legend { padding:0 10px;
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>legend:not(:hover) { background-color:transparent; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>*:not(.textarea) { margin:10px 0px 10px 10px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.icon { margin:12px 0 8px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item.button>span.icon { font-size:32px; line-height:32px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item.button>span.icon { font-size:32px; line-height:30px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item.button.prunes>span.icon { font-size:20px; line-height:32px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item.icons { margin-left:0; }
|
||||
/* fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item.icons { margin-left:0; } */
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item:last-child { margin-right:100px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action>* { margin:10px 0px 10px 10px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action>div.item:last-child { margin-right:100px; }
|
||||
|
@ -4,7 +4,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
can.onlayout.background(can, can.user.info.background||"/require/usr/icons/background.jpg", can._fields)
|
||||
can.onimport._menu(can), can.onimport._notifications(can), can.onimport._searchs(can), can.onimport._dock(can)
|
||||
},
|
||||
_menu: function(can) { can.onappend.plugin(can, {index: "web.chat.macos.menu", style: html.OUTPUT}, function(sub) { can.ui.menu = sub
|
||||
_menu: function(can) { can.onappend.plugin(can, {_space: can.ConfSpace(), index: "web.chat.macos.menu", style: html.OUTPUT}, function(sub) { can.ui.menu = sub
|
||||
sub.onexport.output = function() { can.onimport._desktop(can, can._msg)
|
||||
can.Conf("session") && can.runActionCommand(event, "session", [can.Conf("session")], function(msg) {
|
||||
var item = msg.TableDetail(); can.onimport.session(can, can.base.Obj(item.args))
|
||||
@ -59,7 +59,8 @@ Volcanos(chat.ONIMPORT, {
|
||||
}); can.page.style(can, carte._target, html.TOP, event.y) },
|
||||
}) }) },
|
||||
_window: function(can, item) { if (!item.index) { return } item._space = can.ConfSpace()
|
||||
item.left = 100, item.top = 125, item.height = can.base.Min(can.ConfHeight()-345, 480, 800), item.width = can.base.Min(can.ConfWidth()-360, 640, 1200)
|
||||
item.height = can.base.Min(can.ConfHeight()-200, 320, 800), item.width = can.base.Min(can.ConfWidth()-600, 640, 1600)
|
||||
item.left = (can.ConfWidth()-item.width)/2, item.top = 50
|
||||
if (can.ConfHeight() < 800) { item.top = 25, item.height = can.ConfHeight()-125, item.width = can.ConfWidth()-110 }
|
||||
if (can.user.isMobile) { item.left = 0, item.top = 25, item.height = can.ConfHeight()-125, item.width = can.ConfWidth() }
|
||||
can.onappend.plugin(can, item, function(sub) { can.ondetail.select(can, sub._target)
|
||||
|
@ -18,11 +18,11 @@ func init() {
|
||||
DockAppend(m, "Terminal", web.CODE_XTERM)
|
||||
DockAppend(m, "", web.CODE_VIMER)
|
||||
DockAppend(m, "", web.CODE_COMPILE, mdb.ICON, "usr/icons/go.png")
|
||||
DockAppend(m, "", web.CODE_GIT_STATUS, mdb.ICON, "usr/icons/git.jpg")
|
||||
DockAppend(m, "", web.CODE_GIT_STATUS, mdb.ICON, "usr/icons/git.png")
|
||||
}
|
||||
}},
|
||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashExport(m) }},
|
||||
}, aaa.RoleAction(), PodCmdAction(), CmdHashAction(), mdb.ImportantHashAction())}})
|
||||
}, aaa.RoleAction(), CmdHashAction(), mdb.ImportantHashAction())}})
|
||||
}
|
||||
|
||||
func DockAppend(m *ice.Message, name, index string, arg ...string) {
|
||||
|
@ -33,8 +33,8 @@ func PodCmdAction(arg ...string) ice.Actions {
|
||||
has := map[string]bool{}
|
||||
msg.Table(func(index int, value ice.Maps, head []string) {
|
||||
if !has[value[ctx.INDEX]] {
|
||||
m.Push("", value, head)
|
||||
has[value[ctx.INDEX]] = true
|
||||
m.Push("", value, head)
|
||||
}
|
||||
})
|
||||
m.Display(ctx.FileURI(file))
|
||||
|
@ -4,6 +4,6 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.page.Append(can, can._o
|
||||
].concat(msg.Table(function(item) {
|
||||
return {view: [html.ITEM], list: [{img: can.page.drawText(can, item.name||item.index, 25, 0, 20)}], onclick: function(event) { can.sup.onexport.record(can, item) }}
|
||||
}), [
|
||||
{view: [html.MENU, "", can.Conf("_space")? can.Conf("_space"): can.user.mod.isPod? can.misc.ParseURL(can)[ice.POD]: location.host], onclick: function(event) { can.sup.onexport.record(can, html.DESKTOP) }},
|
||||
{view: [html.MENU, "", can.ConfSpace()||can.misc.Search(can, ice.POD)||location.host], onclick: function(event) { can.sup.onexport.record(can, html.DESKTOP) }},
|
||||
{view: [html.MENU, "", "+"], onclick: function(event) { can.sup.onexport.record(can, mdb.CREATE) }},
|
||||
])) }})
|
||||
|
@ -1,8 +1,11 @@
|
||||
package code
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/lex"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/web/html"
|
||||
@ -24,7 +27,14 @@ const MAKEFILE = "makefile"
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
MAKEFILE: {Name: "makefile path auto", Help: "构建", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _makefile_xterm(m, arg...) }},
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Options(lex.SPLIT_BLOCK, ":")
|
||||
m.Cmd(lex.SPLIT, path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE)), func(indent int, text string, ls []string) {
|
||||
if indent == 1 && ls[1] == ":" {
|
||||
m.Push("target", ls[0]).Push("source", kit.Join(ls[2:])).PushButton("make")
|
||||
}
|
||||
})
|
||||
}},
|
||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _makefile_xterm(m, arg...) }},
|
||||
}, PlugAction())},
|
||||
})
|
||||
|
@ -143,6 +143,13 @@ func init() {
|
||||
m.Cmd(cli.SYSTEM, "goimports", "-w", p)
|
||||
}
|
||||
}},
|
||||
cli.MAKE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
web.PushStream(m)
|
||||
defer web.ToastProcess(m)()
|
||||
m.Cmd(cli.SYSTEM, "echo")
|
||||
m.Cmd(cli.SYSTEM, "date")
|
||||
m.Cmd(cli.SYSTEM, cli.MAKE, m.Option("target"), kit.Dict(cli.CMD_DIR, m.Option(nfs.PATH)))
|
||||
}},
|
||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) { nfs.Trash(m, arg[0]) }},
|
||||
nfs.MODULE: {Name: "create name*=h2 help=示例 type*=Hash,Zone,Data,Code main*=main.go zone key", Help: "模块", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(AUTOGEN, nfs.MODULE, arg)
|
||||
|
@ -13,6 +13,10 @@ import (
|
||||
"shylinux.com/x/webview"
|
||||
)
|
||||
|
||||
const (
|
||||
CONF_SIZE = "var/conf/webview.size"
|
||||
)
|
||||
|
||||
type WebView struct {
|
||||
webview.WebView
|
||||
Source string
|
||||
@ -32,7 +36,7 @@ func (w WebView) Menu() bool {
|
||||
if len(list) == 0 {
|
||||
return false
|
||||
} else if len(list) == 1 {
|
||||
if ls := kit.Split(w.Cmdx(nfs.CAT, "etc/webview.size")); len(ls) > 1 {
|
||||
if ls := kit.Split(w.Cmdx(nfs.CAT, CONF_SIZE)); len(ls) > 1 {
|
||||
w.WebView.SetSize(kit.Int(ls[0]), kit.Int(ls[1])+28, webview.HintNone)
|
||||
} else {
|
||||
w.WebView.SetSize(1200, 800, webview.HintNone)
|
||||
@ -65,7 +69,7 @@ func (w WebView) OpenCmd(cmd string) {
|
||||
cli.Opens(w.Message, "Terminal.app", "-n")
|
||||
}
|
||||
func (w WebView) SetSize(width, height int) {
|
||||
w.Cmd(nfs.SAVE, "etc/webview.size", kit.Format("%v,%v", width, height))
|
||||
w.Cmd(nfs.SAVE, CONF_SIZE, kit.Format("%v,%v", width, height))
|
||||
}
|
||||
func (w WebView) System(arg ...string) string { return w.Cmdx(cli.SYSTEM, arg) }
|
||||
func (w WebView) Power() string {
|
||||
|
@ -46,13 +46,9 @@ func Render(m *Message, cmd string, args ...Any) string {
|
||||
case RENDER_ANCHOR:
|
||||
return kit.Format(`<a href="%s" target="_blank">%s</a>`, kit.Select(arg[0], arg, 1), arg[0])
|
||||
case RENDER_IMAGES:
|
||||
return kit.Format(`<img src="%s" style="max-height:%spx; max-width:%spx">`, arg[0], m.Option(MSG_HEIGHT), m.Option(MSG_WIDTH))
|
||||
return kit.Format(`<img src="%s">`, arg[0])
|
||||
case RENDER_VIDEOS:
|
||||
if kit.Int(m.Option(MSG_HEIGHT)) < kit.Int(m.Option(MSG_WIDTH)) {
|
||||
return kit.Format(`<video src="%s" height="%s" style="max-height:%spx; max-width:%spx" controls autoplay>`, arg[0], m.Option(MSG_HEIGHT), m.Option(MSG_HEIGHT), m.Option(MSG_WIDTH))
|
||||
} else {
|
||||
return kit.Format(`<video src="%s" width="%s" style="max-height:%spx; max-width:%spx" controls autoplay>`, arg[0], m.Option(MSG_WIDTH), m.Option(MSG_HEIGHT), m.Option(MSG_WIDTH))
|
||||
}
|
||||
return kit.Format(`<video src="%s" controls autoplay>`, arg[0])
|
||||
case RENDER_IFRAME:
|
||||
return kit.Format(`<iframe src="%s"></iframe>`, arg[0])
|
||||
case RENDER_SCRIPT:
|
||||
|
Loading…
x
Reference in New Issue
Block a user