icidasset / diffuse

A music player that connects to your cloud/distributed storage.
https://diffuse.sh
Other
809 stars 66 forks source link

Support Hashless Routing (404 Hack) #404

Closed fire17 closed 6 months ago

fire17 commented 7 months ago

Hi there, I'm enjoying diffuse, And the entire 0data concept generally

Saw that

Routing is done using hashes/fragments (eg. diffuse.sh/#/sources)

Was reminded there's a trick to enable routing without slashes on static sites i.e diffuse.sh/sources will work

I found it originally here.. https://github.com/orgs/community/discussions/64096 Please check it out and especially https://github.com/rafgraph/spa-github-pages As a working example

A bit hacky but no reason it shouldn't be supported if the route exist

Thanks a lot and all the best

icidasset commented 7 months ago

Thanks! ☺️ Yeah, I originally went with the hash-based approach because IPFS gateways didn't have a 404.html or redirects at the time. It's a bit difficult because every platform/server has its own approach, eg. Netlify has its _redirects file. Or it doesn't support redirects all, like IPFS originally.

So yeah it's a bit troublesome if you want to support every platform that hosts static sites. Just using hash-based routing seems like the best approach. I assume people don't often put in the page url manually, so I'm not even sure what the upsides are of not having to type the #/ before the page path?