diff --git a/app.js b/app.js index 78b0abc..f65a20d 100644 --- a/app.js +++ b/app.js @@ -24,7 +24,7 @@ let passport = require('passport'); let LocalStrategy = require('passport-local').Strategy; let User = require("./modules/db.js"); -passport.use(new LocalStrategy( +passport.use("local", new LocalStrategy( { }, @@ -36,7 +36,7 @@ passport.use(new LocalStrategy( if (!user) { return cb(null, false); } - if (user.password != password) { + if (user.password !== password) { return cb(null, false); } return cb(null, user); @@ -124,8 +124,8 @@ app.use(require('express-session')({ secret: config.sessionKey, resave: false, s // Initialize Passport and restore authentication state, if any, from the // session. -app.use(passport.initialize()); -app.use(passport.session()); +app.use(passport.initialize({})); +app.use(passport.session({})); let websocket = require("./modules/websocket")(server, app, io, eventDispatcher); let indexRouter = require('./routes/index.js')(websocket, eventDispatcher); diff --git a/locales/en/translation.json b/locales/en/translation.json index 186d80b..9970156 100644 --- a/locales/en/translation.json +++ b/locales/en/translation.json @@ -51,6 +51,8 @@ "editBundle": "Edit bundle", "msg1": "Most of the changes are applied for live environment at next slide change.", "name": "Bundle name", + "backgroundfile": "Select a file", + "msgupload": "You can upload a new background (.jpg or .mp4) here.", "background": "Background", "transition": "Default transition (applied on restart)", "time": "Display time", @@ -66,7 +68,7 @@ "fontName": "Font Name", "fontSize": "Size", "fontColor": "Color", - "fontBorder": "Border Color" + "fontBorder": "Border Color", }, "editSlide": { "changeColor": "Change Color", @@ -92,4 +94,4 @@ "lite": "Lite", "splitter": "or" } -} \ No newline at end of file +} diff --git a/locales/fi/translation.json b/locales/fi/translation.json index 4efe47f..d675689 100644 --- a/locales/fi/translation.json +++ b/locales/fi/translation.json @@ -53,6 +53,8 @@ "name": "Nimi", "background": "Tausta", "transition": "Oletussiirtymä", + "backgroundfile": "Valitse tiedosto", + "msgupload": "Voit ladata uuden taustakuvan (.jpg or .mp4) alta.", "time": "Näytä aika", "duration": "Oletusarvo dian pituudelle", "msg2title": "Huomio Web-fonteille", @@ -92,4 +94,4 @@ "lite": "Kevyt", "splitter": "tai" } -} \ No newline at end of file +} diff --git a/modules/display.js b/modules/display.js index bdf66a6..a10dd01 100644 --- a/modules/display.js +++ b/modules/display.js @@ -37,6 +37,8 @@ class display { * @property {boolean} blackout - should the blackout be enabled * @property {boolean} isStreaming - is media server stream enabled at client * @property {string} streamSource - URL for FLV media stream + * @property {bool} isAnnounce - if the next slide is announce one + * @property {bool} announceMeta - all data needed for announces * @property {string} transition values supported: bars,blinds,blinds3d,zip,blocks,blocks2,concentric,warp,cube,tiles3d,tiles3dprev,slide,swipe,dissolve */ this.serverOptions = { @@ -52,6 +54,7 @@ class display { isStreaming: false, streamSource: "", isAnnounce: false, + announceMeta: {}, transition: "tiles3d", displayTime: true }; @@ -254,4 +257,4 @@ class display { /** * @type {display} */ -module.exports = display; \ No newline at end of file +module.exports = display; diff --git a/routes/admin.js b/routes/admin.js index ea650ae..7433f8a 100644 --- a/routes/admin.js +++ b/routes/admin.js @@ -56,51 +56,74 @@ module.exports = function (websocket, dispatcher) { }); router.post('/edit/bundleProperties', function (req, res, next) { - let bundleData = {}; + let bundleData = {}; + let fields = {}; - var transition = null; - if (req.body.transition !== "") { - transition = req.body.transition; + req.busboy.on('field', function (fieldname, val) { + fields[fieldname] = val; + }); + + req.busboy.on('file', function (fieldname, file, filename, encoding, mimeType) { + if (fieldname === "newBackground") + if (filename.length > 0 && (mimeType === "image/jpeg" || mimeType === "video/mp4" || mimeType === "image/png")) { + console.log(filename) + let fstream = fs.createWriteStream('./data/backgrounds/' + filename); + file.pipe(fstream); + } else { + file.resume(); + } + }); + + req.busboy.on('finish', function () { + + if (fields.hasOwnProperty("sUpload")) { + res.redirect("/admin/edit/bundleProperties?bundle=" + fields.bundle); + } else { + var transition = null; + if (fields.transition !== "") { + transition = fields.transition; + } + + var useWebFonts = false; + if (fields.hasOwnProperty('useWebFonts')) { + useWebFonts = true; + } + + var displayTime = false; + if (fields.hasOwnProperty('displayTime')) { + displayTime = true; + } + + try { + let bundle = bundleManager.getBundle(fields.bundle); + bundleData = bundle.getBundleData(); + bundleData.displayName = fields.displayName; + bundleData.background = fields.background; + bundleData.duration = parseInt(fields.duration); + bundleData.transition = transition; + bundleData.useWebFonts = useWebFonts; + bundleData.displayTime = displayTime; + bundleData.styleHeader.fontFamily = fields.headerFontFamily; + bundleData.styleHeader.fontSize = parseInt(fields.headerFontSize); + bundleData.styleHeader.fill = fields.headerFill; + bundleData.styleHeader.stroke = fields.headerStroke; + bundleData.styleText.fontFamily = fields.textFontFamily; + bundleData.styleText.fontSize = parseInt(fields.textFontSize); + bundleData.styleText.fill = fields.textFill; + bundleData.styleText.stroke = fields.textStroke; + bundle.setBundleData(bundleData); + bundle.save(); + + } catch (err) { + cli.error("error loading bundle", err); + } + + dispatcher.emit("updateBundles"); + res.send("
"); + } + }); } - - var useWebFonts = false; - if (req.body.useWebFonts) { - useWebFonts = true; - } - - var displayTime = false; - if (req.body.displayTime) { - displayTime = true; - } - - try { - let bundle = bundleManager.getBundle(req.body.bundle); - bundleData = bundle.getBundleData(); - bundleData.displayName = req.body.displayName; - bundleData.background = req.body.background; - bundleData.duration = parseInt(req.body.duration); - bundleData.transition = transition; - bundleData.useWebFonts = useWebFonts; - bundleData.displayTime = displayTime; - bundleData.styleHeader.fontFamily = req.body.headerFontFamily; - bundleData.styleHeader.fontSize = parseInt(req.body.headerFontSize); - bundleData.styleHeader.fill = req.body.headerFill; - bundleData.styleHeader.stroke = req.body.headerStroke; - bundleData.styleText.fontFamily = req.body.textFontFamily; - bundleData.styleText.fontSize = parseInt(req.body.textFontSize); - bundleData.styleText.fill = req.body.textFill; - bundleData.styleText.stroke = req.body.textStroke; - bundle.setBundleData(bundleData); - bundle.save(); - - } catch (err) { - cli.error("error loading bundle", err); - - } - - dispatcher.emit("updateBundles"); - res.send(""); - }); + ); router.get('/edit/bundleProperties', function (req, res, next) { let bundle = req.query['bundle']; diff --git a/views/admin/editBundleProperties.twig b/views/admin/editBundleProperties.twig index 8eb0c34..57613d6 100644 --- a/views/admin/editBundleProperties.twig +++ b/views/admin/editBundleProperties.twig @@ -13,8 +13,8 @@{{ t("admin.editBundleProperties.msg1") }}
-