提交 6c22bf8e 作者: Steven Allen

don't expose "version deps" on the gateway

TMI

License: MIT
Signed-off-by: 's avatarSteven Allen <steven@stebalien.com>
上级 b50b8f45
...@@ -160,6 +160,9 @@ var CommandsDaemonROCmd = CommandsCmd(RootRO) ...@@ -160,6 +160,9 @@ var CommandsDaemonROCmd = CommandsCmd(RootRO)
// RefsROCmd is `ipfs refs` command // RefsROCmd is `ipfs refs` command
var RefsROCmd = &cmds.Command{} var RefsROCmd = &cmds.Command{}
// VersionROCmd is `ipfs version` command (without deps).
var VersionROCmd = &cmds.Command{}
var rootROSubcommands = map[string]*cmds.Command{ var rootROSubcommands = map[string]*cmds.Command{
"commands": CommandsDaemonROCmd, "commands": CommandsDaemonROCmd,
"cat": CatCmd, "cat": CatCmd,
...@@ -192,24 +195,27 @@ var rootROSubcommands = map[string]*cmds.Command{ ...@@ -192,24 +195,27 @@ var rootROSubcommands = map[string]*cmds.Command{
}, },
}, },
"resolve": ResolveCmd, "resolve": ResolveCmd,
"version": VersionCmd,
} }
func init() { func init() {
Root.ProcessHelp() Root.ProcessHelp()
*RootRO = *Root *RootRO = *Root
// sanitize readonly refs command
*RefsROCmd = *RefsCmd
RefsROCmd.Subcommands = map[string]*cmds.Command{}
// this was in the big map definition above before, // this was in the big map definition above before,
// but if we leave it there lgc.NewCommand will be executed // but if we leave it there lgc.NewCommand will be executed
// before the value is updated (:/sanitize readonly refs command/) // before the value is updated (:/sanitize readonly refs command/)
// sanitize readonly refs command
*RefsROCmd = *RefsCmd
RefsROCmd.Subcommands = map[string]*cmds.Command{}
rootROSubcommands["refs"] = RefsROCmd rootROSubcommands["refs"] = RefsROCmd
Root.Subcommands = rootSubcommands // sanitize readonly version command (no need to expose precise deps)
*VersionROCmd = *VersionCmd
VersionROCmd.Subcommands = map[string]*cmds.Command{}
rootROSubcommands["version"] = VersionROCmd
Root.Subcommands = rootSubcommands
RootRO.Subcommands = rootROSubcommands RootRO.Subcommands = rootROSubcommands
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论