Skip to content

Commit

Permalink
Merge branch 'master' into feat/7791
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Nov 30, 2021
2 parents 23c028b + 4fb4c2d commit 81aeec2
Show file tree
Hide file tree
Showing 90 changed files with 2,160 additions and 990 deletions.
36 changes: 30 additions & 6 deletions .circleci/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ executors:
environment:
<<: *default_environment
NO_SANDBOX: true
IPFS_REUSEPORT: false
LIBP2P_TCP_REUSEPORT: false
LIBP2P_ALLOW_WEAK_RSA_KEYS: 1
E2E_IPFSD_TYPE: go
dockerizer:
Expand Down Expand Up @@ -106,10 +106,21 @@ jobs:
command: bash <(curl -s https://codecov.io/bash) -cF unittests -X search -f coverage/unit_tests.coverprofile
- run:
command: |
current=$(git rev-parse HEAD)
go get github.com/ipfs/go-ipfs@$current
# we want to test the examples against the current version of go-ipfs
# however, that version might be in a fork so we need to replace the dependency
# backup the go.mod and go.sum files to restore them after we run the tests
cp go.mod go.mod.bak
cp go.sum go.sum.bak
# make sure the examples run against the current version of go-ipfs
go mod edit -replace github.com/ipfs/go-ipfs=./../../..
go mod tidy
go test -v ./...
# restore the go.mod and go.sum files to their original state
mv go.mod.bak go.mod
mv go.sum.bak go.sum
working_directory: ~/ipfs/go-ipfs/docs/examples/go-ipfs-as-a-library

- run:
Expand Down Expand Up @@ -205,7 +216,8 @@ jobs:
- bin/ipfs
- *store_gomod
interop:
executor: node
docker:
- image: cimg/go:1.16-node
parallelism: 4
steps:
- *make_out_dirs
Expand All @@ -216,20 +228,32 @@ jobs:
command: |
npm init -y
npm install ipfs@^0.59.1
npm install ipfs-interop@^7.0.3
npm install ipfs/interop#master
npm install mocha-circleci-reporter@0.0.3
working_directory: ~/ipfs/go-ipfs/interop
- run:
name: Running tests
command: |
WORKDIR=$(pwd)
cd /tmp
git clone https://github.com/ipfs/js-ipfs.git
cd js-ipfs
git checkout 1dcac76f56972fc3519526e93567e39d685033dd
npm install
npm run build
npm run link
cd $WORKDIR
mkdir -p /tmp/test-results/interop/
export MOCHA_FILE="$(mktemp /tmp/test-results/interop/unit.XXXXXX.xml)"
npx ipfs-interop -- -t node -f $(sed -n -e "s|^require('\(.*\)')$|test/\1|p" node_modules/ipfs-interop/test/node.js | circleci tests split) -- --reporter mocha-circleci-reporter
working_directory: ~/ipfs/go-ipfs/interop
environment:
IPFS_REUSEPORT: false
LIBP2P_TCP_REUSEPORT: false
LIBP2P_ALLOW_WEAK_RSA_KEYS: 1
IPFS_GO_EXEC: /tmp/circleci-workspace/bin/ipfs
IPFS_JS_EXEC: /tmp/js-ipfs/packages/ipfs/src/cli.js
IPFS_JS_MODULE: /tmp/js-ipfs/packages/ipfs/dist/cjs/src/index.js
IPFS_JS_HTTP_MODULE: /tmp/js-ipfs/packages/ipfs-http-client/dist/cjs/src/index.js
- store_test_results:
path: /tmp/test-results
go-ipfs-api:
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For more info see: https://docs.ipfs.io/introduction/overview/

Before opening an issue, consider using one of the following locations to ensure you are opening your thread in the right place:
- go-ipfs _implementation_ bugs in [this repo](https://github.com/ipfs/go-ipfs/issues).
- Documentation issues in [ipfs/docs issues](https://github.com/ipfs/docs/issues).
- Documentation issues in [ipfs/docs issues](https://github.com/ipfs/ipfs-docs/issues).
- IPFS _design_ in [ipfs/specs issues](https://github.com/ipfs/specs/issues).
- Exploration of new ideas in [ipfs/notes issues](https://github.com/ipfs/notes/issues).
- Ask questions and meet the rest of the community at the [IPFS Forum](https://discuss.ipfs.io).
Expand Down
2 changes: 1 addition & 1 deletion Rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ include mk/golang.mk
ifeq ($(TEST_NO_FUSE),1)
GOTAGS += nofuse
endif
export IPFS_REUSEPORT=false
export LIBP2P_TCP_REUSEPORT=false

# -------------------- #
# sub-files #
Expand Down
37 changes: 2 additions & 35 deletions assets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This directory contains the go-ipfs assets:

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

These assets are compiled into `bindata.go` with `go generate`.

Expand All @@ -16,37 +16,4 @@ assets directory:

```
go generate .
```

## Updating dir-index-html

Upstream: https://github.com/ipfs/dir-index-html

dir-index-html is a git submodule. To update, run the following commands from
this directory.

```bash
> git -C dir-index-html pull
> git -C dir-index-html checkout vX.Y.Z # target version
```

Then, you'll need to commit the updated submodule _before_ regenerating
`bindata.go`. Otherwise, `go generate` will checkout the checked-in version of
dir-index-html.

```bash
> git add dir-index-html
> git commit -m 'chore: update dir-index-html to vX.Y.Z'
```

Finally, re-generate the directory index HTML template, tidy, and amend the previous
commit.

```bash
> go generate .
> git add bindata.go
> git add bindata_version_hash.go
> go mod tidy
> git commit --amend --no-edit

```
```
2 changes: 1 addition & 1 deletion assets/assets.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:generate git submodule update --init ./dir-index-html
//go:generate npm run build --prefix ./dir-index-html/
//go:generate go run github.com/go-bindata/go-bindata/v3/go-bindata -mode=0644 -modtime=1403768328 -pkg=assets init-doc dir-index-html/dir-index.html dir-index-html/knownIcons.txt
//go:generate gofmt -s -w bindata.go
//go:generate sh -c "sed -i \"s/.*BindataVersionHash.*/BindataVersionHash=\\\"$(git hash-object bindata.go)\\\"/\" bindata_version_hash.go"
Expand Down
2 changes: 1 addition & 1 deletion assets/assets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func testOneFile(f string, t *testing.T) {
}

if !bytes.Equal(vcsData, embdData) {
t.Errorf("asset %s: vcs and embedded data isnt equal", f)
t.Errorf("asset %s: vcs and embedded data isn't equal", f)
return
}

Expand Down
1 change: 0 additions & 1 deletion assets/dir-index-html
Submodule dir-index-html deleted from 67e75c
26 changes: 26 additions & 0 deletions assets/dir-index-html/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# dir-index-html

> Directory listing HTML for `go-ipfs` gateways
![](https://user-images.githubusercontent.com/157609/88379209-ce6f0600-cda2-11ea-9620-20b9237bb441.png)

## Updating

When making updates to the directory listing page template, please note the following:

1. Make your changes to the (human-friendly) source documents in the `src` directory and run `npm run build`
3. Before testing or releasing, go to the top-level `./assets` directory and make sure to run the `go generate .` script to update the bindata version

## Testing

1. Make sure you have [Go](https://golang.org/dl/) installed
2. Start the test server, which lives in its own directory:

```bash
> cd test
> go run .
```
This will listen on [`localhost:3000`](http://localhost:3000/) and reload the template every time you refresh the page.

If you get a "no such file or directory" error upon trying `go run .`, make sure you ran `npm run build` to generate the minified artifact that the test is looking for.

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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/dir-index-html/index.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package dirindexhtml
65 changes: 65 additions & 0 deletions assets/dir-index-html/knownIcons.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.aac
.aiff
.ai
.avi
.bmp
.c
.cpp
.css
.dat
.dmg
.doc
.dotx
.dwg
.dxf
.eps
.exe
.flv
.gif
.h
.hpp
.html
.ics
.iso
.java
.jpg
.jpeg
.js
.key
.less
.mid
.mkv
.mov
.mp3
.mp4
.mpg
.odf
.ods
.odt
.otp
.ots
.ott
.pdf
.php
.png
.ppt
.psd
.py
.qt
.rar
.rb
.rtf
.sass
.scss
.sql
.tga
.tgz
.tiff
.txt
.wav
.wmv
.xls
.xlsx
.xml
.yml
.zip
17 changes: 17 additions & 0 deletions assets/dir-index-html/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "dir-index-html",
"description": "Directory listing HTML for go-ipfs gateways",
"version": "1.3.0",
"private": true,
"homepage": "https://github.com/ipfs/go-ipfs",
"license": "MIT",
"scripts": {
"start": "cd test && go run .",
"build": "npm run build:clean && npm run build:remove-style-links && npm run build:minify-wrap-css && npm run build:combine-html-css && npm run build:remove-unused",
"build:clean": "rm dir-index.html",
"build:remove-style-links": "sed '/<link rel=\"stylesheet\"/d' ./src/dir-index.html > ./base-html.html",
"build:minify-wrap-css": "(echo \"<style>\" && cat ./src/icons.css ./src/style.css | tr -d \"\t\n\r\" && echo && echo \"</style>\") > ./minified-wrapped-style.html",
"build:combine-html-css": "sed '/<\\/title>/ r ./minified-wrapped-style.html' ./base-html.html > ./dir-index.html",
"build:remove-unused": "rm ./base-html.html && rm ./minified-wrapped-style.html"
}
}
96 changes: 96 additions & 0 deletions assets/dir-index-html/src/dir-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<!DOCTYPE html>
{{ $root := . }}
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="description" content="A directory of files hosted on the distributed, decentralized web using IPFS">
<meta property="og:title" content="Files on IPFS">
<meta property="og:description" content="{{ .Path }}">
<meta property="og:type" content="website">
<meta property="og:image" content="https://gateway.ipfs.io/ipfs/QmSDeYAe9mga6NdTozAZuyGL3Q1XjsLtvX28XFxJH8oPjq">
<meta name="twitter:title" content="{{ .Path }}">
<meta name="twitter:description" content="A directory of files hosted on the distributed, decentralized web using IPFS">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://gateway.ipfs.io/ipfs/QmSDeYAe9mga6NdTozAZuyGL3Q1XjsLtvX28XFxJH8oPjq">
<meta name="twitter:creator" content="@ipfs">
<meta name="twitter:site" content="@ipfs">
<meta name="image" content="https://gateway.ipfs.io/ipfs/QmSDeYAe9mga6NdTozAZuyGL3Q1XjsLtvX28XFxJH8oPjq">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAI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wAAAAAAAAAAAAAAAKKeRv+3slb/0cpq/9HKav/Rymr/0cpq/9HKav/Rymr/0cpq/9HKav+1sFX/op5G/wAAAAAAAAAAAAAAAAAAAAAAAAAAop5GUKKeRv/Nxmf/0cpq/9HKav/Rymr/0cpq/83GZ/+inkb/op5GSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAop5G16KeRv/LxWb/y8Vm/6KeRv+inkaPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAop5G/6KeRtcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/n8AAPgfAADwDwAAwAMAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAwAMAAPAPAAD4HwAA/n8AAA==" />
<link rel="stylesheet" href="style.css"/>
<link rel="stylesheet" href="icons.css">
<title>{{ .Path }}</title>
</head>
<body>
<div id="page-header">
<div id="page-header-logo" class="ipfs-logo">&nbsp;</div>
<div id="page-header-menu">
<div class="menu-item-wide"><a href="https://ipfs.io" target="_blank" rel="noopener noreferrer">About IPFS</a></div>
<div class="menu-item-wide"><a href="https://ipfs.io#install" target="_blank" rel="noopener noreferrer">Install IPFS</a></div>
<div class="menu-item-narrow"><a href="https://ipfs.io" target="_blank" rel="noopener noreferrer">About</a></div>
<div class="menu-item-narrow"><a href="https://ipfs.io#install" target="_blank" rel="noopener noreferrer">Install</a></div>
<div>
<a href="https://github.com/ipfs/dir-index-html/issues/" target="_blank" rel="noopener noreferrer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18.4 21"><circle cx="7.5" cy="4.8" r="1"/><circle cx="11.1" cy="4.8" r="1"/><path d="M12.7 8.4c-0.5-1.5-1.9-2.5-3.5-2.5 -1.6 0-3 1-3.5 2.5H12.7z"/><path d="M8.5 9.7H5c-0.5 0.8-0.7 1.7-0.7 2.7 0 2.6 1.8 4.8 4.2 5.2V9.7z"/><path d="M13.4 9.7H9.9v7.9c2.4-0.4 4.2-2.5 4.2-5.2C14.1 11.4 13.9 10.5 13.4 9.7z"/><circle cx="15.7" cy="12.9" r="1"/><circle cx="15.1" cy="15.4" r="1"/><circle cx="15.3" cy="10.4" r="1"/><circle cx="2.7" cy="12.9" r="1"/><circle cx="3.3" cy="15.4" r="1"/><circle cx="3.1" cy="10.4" r="1"/></svg>
</a>
</div>
</div>
</div>
<div id="content">
<div id="content-header" class="d-flex flex-wrap">
<div>
<strong>
Index of
{{ range .Breadcrumbs -}}
/{{ if .Path }}<a href="{{ $root.GatewayURL }}{{ .Path | urlEscape }}">{{ .Name }}</a>{{ else }}{{ .Name }}{{ end }}
{{- else }}
{{ .Path }}
{{ end }}
</strong>
{{ if .Hash }}
<div class="ipfs-hash" translate="no">
{{ .Hash }}
</div>
{{ end }}
</div>
{{ if .Size }}
<div class="no-linebreak flex-shrink-1 ml-auto">
<strong>&nbsp;{{ .Size }}</strong>
</div>
{{ end }}
</div>
<div class="table-responsive">
<table>
<tr>
<td class="type-icon">
<div class="ipfs-_blank">&nbsp;</div>
</td>
<td>
<a href="{{.BackLink | urlEscape}}">..</a>
</td>
<td></td>
<td></td>
</tr>
{{ range .Listing }}
<tr>
<td class="type-icon">
<div class="{{iconFromExt .Name}}">&nbsp;</div>
</td>
<td>
<a href="{{ .Path | urlEscape }}">{{ .Name }}</a>
</td>
<td class="no-linebreak">
{{ if .Hash }}
<a class="ipfs-hash" translate="no" href={{ if $root.DNSLink }}"https://cid.ipfs.io/#{{ .Hash | urlEscape}}" target="_blank" rel="noreferrer noopener"{{ else }}"{{ $root.GatewayURL }}/ipfs/{{ .Hash | urlEscape}}?filename={{ .Name | urlEscape }}"{{ end }}>
{{ .ShortHash }}
</a>
{{ end }}
</td>
<td class="no-linebreak">{{ .Size }}</td>
</tr>
{{ end }}
</table>
</div>
</div>
</body>
</html>
Loading

0 comments on commit 81aeec2

Please sign in to comment.