Add projects

This commit is contained in:
Alois 2026-08-24 00:10:41 +02:00
commit 8b607dd700
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24
1802 changed files with 503346 additions and 2 deletions

View file

@ -0,0 +1,53 @@
package managementasset
import (
"io/fs"
"net/http"
"os"
"path/filepath"
"strings"
)
const (
IndexFile = "index.html"
ManagementFile = "management.html"
)
// Source describes the filesystem and entry file used for the management UI.
type Source struct {
FileSystem http.FileSystem
Entry string
}
// Current returns the configured management UI source.
func Current() (*Source, error) {
if override := strings.TrimSpace(os.Getenv("MANAGEMENT_STATIC_PATH")); override != "" {
cleaned := filepath.Clean(override)
info, err := os.Stat(cleaned)
if err != nil {
return nil, err
}
if !info.IsDir() {
return &Source{
FileSystem: http.Dir(filepath.Dir(cleaned)),
Entry: filepath.Base(cleaned),
}, nil
}
entry := IndexFile
if _, err = os.Stat(filepath.Join(cleaned, entry)); err != nil {
if !os.IsNotExist(err) {
return nil, err
}
entry = ManagementFile
}
return &Source{FileSystem: http.Dir(cleaned), Entry: entry}, nil
}
files := embeddedFiles()
if files == nil {
return nil, fs.ErrNotExist
}
return &Source{FileSystem: http.FS(files), Entry: IndexFile}, nil
}

View file

@ -0,0 +1,19 @@
//go:build frontend
package managementasset
import (
"embed"
"io/fs"
)
//go:embed dist
var frontendFiles embed.FS
func embeddedFiles() fs.FS {
files, err := fs.Sub(frontendFiles, "dist")
if err != nil {
return nil
}
return files
}

View file

@ -0,0 +1,9 @@
//go:build !frontend
package managementasset
import "io/fs"
func embeddedFiles() fs.FS {
return nil
}