mirror of https://gitgud.io/fatchan/jschan.git
merge-requests/208/head
parent
f9ec124d61
commit
b3431baadf
5 changed files with 35 additions and 24 deletions
@ -1,5 +1,11 @@ |
||||
{ |
||||
"dbURL": "mongodb://", |
||||
"port": 7777, |
||||
"sessionSecret": "xxxxx" |
||||
"dbURL": "mongodb://username:password@localhost:27017", |
||||
"port": 7000, |
||||
"sessionSecret": "CHANGE ME", |
||||
"cacheTemplates": true, |
||||
"refererRegex": "^https?:\\/\\/(?:www\\.)?DOMAIN\\.TLD\\/", |
||||
"openGraph": { |
||||
"siteName": "CHANGE ME", |
||||
"url": "https://DOMAIN.TLD" |
||||
} |
||||
} |
||||
|
@ -1,12 +1,13 @@ |
||||
'use strict'; |
||||
|
||||
const outputFile = require('fs-extra').outputFile |
||||
const configs = require(__dirname+'/../configs/main.json') |
||||
, outputFile = require('fs-extra').outputFile |
||||
, pug = require('pug') |
||||
, path = require('path') |
||||
, uploadDirectory = require(__dirname+'/uploadDirectory.js') |
||||
, templateDirectory = path.join(__dirname+'/../views/pages/'); |
||||
|
||||
module.exports = async (htmlName, templateName, options) => { |
||||
const html = pug.renderFile(`${templateDirectory}${templateName}`, { ...options, cache: true }); |
||||
const html = pug.renderFile(`${templateDirectory}${templateName}`, { ...options, cache: configs.cacheTemplates, opengraph: configs.openGraph }); |
||||
return outputFile(`${uploadDirectory}html/${htmlName}`, html); |
||||
}; |
||||
|
Loading…
Reference in new issue