Open btzr-io opened 6 years ago
Something like this?
api/reader?source=url...
We could also pass default settings:
api/reader?source=url..&nightmode=true
This is a good idea. Then people could use it to post a link to a comic, or embed the reader in another web app. Cool.
@workhorsy I did some work on this, Here is the current usage:
If no file is provided it should show the files
component:
Does it work with loading files? I tried
http://localhost:8080/#/reader?file=http://localhost:9999/example.cbr
and it does not load. It still loads the test images.
Is it hooked up to loading files from cbz yet?
@workhorsy do a git pull
and try this:
I tried to use the uncompress download example but isn't working :confused:
action: "error" , error: "Failed to open 'rar' archive."
Update: uncompress works in the main tread but not inside the web-worker
@workhorsy Any ideas? Let me know if you have time to look into this.
https://github.com/btzr-io/comic_book_reader/blob/preact/src/routes/viewer/view.jsx#L42
https://github.com/btzr-io/comic_book_reader/blob/preact/src/routes/viewer/lib/uncompress.worker.js
I'll see if I can figure it out. I might be able to squeeze in some time in the morning.
Looks like zip is working:
http://localhost:8080/#/reader?file=http://localhost:8080/test/example.cbz
but not rar:
http://localhost:8080/#/reader?file=http://localhost:8080/test/example.cbr
I think I've got it figured out. The problem is that the worker calls loadArchiveFormats(['rar', 'zip', 'tar']) to start loading the compression formats. But the view starts sending it messages before loadArchiveFormats is done. You need the worker to send a signal to the view when it is done with loadArchiveFormats.
Here is a PR to fix this. I should probably update the uncompress.js worker example to do this too. It looks like a usability bug. Now this should work
http://localhost:8080/#/reader?file=http://localhost:8080/test/example.cbr
Great thanks!, I'll merge this ASAP.
Here is the live demo (at least now it's working): https://btzr-io.github.io/comic_book_reader/#/reader?file=https://raw.githubusercontent.com/workhorsy/uncompress.js/master/example_rar_5.rar
Embed api to integrate on other websites and apps. @workhorsy See: https://github.com/lbryio/lbry-app/issues/1377