mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-14 04:28:49 +00:00
This is a breaking change because it makes Anubis rely on Go 1.25 ahead of #1525. I think that the change is worth it, but Fedora et.al updates slowly and I really don't want to rock the boat. One of the main reasons to do this is that this enables the ability to build Anubis on Windows (#1304). Signed-off-by: Xe Iaso <me@xeiaso.net>
42 lines
959 B
Go
42 lines
959 B
Go
// Package xess vendors a copy of Xess and makes it available at /.xess/xess.css
|
|
//
|
|
// This is intended to be used as a vendored package in other projects.
|
|
package xess
|
|
|
|
import (
|
|
"embed"
|
|
"net/http"
|
|
"path/filepath"
|
|
|
|
"github.com/TecharoHQ/anubis"
|
|
"github.com/TecharoHQ/anubis/internal"
|
|
)
|
|
|
|
//go:generate go tool gosh ./build.sh
|
|
|
|
var (
|
|
//go:embed *.css static
|
|
Static embed.FS
|
|
|
|
BasePrefix = "/.within.website/x/xess/"
|
|
URL = "/.within.website/x/xess/xess.css"
|
|
)
|
|
|
|
func init() {
|
|
Mount(http.DefaultServeMux)
|
|
|
|
//goland:noinspection GoBoolExpressions
|
|
if anubis.Version != "devel" {
|
|
URL = filepath.Join(filepath.Dir(URL), "xess.min.css")
|
|
}
|
|
|
|
URL = URL + "?cachebuster=" + anubis.Version
|
|
}
|
|
|
|
// Mount registers the xess static file handlers on the given mux
|
|
func Mount(mux *http.ServeMux) {
|
|
prefix := anubis.BasePrefix + "/.within.website/x/xess/"
|
|
|
|
mux.Handle(prefix, internal.UnchangingCache(http.StripPrefix(prefix, http.FileServerFS(Static))))
|
|
}
|