nw-flash-trust
Cross-platform solution for NW.js and Electron to make your Flash plugins trusted, so they can run smoothly.
Why this is needed?
NW.js uses local file://
protocol to render pages. Unfortunately, for security reasons Flash Player doesn't like SWFs embedded locally and applies very restrictive policy to them. Such SWF lands in one of two possible local sandboxes, and communication via ExternalInterface is blocked.
Fortunately there is officially supported way of making your local SWF trusted, so previously mentioned restrictions don't apply. Full explanation can be found in Adobe Flash Player Administration Guide.
Long story short: you have to put text file in special directory provided by Flash Player and save to this file paths of SWFs you want to be trusted. This library provides cross-platform API for doing just that.
Installation
npm install nw-flash-trust
Usage & API
For simplicity API is fully synchronous. It does a little of I/O, but so little it shouldn't be an issue.
var path = require('path');
var flashTrust = require('nw-flash-trust');
var appName = 'myApp';
var trustManager = flashTrust.initSync(appName);
var trustManager = flashTrust.initSync(appName, '/yourApp-data-path/Pepper Data/Shockwave Flash/WritableRoot');
trustManager.add(path.resolve('path-to', 'file.swf'));
trustManager.add(path.resolve('path-to', 'folder'));
trustManager.remove(path.resolve('path-to', 'file.swf'));
var isTrusted = trustManager.isTrusted(path.resolve('path-to', 'file.swf'));
var list = trustManager.list();
trustManager.empty();
License
MIT