From 5027cdff634fdf0fb6e40b6459838ab87e4781de Mon Sep 17 00:00:00 2001 From: daniel-j Date: Wed, 17 Aug 2016 10:37:41 +0200 Subject: [PATCH] make metadata cacheable --- extension/manifest.json | 2 +- package.json | 2 +- src/FimFic2Epub.js | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/extension/manifest.json b/extension/manifest.json index a554648..137f887 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -4,7 +4,7 @@ "name": "fimfic2epub", "short_name": "fimfic2epub", "description": "Improved EPUB exporter for Fimfiction", - "version": "1.1.5", + "version": "1.1.6", "icons": { "128": "icon-128.png" diff --git a/package.json b/package.json index 7be442f..c80afec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fimfic2epub", - "version": "1.1.5", + "version": "1.1.6", "description": "Tool to generate EPUB ebooks from fimfiction stories", "author": "djazz", "repository": { diff --git a/src/FimFic2Epub.js b/src/FimFic2Epub.js index 8ea71e7..3426a51 100644 --- a/src/FimFic2Epub.js +++ b/src/FimFic2Epub.js @@ -53,7 +53,17 @@ module.exports = class FimFic2Epub { reject(data.error) return } - if (!data.story.chapters) data.story.chapters = [] + let story = data.story + // this is so the metadata can be cached. + if (!story.chapters) story.chapters = [] + delete story.likes + delete story.dislikes + delete story.views + delete story.total_views + delete story.comments + story.chapters.forEach((ch) => { + delete ch.views + }) resolve(data.story) }) }) @@ -416,7 +426,7 @@ module.exports = class FimFic2Epub { compressionOptions: {level: 9} }).then((file) => { this.cachedFile = file - resolve(file) + resolve(file, this.filename) }) }) }