Custom user start-up configuration/variable? - google-chrome

I am trying to build a web extension that reads from a dynamically generated value for a system upon startup. The value is stored in a text file that can be read by anyone on the system. However based on my research, it looks like it is not recommended to create an extension that has access to the user's filesystem due to security concerns.
With that said, I was hoping to create a script that takes the dynamic value and stores it as part of some user/system configuration file for that extension in Chrome at system startup. However it looks like doing that may cause Chrome to disable the extension due to integrity issues. Is there any way to declare some sort of system global variable using some sort of configuration file for a Chrome extension to read from?
Native messaging appears to be a way to do this but looks like it might be a bit much for trying to read a single "global" variable for my extension.
What are some other ways to do this?
Thank you for your time!

Related

vcxsrv: reset display settings after saving configuration

I am using vcxsrv to run graphical applications on a linux-cluster. However when I started using it and was asked to select a display setting, I selected one large window and saved this configuration. Now I found that one large window is quite impractical in many cases and would like to change it to multiple windows but don't know how. I am not shown the dialogue-box for choosing the display settings anymore when launching the application and I was looking for some config.xlaunch file that I read about in another post but couldn't find any. I am also not sure where this file would be saved. maybe I was just searching in the wrong place.
Does anybody know how to reset the display settings or where the config file is usually saved?
Simply execute "vcxsrv.exe" from your VcXsrv install directory.

Is there a way to set a file to read only in GODOT

I am saving data as part of a game, using a CSV file, and want to set it to read-only so that the user cannot modify it (system designed for not very experienced users).
Is there any way to save these files so that they are read-only?
Unfortunately it seems that godot's File API does not provide a mechanism to change file permissions. You could try using an encrypted file, which will prevent the user from trivially viewing it as a CSV file (e.g. it shouldn't open by default in their spreadsheet program). However, an encrypted file can still be overwritten and corrupted, and this will hinder modding for players that enjoy digging around game files.
You could write a proposal to include permissions functionality in the File API, or write the saving code in a language other than GDScript, where you'd have access to a standard library with this functionality. You could write a GDNative extension that supports this.
Ultimately you have to decide how important it is to fool-proof your system. A determined user will find ways to break things.

PhoneGap Offline Caching json data

I'm building a Phonegap application and i'm planning to set it to work in both Offline and Online mode, the idea is to get JSON Data from a PHP server side script and show it in the application, these data contains text, images so my question is is there anyway to set a dynamic cache manifest or any other way in a way that the user can see the already loaded data when he's offline, like caching the json result itself or anything else you can help me with
thanks
What do you mean by "work in both Offline and Online mode"? Are the users able to only see the user created data or can they modify it too? Is it correct to use a Manifest to control caching of user created data? I would have thought you should only really use it for caching the application templates and code. In any case I think you'll probably need something that you can exert more control over, something based perhaps using WebSQL, IndexedDb or LocalStorage.
I have been working on the modify-it-too question for many months and have a solution in the form of javascript(phonegap) <-> server synchronization that works somewhat like a version control system, with version numbers and conflict resolution. There's some pretty great docs and demo on the GitHub page and you can even see a presentation courtesy of SkillsMatter / LondonAJAX.. Currently there is only a JS/Node based server but I will probably do PHP based server because that's my day job If you look at the server code it's pretty easy to implement.
BTW I would use a different method to store the images, why not just download them and store them in a File, I don't know the storage limits, but I bet that is the way that Phonegap will let you get away with most.

Preemptively getting pages with HTML5 offline manifest or just their data

