28 lines
384 B
Go
28 lines
384 B
Go
|
package root
|
||
|
|
||
|
import (
|
||
|
"embed"
|
||
|
"io/fs"
|
||
|
"net/http"
|
||
|
|
||
|
"go.sour.is/pkg/lg"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
//go:embed assets/*
|
||
|
files embed.FS
|
||
|
)
|
||
|
|
||
|
type root struct{}
|
||
|
|
||
|
func New() *root {
|
||
|
return &root{}
|
||
|
}
|
||
|
|
||
|
func (s *root) RegisterHTTP(mux *http.ServeMux) {
|
||
|
a, _ := fs.Sub(files, "assets")
|
||
|
assets := http.StripPrefix("/", http.FileServer(http.FS(a)))
|
||
|
|
||
|
mux.Handle("/", lg.Htrace(assets, "mailadm-assets"))
|
||
|
}
|