include plugins from shout config directory in html

This commit is contained in:
Josip Janžić 2014-12-27 21:08:18 +01:00
parent af563db0e2
commit 05c910c9d3
2 changed files with 21 additions and 1 deletions

View File

@ -287,5 +287,9 @@
<script src="js/shout.templates.js"></script>
<script src="js/shout.js"></script>
<% plugins.forEach(function(file) { %>
<script src="plugins/<%= file %>"></script>
<% }) %>
</body>
</html>

View File

@ -13,12 +13,28 @@ var manager = new ClientManager();
module.exports = function(options) {
config = Helper.getConfig();
config = _.extend(config, options);
config = _.extend(config, options, {
plugins: []
});
var app = express()
.use(index)
.use(express.static("client"));
fs.readdir(Helper.HOME + '/plugins', function(err, files) {
if (err) {
if (err.code !== 'ENOENT') {
console.log(err);
}
return;
}
if (files.length) {
config.plugins = files;
app.use('/plugins', express.static(Helper.HOME + '/plugins'));
}
});
app.enable("trust proxy");
var server = null;