Another problem with this approach is the security of the data.
Since we are now asking the user to select the data from his own system, we are essentially giving him access to all the data available. Not only that, he/she could change the data and upload it to the online server without any problems and the data would be saved online forever.
One possibility is to save previous versions of the data online up to a certain date (let’s say 2-3 days) and also save a log of who changed the data and when (log file will be smaller and can be saved for longer).
Although JS doesn’t allow picking up files willy-nilly from a user’s local system, we could definitely ask permission from the user to do so. The way I found to do this is by asking the user to fill a file input field which will contain the JSON data we want to read.
Problem is we will have to ask the user to navigate to the file and this would be a great hurdle to the usability of the application.
In a recent post I explained how wee could theoretically save user’s data onto a local file which could then be synced to the Firebase database online. As i ventured further into the idea, I realized that JS doesn’t really allow you to read a file on the local system of the user.
I was a little frustrated after reading about 5 posts on StackOverflow stating how it would be “Invasion of Privacy” if we could do that but I realized that what they were posting was absolutely valid.
Recently I published a post where I explained why I needed to create some synchronization scripts for a web application that uses Firebase as a Database.
As stated in the previous post, there are 3 parts to this endeavor.
I will be planning out the first one in this post.
1. When user enters or edits data while offline, save the data in a local json file. So, Firebase allows the users 4 ways to enter data into the database.
I recently took up a project where I needed to store some structured data and provide the user with a UI to insert view and edit the data in a streamlined way.
At first I tried to use a MySQL database, but it was too much work. Also I didn’t know the limits of the data they could enter so defining data types was a chore as well.