feat: build with no embedded front-end files

This commit is contained in:
Hintay 2025-02-04 01:10:29 +09:00
parent b090564a34
commit a560d98acf
No known key found for this signature in database
GPG key ID: 120FC7FF121F2F2D
10 changed files with 91 additions and 35 deletions

View file

@ -0,0 +1,29 @@
//go:build !unembed
package middleware
import (
"io/fs"
"net/http"
"path"
"github.com/0xJacky/Nginx-UI/app"
"github.com/gin-contrib/static"
"github.com/uozi-tech/cosy/logger"
)
func MustFs(dir string) (serverFileSystem static.ServeFileSystem) {
sub, err := fs.Sub(app.DistFS, path.Join("dist", dir))
if err != nil {
logger.Error(err)
return
}
serverFileSystem = ServerFileSystemType{
http.FS(sub),
}
return
}