37 lines
631 B
Go
37 lines
631 B
Go
//go:build !dev
|
|
|
|
package main
|
|
|
|
import (
|
|
_ "embed"
|
|
"encoding/base64"
|
|
"html/template"
|
|
"strings"
|
|
)
|
|
|
|
//go:embed ui/script.js
|
|
var scriptJs string
|
|
|
|
//go:embed ui/style.css
|
|
var styleCss string
|
|
|
|
//go:embed ui/favicon.svg
|
|
var faviconSvg []byte
|
|
|
|
//go:embed ui/ui.html
|
|
var uiTmpl string
|
|
|
|
var tmpl *template.Template
|
|
|
|
func init() {
|
|
t := strings.Replace(uiTmpl, "css_will_be_here", styleCss, 1)
|
|
t = strings.Replace(t, "js_will_be_here", scriptJs, 1)
|
|
t = strings.Replace(t, "favicon_will_be_here", base64.StdEncoding.EncodeToString(faviconSvg), 2)
|
|
|
|
var err error
|
|
tmpl, err = template.New("").Parse(t)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|