提交 94c64c57 作者: Juan Batiz-Benet

Merge pull request #751 from jbenet/fix-webui-history

corehttp: allow all webui paths we published.
...@@ -195,8 +195,13 @@ func daemonFunc(req cmds.Request, res cmds.Response) { ...@@ -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,
......
...@@ -3,4 +3,10 @@ package corehttp ...@@ -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)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论