From 253bb433eac5870a85e014a3df22a7eccbde1c0c Mon Sep 17 00:00:00 2001 From: Severin Puschkarski Date: Mon, 12 Sep 2016 18:22:46 +0200 Subject: [PATCH 1/3] Use Express4 route instead of app. Fixes ejs view --- lib/middleware.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/middleware.js b/lib/middleware.js index 5726b58..c434e63 100644 --- a/lib/middleware.js +++ b/lib/middleware.js @@ -7,17 +7,14 @@ im = require('imagemagick-stream'), common; module.exports = function(config){ - var app = express(), + var router = express.Router(); staticFiles = config.staticFiles, common = require('./common')(config), album = require('./album')(config), photo = require('./photo')(config); + - app.set('views', path.join(__dirname, '..', 'views')); - app.set('view engine', 'ejs'); - - - app.get('/gallery.css', function(req, res, next){ + router.get('/gallery.css', function(req, res, next){ var fstream = fs.createReadStream(path.join(__dirname, '..', 'css/gallery.css')); res.type('text/css'); fstream.on('error', function(err){ @@ -27,7 +24,7 @@ module.exports = function(config){ }); // Photo Page - app.get(/.+(\.(jpg|bmp|jpeg|gif|png|tif)(\?tn=(1|0))?)$/i, function(req, res, next){ + router.get(/.+(\.(jpg|bmp|jpeg|gif|png|tif)(\?tn=(1|0))?)$/i, function(req, res, next){ var filePath = path.join(staticFiles, req.path), fstream; @@ -99,9 +96,9 @@ module.exports = function(config){ }); // Photo Pages - anything containing */photo/* - app.get(/(.+\/)?photo\/(.+)/i, photo, common.render); + router.get(/(.+\/)?photo\/(.+)/i, photo, common.render); // Album Page - everything that doesn't contain the photo string // regex source http://stackoverflow.com/questions/406230/regular-expression-to-match-string-not-containing-a-word - app.get(/^((?!\/photo\/).)*$/, album, common.render); - return app; + router.get(/^((?!\/photo\/).)*$/, album, common.render); + return router; } From 29fbbbe2b5ec52387567de92b2ef1d3445b07811 Mon Sep 17 00:00:00 2001 From: Zevero Date: Mon, 24 Oct 2016 12:48:55 +0200 Subject: [PATCH 2/3] Remove css from template - please include manually --- views/album.ejs | 2 -- 1 file changed, 2 deletions(-) diff --git a/views/album.ejs b/views/album.ejs index 674b1ea..7e18b54 100644 --- a/views/album.ejs +++ b/views/album.ejs @@ -1,5 +1,3 @@ - - <% if (!isRoot){ %>