From e5834c077f203aa5c80f777f91e0bf650614241d Mon Sep 17 00:00:00 2001
From: butlerx
Date: Wed, 31 May 2017 23:28:43 +0100
Subject: add the ability to set slide theme in slide options
---
lib/response.js | 1 +
public/views/slide.ejs | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/lib/response.js b/lib/response.js
index a9abd1d4..fec6c561 100755
--- a/lib/response.js
+++ b/lib/response.js
@@ -574,6 +574,7 @@ function showPublishSlide (req, res, next) {
updatetime: updatetime,
url: origin,
body: markdown,
+ theme: meta.slideOptions.theme,
meta: JSON.stringify(extracted.meta),
useCDN: config.usecdn,
owner: note.owner ? note.owner.id : null,
diff --git a/public/views/slide.ejs b/public/views/slide.ejs
index 26c38bba..7ff5016e 100644
--- a/public/views/slide.ejs
+++ b/public/views/slide.ejs
@@ -30,7 +30,11 @@
<% } %>
+ <% if(typeof theme !== 'undefined' && theme) { %>
+
+ <% } else { %>
+ <% } %>
--
cgit v1.2.3
From c531d96f6617663dae8534aba2623f541c7d12de Mon Sep 17 00:00:00 2001
From: butlerx
Date: Thu, 1 Jun 2017 09:47:52 +0100
Subject: check if reveal theme exists
---
lib/response.js | 3 ++-
lib/utils.js | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/response.js b/lib/response.js
index fec6c561..cda484e7 100755
--- a/lib/response.js
+++ b/lib/response.js
@@ -13,6 +13,7 @@ var moment = require('moment')
var config = require('./config')
var logger = require('./logger')
var models = require('./models')
+var utils = require('./utils')
// public
var response = {
@@ -574,7 +575,7 @@ function showPublishSlide (req, res, next) {
updatetime: updatetime,
url: origin,
body: markdown,
- theme: meta.slideOptions.theme,
+ theme: utils.isRevealTheme(meta.slideOptions.theme),
meta: JSON.stringify(extracted.meta),
useCDN: config.usecdn,
owner: note.owner ? note.owner.id : null,
diff --git a/lib/utils.js b/lib/utils.js
index d9289dca..fe70a0f1 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -1,4 +1,6 @@
'use strict'
+const fs = require('fs')
+const path = require('path')
exports.isSQLite = function isSQLite (sequelize) {
return sequelize.options.dialect === 'sqlite'
@@ -23,3 +25,10 @@ exports.getImageMimeType = function getImageMimeType (imagePath) {
return undefined
}
}
+
+exports.isRevealTheme = function isRevealTheme (theme) {
+ if (fs.existsSync(path.join(process.cwd(), 'public', 'build', 'reveal.js', 'css', 'theme', theme + '.css'))) {
+ return theme
+ }
+ return undefined
+}
--
cgit v1.2.3
From 0c827703c1cf24cd6a04b56dd25de483873fe0f3 Mon Sep 17 00:00:00 2001
From: butlerx
Date: Fri, 2 Jun 2017 11:34:35 +0100
Subject: switch to __dirname
---
lib/utils.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/utils.js b/lib/utils.js
index fe70a0f1..247f85f2 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -27,7 +27,7 @@ exports.getImageMimeType = function getImageMimeType (imagePath) {
}
exports.isRevealTheme = function isRevealTheme (theme) {
- if (fs.existsSync(path.join(process.cwd(), 'public', 'build', 'reveal.js', 'css', 'theme', theme + '.css'))) {
+ if (fs.existsSync(path.join(__dirname, '..', 'public', 'build', 'reveal.js', 'css', 'theme', theme + '.css'))) {
return theme
}
return undefined
--
cgit v1.2.3