mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-27 07:57:30 +08:00
Merge pull request #1583 from rht/feat/read-only-api-gateway
Readonly gateway API fix
This commit is contained in:
@ -109,6 +109,14 @@ var rootSubcommands = map[string]*cmds.Command{
|
|||||||
"version": VersionCmd,
|
"version": VersionCmd,
|
||||||
"bitswap": BitswapCmd,
|
"bitswap": BitswapCmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RootRO is the readonly version of Root
|
||||||
|
var RootRO = &cmds.Command{}
|
||||||
|
|
||||||
|
var CommandsDaemonROCmd = CommandsCmd(RootRO)
|
||||||
|
|
||||||
|
var RefsROCmd = &cmds.Command{}
|
||||||
|
|
||||||
var rootROSubcommands = map[string]*cmds.Command{
|
var rootROSubcommands = map[string]*cmds.Command{
|
||||||
"block": &cmds.Command{
|
"block": &cmds.Command{
|
||||||
Subcommands: map[string]*cmds.Command{
|
Subcommands: map[string]*cmds.Command{
|
||||||
@ -117,7 +125,7 @@ var rootROSubcommands = map[string]*cmds.Command{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"cat": CatCmd,
|
"cat": CatCmd,
|
||||||
"commands": CommandsDaemonCmd,
|
"commands": CommandsDaemonROCmd,
|
||||||
"ls": LsCmd,
|
"ls": LsCmd,
|
||||||
"name": &cmds.Command{
|
"name": &cmds.Command{
|
||||||
Subcommands: map[string]*cmds.Command{
|
Subcommands: map[string]*cmds.Command{
|
||||||
@ -132,14 +140,17 @@ var rootROSubcommands = map[string]*cmds.Command{
|
|||||||
"stat": objectStatCmd,
|
"stat": objectStatCmd,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"refs": RefsCmd,
|
"refs": RefsROCmd,
|
||||||
//"resolve": ResolveCmd,
|
//"resolve": ResolveCmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
var RootRO = &cmds.Command{}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
*RootRO = *Root
|
*RootRO = *Root
|
||||||
|
|
||||||
|
// sanitize readonly refs command
|
||||||
|
*RefsROCmd = *RefsCmd
|
||||||
|
RefsROCmd.Subcommands = map[string]*cmds.Command{}
|
||||||
|
|
||||||
Root.Subcommands = rootSubcommands
|
Root.Subcommands = rootSubcommands
|
||||||
RootRO.Subcommands = rootROSubcommands
|
RootRO.Subcommands = rootROSubcommands
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user