* fix(core/gateway): option to limit directory size listing
* feat(gw): HTMLDirListingLimit
This is alternative take on the way we limit the HTML listing output.
Instead of a hard cut-off, we list up to HTMLDirListingLimit.
When a directory has more items than HTMLDirListingLimit we show
additional header and footer informing user that only $HTMLDirListingLimit
items are listed. This is a better UX.
* fix: 0 disables Gateway.HTMLDirListingLimit
* refactor: Gateway.FastDirIndexThreshold
see explainer in docs/config.md
* refactor: prealoc slices
* docs: Gateway.FastDirIndexThreshold
* refactor: core/corehttp/gateway_handler.go
https://github.com/ipfs/go-ipfs/pull/8853#discussion_r851437088
* docs: apply suggestions from code review
Co-authored-by: Alan Shaw <alan.shaw@protocol.ai>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Alan Shaw <alan.shaw@protocol.ai>
Since go1.16, there are built in tools that allow for embeding
filesystem inside the binary. We now make use of the `embed` package to
have all files put into the binary, removing the need to generate the
files and removes dependencies
Co-authored-by: Jorropo <jorropo.pgm@gmail.com>
This "simplify" flag mainly removes redundant types in expressions.
Not particularly important, but a nice change that also makes gopls not
show warnings.
While the content of raw files retrieved via the gateway should never
change, the look and feel of the directory index can and will change
between versions of go-ipfs.
Incorporate the hash of assets/bindata.go into the ETag when appropriate
1. Use a submodule for dir-index-html. This isn't a go dependency and treating
it like one is more trouble than it's worth. We don't actually need to
checkout the submodule unless we need to regenerate the assets.
2. Avoid a runtime dependency on dir-index-html (may shave a few bytes off the
final binary?).
3. Remove unused code.
4. Avoid bundling unused files.
5. Switch to a maintained version of go-bindata.
6. Use go mod to manage go-bindata.