Fix UI access in pc3

This commit is contained in:
0x1a8510f2 2022-10-15 07:54:20 +01:00
parent 7e8da4da19
commit a2ecc5cdb5
Signed by: 0x1a8510f2
GPG Key ID: 1C692E355D76775D
2 changed files with 6 additions and 5 deletions

View File

@ -17,7 +17,7 @@ import (
"git.0x1a8510f2.space/wraith-labs/wraith-module-pinecomms/internal/pmanager"
)
//go:embed ui/dist
//go:embed ui/dist/*
var ui embed.FS
const (
@ -95,15 +95,16 @@ func main() {
//
// Use pmanager non-pinecone webserver to host web UI and an API to communicate with it.
ui, err := fs.Sub(ui, "ui")
ui, err := fs.Sub(ui, "ui/dist")
if err != nil {
panic(err)
}
pm.SetWebserverHandlers(map[string]http.Handler{
"/": http.FileServer(http.FS(ui)),
"/api/": http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
"/X/": http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(418)
}),
"/": http.FileServer(http.FS(ui)),
})
// Start pinecone.

View File

@ -218,7 +218,7 @@ func (pm *manager) Start() {
// If additional handlers are configured for the webserver, add them.
for route, handler := range c.webserverHandlers {
httpRouter.Handle(route, handler)
httpRouter.PathPrefix(route).Handler(handler)
}
// Non-pinecone HTTP server.