Open kallisti5 opened 2 years ago
This is a sensible request.
ipfs files stat --with-local
for every item. If it is too expensive, we could go with inexpensive check, perhaps ipfs dag stat --offline
? (error means DAG is not 100% local)seems fair. It would also help with the "pinned content visibility" issues found in other issues. It's a bit spread out, but would be a workaround for those.
Also, yeah.. it does sound potentially a bit expensive... so some care would be needed. If it was too expensive theoretically it could be used as an abuse mechanism (hammering a gateway for the availability of a complex recursive CID)
If i understand correctly this issue does not belong in this repository, the changes need to happen to:
I would love to take a look at it!
I am moving this issue to go-ipfs repo.
Caveat: generating static HTML is expensive, and we want to cache it for as long as possible, have per-release static Etag
for these dir listings, so showing this via rendered HTML is not feasible – these status indicators will get out of sync pretty fast due to older version being read from cache.
If you are interested in moving this forward I'd look at https://github.com/ipfs/go-ipfs/issues/8783 This JS check will remove the need for re-generating entire HTML all the time.
If we have it, then static HTML page for dir listing could do JS fetch
HEAD
request for the each dir child in the viewport by sending request for it (e.g. with Accept: application/vnd.ipfs.cache.local
content type).
This will work nicely with big directories – we should only fetch the state of visible items.
@lidel i have a couple of questions before i open a PR. You can see my changes here.
Listing.Path
from the template rather than picking it up from the DOM. If that is undesirable i can switch it.icons.css
do not have one that fit this case. I've put the letter R (from remote) just to demonstrate its functionality.@xrazis thank you for poking at this! Feel free to open a PR, we can continue there, but for now quick feedback here:
.Listing
from template is good.
<div>
is appended to the <td>
by JS, and not rendered by the HTML template for every item?
Is your feature request related to a problem? Please describe.
As a user of IPFS, it's difficult to visualize if files are cached on the gateway you're connected to vs if the files need to be retrieved from the network.
Describe the solution you'd like An indicator to show if a CID is cached on the current gateway.
Example (horrible) mock up:
The first three entries are cached on the gateway, the final one would require pulling from other IPFS nodes. Three indicators may be needed: