1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-12-12 11:32:37 +08:00
parent 4fd30e611d
commit 3ce839ecc9
14 changed files with 89 additions and 76 deletions

View File

@ -22,6 +22,7 @@ const (
THEME = "theme"
LANGUAGE = "language"
LOCATION = "location"
LONGITUDE = "longitude"
LATITUDE = "latitude"
PROVINCE = "province"

View File

@ -70,7 +70,7 @@ func init() {
m.OptionDefault(FG, BLACK, BG, WHITE)
_qrcode_cli(m, kit.Select(kit.Select(ice.Info.Make.Domain, ice.Info.Domain), arg, 0))
} else {
m.OptionDefault(SIZE, "320")
m.OptionDefault(SIZE, kit.Select("360", "260", m.IsMobileUA()))
// m.OptionDefault(SIZE, kit.Select("320", "368", m.IsWeixinUA()))
m.Option(FG, kit.Select(m.Option(ice.MSG_FG), arg, 1))
m.Option(BG, kit.Select(m.Option(ice.MSG_BG), arg, 2))

View File

@ -8,6 +8,7 @@ import (
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits"
)
@ -33,8 +34,8 @@ func BasicSess(m *ice.Message) {
aaa.SessCheck(m, m.Option(ice.MSG_SESSID))
}
func BasicCheck(m *ice.Message, realm string) bool {
switch ls := kit.Split(m.R.Header.Get(Authorization)); kit.Select("", ls, 0) {
case Basic:
switch ls := kit.Split(m.R.Header.Get(html.Authorization)); kit.Select("", ls, 0) {
case html.Basic:
if buf, err := base64.StdEncoding.DecodeString(kit.Select("", ls, 1)); !m.Warn(err) {
if ls := strings.SplitN(string(buf), ":", 2); !m.Warn(len(ls) < 2) {
if msg := m.Cmd(TOKEN, ls[1]); !m.Warn(msg.Time() > msg.Append(mdb.TIME)) {

View File

@ -18,7 +18,7 @@ import (
func _cache_name(m *ice.Message, h string) string { return path.Join(ice.VAR_FILE, h[:2], h) }
func _cache_mime(m *ice.Message, mime, name string) string {
if mime == ApplicationOctet {
if mime == html.ApplicationOctet {
if kit.ExtIsImage(name) {
mime = IMAGE + nfs.PS + kit.Ext(name)
} else if kit.ExtIsVideo(name) {
@ -64,7 +64,7 @@ func _cache_upload(m *ice.Message, r *http.Request) (mime, name, file, size stri
b.Seek(0, os.SEEK_SET)
if n, e := io.Copy(f, b); !m.Warn(e, ice.ErrNotValid, UPLOAD) {
m.Logs(nfs.SAVE, nfs.FILE, p, nfs.SIZE, kit.FmtSize(int64(n)))
return h.Header.Get(ContentType), h.Filename, p, kit.Format(n)
return h.Header.Get(html.ContentType), h.Filename, p, kit.Format(n)
}
}
}
@ -79,7 +79,7 @@ func _cache_download(m *ice.Message, r *http.Response, file string, cb ice.Any)
}()
defer f.Close()
last, base := 0, 10
nfs.CopyStream(m, f, r.Body, base*ice.MOD_BUFS, kit.Int(kit.Select("100", r.Header.Get(ContentLength))), func(count, total, value int) {
nfs.CopyStream(m, f, r.Body, base*ice.MOD_BUFS, kit.Int(kit.Select("100", r.Header.Get(html.ContentLength))), func(count, total, value int) {
if value/base == last {
return
}

View File

@ -4,7 +4,9 @@ import (
"strings"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits"
)
@ -49,9 +51,9 @@ func init() {
mdb.CREATE: {Name: "create type name text", Hand: func(m *ice.Message, arg ...string) {
mdb.HashSelectUpdate(m, mdb.HashCreate(m), func(value ice.Map) { value[mdb.COUNT] = kit.Int(value[mdb.COUNT]) + 1 })
}},
"valid": {Hand: func(m *ice.Message, arg ...string) {
mdb.VALID: {Hand: func(m *ice.Message, arg ...string) {
mdb.HashSelect(m.Spawn(), arg...).Table(func(value ice.Maps) {
if !strings.HasPrefix(value[mdb.TEXT], "Mozilla/") {
if !strings.HasPrefix(value[mdb.TEXT], html.Mozilla) {
return
} else if count := kit.Int(value[mdb.COUNT]); count < 3 {
return
@ -61,23 +63,26 @@ func init() {
})
m.StatusTimeCount(_count_stat(m))
}},
"location": {Hand: func(m *ice.Message, arg ...string) {
mdb.HashSelects(m).Sort(mdb.COUNT, ice.INT_R)
GoToast(m, "", func(toast func(string, int, int)) []string {
aaa.LOCATION: {Hand: func(m *ice.Message, arg ...string) {
GoToast(mdb.HashSelects(m).Sort(mdb.COUNT, ice.INT_R), "", func(toast func(string, int, int)) []string {
m.Table(func(index int, value ice.Maps) {
if value["location"] == "" {
if value[aaa.LOCATION] == "" {
location := kit.Format(kit.Value(SpideGet(m, "http://opendata.baidu.com/api.php?co=&resource_id=6006&oe=utf8", "query", value[mdb.NAME]), "data.0.location"))
mdb.HashModify(m, mdb.HASH, value[mdb.HASH], "location", location)
toast(location, index, m.Length())
mdb.HashModify(m, mdb.HASH, value[mdb.HASH], aaa.LOCATION, location)
toast(kit.Select(value[mdb.NAME], location), index, m.Length())
m.Sleep300ms()
}
})
return nil
})
}},
}, mdb.HashAction(mdb.LIMIT, 1000, mdb.LEAST, 500, mdb.SHORT, "type,name", mdb.FIELD, "time,hash,count,location,type,name,text", mdb.SORT, "type,name,text,location")), Hand: func(m *ice.Message, arg ...string) {
mdb.HashSelect(m, arg...)
m.StatusTimeCount(_count_stat(m))
}, mdb.HashAction(mdb.LIMIT, 1000, mdb.LEAST, 500, mdb.SHORT, "type,name", mdb.FIELD, "time,hash,count,location,type,name,text")), Hand: func(m *ice.Message, arg ...string) {
mdb.HashSelect(m, arg...).Sort(mdb.TIME, ice.STR_R).StatusTimeCount(_count_stat(m))
}},
})
}
func Count(m *ice.Message, arg ...string) *ice.Message {
m.Cmd(COUNT, mdb.CREATE, arg, kit.Dict(ice.LOG_DISABLE, ice.TRUE))
return m
}

View File

@ -6,11 +6,30 @@ import (
kit "shylinux.com/x/toolkits"
)
const (
Mozilla = "Mozilla"
UserAgent = "User-Agent"
Referer = "Referer"
Authorization = "Authorization"
Bearer = "Bearer"
Basic = "Basic"
Accept = "Accept"
AcceptLanguage = "Accept-Language"
ContentLength = "Content-Length"
ContentType = "Content-Type"
XForwardedFor = "X-Forwarded-For"
XHost = "X-Host"
ApplicationForm = "application/x-www-form-urlencoded"
ApplicationOctet = "application/octet-stream"
ApplicationJSON = "application/json"
)
const (
H1 = "h1"
H2 = "h2"
H3 = "h3"
SPAN = "span"
CHECKBOX = "checkbox"
STYLE = "style"
WIDTH = "width"
@ -77,8 +96,3 @@ func FormatDanger(value string) string {
COLOR, "var(--danger-fg-color)",
))
}
const (
AcceptLanguage = "Accept-Language"
CHECKBOX = "checkbox"
)

View File

@ -14,6 +14,7 @@ import (
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits"
)
@ -98,7 +99,7 @@ func RenderType(w http.ResponseWriter, name, mime string) {
mime = "application/" + kit.Ext(name)
}
}
RenderHeader(w, ContentType, mime)
RenderHeader(w, html.ContentType, mime)
}
func RenderOrigin(w http.ResponseWriter, origin string) {
RenderHeader(w, "Access-Control-Allow-Origin", origin)

View File

@ -19,6 +19,7 @@ import (
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/ssh"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/toolkits/logs"
)
@ -40,7 +41,6 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
const (
X_REAL_IP = "X-Real-Ip"
X_REAL_PORT = "X-Real-Port"
X_FORWARDED_FOR = "X-Forwarded-For"
INDEX_MODULE = "Index-Module"
)
if r.Header.Get(INDEX_MODULE) == "" {
@ -52,7 +52,7 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
if r.Header.Set(ice.MSG_USERIP, ip); r.Header.Get(X_REAL_PORT) != "" {
r.Header.Set(ice.MSG_USERADDR, ip+nfs.DF+r.Header.Get(X_REAL_PORT))
}
} else if ip := r.Header.Get(X_FORWARDED_FOR); ip != "" {
} else if ip := r.Header.Get(html.XForwardedFor); ip != "" {
r.Header.Set(ice.MSG_USERIP, kit.Split(ip)[0])
} else if strings.HasPrefix(r.RemoteAddr, "[") {
r.Header.Set(ice.MSG_USERIP, strings.Split(r.RemoteAddr, "]")[0][1:])
@ -63,7 +63,7 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
r.Header.Set(ice.LOG_TRACEID, log.Traceid())
m.Logs(r.Header.Get(ice.MSG_USERIP), r.Method, r.URL.String(), logs.TraceidMeta(r.Header.Get(ice.LOG_TRACEID)))
}
if path.Join(r.URL.Path) == nfs.PS && strings.HasPrefix(r.UserAgent(), Mozilla) {
if path.Join(r.URL.Path) == nfs.PS && strings.HasPrefix(r.UserAgent(), html.Mozilla) {
r.URL.Path = kit.Select(nfs.PS, mdb.Config(m, ice.MAIN))
}
if r.Method == http.MethodGet {
@ -85,7 +85,7 @@ func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) boo
} else if p = path.Join(nfs.USR, r.URL.Path); kit.HasPrefix(r.URL.Path, nfs.VOLCANOS, nfs.INTSHELL) && nfs.Exists(msg, p) {
return Render(msg, ice.RENDER_DOWNLOAD, p)
} else if p = strings.TrimPrefix(r.URL.Path, nfs.REQUIRE); kit.HasPrefix(r.URL.Path, ice.REQUIRE_SRC, nfs.REQUIRE+ice.USR_ICONS, nfs.REQUIRE+ice.USR_ICEBERGS) && nfs.Exists(msg, p) {
ispod := kit.Contains(r.URL.String(), CHAT_POD, "pod=") || kit.Contains(r.Header.Get(Referer), CHAT_POD, "pod=")
ispod := kit.Contains(r.URL.String(), CHAT_POD, "pod=") || kit.Contains(r.Header.Get(html.Referer), CHAT_POD, "pod=")
return !ispod && Render(msg, ice.RENDER_DOWNLOAD, p)
} else if p = path.Join(ice.USR_MODULES, strings.TrimPrefix(r.URL.Path, ice.REQUIRE_MODULES)); kit.HasPrefix(r.URL.Path, ice.REQUIRE_MODULES) && nfs.Exists(msg, p) {
return Render(msg, ice.RENDER_DOWNLOAD, p)
@ -94,7 +94,7 @@ func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) boo
}
}
func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.ResponseWriter, r *http.Request) {
debug := strings.Contains(r.URL.String(), "debug=true") || strings.Contains(r.Header.Get(Referer), "debug=true")
debug := strings.Contains(r.URL.String(), "debug=true") || strings.Contains(r.Header.Get(html.Referer), "debug=true")
m.Options(ice.LOG_TRACEID, r.Header.Get(ice.LOG_TRACEID), ice.MSG_LANGUAGE, "")
_log := func(level string, arg ...ice.Any) *ice.Message {
if debug || arg[0] == ice.MSG_CMDS {
@ -102,8 +102,8 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
}
return m
}
kit.If(r.Header.Get(Referer), func(p string) { _log("page", Referer, p) })
if u, e := url.Parse(r.Header.Get(Referer)); e == nil {
kit.If(r.Header.Get(html.Referer), func(p string) { _log("page", html.Referer, p) })
if u, e := url.Parse(r.Header.Get(html.Referer)); e == nil {
add := func(k, v string) { _log(nfs.PATH, k, m.Option(k, v)) }
switch arg := strings.Split(strings.TrimPrefix(u.Path, nfs.PS), nfs.PS); arg[0] {
case CHAT:
@ -117,18 +117,18 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
if r.Method == http.MethodGet && m.Option(ice.MSG_CMDS) != "" {
_log(ctx.ARGS, ice.MSG_CMDS, m.Optionv(ice.MSG_CMDS))
}
switch kit.Select("", kit.Split(r.Header.Get(ContentType)), 0) {
case ApplicationJSON:
switch kit.Select("", kit.Split(r.Header.Get(html.ContentType)), 0) {
case html.ApplicationJSON:
kit.For(kit.UnMarshal(r.Body), func(k string, v ice.Any) { m.Optionv(k, v) })
default:
r.ParseMultipartForm(kit.Int64(kit.Select("4096", r.Header.Get(ContentLength))))
r.ParseMultipartForm(kit.Int64(kit.Select("4096", r.Header.Get(html.ContentLength))))
kit.For(r.PostForm, func(k string, v []string) { _log(FORM, k, kit.Join(v, lex.SP)).Optionv(k, v) })
}
kit.For(r.Cookies(), func(k, v string) { m.Optionv(k, v) })
m.Options(ice.MSG_METHOD, r.Method, ice.MSG_COUNT, "0")
m.Options(ice.MSG_REFERER, r.Header.Get(Referer))
m.Options(ice.MSG_REFERER, r.Header.Get(html.Referer))
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_USERUA, r.Header.Get(html.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)))))
kit.If(m.Optionv(ice.MSG_CMDS) == nil, func() {
kit.If(strings.TrimPrefix(r.URL.Path, key), func(p string) { m.Optionv(ice.MSG_CMDS, strings.Split(p, nfs.PS)) })
@ -154,8 +154,8 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
}
func _serve_domain(m *ice.Message) string {
return kit.GetValid(
func() string { return kit.Select("", m.R.Header.Get(Referer), m.R.Method == http.MethodPost) },
func() string { return m.R.Header.Get("X-Host") },
func() string { return kit.Select("", m.R.Header.Get(html.Referer), m.R.Method == http.MethodPost) },
func() string { return m.R.Header.Get(html.XHost) },
func() string { return ice.Info.Domain },
func() string {
if b, e := regexp.MatchString("^[0-9.]+$", m.R.Host); b && e == nil {
@ -183,7 +183,7 @@ func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWrite
aaa.SessAuth(m, kit.Dict(aaa.USERNICK, ls[1], aaa.USERNAME, ls[2], aaa.USERROLE, ls[3]), CACHE, ls[0])
}
}
m.Cmd(COUNT, mdb.CREATE, aaa.IP, m.Option(ice.MSG_USERIP), m.Option(ice.MSG_USERUA), kit.Dict(ice.LOG_DISABLE, ice.TRUE))
Count(m, aaa.IP, m.Option(ice.MSG_USERIP), m.Option(ice.MSG_USERUA))
return cmds, aaa.Right(m, key, cmds)
}
@ -275,5 +275,5 @@ func RequireFile(m *ice.Message, file string) string {
return ""
}
func IsLocalHost(m *ice.Message) bool {
return (m.R == nil || m.R.Header.Get("X-Forwarded-For") == "") && tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP))
return (m.R == nil || m.R.Header.Get(html.XForwardedFor) == "") && tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP))
}

View File

@ -19,6 +19,7 @@ import (
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits"
)
@ -61,7 +62,7 @@ func _spide_show(m *ice.Message, name string, arg ...string) {
return
}
defer res.Body.Close()
m.Cost(cli.STATUS, res.Status, nfs.SIZE, kit.FmtSize(kit.Int64(res.Header.Get(ContentLength))), mdb.TYPE, res.Header.Get(ContentType))
m.Cost(cli.STATUS, res.Status, nfs.SIZE, kit.FmtSize(kit.Int64(res.Header.Get(html.ContentLength))), mdb.TYPE, res.Header.Get(html.ContentType))
m.Push(mdb.TYPE, STATUS).Push(mdb.NAME, res.StatusCode).Push(mdb.VALUE, res.Status)
m.Options(STATUS, res.Status)
kit.For(res.Header, func(k string, v []string) {
@ -104,16 +105,16 @@ func _spide_body(m *ice.Message, method string, arg ...string) (io.Reader, ice.M
case SPIDE_FORM:
arg = kit.Simple(arg, func(v string) string { return url.QueryEscape(v) })
_data := kit.JoinKV("=", "&", arg[1:]...)
head[ContentType], body = ApplicationForm, bytes.NewBufferString(_data)
head[html.ContentType], body = html.ApplicationForm, bytes.NewBufferString(_data)
case SPIDE_PART:
head[ContentType], body = _spide_part(m, arg...)
head[html.ContentType], body = _spide_part(m, arg...)
case SPIDE_FILE:
if f, e := nfs.OpenFile(m, arg[1]); m.Assert(e) {
m.Logs(nfs.LOAD, nfs.FILE, arg[1])
body = f
}
case SPIDE_DATA:
head[ContentType], body = ApplicationJSON, bytes.NewBufferString(kit.Select("{}", arg, 1))
head[html.ContentType], body = html.ApplicationJSON, bytes.NewBufferString(kit.Select("{}", arg, 1))
case SPIDE_JSON:
arg = arg[1:]
fallthrough
@ -121,7 +122,7 @@ func _spide_body(m *ice.Message, method string, arg ...string) (io.Reader, ice.M
data := ice.Map{}
kit.For(arg, func(k, v string) { kit.Value(data, k, v) })
_data := kit.Format(data)
head[ContentType], body = ApplicationJSON, bytes.NewBufferString(_data)
head[html.ContentType], body = html.ApplicationJSON, bytes.NewBufferString(_data)
}
return body, head, arg[:0]
}
@ -170,7 +171,9 @@ func _spide_head(m *ice.Message, req *http.Request, head ice.Maps, value ice.Map
kit.For(value[SPIDE_COOKIE], func(k string, v string) { req.AddCookie(&http.Cookie{Name: k, Value: v}) })
kit.For(kit.Simple(m.Optionv(SPIDE_COOKIE)), func(k, v string) { req.AddCookie(&http.Cookie{Name: k, Value: v}) })
kit.For(kit.Simple(m.Optionv(SPIDE_HEADER)), func(k, v string) { req.Header.Set(k, v) })
kit.If(req.Method == http.MethodPost, func() { m.Logs(kit.Select(ice.AUTO, req.Header.Get(ContentLength)), req.Header.Get(ContentType)) })
kit.If(req.Method == http.MethodPost, func() {
m.Logs(kit.Select(ice.AUTO, req.Header.Get(html.ContentLength)), req.Header.Get(html.ContentType))
})
}
func _spide_send(m *ice.Message, name string, req *http.Request, timeout string) (*http.Response, error) {
client := mdb.HashSelectTarget(m, name, func() ice.Any { return &http.Client{Timeout: kit.Duration(timeout)} }).(*http.Client)
@ -184,7 +187,7 @@ func _spide_save(m *ice.Message, action, file, uri string, res *http.Response) {
}
switch action {
case SPIDE_RAW:
if b, _ := ioutil.ReadAll(res.Body); strings.HasPrefix(res.Header.Get(ContentType), ApplicationJSON) {
if b, _ := ioutil.ReadAll(res.Body); strings.HasPrefix(res.Header.Get(html.ContentType), html.ApplicationJSON) {
// m.Echo(kit.Formats(kit.UnMarshal(string(b))))
m.Echo(string(b))
} else {
@ -198,7 +201,7 @@ func _spide_save(m *ice.Message, action, file, uri string, res *http.Response) {
case SPIDE_SAVE:
_cache_download(m, res, file, m.OptionCB(SPIDE))
case SPIDE_CACHE:
m.Cmdy(CACHE, DOWNLOAD, res.Header.Get(ContentType), uri, kit.Dict(RESPONSE, res), m.OptionCB(SPIDE))
m.Cmdy(CACHE, DOWNLOAD, res.Header.Get(html.ContentType), uri, kit.Dict(RESPONSE, res), m.OptionCB(SPIDE))
m.Echo(m.Append(mdb.HASH))
default:
var data ice.Any
@ -226,21 +229,6 @@ const (
SPIDE_JSON = "json"
SPIDE_RES = "content_data"
Basic = "Basic"
Bearer = "Bearer"
Authorization = "Authorization"
AcceptLanguage = "Accept-Language"
ContentLength = "Content-Length"
ContentType = "Content-Type"
UserAgent = "User-Agent"
Referer = "Referer"
Accept = "Accept"
Mozilla = "Mozilla"
ApplicationForm = "application/x-www-form-urlencoded"
ApplicationOctet = "application/octet-stream"
ApplicationJSON = "application/json"
IMAGE_JPEG = "image/jpeg"
IMAGE_PNG = "image/png"
TEXT_HTML = "text/html"
@ -332,7 +320,7 @@ func init() {
case HEADER:
switch arg[0] {
case mdb.KEY:
m.Push(arg[0], Authorization)
m.Push(arg[0], html.Authorization)
}
default:
mdb.HashSelectValue(m.Spawn(), func(value ice.Map) { m.Push(kit.Select(ORIGIN, arg, 0), kit.Value(value, CLIENT_ORIGIN)) })

View File

@ -10,6 +10,7 @@ import (
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits"
)
@ -32,7 +33,7 @@ func init() {
if m.Warn(m.R.Method != http.MethodPost, ice.ErrNotAllow) {
return
}
msg := m.Cmd("", mdb.CREATE, mdb.TYPE, Basic, mdb.NAME, m.Option(ice.MSG_USERNAME), mdb.TEXT, m.Option(tcp.HOST))
msg := m.Cmd("", mdb.CREATE, mdb.TYPE, html.Basic, mdb.NAME, m.Option(ice.MSG_USERNAME), mdb.TEXT, m.Option(tcp.HOST))
m.ProcessReplace(kit.MergeURL2(m.Option(tcp.HOST), ChatCmdPath(m, m.PrefixKey(), SET),
TOKEN, strings.Replace(UserHost(m), "://", kit.Format("://%s:%s@", m.Option(ice.MSG_USERNAME), msg.Result()), 1)))
}},

View File

@ -10,6 +10,7 @@ import (
"shylinux.com/x/icebergs/base/lex"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
"shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits"
)
@ -177,7 +178,7 @@ func (s Client) request(m *ice.Message, hash, api string, arg ...string) []strin
m.Option(ACCESS_TOKEN, msg.Append(ACCESS_TOKEN))
})
kit.If(m.Option(ACCESS_TOKEN), func(p string) {
m.Options(web.SPIDE_HEADER, ice.Maps{web.Authorization: msg.Append(TOKEN_PREFIX) + lex.SP + p})
m.Options(web.SPIDE_HEADER, ice.Maps{html.Authorization: msg.Append(TOKEN_PREFIX) + lex.SP + p})
arg = append(arg, ACCESS_TOKEN, p)
})
kit.If(api == "", func() { api = path.Join(msg.Append(API_PREFIX), m.ActionKey()) })

View File

@ -9,6 +9,7 @@ import (
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web"
"shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits"
)
@ -33,5 +34,5 @@ func GetSSO(m *ice.Message) string {
return ""
}
ls := strings.Split(kit.ParseURL(link).Path, nfs.PS)
return kit.MergeURL2(link, web.PP(CHAT, SSO), web.SPACE, kit.Select("", ls, 3), cli.BACK, m.R.Header.Get(web.Referer))
return kit.MergeURL2(link, web.PP(CHAT, SSO), web.SPACE, kit.Select("", ls, 3), cli.BACK, m.R.Header.Get(html.Referer))
}

View File

@ -11,7 +11,7 @@ import (
"shylinux.com/x/icebergs/base/gdb"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web"
"shylinux.com/x/icebergs/base/web/html"
"shylinux.com/x/icebergs/core/chat"
"shylinux.com/x/icebergs/core/chat/location"
kit "shylinux.com/x/toolkits"
@ -20,7 +20,7 @@ import (
func _wx_sign(m *ice.Message, nonce, stamp string) string {
return kit.Format(sha1.Sum([]byte(kit.Join(kit.Sort(kit.Simple(
kit.Format("jsapi_ticket=%s", m.Cmdx(ACCESS, TICKET)),
kit.Format("url=%s", m.R.Header.Get(web.Referer)),
kit.Format("url=%s", m.R.Header.Get(html.Referer)),
kit.Format("timestamp=%s", stamp),
kit.Format("noncestr=%s", nonce),
)), "&"))))

View File

@ -62,7 +62,7 @@ func init() {
msg := spidePost(m, WXACODE_UNLIMIT, web.SPIDE_DATA, kit.Format(kit.Dict(
"env_version", m.Option(ENV), "page", info.Append(PAGES), SCENE, meta, IS_HYALINE, m.Option(IS_HYALINE) == ice.TRUE, html.WIDTH, 320,
)))
switch kit.Select("", kit.Split(msg.Option(web.ContentType), "; "), 0) {
switch kit.Select("", kit.Split(msg.Option(html.ContentType), "; "), 0) {
case web.IMAGE_JPEG:
image := m.Cmd(web.CACHE, web.WRITE, mdb.TYPE, web.IMAGE_JPEG, mdb.NAME, scene, kit.Dict(mdb.TEXT, msg.Result())).Append(mdb.HASH)
mdb.HashSelects(m, mdb.HashCreate(m.Spawn(), m.OptionSimple(mdb.NAME), mdb.TEXT, meta, nfs.IMAGE, image, ctx.INDEX, m.Prefix(IDE), ctx.ARGS, scene, mdb.TYPE, m.Option(ENV)))