1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00

opt share

This commit is contained in:
shylinux 2021-08-05 09:56:45 +08:00
parent 07156e688e
commit 305b5845ac
5 changed files with 31 additions and 8 deletions

View File

@ -79,12 +79,24 @@ func _serve_handle(key string, cmd *ice.Command, msg *ice.Message, w http.Respon
msg.Option(v.Name, v.Value)
}
if ls := strings.Split(r.URL.Path, "/"); len(ls) > 2 && ls[1] == "share" {
msg.Logs("refer", ls[1], ls[2])
msg.Option(ls[1], ls[2])
} else {
msg.Debug("%v", ls)
}
// 请求变量
if u, e := url.Parse(r.Header.Get("Referer")); e == nil {
for k, v := range u.Query() {
msg.Logs("refer", k, v)
msg.Option(k, v)
}
if ls := strings.Split(u.Path, "/"); len(ls) > 2 && ls[1] == "share" {
msg.Logs("refer", ls[1], ls[2])
msg.Option(ls[1], ls[2])
} else {
msg.Debug("%v", ls)
}
}
// 请求地址

View File

@ -208,6 +208,9 @@ func init() {
case STORM:
m.RenderRedirect("/page/share.html", SHARE, m.Option(SHARE))
case FIELD:
m.RenderDownload(path.Join(m.Conf(SERVE, kit.Keym(ice.VOLCANOS, kit.MDB_PATH)), "/page/index.html"))
}
}},

View File

@ -37,7 +37,12 @@ func init() {
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if strings.HasSuffix(m.R.URL.Path, "/") {
m.RenderDownload(path.Join(m.Conf(web.SERVE, kit.Keym(ice.VOLCANOS, kit.MDB_PATH)), m.Conf(CMD, kit.Keym(kit.MDB_INDEX))))
return
return // 目录
}
if msg := m.Cmd(ctx.COMMAND, arg[0]); msg.Append("meta") != "" {
_cmd_render(m, arg[0])
return // 命令
}
switch p := path.Join(m.Conf(CMD, kit.META_PATH), path.Join(arg...)); kit.Ext(p) {
@ -85,10 +90,13 @@ func init() {
},
Configs: map[string]*ice.Config{
CMD: {Name: CMD, Help: "命令", Value: kit.Data(
kit.MDB_PATH, "./", kit.MDB_INDEX, "page/cmd.html", kit.MDB_TEMPLATE, `
<!DOCTYPE html>
<body><script src="/page/can.js"></script>
<script>app("/chat/", %s)</script>
kit.MDB_PATH, "./", kit.MDB_INDEX, "page/cmd.html", kit.MDB_TEMPLATE, `<!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="/page/cmd.css">
</head>
<body>
<script src="/page/cmd.js"></script>
<script>cmd(%s)</script>
</body>
`,
)},

View File

@ -32,7 +32,7 @@ func _header_check(m *ice.Message, arg ...string) {
func _header_share(m *ice.Message, arg ...string) {
if m.Option(kit.MDB_LINK) == "" {
share := m.Cmdx(web.SHARE, mdb.CREATE, kit.MDB_TYPE, web.LOGIN, arg)
m.Option(kit.MDB_LINK, kit.MergeURL(m.Option(ice.MSG_USERWEB), web.SHARE, share))
m.Option(kit.MDB_LINK, kit.MergeURL2(m.Option(ice.MSG_USERWEB), "/share/"+share))
}
link := tcp.ReplaceLocalhost(m, m.Option(kit.MDB_LINK))

View File

@ -83,8 +83,8 @@ func init() {
m.Echo(p)
}
m.Cmd(nfs.COPY, _volcanos("page/can.css"), _volcanos("page/index.css"), _volcanos("page/cache.css"))
m.Cmd(nfs.COPY, _volcanos("page/can.js"), _volcanos("proto.js"), _volcanos("page/cache.js"))
m.Cmd(nfs.COPY, _volcanos("page/cmd.css"), _volcanos("page/index.css"), _volcanos("page/cache.css"))
m.Cmd(nfs.COPY, _volcanos("page/cmd.js"), _volcanos("proto.js"), _volcanos("page/cache.js"))
}},
mdb.PRUNES: {Name: "prunes", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(nfs.SAVE, path.Join(ice.USR_VOLCANOS, "page/cache.css"), "")