初始化仓库
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
//go:build !no_web
|
||||
|
||||
package web
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"log/slog"
|
||||
|
||||
"github.com/chenhg5/cc-connect/core"
|
||||
)
|
||||
|
||||
//go:embed all:dist
|
||||
var distFS embed.FS
|
||||
|
||||
func init() {
|
||||
sub, err := fs.Sub(distFS, "dist")
|
||||
if err != nil {
|
||||
slog.Warn("web: embedded dist directory unavailable; web admin disabled", "error", err)
|
||||
return
|
||||
}
|
||||
if _, err := fs.Stat(sub, "index.html"); err != nil {
|
||||
slog.Warn("web: embedded dist assets missing index.html; web admin disabled", "error", err)
|
||||
return
|
||||
}
|
||||
core.RegisterWebAssets(sub)
|
||||
}
|
||||
Reference in New Issue
Block a user