Fix UI access in pc3
This commit is contained in:
parent
7e8da4da19
commit
a2ecc5cdb5
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user