sammacbeth / dat-fox

dat:// protocol as a Firefox webextension
MIT License
250 stars 12 forks source link

Redirect to dat website if available #43

Open wuniversales opened 4 years ago

wuniversales commented 4 years ago

For example, give the option to automatically redirect from

https://beakerbrowser.com/

To your Dat website

dat: //beakerbrowser.com/

sammacbeth commented 4 years ago

A simple version of this should be easy to implement. The availability of a dat version of a site is currently detected here: https://github.com/sammacbeth/dat-fox/blob/master/background/page-action.js#L12 . If a redirect is forced there to the dat url, it will be from then on loaded over dat. This feature could be toggled via a checkbox on the settings page.

We may also need to consider how to revert to HTTP if the dat version is unavailable. We could add a button in the page action to do that.

I'd take a PR for these changes if someone wanted to jump on it.

da2x commented 4 years ago

We may also need to consider how to revert to HTTP if the dat version is unavailable. We could add a button in the page action to do that.

Maybe do the reverse? Start loading it in the background and only redirect from HTTP to Dat when it’s verified that Dat is working. Sudden redirects while you’re busy reading a page isn’t a pleasant UX. Maybe wait until the next pageview and redirect only for cached dat-dns responses?