基本信息
IPFS 版本:v0.4.23
WebUI 版本: v2.7.2
服务端设置
WebUI 使用独立仓库管理,最新版直接发布到 IPFS 网络上,在IPFS实现代码中引用相应CID,如在 go-ipfs 中的webui.go所示。
// serveHTTPApi collects options, creates listener, prints status message and starts serving requests
func serveHTTPApi(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, error) {
...
// 定义处理 /ipfs/<cid> 请求
// corehttp.WebUIPaths 包含webui的历史版本
gatewayOpt := corehttp.GatewayOption(false, corehttp.WebUIPaths...)
if unrestricted {
gatewayOpt = corehttp.GatewayOption(true, "/ipfs", "/ipns")
}
var opts = []corehttp.ServeOption{
...
// 访问 <host>:5001/webui 重定向到最新的webui版本
corehttp.WebUIOption,
gatewayOpt,
...
}
...
IPFS Web UI
WebUI基于React实现,使用 js-ipfs-http-client 与后端节点交互。
WebUI 使用 Redux Bundler 管理 Redux 状态数据。
IPFS API初始化
...
import ipfsBundle from 'ipfs-redux-bundle'
...
export default composeBundles(
...
// ipfs api bundle
ipfsBundle({
tryWindow: false,
ipfsConnectionTest: async (ipfs) => {
// ipfs connection is working if can we fetch the bw stats.
// See: https://github.com/ipfs-shipyard/ipfs-webui/issues/835#issuecomment-466966884
try {
await ipfs.stats.bw()
} catch
167




被折叠的 条评论
为什么被折叠?



