mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-14 04:28:49 +00:00
Closes #754 This implementation is flawed, it's making the pass-challenge route return 404s. I'm not entirely sure why this is happening, but I'm pushing this for now in case there's some low hanging fruit. Signed-off-by: Xe Iaso <me@xeiaso.net>
40 lines
892 B
Go
40 lines
892 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"
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
var (
|
|
//go:embed *.css static
|
|
Static embed.FS
|
|
|
|
URL = "/.within.website/x/xess/xess.css"
|
|
)
|
|
|
|
func init() {
|
|
//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(r *mux.Router) {
|
|
prefix := anubis.BasePrefix + "/.within.website/x/xess/"
|
|
|
|
r.PathPrefix(prefix).
|
|
Handler(internal.UnchangingCache(http.StripPrefix(prefix, http.FileServerFS(Static)))).
|
|
Name("xess")
|
|
}
|