forked from x/icebergs
add some
This commit is contained in:
parent
6e8235346f
commit
a220752657
@ -275,6 +275,7 @@ func init() {
|
||||
m.Cmd("", mdb.CREATE, ice.DEV, kit.Select(kit.Select("https://contexts.com.cn", ice.Info.Make.Domain), conf[cli.CTX_DEV]))
|
||||
m.Cmd("", mdb.CREATE, ice.COM, kit.Select("https://contexts.com.cn", conf[cli.CTX_COM]))
|
||||
m.Cmd("", mdb.CREATE, ice.HUB, kit.Select("https://repos.shylinux.com", conf[cli.CTX_HUB]))
|
||||
m.Cmd("", mdb.CREATE, "repos", kit.Select("https://repos.shylinux.com", conf[cli.CTX_HUB]))
|
||||
m.Cmd("", mdb.CREATE, ice.SHY, kit.Select(kit.Select("https://shylinux.com", ice.Info.Make.Remote), conf[cli.CTX_SHY]))
|
||||
}},
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
|
@ -21,7 +21,7 @@ func init() {
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
Notify(m, cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
|
||||
FinderAppend(m, "Applications", m.PrefixKey())
|
||||
AppInstall(m, "usr/icons/Finder.png", nfs.DIR)
|
||||
AppInstall(m, "usr/icons/dir.png", nfs.DIR)
|
||||
AppInstall(m, "usr/icons/Safari.png", web.CHAT_IFRAME)
|
||||
AppInstall(m, "usr/icons/Terminal.png", web.CODE_XTERM)
|
||||
AppInstall(m, "usr/icons/Calendar.png", web.TEAM_PLAN)
|
||||
|
@ -5,8 +5,11 @@ import (
|
||||
"time"
|
||||
|
||||
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"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
"shylinux.com/x/icebergs/core/chat/macos"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
@ -14,56 +17,55 @@ import (
|
||||
|
||||
func init() {
|
||||
const SEARCH = "search"
|
||||
const (
|
||||
EXPLORE_REPOS = "/explore/repos"
|
||||
REPOS_SEARCH = "/api/v1/repos/search"
|
||||
)
|
||||
const (
|
||||
WEB_SPIDE = "web.spide"
|
||||
UPDATED_AT = "updated_at"
|
||||
CLONE_URL = "clone_url"
|
||||
HTML_URL = "html_url"
|
||||
WEBSITE = "website"
|
||||
)
|
||||
Index.MergeCommands(ice.Commands{
|
||||
SEARCH: {Name: "search repos keyword auto", Help: "代码源", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
macos.AppInstall(m, "usr/icons/gitea.png", m.PrefixKey(), ctx.ARGS, kit.Format([]string{"repos"}))
|
||||
macos.AppInstall(m, "usr/icons/gitea.png", m.PrefixKey(), ctx.ARGS, kit.Format([]string{REPOS}))
|
||||
}},
|
||||
cli.START: {Name: "start name", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(web.DREAM, cli.START)
|
||||
}},
|
||||
CLONE: {Name: "clone name", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(REPOS, CLONE, m.Option(REPOS))
|
||||
}},
|
||||
cli.OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(m.Option("html_url"))
|
||||
}},
|
||||
"origin": {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(m.Cmdv("web.spide", "repos", "client.origin") + "/explore/repos")
|
||||
cli.START: {Name: "start name*", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(web.DREAM, cli.START) }},
|
||||
CLONE: {Name: "clone name*", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(REPOS, CLONE, m.Option(REPOS)) }},
|
||||
HTML_URL: {Help: "源码", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.Option(HTML_URL)) }},
|
||||
WEBSITE: {Help: "官网", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.Option(WEBSITE)) }},
|
||||
ORIGIN: {Help: "平台", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(m.Cmdv(WEB_SPIDE, kit.Select(m.Option(REPOS), arg, 0), web.CLIENT_ORIGIN) + EXPLORE_REPOS)
|
||||
}},
|
||||
}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
m.Cmdy("web.spide").RenameAppend("client.name", "repos", "client.url", "origin").Cut("time,repos,origin")
|
||||
m.Cmdy(WEB_SPIDE).RenameAppend(web.CLIENT_NAME, REPOS, web.CLIENT_URL, ORIGIN).Cut("time,repos,origin")
|
||||
return
|
||||
}
|
||||
res := kit.UnMarshal(m.Cmdx("web.spide", REPOS, web.SPIDE_RAW, http.MethodGet, "/api/v1/repos/search",
|
||||
res := kit.UnMarshal(m.Cmdx(WEB_SPIDE, arg[0], web.SPIDE_RAW, http.MethodGet, REPOS_SEARCH,
|
||||
"q", kit.Select("", arg, 1), "sort", "updated", "order", "desc", "page", "1", "limit", "100",
|
||||
))
|
||||
kit.For(kit.Value(res, "data"), func(value ice.Map) {
|
||||
value["size"] = kit.FmtSize(kit.Int(value["size"]) * 1000)
|
||||
if t, e := time.Parse(time.RFC3339, kit.Format(value["updated_at"])); e == nil {
|
||||
value["updated_at"] = t.Format("01-02 15:04")
|
||||
kit.For(kit.Value(res, mdb.DATA), func(value ice.Map) {
|
||||
value[nfs.SIZE] = kit.FmtSize(kit.Int(value[nfs.SIZE]) * 1000)
|
||||
if t, e := time.Parse(time.RFC3339, kit.Format(value[UPDATED_AT])); e == nil {
|
||||
value[UPDATED_AT] = t.Format("01-02 15:04")
|
||||
}
|
||||
m.Push("", value, []string{
|
||||
"avatar_url",
|
||||
"name",
|
||||
|
||||
"language",
|
||||
"forks_count",
|
||||
"stars_count",
|
||||
"watchers_count",
|
||||
"size", "updated_at",
|
||||
|
||||
"description",
|
||||
"clone_url",
|
||||
"html_url",
|
||||
"website",
|
||||
aaa.AVATAR_URL, mdb.NAME, aaa.LANGUAGE,
|
||||
"forks_count", "stars_count", "watchers_count",
|
||||
nfs.SIZE, UPDATED_AT, "description",
|
||||
CLONE_URL, HTML_URL, WEBSITE,
|
||||
})
|
||||
m.PushButton(cli.START, CLONE, cli.OPEN)
|
||||
button := []ice.Any{}
|
||||
kit.If(!kit.IsIn(kit.Format(value[mdb.NAME]), ice.ICEBERGS, ice.VOLCANOS), func() { button = append(button, cli.START) })
|
||||
button = append(button, CLONE)
|
||||
kit.For([]string{HTML_URL, WEBSITE}, func(key string) { kit.If(kit.Format(value[key]), func() { button = append(button, key) }) })
|
||||
m.PushButton(button...)
|
||||
})
|
||||
m.RenameAppend("clone_url", "repos").StatusTimeCount().Display("")
|
||||
m.Action("origin")
|
||||
// m.Echo("%v", kit.Formats(res))
|
||||
m.RenameAppend(CLONE_URL, REPOS).StatusTimeCount().Display("").Action(ORIGIN)
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
@ -4,10 +4,8 @@ Volcanos(chat.ONIMPORT, {
|
||||
can.onappend.style(can, "card", can._output)
|
||||
can.page.Appends(can, can._output, msg.Table(function(value) {
|
||||
return {view: [[html.ITEM, value.status]], list: [
|
||||
{view: [wiki.TITLE, html.DIV], list: [{img: value.avatar_url}, {view: "name", list: [
|
||||
{view: "name", list: [
|
||||
{text: [value.name, "", "name"]},
|
||||
]},
|
||||
{view: [wiki.TITLE, html.DIV], list: [{img: value.avatar_url}, {view: mdb.NAME, list: [
|
||||
{view: mdb.NAME, list: [{text: [value.name, "", mdb.NAME]}]},
|
||||
{view: "label", list: [
|
||||
{icon: "bi bi-file-earmark-code"}, {text: value.language},
|
||||
{icon: "bi bi-share"}, {text: value.forks_count},
|
||||
@ -18,8 +16,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
]}]}, {view: [wiki.CONTENT, html.DIV, value.description]},
|
||||
{view: html.ACTION, inner: value.action, _init: function(target) { can.onappend.mores(can, target, value, 5) }},
|
||||
]}
|
||||
})), can.onappend.board(can, msg)
|
||||
can.onimport.layout(can)
|
||||
})), can.onappend.board(can, msg), can.onimport.layout(can)
|
||||
},
|
||||
layout: function(can) { can.onlayout.expand(can, can._output, 360) },
|
||||
}, [""])
|
@ -202,9 +202,10 @@ func (m *Message) EchoScript(arg ...string) *Message { return m.Echo(Render(m, R
|
||||
func (m *Message) EchoDownload(arg ...string) *Message {
|
||||
return m.Echo(Render(m, RENDER_DOWNLOAD, arg))
|
||||
}
|
||||
func (m *Message) Display(file string, arg ...Any) {
|
||||
func (m *Message) Display(file string, arg ...Any) *Message {
|
||||
file = m.resource(file)
|
||||
m.Option(MSG_DISPLAY, kit.MergeURL(kit.Select(kit.ExtChange(file, JS), file, strings.Contains(file, QS)), arg...))
|
||||
return m
|
||||
}
|
||||
func (m *Message) Resource(file string) string { return m.resource(file) }
|
||||
func (m *Message) resource(file string) string {
|
||||
|
Loading…
x
Reference in New Issue
Block a user