webui.go 467 Bytes
Newer Older
Brian Tiger Chow's avatar
Brian Tiger Chow committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
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)
}