kubo/assets/dir-index-html
Lucas Molas 25cc85fa93
feat(gateway): Gateway.FastDirIndexThreshold (#8853)
* 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>
2022-04-28 19:36:57 +02:00
..
src feat(gateway): Gateway.FastDirIndexThreshold (#8853) 2022-04-28 19:36:57 +02:00
test feat(gateway): Gateway.FastDirIndexThreshold (#8853) 2022-04-28 19:36:57 +02:00
dir-index.html feat(gateway): Gateway.FastDirIndexThreshold (#8853) 2022-04-28 19:36:57 +02:00
index.go removed dir-index-html submodule 2021-11-18 14:28:13 +08:00
knownIcons.txt removed dir-index-html submodule 2021-11-18 14:28:13 +08:00
package.json chore: cleanup after merging dir-index-html 2021-11-23 20:32:39 +01:00
README.md chore: cleanup after merging dir-index-html 2021-11-23 20:32:39 +01:00

dir-index-html

Directory listing HTML for go-ipfs gateways

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
  2. 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 installed
  2. Start the test server, which lives in its own directory:
> cd test
> go run .

This will listen on 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.