RangerMauve / dat-archive-web

DatArchive implementation for browsers that uses dat-gateway
MIT License
30 stars 4 forks source link

Automatically convert gateway URLs to dat:// URLs #3

Closed RangerMauve closed 6 years ago

RangerMauve commented 6 years ago

A problem we have is that dat-gateway can serve dat archives via HTTP, but it cannot set the value of window.location. So any apps that rely on self-modification won't be able to use new DatArchive(window.location.href).

This could be addressed within dat-archive-web. It can detect when it receives an http(s) URL in its constructor, and will attempt to first, find the subdomain and check if it's a redirected archive (in which case it will do a base32 decode). Next it will try to get the domain or host from the first item in the path. If the second one fails, it'll just error out normally.

rjcorwin commented 6 years ago

That's a great idea!

RangerMauve commented 6 years ago

Released in 1.1.0 :D