修复书本读取
parent
e855b5cd26
commit
5435bc6482
|
@ -28,7 +28,7 @@
|
||||||
<div class="detail" :class="{blur: !curr.code}">
|
<div class="detail" :class="{blur: !curr.code}">
|
||||||
|
|
||||||
<book :for="it in books">
|
<book :for="it in books">
|
||||||
<img :src="'book://' + it.title + '/' + it.cover">
|
<img :src="'book://cache/' + it.title + '/' + it.cover">
|
||||||
{{it.title}}
|
{{it.title}}
|
||||||
</book>
|
</book>
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ Anot({
|
||||||
while (this.load.curr < this.load.num) {
|
while (this.load.curr < this.load.num) {
|
||||||
this.load.curr++
|
this.load.curr++
|
||||||
let book = files.pop()
|
let book = files.pop()
|
||||||
let res = app.dispatch('parse-book', { book, cate: this.burr })
|
let res = app.dispatch('parse-book', { book, cate: this.curr })
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res) {
|
if (res) {
|
||||||
this.books.push(res)
|
this.books.push(res)
|
||||||
|
|
|
@ -65,11 +65,11 @@ app.once('ready', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
protocol.registerStreamProtocol('book', function(req, cb) {
|
protocol.registerStreamProtocol('book', function(req, cb) {
|
||||||
var file = decodeURIComponent(req.url.replace(/^book:[\/]+/, '/'))
|
var file = decodeURIComponent(req.url.replace(/^book:[\/]+cache/, './'))
|
||||||
var ext = path.extname(file)
|
var ext = path.extname(file)
|
||||||
|
|
||||||
file = path.resolve(CACHE_DIR, file)
|
file = path.resolve(CACHE_DIR, file)
|
||||||
|
console.log(file)
|
||||||
cb({
|
cb({
|
||||||
data: fs.origin.createReadStream(file),
|
data: fs.origin.createReadStream(file),
|
||||||
mimeType: MIME_TYPES[ext] || MIME_TYPES.all,
|
mimeType: MIME_TYPES[ext] || MIME_TYPES.all,
|
||||||
|
|
|
@ -113,6 +113,7 @@ module.exports = function(app) {
|
||||||
} else {
|
} else {
|
||||||
cache[cate] = [info]
|
cache[cate] = [info]
|
||||||
}
|
}
|
||||||
|
fs.echo(JSON.stringify(cache), DB_FILE)
|
||||||
ev.returnValue = info
|
ev.returnValue = info
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
/Users/yutent/Library/Application Support/org.bytedo.epub/app.cache
|
Loading…
Reference in New Issue