Skip to content

Commit

Permalink
refactor: use gateway from go-libipfs (#9588)
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias authored Jan 31, 2023
1 parent 6819d9a commit 8d3b315
Show file tree
Hide file tree
Showing 34 changed files with 20 additions and 3,972 deletions.
10 changes: 0 additions & 10 deletions assets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,3 @@
This directory contains the go-ipfs assets:

* Getting started documentation (`init-doc`).
* Directory listing HTML template (`dir-index-html`).

## Re-generating

Edit the source files and use `go generate` from within the
assets directory:

```
go generate .
```
36 changes: 1 addition & 35 deletions assets/assets.go
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
//go:generate npm run build --prefix ./dir-index-html/
package assets

import (
"embed"
"fmt"
"io"
"io/fs"
gopath "path"
"strconv"

"github.com/ipfs/kubo/core"
"github.com/ipfs/kubo/core/coreapi"

"github.com/cespare/xxhash"
cid "github.com/ipfs/go-cid"
"github.com/ipfs/go-libipfs/files"
options "github.com/ipfs/interface-go-ipfs-core/options"
"github.com/ipfs/interface-go-ipfs-core/path"
)

//go:embed init-doc dir-index-html/dir-index.html dir-index-html/knownIcons.txt
//go:embed init-doc
var Asset embed.FS

// AssetHash a non-cryptographic hash of all embedded assets
var AssetHash string

// initDocPaths lists the paths for the docs we want to seed during --init
var initDocPaths = []string{
gopath.Join("init-doc", "about"),
Expand All @@ -36,32 +28,6 @@ var initDocPaths = []string{
gopath.Join("init-doc", "ping"),
}

func init() {
sum := xxhash.New()
err := fs.WalkDir(Asset, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}

if d.IsDir() {
return nil
}

file, err := Asset.Open(path)
if err != nil {
return err
}
defer file.Close()
_, err = io.Copy(sum, file)
return err
})
if err != nil {
panic("error creating asset sum: " + err.Error())
}

AssetHash = strconv.FormatUint(sum.Sum64(), 32)
}

// SeedInitDocs adds the list of embedded init documentation to the passed node, pins it and returns the root key
func SeedInitDocs(nd *core.IpfsNode) (cid.Cid, error) {
return addAssetList(nd, initDocPaths)
Expand Down
3 changes: 0 additions & 3 deletions assets/dag-index-html/README.md

This file was deleted.

81 changes: 0 additions & 81 deletions assets/dag-index-html/index.go

This file was deleted.

26 changes: 0 additions & 26 deletions assets/dir-index-html/README.md

This file was deleted.

99 changes: 0 additions & 99 deletions assets/dir-index-html/dir-index.html

This file was deleted.

1 change: 0 additions & 1 deletion assets/dir-index-html/index.go

This file was deleted.

65 changes: 0 additions & 65 deletions assets/dir-index-html/knownIcons.txt

This file was deleted.

17 changes: 0 additions & 17 deletions assets/dir-index-html/package.json

This file was deleted.

98 changes: 0 additions & 98 deletions assets/dir-index-html/src/dir-index.html

This file was deleted.

Loading

0 comments on commit 8d3b315

Please sign in to comment.