1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 22:49:13 +08:00

corehttp: allow all webui paths we published.

Otherwise we break users links! cc @mappum
This commit is contained in:
Juan Batiz-Benet
2015-02-06 07:30:42 -08:00
parent 28079bdc26
commit 64a4c27913
2 changed files with 13 additions and 2 deletions

View File

@ -195,8 +195,13 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
blocklist := &corehttp.BlockList{} blocklist := &corehttp.BlockList{}
blocklist.SetDecider(func(s string) bool { blocklist.SetDecider(func(s string) bool {
// only allow paths that begin with the WebUI path // for now, only allow paths in the WebUI path
return strings.HasPrefix(s, corehttp.WebUIPath) for _, webuipath := range corehttp.WebUIPaths {
if strings.HasPrefix(s, webuipath) {
return true
}
}
return false
}) })
gatewayConfig := corehttp.GatewayConfig{ gatewayConfig := corehttp.GatewayConfig{
Writable: true, Writable: true,

View File

@ -3,4 +3,10 @@ package corehttp
// TODO: move to IPNS // TODO: move to IPNS
const WebUIPath = "/ipfs/QmSHDxWsMPuJQKWmVA1rB5a3NX2Eme5fPqNb63qwaqiqSp" const WebUIPath = "/ipfs/QmSHDxWsMPuJQKWmVA1rB5a3NX2Eme5fPqNb63qwaqiqSp"
// this is a list of all past webUI paths.
var WebUIPaths = []string{
WebUIPath,
"/ipfs/QmctngrQAt9fjpQUZr7Bx3BsXUcif52eZGTizWhvcShsjz",
}
var WebUIOption = RedirectOption("webui", WebUIPath) var WebUIOption = RedirectOption("webui", WebUIPath)