Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
0c8a0975
Commit
0c8a0975
authored
9 years ago
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1221 from ipfs/unrestricted-api-access
Add option to allow unrestricted API access
parents
08ea56ce
30f674af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
cmd/ipfs/daemon.go
cmd/ipfs/daemon.go
+6
-0
No files found.
cmd/ipfs/daemon.go
View file @
0c8a0975
...
...
@@ -28,6 +28,7 @@ const (
writableKwd
=
"writable"
ipfsMountKwd
=
"mount-ipfs"
ipnsMountKwd
=
"mount-ipns"
unrestrictedApiAccess
=
"unrestricted-api"
// apiAddrKwd = "address-api"
// swarmAddrKwd = "address-swarm"
)
...
...
@@ -71,6 +72,7 @@ the port as you would other services or database (firewall, authenticated proxy,
cmds
.
BoolOption
(
writableKwd
,
"Enable writing objects (with POST, PUT and DELETE)"
),
cmds
.
StringOption
(
ipfsMountKwd
,
"Path to the mountpoint for IPFS (if using --mount)"
),
cmds
.
StringOption
(
ipnsMountKwd
,
"Path to the mountpoint for IPNS (if using --mount)"
),
cmds
.
BoolOption
(
unrestrictedApiAccess
,
"Allow API access to unlisted hashes"
),
// TODO: add way to override addresses. tricky part: updating the config if also --init.
// cmds.StringOption(apiAddrKwd, "Address for the daemon rpc API (overrides config)"),
...
...
@@ -281,6 +283,10 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
Writable
:
true
,
BlockList
:
&
corehttp
.
BlockList
{
Decider
:
func
(
s
string
)
bool
{
unrestricted
,
_
,
_
:=
req
.
Option
(
unrestrictedApiAccess
)
.
Bool
()
if
unrestricted
{
return
true
}
// for now, only allow paths in the WebUI path
for
_
,
webuipath
:=
range
corehttp
.
WebUIPaths
{
if
strings
.
HasPrefix
(
s
,
webuipath
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment