mirror of
https://github.com/daniel-j/fimfic2epub.git
synced 2024-09-30 00:56:13 +13:00
fix remote resources bug
This commit is contained in:
parent
6e24d047d3
commit
ee20ef8b7e
3 changed files with 31 additions and 32 deletions
|
@ -4,7 +4,7 @@
|
||||||
"name": "fimfic2epub",
|
"name": "fimfic2epub",
|
||||||
"short_name": "fimfic2epub",
|
"short_name": "fimfic2epub",
|
||||||
"description": "Improved EPUB exporter for Fimfiction",
|
"description": "Improved EPUB exporter for Fimfiction",
|
||||||
"version": "1.4.0",
|
"version": "1.4.1",
|
||||||
|
|
||||||
"icons": {
|
"icons": {
|
||||||
"128": "icon-128.png"
|
"128": "icon-128.png"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "fimfic2epub",
|
"name": "fimfic2epub",
|
||||||
"version": "1.4.0",
|
"version": "1.4.1",
|
||||||
"description": "Tool to generate improved EPUB ebooks from Fimfiction stories",
|
"description": "Tool to generate improved EPUB ebooks from Fimfiction stories",
|
||||||
"author": "djazz",
|
"author": "djazz",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -137,6 +137,7 @@ class FimFic2Epub extends Emitter {
|
||||||
this.pcache.fetchAll = this.fetchMetadata()
|
this.pcache.fetchAll = this.fetchMetadata()
|
||||||
.then(this.fetchChapters.bind(this))
|
.then(this.fetchChapters.bind(this))
|
||||||
.then(this.fetchCoverImage.bind(this))
|
.then(this.fetchCoverImage.bind(this))
|
||||||
|
.then(this.buildChapters.bind(this))
|
||||||
.then(this.fetchRemoteFiles.bind(this))
|
.then(this.fetchRemoteFiles.bind(this))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.progress(0, 0.95)
|
this.progress(0, 0.95)
|
||||||
|
@ -322,41 +323,39 @@ class FimFic2Epub extends Emitter {
|
||||||
this.cachedFile = null
|
this.cachedFile = null
|
||||||
this.zip = null
|
this.zip = null
|
||||||
|
|
||||||
return this.buildChapters().then(() => {
|
this.replaceRemoteResources()
|
||||||
this.replaceRemoteResources()
|
|
||||||
|
|
||||||
this.zip = new JSZip()
|
this.zip = new JSZip()
|
||||||
|
|
||||||
this.zip.file('mimetype', 'application/epub+zip')
|
this.zip.file('mimetype', 'application/epub+zip')
|
||||||
this.zip.file('META-INF/container.xml', containerXml)
|
this.zip.file('META-INF/container.xml', containerXml)
|
||||||
|
|
||||||
this.zip.file('OEBPS/content.opf', template.createOpf(this))
|
this.zip.file('OEBPS/content.opf', template.createOpf(this))
|
||||||
|
|
||||||
if (this.coverImage) {
|
if (this.coverImage) {
|
||||||
this.zip.file('OEBPS/' + this.coverFilename, this.coverImage)
|
this.zip.file('OEBPS/' + this.coverFilename, this.coverImage)
|
||||||
|
}
|
||||||
|
this.zip.file('OEBPS/Text/cover.xhtml', template.createCoverPage(this))
|
||||||
|
this.zip.file('OEBPS/Styles/coverstyle.css', coverstyleCss)
|
||||||
|
|
||||||
|
this.zip.file('OEBPS/Text/title.xhtml', template.createTitlePage(this))
|
||||||
|
this.zip.file('OEBPS/Styles/titlestyle.css', titlestyleCss)
|
||||||
|
|
||||||
|
this.zip.file('OEBPS/Text/nav.xhtml', template.createNav(this))
|
||||||
|
this.zip.file('OEBPS/toc.ncx', template.createNcx(this))
|
||||||
|
|
||||||
|
for (let i = 0; i < this.chapters.length; i++) {
|
||||||
|
let filename = 'OEBPS/Text/chapter_' + zeroFill(3, i + 1) + '.xhtml'
|
||||||
|
let html = this.chaptersHtml[i]
|
||||||
|
this.zip.file(filename, html)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.zip.file('OEBPS/Styles/style.css', styleCss)
|
||||||
|
|
||||||
|
this.remoteResources.forEach((r) => {
|
||||||
|
if (r.dest) {
|
||||||
|
this.zip.file('OEBPS/' + r.dest, r.data)
|
||||||
}
|
}
|
||||||
this.zip.file('OEBPS/Text/cover.xhtml', template.createCoverPage(this))
|
|
||||||
this.zip.file('OEBPS/Styles/coverstyle.css', coverstyleCss)
|
|
||||||
|
|
||||||
this.zip.file('OEBPS/Text/title.xhtml', template.createTitlePage(this))
|
|
||||||
this.zip.file('OEBPS/Styles/titlestyle.css', titlestyleCss)
|
|
||||||
|
|
||||||
this.zip.file('OEBPS/Text/nav.xhtml', template.createNav(this))
|
|
||||||
this.zip.file('OEBPS/toc.ncx', template.createNcx(this))
|
|
||||||
|
|
||||||
for (let i = 0; i < this.chapters.length; i++) {
|
|
||||||
let filename = 'OEBPS/Text/chapter_' + zeroFill(3, i + 1) + '.xhtml'
|
|
||||||
let html = this.chaptersHtml[i]
|
|
||||||
this.zip.file(filename, html)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.zip.file('OEBPS/Styles/style.css', styleCss)
|
|
||||||
|
|
||||||
this.remoteResources.forEach((r) => {
|
|
||||||
if (r.dest) {
|
|
||||||
this.zip.file('OEBPS/' + r.dest, r.data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue