2017-03-28 03:25:36 -04:00
|
|
|
'use strict'
|
2017-06-01 04:47:52 -04:00
|
|
|
const fs = require('fs')
|
|
|
|
const path = require('path')
|
2017-03-28 03:25:36 -04:00
|
|
|
|
|
|
|
exports.isSQLite = function isSQLite (sequelize) {
|
|
|
|
return sequelize.options.dialect === 'sqlite'
|
|
|
|
}
|
2017-05-08 04:22:52 -04:00
|
|
|
|
|
|
|
exports.getImageMimeType = function getImageMimeType (imagePath) {
|
|
|
|
var fileExtension = /[^.]+$/.exec(imagePath)
|
|
|
|
|
|
|
|
switch (fileExtension[0]) {
|
2017-05-08 05:00:45 -04:00
|
|
|
case 'bmp':
|
|
|
|
return 'image/bmp'
|
|
|
|
case 'gif':
|
|
|
|
return 'image/gif'
|
|
|
|
case 'jpg':
|
|
|
|
case 'jpeg':
|
|
|
|
return 'image/jpeg'
|
|
|
|
case 'png':
|
|
|
|
return 'image/png'
|
|
|
|
case 'tiff':
|
|
|
|
return 'image/tiff'
|
2017-05-08 04:22:52 -04:00
|
|
|
default:
|
|
|
|
return undefined
|
|
|
|
}
|
|
|
|
}
|
2017-06-01 04:47:52 -04:00
|
|
|
|
|
|
|
exports.isRevealTheme = function isRevealTheme (theme) {
|
2017-06-02 06:34:35 -04:00
|
|
|
if (fs.existsSync(path.join(__dirname, '..', 'public', 'build', 'reveal.js', 'css', 'theme', theme + '.css'))) {
|
2017-06-01 04:47:52 -04:00
|
|
|
return theme
|
|
|
|
}
|
|
|
|
return undefined
|
|
|
|
}
|