kubo/core/corehttp/webui.go
2015-01-22 01:28:40 -08:00

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)
}