Open marbetschar opened 7 years ago
Safari extension would be super wonderful! Just haven't had time to get around to it.
It shouldn't be tooo hard though.
Some safari apis that would need to be figured out:
These are all the .js files that run in Chrome: https://github.com/haroldtreen/epub-press-clients/tree/master/packages/epub-press-chrome/scripts
All talking to the Browser apis is done through Browser.js
so theoretically, you should be able to update the following methods to work in Safari and make it cross platform pretty easy.
getCurrentWindowTabs
: https://github.com/haroldtreen/epub-press-clients/blob/master/packages/epub-press-chrome/scripts/browser.js#L33getLocalStorage
: https://github.com/haroldtreen/epub-press-clients/blob/master/packages/epub-press-chrome/scripts/browser.js#L73download
: https://github.com/haroldtreen/epub-press-clients/blob/master/packages/epub-press-chrome/scripts/browser.js#L109...Basically anywhere that chrome
is used 😅 .
You'd probably want something like
if (chrome) {
// Do current implementation
else {
// Do safari specific stuff.
}
Would be super cool if you were able to get it started. I haven't had the time to do it myself, but if there was a PR started I would be super keen to collaborate on that.
Thanks for offering!
I've started building the macOS Share Extension as discussed in https://github.com/haroldtreen/epub-press-clients/issues/10.
Unfortunately I'm stuck publishing the book - hoping you may help out with a basic walk through on which endpoints should be called in which order.
Can you please confirm the following is correct?
POST https://epub.press/api/v1/books
- tells the server to create the book, returns the bookId
GET https://epub.press/api/v1/books/{bookId}/status
- poll this till it returns the book is finishedGET https://epub.press/api/v1/books/{bookId}/download
- download the finished bookAnd also provide dummy parameters which should be send to the endpoints? Unfortunately I get a 404
at 1.
, so kind of rudimentary specs would really help.
Last but not least, here a little sneak peek - for simplicity I'm starting with only one article (the active tab):
Wicked! Happy to give more explanation... probably best to commit it though rather than post here :).
But the TLDR is that you seem to have it right!
GET https://epub.press/api/v1/books/{bookId}/status
this returns some json
which will include the progress. Once progress is 100, it is ready to download.GET https://epub.press/api/v1/books/{bookId}/download
will likely return 404 if the publish isn't complete.json for publish can just have:
{
"title": "Some title",
"urls": ["http://google.com"]
}
or sections:
{
"title": "Some title",
"sections": [
{ "html": "<html></html>", "title": "Empty" }
]
}
I'll write that up ASAP (just landed after 24 hours of flying and going to take a while to get up to speed).
Excited to see where this is headed :).
Thank you very much!! The Safari Share Extension for macOS works seamlessly! :) Have to tweak the app a bit more in terms of minor design issues and will then release the first version to the public.
Here's a shot of the current share extension:
Wicked! I started writing the API spec out today, but seems you beat me to it :D.
Great to hear!
I was wondering if the Safari version was still being worked on? Just found this extension but saw that it hasn't been updated in a few months.
Hey @WinterLoki !
Not sure on the status of the safari work. I think @marbetschar found a solution to his problem and left it at that.
Most of the feature requests have been on the backend, so this has been super low priority for me. But as before, I'm happy to support anyone looking to implement something for safari.
@WinterLoki I'm working on an iBook helper App which allows you to create an ePub file from the Safari extension (as for now only from the current page as you can see in the above screenshot) - as well as export non-protected DRM books including all iBook annotations as a PDF file.
Unfortunately I'm struggling with the App Store review now, since I'm not able to find any ePub2PDF framework which seems to be compatible with the guidelines.
Does it help you, if I publish the App without any PDF export functionality for now? Just with the Safari extension?
@marbetschar Definitely publish what has been done! :D
@NightMachinary you'll find the current work here: https://gitlab.com/marbetschar/iBookmarks
Please note I was able to submit the app to the App Store, since at time of creating there was no ePub2PDF library which I was able to embed in the app. If you want to export PDF from iBooks, you need to install Calibre in /Applications
.
I don't use the app anymore, therefore I have no clue if the features still work as expected - feel free to clone & modify as you see fit.
I've seen the Safari extension is already planned. Is there already any ETA available? Or is there any code which can already be used or testdriven? Would love to help out here, since Safari is my primary content browser.