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/
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",
"version": "0.0.0",
"version": "0.1.0",
"description": "A digital give-a-book, take-a-book library for ebooks",
"main": "server.js",
"scripts": {

View File

@ -30,7 +30,7 @@ module.exports = function (app) {
}),
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,
title: bookData.title,
author: bookData.author,

View File

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

View File

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

View File

@ -26,6 +26,11 @@ module.exports = class {
.replace(/\{\{allowedFormats\}\}/g, settings.allowedFormats.join(','))
.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) {
const regExp = new RegExp('\{\{' + templateVar + '\}\}', 'g')
filledTemplate = filledTemplate.replace(regExp, templateVars[templateVar]);

View File

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