-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: superhot support for w3s.link read #165
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a couple of minor nits
!env.GATEWAY_DOMAINS.filter((gwDomain) => urlString.includes(gwDomain)) | ||
.length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!env.GATEWAY_DOMAINS.filter((gwDomain) => urlString.includes(gwDomain)) | |
.length | |
!env.GATEWAY_DOMAINS.includes(new URL(urlString).hostname) |
...for the reason that the user could put w3s.link
in the pathname otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const a = new URL('http://bafkreidyeivj7adnnac6ljvzj2e3rd5xdw3revw4da7mx2ckrstapoupoq.ipfs.localhost:9081')
a.hostname
'bafkreidyeivj7adnnac6ljvzj2e3rd5xdw3revw4da7mx2ckrstapoupoq.ipfs.localhost'
URLs are tricky, we can't go the way suggested here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just url.host
and .endsWith
instead? I think it's better to use the domain if we can!
Deploying with Cloudflare Pages
|
Co-authored-by: Alan Shaw <alan.shaw@protocol.ai>
9afff9c
to
22052e6
Compare
This PR adds support for superhot reads in w3s.link - we still need to look into moving this API into a common context instead of tied with nftstorage.link (not included in current initiative scope)
w3s.link should be able to read from SuperHot perma-cache and also share same content in R2 regardless of domain used for perma-cache. It currently gets 400 error due to not being a valid domain to get. This PR changes that by allowing reads from either nftstorage.link or w3s.link (array in ENV variable).
Moreover, I took decision here to modify normalized URLs to just be w3s.link all the time (converted from nftstorage.link when those are provided). Main reason for this is our current direction of Web3.storage platform and nft.storage being part of the stack.