Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Commit

Permalink
server: Ignore entries in systems or plugins if they contain a dot in…
Browse files Browse the repository at this point in the history
… their name or are not folders. Fixes #10
  • Loading branch information
elisee committed Jan 7, 2016
1 parent 5effe1a commit 746fcba
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions server/loadSystems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ export let buildFilesBySystem: { [systemName: string]: string[]; } = {};

export default function(mainApp: express.Express, buildApp: express.Express, callback: Function) {
async.eachSeries(fs.readdirSync(systemsPath), (systemName, cb) => {
SupCore.system = SupCore.systems[systemName] = new SupCore.System(systemName);
if (systemName.indexOf(".") !== -1) { cb(); return; }

let systemPath = path.join(systemsPath, systemName);
if (!fs.statSync(systemPath).isDirectory()) { cb(); return; }

SupCore.system = SupCore.systems[systemName] = new SupCore.System(systemName);

// Expose public stuff
try { fs.mkdirSync(`${systemPath}/public`); } catch (err) { /* Ignore */ }
Expand Down Expand Up @@ -82,9 +86,13 @@ function loadPlugins (systemName: string, pluginsPath: string, mainApp: express.
pluginNamesByAuthor[pluginAuthor] = [];
for (let pluginName of fs.readdirSync(pluginAuthorPath)) {
if (shouldIgnorePlugin(pluginName)) continue;

let pluginPath = `${pluginsPath}/${pluginAuthor}/${pluginName}`;
if (!fs.statSync(pluginPath).isDirectory()) continue;

pluginNamesByAuthor[pluginAuthor].push(pluginName);

let packageData = fs.readFileSync(`${pluginsPath}/${pluginAuthor}/${pluginName}/package.json`, { encoding: "utf8" });
let packageData = fs.readFileSync(`${pluginPath}/package.json`, { encoding: "utf8" });
if (packageData != null) {
let packageJSON = JSON.parse(packageData);
if (packageJSON.superpowers != null && packageJSON.superpowers.publishedPluginBundles != null)
Expand Down

0 comments on commit 746fcba

Please sign in to comment.