0d6c8c7989
CI / test (push) Failing after 13m11s
This is the complete fix for the missing /admin/ route and frontend serving: Backend: - internal/web/web.go: new package with go:embed for web/dist/ - internal/api/router.go: add routes for /admin/, /admin/*, /assets/* - internal/db/db.go: fix SQLite DSN parsing (sqlite:///path -> path) Build system: - Makefile: new 'embed-prep' target copies web/dist to internal/web/dist - make build now runs embed-prep -> frontend/build automatically Deployment: - deploy/llamalink.service: remove invalid --host/--port flags, add EnvironmentFile=/etc/llamalink/env Verified: - /health returns 200 - /admin/ serves Vue SPA HTML - /assets/* serves CSS and JS files from embedded FS - sqlite:///./llamalink.db works correctly
26 lines
410 B
Go
26 lines
410 B
Go
package web
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
"net/http"
|
|
"path"
|
|
)
|
|
|
|
//go:embed all:dist
|
|
var distFS embed.FS
|
|
|
|
func FileSystem() http.FileSystem {
|
|
sub, _ := fs.Sub(distFS, "dist")
|
|
return http.FS(sub)
|
|
}
|
|
|
|
func Index() ([]byte, error) {
|
|
return distFS.ReadFile("dist/index.html")
|
|
}
|
|
|
|
func ServeAsset(filepath string) ([]byte, error) {
|
|
fullPath := path.Join("dist/assets", filepath)
|
|
return distFS.ReadFile(fullPath)
|
|
}
|