1
0
mirror of https://shylinux.com/x/icebergs synced 2025-05-03 20:07:01 +08:00
This commit is contained in:
harveyshao 2022-03-12 19:10:55 +08:00
parent 2b1f7bb9b5
commit 84460c4d41
4 changed files with 27 additions and 12 deletions

View File

@ -146,6 +146,7 @@ var Index = &ice.Context{Name: MDB, Help: "数据模块", Commands: map[string]*
case LIST:
_list_insert(m, arg[0], _domain_chain(m, arg[1]), arg[3:]...)
}
m.ProcessRefresh3ms()
}},
DELETE: {Name: "delete key sub type field value", Help: "删除", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
switch arg[2] {
@ -156,6 +157,7 @@ var Index = &ice.Context{Name: MDB, Help: "数据模块", Commands: map[string]*
case LIST:
_list_delete(m, arg[0], _domain_chain(m, arg[1]), arg[3], arg[4])
}
m.ProcessRefresh3ms()
}},
MODIFY: {Name: "modify key sub type field value arg...", Help: "编辑", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
switch arg[2] {

View File

@ -2,6 +2,7 @@ package code
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
@ -68,6 +69,25 @@ func init() {
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
BINPACK: {Name: "binpack path auto create remove export", Help: "打包", Action: map[string]*ice.Action{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
ice.Dump = func(w io.Writer, name string, cb func(string)) bool {
for _, key := range []string{name, strings.TrimPrefix(name, ice.USR_VOLCANOS)} {
if key == "/page/index.html" && kit.FileExists("src/website/index.txt") {
if s := m.Cmdx("web.chat.website", "show", "index.txt", "Header", "", "River", "", "Action", "", "Footer", ""); s != "" {
fmt.Fprint(w, s)
return true
}
}
if b, ok := ice.Info.Pack[key]; ok {
if cb != nil {
cb(name)
}
w.Write(b)
return true
}
}
return false
}
if kit.FileExists(path.Join(ice.USR_VOLCANOS, ice.PROTO_JS)) {
m.Cmd(BINPACK, mdb.REMOVE)
}
@ -76,6 +96,7 @@ func init() {
ice.Info.Pack["/page/index.html"] = []byte(s)
}
}
web.AddRewrite(func(w http.ResponseWriter, r *http.Request) bool {
if len(ice.Info.Pack) == 0 {
return false

15
info.go
View File

@ -88,18 +88,9 @@ func AddFileKey(dir, key string) {
func GetFileKey(dir string) string {
return Info.File[fileKey(dir)]
}
func Dump(w io.Writer, name string, cb func(string)) bool {
for _, key := range []string{name, strings.TrimPrefix(name, USR_VOLCANOS)} {
if b, ok := Info.Pack[key]; ok {
if cb != nil {
cb(name)
}
w.Write(b)
return true
}
}
return false
}
var Dump = func(w io.Writer, name string, cb func(string)) bool { return false }
func name(name string, value interface{}) string {
if s, ok := Info.names[name]; ok {
last := ""

View File

@ -204,6 +204,7 @@ func (m *Message) ProcessRefresh(delay string) {
}
m.Process(PROCESS_REFRESH)
}
func (m *Message) ProcessRefresh3ms() { m.ProcessRefresh("3ms") }
func (m *Message) ProcessRefresh30ms() { m.ProcessRefresh("30ms") }
func (m *Message) ProcessRefresh300ms() { m.ProcessRefresh("300ms") }
func (m *Message) ProcessRefresh3s() { m.ProcessRefresh("3s") }