fix map bug
This commit is contained in:
parent
71d7a26ea3
commit
05773f6b1d
4 changed files with 16 additions and 11 deletions
|
|
@ -12,6 +12,7 @@ import (
|
||||||
jsoniter "github.com/json-iterator/go"
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/yaoapp/gou"
|
"github.com/yaoapp/gou"
|
||||||
"github.com/yaoapp/kun/exception"
|
"github.com/yaoapp/kun/exception"
|
||||||
|
"github.com/yaoapp/kun/maps"
|
||||||
"github.com/yaoapp/xiang/config"
|
"github.com/yaoapp/xiang/config"
|
||||||
"github.com/yaoapp/xiang/data"
|
"github.com/yaoapp/xiang/data"
|
||||||
"github.com/yaoapp/xiang/share"
|
"github.com/yaoapp/xiang/share"
|
||||||
|
|
@ -78,15 +79,15 @@ func LoadAppInfo(root string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if fs.MustExists("/xiang/icons/icon.icns") {
|
if fs.MustExists("/xiang/icons/icon.icns") {
|
||||||
info.Icons["icns"] = xfs.Encode(fs.MustReadFile("/xiang/icons/icon.icns"))
|
info.Icons.Set("icns", xfs.Encode(fs.MustReadFile("/xiang/icons/icon.icns")))
|
||||||
}
|
}
|
||||||
|
|
||||||
if fs.MustExists("/xiang/icons/icon.ico") {
|
if fs.MustExists("/xiang/icons/icon.ico") {
|
||||||
info.Icons["ico"] = xfs.Encode(fs.MustReadFile("/xiang/icons/icon.ico"))
|
info.Icons.Set("ico", xfs.Encode(fs.MustReadFile("/xiang/icons/icon.ico")))
|
||||||
}
|
}
|
||||||
|
|
||||||
if fs.MustExists("/xiang/icons/icon.png") {
|
if fs.MustExists("/xiang/icons/icon.png") {
|
||||||
info.Icons["png"] = xfs.Encode(fs.MustReadFile("/xiang/icons/icon.png"))
|
info.Icons.Set("png", xfs.Encode(fs.MustReadFile("/xiang/icons/icon.png")))
|
||||||
}
|
}
|
||||||
|
|
||||||
share.App = info
|
share.App = info
|
||||||
|
|
@ -94,15 +95,17 @@ func LoadAppInfo(root string) {
|
||||||
|
|
||||||
// defaultAppInfo 读取默认应用信息
|
// defaultAppInfo 读取默认应用信息
|
||||||
func defaultAppInfo() share.AppInfo {
|
func defaultAppInfo() share.AppInfo {
|
||||||
info := share.AppInfo{}
|
info := share.AppInfo{
|
||||||
|
Icons: maps.MakeSync(),
|
||||||
|
}
|
||||||
err := jsoniter.Unmarshal(data.MustAsset("xiang/data/app.json"), &info)
|
err := jsoniter.Unmarshal(data.MustAsset("xiang/data/app.json"), &info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exception.New("解析默认应用失败 %s", 500, err).Throw()
|
exception.New("解析默认应用失败 %s", 500, err).Throw()
|
||||||
}
|
}
|
||||||
|
|
||||||
info.Icons["icns"] = xfs.Encode(data.MustAsset("xiang/data/icons/icon.icns"))
|
info.Icons.Set("icns", xfs.Encode(data.MustAsset("xiang/data/icons/icon.icns")))
|
||||||
info.Icons["ico"] = xfs.Encode(data.MustAsset("xiang/data/icons/icon.ico"))
|
info.Icons.Set("ico", xfs.Encode(data.MustAsset("xiang/data/icons/icon.ico")))
|
||||||
info.Icons["png"] = xfs.Encode(data.MustAsset("xiang/data/icons/icon.png"))
|
info.Icons.Set("png", xfs.Encode(data.MustAsset("xiang/data/icons/icon.png")))
|
||||||
|
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@ func processPing(process *gou.Process) interface{} {
|
||||||
|
|
||||||
// processInspect 返回系统信息
|
// processInspect 返回系统信息
|
||||||
func processInspect(process *gou.Process) interface{} {
|
func processInspect(process *gou.Process) interface{} {
|
||||||
share.App.Icons["favicon"] = "/api/xiang/favicon.ico"
|
share.App.Icons.Set("favicon", "/api/xiang/favicon.ico")
|
||||||
return share.App.Public()
|
return share.App.Public()
|
||||||
}
|
}
|
||||||
|
|
||||||
// processFavicon 运行模型 MustCreate
|
// processFavicon 运行模型 MustCreate
|
||||||
func processFavicon(process *gou.Process) interface{} {
|
func processFavicon(process *gou.Process) interface{} {
|
||||||
return xfs.DecodeString(share.App.Icons["png"])
|
return xfs.DecodeString(share.App.Icons.Get("png").(string))
|
||||||
}
|
}
|
||||||
|
|
||||||
// processFileContent 返回文件内容
|
// processFileContent 返回文件内容
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// VERSION 版本号
|
// VERSION 版本号
|
||||||
const VERSION = "0.8.2"
|
const VERSION = "0.8.3"
|
||||||
|
|
||||||
// DOMAIN 许可域
|
// DOMAIN 许可域
|
||||||
const DOMAIN = "*.iqka.com"
|
const DOMAIN = "*.iqka.com"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package share
|
package share
|
||||||
|
|
||||||
|
import "github.com/yaoapp/kun/maps"
|
||||||
|
|
||||||
// App 应用信息
|
// App 应用信息
|
||||||
var App AppInfo
|
var App AppInfo
|
||||||
|
|
||||||
|
|
@ -9,7 +11,7 @@ type AppInfo struct {
|
||||||
Short string `json:"short,omitempty"`
|
Short string `json:"short,omitempty"`
|
||||||
Version string `json:"version,omitempty"`
|
Version string `json:"version,omitempty"`
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
Icons map[string]string `json:"icons,omitempty"`
|
Icons maps.MapStrSync `json:"icons,omitempty"`
|
||||||
Storage AppStorage `json:"storage,omitempty"`
|
Storage AppStorage `json:"storage,omitempty"`
|
||||||
Option map[string]interface{} `json:"option,omitempty"`
|
Option map[string]interface{} `json:"option,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue