This commit is contained in:
tao.chen
2026-08-27 12:58:48 +08:00
parent c8e4996c34
commit 7225b72906
10 changed files with 1092 additions and 923 deletions
+29
View File
@@ -0,0 +1,29 @@
package main
import (
"strings"
_ "embed"
)
// 嵌入式静态页面 (单文件部署, 把 HTML/CSS/JS 编译进二进制, 无需运行时外部文件)
//go:embed static/index.html.tpl
var indexTpl []byte
//go:embed static/app.css
var appCSS []byte
//go:embed static/app.js
var appJS []byte
// pageHTML is the assembled single-file deployment response.
// Computed once at startup; same bytes served on every GET /.
var pageHTML []byte
func init() {
s := string(indexTpl)
s = strings.Replace(s, "/*EMBED_CSS*/", string(appCSS), 1)
s = strings.Replace(s, "/*EMBED_JS*/", string(appJS), 1)
pageHTML = []byte(s)
}