Skip to content
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

Redirect with subdomain resolution for IPFS hosting #85

Merged
merged 14 commits into from
Jan 29, 2024
Merged

Conversation

jubalm
Copy link

@jubalm jubalm commented Jan 27, 2024

Automatically redirects app when hosted on /ipfs/{hash} subpath to subdomain resolution.

IPFS Recommendation

@jubalm
Copy link
Author

jubalm commented Jan 27, 2024

Update:

  • it seems running npm run build generates paths for JS source with an absolute URL, added package.json property "homepage": "./" which webpack uses to transform the paths

@MicahZoltu
Copy link

Good find on the build output being transformed. Have you verified that the links in the page are all relative after build process once you made the homepage change?

Copy link

@MicahZoltu MicahZoltu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to include 127.0.0.1 => localhost redirect in this code?

Comment on lines 26 to 27
const cidRegex =
/\/ipfs\/(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const cidRegex =
/\/ipfs\/(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})/
const cidRegex = /\/ipfs\/(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})/

Looks like you had one line originally but changed it. Why?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uniswap linter splits too long lines. I haven't touched the linter rules

src/components/IPFSSubpathRedirect.tsx Outdated Show resolved Hide resolved
src/components/IPFSSubpathRedirect.tsx Outdated Show resolved Hide resolved
src/components/IPFSSubpathRedirect.tsx Outdated Show resolved Hide resolved
src/pages/App.tsx Outdated Show resolved Hide resolved
src/pages/App.tsx Outdated Show resolved Hide resolved
src/components/IPFSSubpathRedirect.tsx Outdated Show resolved Hide resolved
src/components/IPFSSubpathRedirect.tsx Outdated Show resolved Hide resolved
KillariDev and others added 10 commits January 29, 2024 16:23
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
@KillariDev KillariDev merged commit b69191b into main Jan 29, 2024
14 checks passed
@KillariDev KillariDev deleted the ipfs-redirect branch January 29, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants