2022-03-17 00:33:59 +00:00
|
|
|
package ui
|
|
|
|
|
2023-04-19 03:01:32 +00:00
|
|
|
import (
|
|
|
|
"embed"
|
|
|
|
"io/fs"
|
|
|
|
"runtime"
|
|
|
|
)
|
2022-03-17 00:33:59 +00:00
|
|
|
|
|
|
|
//go:embed v2.5/build
|
2023-04-19 03:01:32 +00:00
|
|
|
var uiBox embed.FS
|
|
|
|
var UIBox fs.FS
|
2022-03-17 00:33:59 +00:00
|
|
|
|
|
|
|
//go:embed login
|
2023-04-19 03:01:32 +00:00
|
|
|
var loginUIBox embed.FS
|
|
|
|
var LoginUIBox fs.FS
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
var err error
|
|
|
|
UIBox, err = fs.Sub(uiBox, "v2.5/build")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
LoginUIBox, err = fs.Sub(loginUIBox, "login")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type faviconProvider struct{}
|
|
|
|
|
|
|
|
var FaviconProvider = faviconProvider{}
|
|
|
|
|
|
|
|
func (p *faviconProvider) GetFavicon() []byte {
|
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
ret, _ := fs.ReadFile(UIBox, "favicon.ico")
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
|
|
|
return p.GetFaviconPng()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *faviconProvider) GetFaviconPng() []byte {
|
|
|
|
ret, _ := fs.ReadFile(UIBox, "favicon.png")
|
|
|
|
return ret
|
|
|
|
}
|