mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 03:17:43 +08:00
26 lines
467 B
Go
26 lines
467 B
Go
package corehttp
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
core "github.com/jbenet/go-ipfs/core"
|
|
)
|
|
|
|
const (
|
|
// TODO rename
|
|
webuiPath = "/ipfs/QmTWvqK9dYvqjAMAcCeUun8b45Fwu7wPhEN9B9TsGbkXfJ"
|
|
)
|
|
|
|
func WebUIOption(n *core.IpfsNode, mux *http.ServeMux) error {
|
|
mux.Handle("/webui/", &redirectHandler{webuiPath})
|
|
return nil
|
|
}
|
|
|
|
type redirectHandler struct {
|
|
path string
|
|
}
|
|
|
|
func (i *redirectHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
http.Redirect(w, r, i.path, 302)
|
|
}
|