// Unpin the current node repo, re-add it, then publish to ipns func (n *OpenBazaarNode) SeedNode() error { if err := ipfs.UnPinDir(n.Context, n.RootHash); err != nil { return err } hash, aerr := ipfs.AddDirectory(n.Context, path.Join(n.RepoPath, "root")) if aerr != nil { return aerr } _, perr := ipfs.Publish(n.Context, hash) if perr != nil { return perr } n.RootHash = hash return nil }
func newRestAPIHandler(node *core.OpenBazaarNode) (*restAPIHandler, error) { // Add the current node directory in case it's note already added. dirHash, aerr := ipfs.AddDirectory(node.Context, path.Join(node.RepoPath, "root")) if aerr != nil { log.Error(aerr) return nil, aerr } node.RootHash = dirHash prefixes := []string{"/ob/", "/wallet/"} i := &restAPIHandler{ config: RestAPIConfig{ Writable: true, BlockList: &corehttp.BlockList{}, PathPrefixes: prefixes, }, node: node, } return i, nil }