maccman/macgap — pull request #96 by JLarky (2014-03-16 16:23:38+00:00)
Title: command macgap.localfile.read("path/to/file")

that allows to read files from filesystem as long as filename is whitelisted

One can use that to include user provided css or scripts. Example

webapp:
``` javascript
if (window.macgap.localfile) {
var json = macgap.localfile.read("~/my_app_userstyle.css");
if (json) {
response = $.parseJSON(json);
if (response && response.content) {
css = response.content;
var styleNode = document.createElement('style');
styleNode.type = "text/css";
var styleText = document.createTextNode(css);
styleNode.appendChild(styleText);
document.getElementsByTagName('head')[0].appendChild(styleNode);
}
}
}
```

and in public/localfiles.whitelist
```
~/my_app_userstyle.css
```