From 16c45a1795aec34021b27d0128eee50479e12dc7 Mon Sep 17 00:00:00 2001 From: benweet Date: Thu, 28 Aug 2014 00:04:27 +0100 Subject: [PATCH] Landing page (final) --- app/index.js | 44 ++- public/html/gdrive-action.html | 2 +- public/res/WELCOME.md | 10 +- public/res/extensions/welcomeTour.js | 2 +- public/res/img/icons.png | Bin 5069 -> 5071 bytes public/res/img/icons2x.png | Bin 12296 -> 12323 bytes public/res/img/stackedit-32.ico | Bin 5430 -> 5430 bytes public/res/styles/base.less | 1 - public/res/styles/main.less | 17 +- public/sitemap.xml | 28 ++ views/editor.html | 31 ++ views/error_404.html | 22 ++ views/landing.html | 481 +++++++++++++++++++++++++++ views/viewer.html | 29 ++ 14 files changed, 634 insertions(+), 33 deletions(-) create mode 100644 public/sitemap.xml create mode 100644 views/editor.html create mode 100644 views/error_404.html create mode 100644 views/landing.html create mode 100644 views/viewer.html diff --git a/app/index.js b/app/index.js index bf082004..d3767383 100644 --- a/app/index.js +++ b/app/index.js @@ -1,8 +1,10 @@ var express = require('express'); var app = express(); +var compression = require('compression'); +var serveStatic = require('serve-static'); // Configure ejs engine -app.set('views', __dirname + '/../public'); +app.set('views', __dirname + '/../views'); app.engine('html', require('ejs').renderFile); // Force HTTPS on stackedit.io @@ -15,28 +17,42 @@ app.all('*', function(req, res, next) { }); // Use gzip compression -app.use(express.compress()); +app.use(compression()); // Serve static resources -app.use(express.static(__dirname + '/../public')); - -// Serve editor.html in /viewer -app.get('/editor', function (req, res) { - res.render('editor.html'); -}); - -// Serve viewer.html in /viewer -app.get('/viewer', function (req, res) { - res.render('viewer.html'); -}); +app.use(serveStatic(__dirname + '/../public')); app.post('/pdfExport', require('./pdf').export); app.post('/sshPublish', require('./ssh').publish); app.post('/picasaImportImg', require('./picasa').importImg); app.get('/downloadImport', require('./download').importPublic); -// Error 404 app.use(function(req, res, next) { + res.renderDebug = function(page) { + return res.render(page, { + cache: !req.query.hasOwnProperty('debug') + }); + }; + next(); +}); + +// Serve landing.html in / +app.get('/', function(req, res) { + res.renderDebug('landing.html'); +}); + +// Serve editor.html in /viewer +app.get('/editor', function(req, res) { + res.renderDebug('editor.html'); +}); + +// Serve viewer.html in /viewer +app.get('/viewer', function(req, res) { + res.renderDebug('viewer.html'); +}); + +// Error 404 +app.use(function(req, res) { res.status(404); res.render('error_404.html'); }); diff --git a/public/html/gdrive-action.html b/public/html/gdrive-action.html index f6fce3ee..50f6d711 100644 --- a/public/html/gdrive-action.html +++ b/public/html/gdrive-action.html @@ -3,7 +3,7 @@ + + + + + + diff --git a/views/error_404.html b/views/error_404.html new file mode 100644 index 00000000..0e0f3537 --- /dev/null +++ b/views/error_404.html @@ -0,0 +1,22 @@ + + + + + StackEdit - 404 + + + + + + + + +
+

+ +

+

404 — Page not found

+

Looking for StackEdit recovery?

+ + + diff --git a/views/landing.html b/views/landing.html new file mode 100644 index 00000000..6bd3df00 --- /dev/null +++ b/views/landing.html @@ -0,0 +1,481 @@ + +> + + + StackEdit – In-browser markdown editor + + + + + + + + + + + + + + +
+ + + + + +
+
+ + +
+ + + diff --git a/views/viewer.html b/views/viewer.html new file mode 100644 index 00000000..d0a02279 --- /dev/null +++ b/views/viewer.html @@ -0,0 +1,29 @@ + +> + + + StackEdit Viewer + + + + + + + + + + + + + +