Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Bibi with PyQt5 and QtWebEngine in local mode always fails #118

Open
kevinhendricks opened this issue May 5, 2021 · 1 comment
Open

Comments

@kevinhendricks
Copy link

kevinhendricks commented May 5, 2021

I am building aPyQt5 app that used QtWebEngine (chrome browser engine) in local mode to open a local url. I have explicitly allowed local mode access in QtWebEngine (think Qt's version of Electron)

But bibi.js seems to be preventing any local file url from being used even though the QtWebEngine code explicitly is set to allow it.

ERROR: file:///Users/kbhend/Desktop/BibiReader/bibi/resources/scripts/bibi.js:11: Bibi can't open books via URL on local mode

If I comment out that line it will get slightly further and then fail with:

ERROR: file:///Users/kbhend/Desktop/BibiReader/bibi/resources/scripts/bibi.js:11: Failed to open the book (Probably CORS Blocked)

So unlike, Readium, and FuturePress epubjs, Bibi will not allow you to pass in a file url to a local unpacked epub even through the entire browser engine is housed locally, has explicitly given access to local file urls, and the path is local and relative to the bidi/index.html.

Are their settings in default.js or someplace else in Bidi that I can use to override this behaviour so that a standalone local reader can be developed.

We are trying to develop a set of Sigil plugins to view the current contents of the epub being edited in Sigil via various browser based e-readers so that epub developers can see what works and what does not more easily.

Thanks for any pointers.

ps. Without passing the query ?book=ebook, Bibi will nicely fire up and ask us to drag an .epub file on it whereas we need to pass it a file url to an already unpacked epub that is under Sigil's plugin control.

@kevinhendricks
Copy link
Author

If I rezip the unpacked epub, I can pass its url just fine via the query. The issue is only with local unpacked epubs. I started studying bibi_heart.js and it appears to allow remote unpacked epubs but not local. This appears to be an artificial restriction. It would be silly to have to zip up the unpacked epub currently being edited in Sigil just to hand it to Bibi to be unzipped immediately. Being able to load local unpacked epubs would seem to be a reasonably valuable ability when using Bibi with things like Electron or QtWebEngine to create a completely local reader app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant