I implemented a simple little proof-of-concept of building a SAFE browser inside of Electron at GitHub - cretz/safe-poc-browser: Simple Proof-of-Concept Browser for SAFE Network. The instructions to run are in the README there.
The code is ugly and it’s kind of a hackjob just to prove it could be done. After writing it I am not convinced it is a reasonable way to browse SAFE, but it does offer some benefits over the proxy. Namely:
- Uses a safe:// protocol instead of HTTP. It is backwards compatible with the current web proxy, so http://foo.bar.safenet/baz becomes safe://foo.bar/baz (but you might have to remove the PAC file from your internet settings to use it, I forget)
- Blocks access to all HTTP content (but has a special hook to handle *.safenet URLs to work with the proxy)
- Upon request to click any HTTP link, it offers users the choice to open in their browser
- Don’t have to fork an entire browser and get to stay out of the public internet at the same time
Some other things:
- Even though I don’t even use the API, I still coded it to register w/ the launcher, so it shows how to do that (basically the same as the demo app)
- Although I didn’t implement it, it would be trivial to support injecting a JS API usable from the pages
Again, the impl is really crappy. I don’t even have a way to close tabs, heh. I do not consider the app to be worthy and would not really recommend its use. But I was able to understand the details of the nacl handshake to register and some of the other features for my future apps. If someone really does think it’s worthy they can fork it, but there are two major downsides to this approach: basically none of the browser UI features (I don’t even have copy paste support), and no auto updating (though Electron has support for it).
Having said that, I don’t believe the proxy is the right idea either. I know it’s easiest for everyone to just upload a website in HTML/JS/CSS but the best approach one day in the future might be an app that lets users build things that give them utmost flexibility while not relying on web technologies. Like traveling back in time to how people built MySpace pages
Finally, I am going to use this opportunity to drop a little wishlist on the launcher stuff here. My wishlist:
- Swagger/OpenAPI spec for launcher rest service
- Get the proxy out of the launcher and instead make it an app
- More things exposed via launcher rest service such as (it would be nice if safe_ffi exposed all of this too):
- Direct structured data rw access
- Direct immutable data access
- Direct self_encryptor write access (please use multipart file on this, and of course return datamap on success)
- Instead of having the app chunk the contents itself as is done via modifyFileContent, support multipart form file uploads over HTTP
- Same deal with getFile. Instead of a method that buries the data, use normal HTTP for what it’s good for. Specifically, please support things like content-range HTTP headers instead of a call with headers
- If you want to be awesome, support webdav (if you don’t, I’ll likely make my own with GitHub - mikedeboer/jsDAV: jsDAV allows you to easily add WebDAV support to a NodeJS application. jsDAV is meant to cover the entire standard, and attempts to allow integration using an easy to understand API. that just proxies to safe launcher APIs)
- Or instead of the above, just add a GPL linking exception to safe_* libraries and others can build things like the safe launcher without being infected by the license
- With the safe_launcher dist, distribute all safe_* libs as shared libs instead of statically compiling them in (or putting them all in safe_ffi)
- Installer for safe launcher and make a way for the path to be programmatically discovered (via rest is fine). Also make the safe_* lib versions programmatically discoverable. This helps apps dyamically load the latest safe_* libs from there instead of deploying their software with their own (or worse, statically compiling them) while also checking compatibility
Feel free to hit me up with questions (sleeping now, but will answer later). But don’t even bother filing bugs :-), it really is just a little sample project…