sbs20 / scanserv

scanserv is a simple web-based UI for SANE which allows you to share a scanner on a network.
GNU General Public License v2.0
41 stars 13 forks source link

Memorize mode and resolution in a cookie #5

Closed cedr-x closed 7 years ago

cedr-x commented 7 years ago

Hello Sam, I've added one last thing: resolution / mode last setting stored in a cookie I find this usefull since I usually scan in grey (texts/letters), so I do not have to review those settings between 2 scans. Please review, and let me know if you want changes / enhancements Regards, Cedric

cedr-x commented 7 years ago

Yes, you're right. This behaviour is maybe too personal. So, what do you think about storing all settings in a php session ? we are few using the scanner here, so I'd really like to store settings for each user rather than a global setting of all. If you're ok, I could do that.

sbs20 commented 7 years ago

I had been thinking about using local storage - i.e. stored in a user's browser. Behaviourally it'd be just like using cookies but you can store much more data. In truth, we don't need the 5mb limit (or whatever) to store a tiny object payload, but it seems nicer and more forward looking. Like you I'd prefer not to use server sessions.

I haven't looked into this recently, but I believe Amplify offers a good common API http://amplifyjs.com/api/store/ - what do you think?

cedr-x commented 7 years ago

I didn't know the localstorage ! that sounds great since that data is only used by js, there's no need to send that to the server. I'll look further to amplifyjs, it seams to be very closed to jscookie. I'll add those methods (setValues) to page obj as you suggest. Thank you for your advices !

cedr-x commented 7 years ago

Hello, I've remove the usage of cookies for amplify instead, and set this behaviour for all the setting. Please review this change request. I'm not sure if I've done the event handling, or the defaulting init right, so let me know if there's better ways Thank you Cedric

sbs20 commented 7 years ago

Much cleaner - I still have a few ideas but I'll have a go at them