Local database doesn't persist after closing application
Closed this issue · 17 comments
WebSQL database and local storage get lost after restart
same issue as: https://github.com/appjs/appjs/issues/374
platform: windows 7
Now, appjs never really stored anything AFAIK. However Deskshell is based off Chromium. So maybe it has to do with the chrome-profile folder, or the access to it. But that is where such data is supposed to be stored as far as I know... o.o
@sihorton might be the better guy here, I am just guessing ^.^
Am 22.10.2013 um 17:32 schrieb Jin Lu notifications@github.com:
WebSQL database and local storage get lost after restart
same issue as: appjs/appjs#374
—
Reply to this email directly or view it on GitHub.
I have taken a look into this issue but have not found the solution yet. We are using chromium portable: http://portableapps.com/apps/internet/google_chrome_portable but then calling chrome.exe directly instead of the chrome portable exe. I don't see any settings in the download for save directories or the like. We pass in a profile directory so ideally it should save into that directory. We will need to setup a test application and then try to find out where it is saving the settings and then why it is loosing them.
If we can find a different chromium install for windows that does work with WebSQL / local storage then I am willing to switch to that.
As a work around nodejs gives you access to sqlite3 database, if you use this approach then you won't be limited to the 5 meg storage that chromium gives you but can instead have unlimited database size. Likewise node can write out json file directly to disk so you can save unlimited data to the client hard disk if needed rather than the limited amount supplied by chromium.
However even if the workaround is nicer than the built in html5 api's it is best for us to support them since it will be expected to be available and keeps code compatible with standard website code.
@sihorton : I created a test app few weeks ago, and I assume all local data should be saved in directory: ...\AppData\Local\Deskshell-apps\mytestapp , it would be nice to have a configurable setting like "CachePath" in appjs which control the path.
does google_chrome_portable support runtime parameter like --user-data=DIR ?
In app.js if you create a file "test.json" then that will be saved in "...\AppData\Local\Deskshell-apps\mytestapp" however if you use built in chrome functions then they will be saved in the user profile directory (AppData\Local\Deskshell\bin\win\chrome-profile).
This site lists all of the command line switches we can pass into chrome: http://peter.sh/experiments/chromium-command-line-switches/.
Deskshell is simple javascript so we just boot off chrome.exe with a list of switches (bin/win/node_modules/deskshell-api/index.js line 230 is where we set the switches). It is even possible to add additional parameters yourself by passing in "chromiumFlags" as a parameter to deskShell.startApp function call in app.js
We pass in "--user-data-dir=../../../../chrome-profile" as well as --disable-translate, --app-window-size, --remote-debugging-port and --app.
It should be possible to get the local storage / websql working if we just play around a bit. In your test app do you see any files being created in the chrome-profile directory while the app is running?
@sihorton I can see a directory is created in chrome-profile\Default\databases when my app is running, but the name of directory is like: http_localhost_54246, I guess deskshell use a random port each time, so it can not find the data that it created with another port.
Ah, ok that makes sense :-)
Just open your MyApp.desk file and add the port you want to use:-
,"port":8190
Then the application will always use port 8190 instead of a new one each time :-)
@sihorton thanks it works! can you give a example to modify parameter "--user-data-dir=../../../../chrome-profile"? can I do it in MyApp.desk ? I really want to save all my data in "...\AppData\Local\Deskshell-apps\mytestapp\data"
Great, glad that it is working now :-)
Since the profile directory wants to be relative to the current application directory can you try the following in your app.js file?
var running = deskShell.startApp({
chromiumFlags:[
'--user-data-dir='+__dirname+'\data'
]
});
I am not 100% sure that this will work since we will end up sending in 2 user-data-dir flags to chrome. However if it does not work I could do a new deskshell release which allows you to turn off the default profile dir. Can you first try the above change?
thx @sihorton I tested above code but it's not working. all data are still saved in "chrome-profile" directory.
Ok, sorry that did not work, I have updated the deskshell code to support a new parameter just for you :-)
For now download the following file http://deskshell.org/tmp/index.js and save to AppData\Local\Deskshell\bin\win\node_modules\deskshell-api\index.js
Then change your app.js to the following:
var running = deskShell.startApp({
"user-data-dir":__dirname+"/data"
})
Then hopefully the data dir will now be stored under your application. Let me know if it does not work and I can send you an example application setup to store its data directory as you requested. I will add this fix to the standard deskshell release so next update it will be available for everyone.
Great :-)
Hi Simon,
Just a quick head's up to say a big thanks for your fantastic work. I'm
finally getting a chance to play with deskShell a bit and it's super
slick -- great fun!
Have a great day,
-Chris
Thanks Chris :-)
If you just run deskshell the demo app that opens should contain a little tutorial, docs and some demos. Let me know if we need to improve any of the explanations!
It all works amazingly well so far. Super simple + very slick. Kudos!
-Chris
Thanks Chris :-)
If you just run deskshell the demo app that opens should contain a
little tutorial, docs and some demos. Let me know if we need to
improve any of the explanations!—
Reply to this email directly or view it on GitHub
#17 (comment).
Which port of Deskshell are you testing? :)
Am 05.11.2013 um 21:11 schrieb Chris Banford notifications@github.com:
It all works amazingly well so far. Super simple + very slick. Kudos!
-ChrisThanks Chris :-)
If you just run deskshell the demo app that opens should contain a
little tutorial, docs and some demos. Let me know if we need to
improve any of the explanations!—
Reply to this email directly or view it on GitHub
#17 (comment).—
Reply to this email directly or view it on GitHub.
Hi Ingwie -- not quite sure how I managed to hijack this thread (sorry!)...
...I'm using the default Node version. Is there an easy way to try/test your php version as well? I'm guessing that Documentation is probably the biggest missing piece at the moment??
-Chris