bunsenbrowser / bunsen

🔥 Bunsen Browser provides easy to use offline P2P application and file distribution that is verifiable on Android devices. https://bunsenbrowser.github.io/
117 stars 7 forks source link

window.location should reflect current Dat Archive address #83

Open rjcorwin opened 5 years ago

rjcorwin commented 5 years ago

Following dat:// links works great in Bunsen, however the following code will not work in Bunsen...

fetch(`dat://foo.com/dat.json`).then(console.log)

Some quick research shows how we may be able to handle this in WebView.

rjcorwin commented 5 years ago

Tried this approach but it appears that the CordovaWebViewClient class no longer exists, saw some chatter about it being removed.

Found a promising lead here where someone suggests forking cordova-plugin-inappbrowser.

rjcorwin commented 5 years ago

Trying out forking of cordova-plugin-inappbrowser and adding a log statement for when a URL to anything starting with dat: occurs (https://github.com/rjsteinert/cordova-plugin-inappbrowser/blob/master/src/android/InAppBrowser.java#L1160). When the app boots up in the emulator I run adb logcat | grep DAT and then inspect using Chrome. To open InAppBrowser, using the chrome devtools I run cordova.InAppBrowser.open('dat://foo.com')... but no log messages related to "DAT" in the logcat occur. Coming back to this later.

rjcorwin commented 5 years ago

@chrisekelley I changed the name of this ticket to more accurately reflect the goal. Even if when we get intercepting of requests in a WebView on the rails, we still need to hand off those requests to something that gets the contents of the request. That might include making a request to Dat Gateway. In that way, the Java side of the App would be a proxy to the gateway. I think you were getting it when you said "transparent proxy".

RangerMauve commented 5 years ago

What I ended up doing when I was playing around with dat-polyfill, I had it detect when a URL was from the gateway and treat it as a dat:// URL. Maybe that could work here.