Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Object.keys(plugins).forEach(function(name) {
var simpleName = name.split('.', 2)[1];
if (protocols.contains(simpleName)) {
return;
}
var dir = plugins[name];
var isSys = dir.isSys;
dir = dir.root;
try {
var pkgPath = path.join(dir, 'package.json');
var pkg = fse.readJsonSync(pkgPath);
if (pkg && pkg.version) {
var stats = fs.statSync(pkgPath);
var conf = pkg.whistleConfig || '';
var hintList = util.getHintList(conf);
var plugin = {
isSys: isSys,
moduleName: pkg.name,
networkMenus: util.getPluginMenu(conf.networkMenus || conf.networkMenu, simpleName),
rulesMenus: util.getPluginMenu(conf.rulesMenus || conf.rulesMenu, simpleName),
valuesMenus: util.getPluginMenu(conf.valuesMenus || conf.valuesMenu, simpleName),
pluginHomepage: pluginUtil.getPluginHomepage(pkg, simpleName),
priority: parseInt(conf.priority, 10) || parseInt(pkg.pluginPriority, 10) || 0,
rulesUrl: util.getCgiUrl(conf.rulesUrl),
valuesUrl: util.getCgiUrl(conf.valuesUrl),
hintUrl: hintList ? undefined : util.getCgiUrl(conf.hintUrl),
hideShortProtocol: !!conf.hideShortProtocol,
function readConfig(storage) {
var dataDir = getDataDir();
var configFile = path.join(dataDir, encodeURIComponent('#' + (storage ? storage + '#' : '')));
if (!fs.existsSync(configFile)) {
return;
}
try {
return fse.readJsonSync(configFile);
} catch(e) {}
}