Compare commits

...

4 Commits

9 changed files with 18 additions and 4 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ public/history/*.json
.well-known/ .well-known/
settings.json settings.json
customHtmlAfterFooter.html

BIN
README.md

Binary file not shown.

View File

@ -0,0 +1,5 @@
<script>
$(document).ready(function() {
console.log('This runs after everything else is loaded.');
});
</script>

View File

@ -1,6 +1,6 @@
{ {
"name": "little-library", "name": "little-library",
"version": "0.0.0", "version": "0.1.0",
"description": "A digital give-a-book, take-a-book library for ebooks", "description": "A digital give-a-book, take-a-book library for ebooks",
"main": "server.js", "main": "server.js",
"scripts": { "scripts": {

View File

@ -30,7 +30,7 @@ module.exports = function (app) {
}), }),
footer: '<a class="button close">Close</a>', footer: '<a class="button close">Close</a>',
}); });
return app.templater.fill('./templates/elements/book.html', { return app.templater.fill('./templates/elements/book_readable.html', {
id, id,
title: bookData.title, title: bookData.title,
author: bookData.author, author: bookData.author,

View File

@ -181,8 +181,8 @@ Server.prototype.start = function () {
console.log('Started server on port ' + (process.env.PORT || settings.port)); console.log('Started server on port ' + (process.env.PORT || settings.port));
}); });
if (this.https) { if (this.https) {
this.https.listen(443, () => { this.https.listen(settings.sslPort, () => {
console.log('Started SSL server on port 443'); console.log('Started SSL server on port ' + settings.sslPort);
}); });
} }
} }

View File

@ -10,6 +10,7 @@
"allowedFormats": [".epub", ".mobi", ".pdf"], "allowedFormats": [".epub", ".mobi", ".pdf"],
"toolsPassword": "password", "toolsPassword": "password",
"hideVisitors": false, "hideVisitors": false,
"sslPort": 443,
"sslPrivateKey": null, "sslPrivateKey": null,
"sslCertificate": null, "sslCertificate": null,
"sslCertificateAuthority": null, "sslCertificateAuthority": null,

View File

@ -26,6 +26,11 @@ module.exports = class {
.replace(/\{\{allowedFormats\}\}/g, settings.allowedFormats.join(',')) .replace(/\{\{allowedFormats\}\}/g, settings.allowedFormats.join(','))
.replace(/\{\{maxFileSize\}\}/g, (settings.maxFileSize > 0 ? settings.maxFileSize + 'MB' : 'no')); .replace(/\{\{maxFileSize\}\}/g, (settings.maxFileSize > 0 ? settings.maxFileSize + 'MB' : 'no'));
if (fs.existsSync(path.resolve('./customHtmlAfterFooter.html'))) {
const customHtmlAfterFooter = fs.readFileSync(path.resolve('./customHtmlAfterFooter.html'));
filledTemplate = filledTemplate.replace(/\{\{customHtmlAfterFooter\}\}/g, customHtmlAfterFooter);
}
for (let templateVar in templateVars) { for (let templateVar in templateVars) {
const regExp = new RegExp('\{\{' + templateVar + '\}\}', 'g') const regExp = new RegExp('\{\{' + templateVar + '\}\}', 'g')
filledTemplate = filledTemplate.replace(regExp, templateVars[templateVar]); filledTemplate = filledTemplate.replace(regExp, templateVars[templateVar]);

View File

@ -86,6 +86,8 @@
{{modal}} {{modal}}
<script src="{{resourcePath}}js/little-library.js"></script> <script src="{{resourcePath}}js/little-library.js"></script>
{{customHtmlAfterFooter}}
</body> </body>
</html> </html>