Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corehttp: allow all webui paths we published. #751

Merged
merged 1 commit into from
Feb 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,13 @@ func daemonFunc(req cmds.Request, res cmds.Response) {

blocklist := &corehttp.BlockList{}
blocklist.SetDecider(func(s string) bool {
// only allow paths that begin with the WebUI path
return strings.HasPrefix(s, corehttp.WebUIPath)
// for now, only allow paths in the WebUI path
for _, webuipath := range corehttp.WebUIPaths {
if strings.HasPrefix(s, webuipath) {
return true
}
}
return false
})
gatewayConfig := corehttp.GatewayConfig{
Writable: true,
Expand Down
6 changes: 6 additions & 0 deletions core/corehttp/webui.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ package corehttp
// TODO: move to IPNS
const WebUIPath = "/ipfs/QmSHDxWsMPuJQKWmVA1rB5a3NX2Eme5fPqNb63qwaqiqSp"

// this is a list of all past webUI paths.
var WebUIPaths = []string{
WebUIPath,
"/ipfs/QmctngrQAt9fjpQUZr7Bx3BsXUcif52eZGTizWhvcShsjz",
}

var WebUIOption = RedirectOption("webui", WebUIPath)