Background
I have a (glorified) CRUD application that I'd like to enable HTML5 offline support with. The cache-manifest system looks simple yet powerful, but I'm curious about how I can allow users to access data while offline.
For example, suppose I have these pages for the entity "Case" (i.e. this is CRM case-management software):
http://myapplication.com/Case
http://myapplication.com/Case/{id}
http://myapplication.com/Case/Create
The first URI contains a paged listing of all cases, using the querystring parameters pageIndex and pageSize, e.g. /Case?pageIndex=2&pageSize=20.
The second URI is the template for editing individual cases, e.g. /Case/1 or /Case/56.
Finally, /Case/Create is the form used to create cases.
The Problem
I would like all three to be available offline.
/Case
The simple way would be to add /Case to the cache-manifest, however that would break paging (as the links wouldn't work).
I think I could instead add something like /Case/AllData which is an XML resource, which is cached and if offline then a script on /Case would use this XML data to populate the list and provide for pagination.
If I go for the latter, how can I have this XML data stored in the in-browser SQL database instead of as a cached resource? I think using the SQL database would be more resilient.
/Case/{id}
This is more complicated. There is the simple solution of manually adding /Case/1, /Case/2, /Case/3 etc... to /Case/1234, but there can be hundreds or even thousands of cases so this isn't very practical.
I think the system should provide access to the 30 most recent cases, for example. As above, how can I store this data in the database?
Also, how would this work? If I don't explicitly add /Case/34 to the manifest and the user clicks on to /Case/34 how can I get the browser to load a page that my JavaScript will populate based on the browser's SQL database data and not display the offline message?
/Case/Create
This one is more simple - as it's just an empty page and on the <form>'s submit action my script would detect if it's offline, and if it is offline then it would add it to the browser's SQL database. Does this sound okay?
Thanks!
I think you need to be looking at a LocalStorage database (though it does have some downsides), but there are other alternatives such as WebSQL and IndexedDB.
Also I don't think you should be using numeric Id's if you are allowing people to create as you will get Primary Key conflicts, it is probably best to use something like a GUID.
Another thing you need is the ability to push those new cases onto the server. there could be multiple...
Can they be edited? If they can I think you really need to be thinking about synchronization and conflict resolution hard very hard if that is the case.
Shameless self promotion, I have a project that is designed to handle these very issues, though it's not done, it's close. You can see it (with an ugly but very functional) demo at https://github.com/forbesmyester/SyncIt

How to dynamically configure an application?

When I say "configure" I mean where to save those values that could change very often (constants values like taxes rates or something similar) and then when you need to change them you don't want to re-compile your application.
Where to save those values? Database? XML File? Flat File?
It depends on how often these change and who or what changes them. For some application specific settings, it's best to use an XML or config file, where the developers are the ones responsible for updating it. For other "businessy" values (like exchange rates, tax rates, etc), it's best to keep them in the database and provide a UI for users (not developers) to update.
It also depends on how many apps depend on this value, for example, if several applications depend on some setting (such as email server addres), it's best to put it in a database since it'll be easily accessible from any machine where the app is running.
I use INI files for potentially user-configurable files, and BIN files for data that save session state between runs.
But, it is very dependent upon what type of application you are developing.
it depends on how your app is architecture. you could design your app in such way that you could change the location of you configuration. by just injecting the provider.
Normally I use Ini files or XML if the data is structured.
For applications that already use a database and you don't want to have the user to change the data easily, you can use the database.
I almost never use binary data unless you want to obfuscate the data for the user.
Regardless of app, you're probably going to have at least 3 sources of configuration data:
Command line flags, usually for bootstrapping your run-time environment, e.g, finding config files, setting debug flags, include paths, class paths, etc
Config files, potentially more than one that may override each other. These usually boot strap your application: connection strings, cache settings, build-specific settings, etc
Control data in a database. Things like timezones, conversion rates, stable display values, etc. This data should also be versioned in the database (as in, a "Data Version" field, not living in a version control system). Versioning it will save a lot of headaches when you find you need to change a setting for a new release, but the old release will break if you change it.
Generally, anything that changes at run-time should go in the database. Anything that is sensitive and rarely changing should go into the config files, and any hacks should go on the command line (--[no]enable-bug-287438-hack can be very handy when you need it).
I prefer the simplicity of a flat ini file. Here's an example Setting class that you might find useful.