haroldtreen / epub-press-clients

📦 Clients for building books with EpubPress.
https://epub.press
GNU General Public License v3.0
585 stars 69 forks source link

Add functionality for users to type in an author as metadata #100

Open sanujar opened 2 years ago

sanujar commented 2 years ago

While I was working on the epub-press server, I noticed the lack of an author field in the Chrome popup, and since I've familiarised myself with epub-press's code (and this appears to be on the roadmap for the Chrome extension), I decided to give this a shot. It isn't automatically identified authors, but it's still better than not being able to sort through all the different articles epub-press has created from many different sites.

From what tests I have carried out, this works fine, with the input in the popup being used to modify the author in the book's metadata, with a placeholder of EpubPress being the fallback. I don't think I've messed anything up, but please do let me know if anything needs changing.

EDIT: I don't know if I broke something, but Chrome is now giving this error on the extensions page:

Error in event handler: TypeError: Cannot read properties of undefined (reading 'current') Context - _generated_background_page.html Stack Trace - build/background.js:223 (downloadListener)

} else if (downloadInfo.endTime || downloadInfo.state.current === 'complete') {

haroldtreen commented 2 years ago

Hey - thanks for adding this! Weird to hear you're seeing a chrome error... doesn't look related... looks more like the server isn't happy about something / isn't returning expected json?

Will try and pull this down to check it out...

sanujar commented 2 years ago

I just pulled the main fork of the project down and added it to Chrome (without any of my modifications) and I'm getting the same error once I initiate a download. The download is working absolutely fine as far as I can tell, so I don't really know what's going on here.

haroldtreen commented 2 years ago

Hmmm.... I wonder what the server is responding with... usually you can see if you inspect the background page and look at network requests.

Have a doc here that goes over some debugging tips: https://github.com/haroldtreen/epub-press-clients/blob/master/packages/epub-press-chrome/DEBUGGING.md

sanujar commented 2 years ago

This is what I get when inspecting the background page and creating an ebook (with the extension from this branch with no modifications). All the responses seem to be 2xx, and the download still works, so...

EDIT: This is popping up in the console every time I do a download:

_generated_background_page.html:1 Error in event handler: TypeError: Cannot read properties of undefined (reading 'current') at downloadListener (chrome-extension://jkghpjgehglfekpkdbehhjibkpjfoobd/build/background.js:223:69)