Litewrite on SAFE Alpha2 - a remotestorage.js Web App

litewrite is a no distraction note taking app, that is designed to sync with online storage. litewrite is simple and opens with the instructions so take a moment to read them the first time you use it.

litewrite is now on alpha2: safe://litewrite4 requires SAFE Browser v0.7.0.

You will also need Trust Level 1 (Basic User) on this forum if you’ve not already done so!

When using litewrite you don’t need to save or load anything. Any notes you create or text you type will just be there next time you visit the app on the same machine. If connected to your SAFE account it syncs with your online SAFE storage (red cube glowing light and dark) and if you visit the app from another computer, that will sync and download your notes like magic.

To connect it to SAFEnetwork click the blue SAFE ‘cube’ icon to connect and click ‘Allow’ in SAFE Authenticator. Your notes will be uploaded to your SAFE storage and be available on any machine when you connect and login to your SAFE network account.

Developers: notes are initially stored in your local browser storage (actually IndexDB) and sychronised with your SAFE storage whenever you are connected. You can see this happen in the debug console every 10 seconds. The original (non-SAFE litewrite repo) is github/litewrite, and my modified remotestorage.js on this branch. That is a fork of RS.js v0.14 but I plan to update it to RS.js 1.0 which may well be released today.

Note: I didn’t create litewrite, I have modified a library called remotestorage.js to work with SAFEnetwork to demonstrate this way of building web apps. So anybody can build an app with offline-first functionality using this library. This is an early version but I’ve tried it on a few web apps now so it should be good enough to start building on - or to learn how it works and use that in your own apps.

My work on remotestorage.io is to help others who want to build apps that have this kind of sync feature, and also part of the bigger project to make safepress.io - a WordPress like website CMS for SAFEnetwork (help needed, so get in touch if you’d like to help that happen or feel you would be able to make this your own - I’d be happy to help make that happen because I can’t do so myself).

[This topic supercedes the earlier discussion which is out of date Litewrite on SAFE - a remotestorage.js Web App.]

35 Likes

Great stuff, Mark!!

Stuff like this can be small and big, all at the same time.

7 Likes

Excellent stuff @happybeing - just trying it now. Do you have a preferred place to report any bugs? Here or Github?

2 Likes

Thanks for that. I used it to immediately write a list of all the current Safe Websites and apps I find interesting :slight_smile:

2 Likes

Getting this error.

Error: -103

Core error: Routing client error → Requested data not found

Running version 0.7.0 SB

and I’m trust level 1?

nb: since I’ve installed 0.7.0 I’ve also had errors launching the mail app…

1 Like

Bugs? The cheek of this guy :wink:

Either here or github is fine.

3 Likes

I had the same problem. Make sure you are doing the normal browser, not the mock browser. Also, make sure you’re extracting the zip file correctly. I used WinRAR, but drug the directory instead of using “Extract” from the menu, and still was getting the routing error on all sites. But now it’s working, after extracting the zip file in a different way. There’s something different with these zip files.

Ah the confidence! You’ll be offering a bug bounty then? :wink:

4 Likes

Well I’ve been happily passing notes between Windows and Linux machines (passes for a good night’s entertainment round my way) and happy to say - it works really well :+1:

The answer is - Yes!

The console shows it happily resynching every few seconds on both systems. The only times I ran into trouble was when I cancelled the SAFE connection using the ‘poweroff’ button after clicking the orange icon it basically wiped the account - all but the default Litewrite note disappeared, along with the SAFE icon.

Edit: restarting the browser and clicking on the orange icon again allows reconnection with the SAFE network and access to the notes - so the account was not wiped.

Other times the result of clicking the orange icon were not so drastic. Sometimes a selection box appeared asking which storage medium to connect to (I guess this is the underlying remotestorage.js functionality peeking through).

The only other things to report is that sometimes I had to revoke and reauthenticate the app (timed out possibly?) and occasionally there were a few red errors in the console (didn’t note them down unfortunately) necessitating a refresh.

Also, edits to a note do not seem to get transfered (ie write a note in Windows, check it’s accesible from Linux. Edit the note in Windows, the edits are not visible in Linux. I didn’t investigate this too far so perhaps it just needs a refresh.

And finally browser-stored notes are available to all accounts using the browser instance. So if create a note ‘blah blah’, log out, log in with a different account the note ‘blah blah’ is visible. Can IndexedDB instances be tied to an account I wonder?

2 Likes

Good choice of words

1 Like

I had downloaded the mock zip file. :wink:

All seems to be working again thanks.

Litewrite is very cool app and a great foundation for whats possible.

3 Likes

Thanks @JPL really useful testing and feedback there.

I have noted this for when I want to track down bugs and improve the UI but I am going to wait until I’ve made other changes (such as upgrading to use the next iteration of remoteStorage.js v1.0).

Feedback and reports like this are extremely useful to me, and any developer, so I encourage others to post their experiences of using any SAFE apps. Thanks again @JPL :slight_smile:

3 Likes

Glad it helps! Always fun to test new things (and much easier than writing them :slight_smile: ). One question I have, and something I’ve never quite sure of is the calculation of PUTs. If I create a note it seems to use about 7 PUTs. As a developer how much control do you have over this? Thanks

2 Likes

Good question and no definitive answer because “it depends” of course on the application and how it is implemented. All I can do is say a bit about what happens with Litewrite: creating a note causes a file to be created and an update of the container that holds those files. Not sure how many PUTs that is? But also, as you begin typing that can trigger an update so there may be further updates while you write. So this level of synch could get relatively expensive. This is definitely going to be interesting when we start to compare approaches.

As a developer using RS.js you can have some control over this I think - say by turning sync on and off - and if you are going direct to SAFE in your app of course you can have much finer control. It will depend on how sensitive we are to PUT use. If I’m happy with say, an overall monthly cost of all my SAFE Apps (like your mobile data allowance), will I care if one app uses two or several times as many PUTs as another for a similar thing?