mirror of
https://github.com/TecharoHQ/anubis.git
synced 2025-09-07 19:54:56 -04:00
fix(lib): try to make base path prefixing work again
Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
2ea8296682
commit
d6f02ac5f9
@ -67,14 +67,15 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
next http.Handler
|
next http.Handler
|
||||||
mux *http.ServeMux
|
mux *http.ServeMux
|
||||||
policy *policy.ParsedConfig
|
policy *policy.ParsedConfig
|
||||||
OGTags *ogtags.OGTagCache
|
OGTags *ogtags.OGTagCache
|
||||||
ed25519Priv ed25519.PrivateKey
|
ed25519Priv ed25519.PrivateKey
|
||||||
hs512Secret []byte
|
hs512Secret []byte
|
||||||
opts Options
|
opts Options
|
||||||
store store.Interface
|
store store.Interface
|
||||||
|
internalPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) getTokenKeyfunc() jwt.Keyfunc {
|
func (s *Server) getTokenKeyfunc() jwt.Keyfunc {
|
||||||
|
@ -101,13 +101,14 @@ func New(opts Options) (*Server, error) {
|
|||||||
anubis.BasePrefix = opts.BasePrefix
|
anubis.BasePrefix = opts.BasePrefix
|
||||||
|
|
||||||
result := &Server{
|
result := &Server{
|
||||||
next: opts.Next,
|
next: opts.Next,
|
||||||
ed25519Priv: opts.ED25519PrivateKey,
|
ed25519Priv: opts.ED25519PrivateKey,
|
||||||
hs512Secret: opts.HS512Secret,
|
hs512Secret: opts.HS512Secret,
|
||||||
policy: opts.Policy,
|
policy: opts.Policy,
|
||||||
opts: opts,
|
opts: opts,
|
||||||
OGTags: ogtags.NewOGTagCache(opts.Target, opts.Policy.OpenGraph, opts.Policy.Store),
|
OGTags: ogtags.NewOGTagCache(opts.Target, opts.Policy.OpenGraph, opts.Policy.Store),
|
||||||
store: opts.Policy.Store,
|
store: opts.Policy.Store,
|
||||||
|
internalPath: opts.BasePrefix + anubis.StaticPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
|
@ -200,7 +200,7 @@ func (s *Server) respondWithStatus(w http.ResponseWriter, r *http.Request, msg s
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
switch strings.HasPrefix(r.URL.Path, anubis.StaticPath) {
|
switch strings.HasPrefix(r.URL.Path, s.internalPath) {
|
||||||
case true:
|
case true:
|
||||||
s.mux.ServeHTTP(w, r)
|
s.mux.ServeHTTP(w, r)
|
||||||
case false:
|
case false:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user