Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle

Notices

Reply
 
Thread Tools Search this Thread
Old 04-04-2024, 04:46 AM   #1
endriu
Enthusiast
endriu began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Apr 2013
Device: Kindle Paperwhite
Post Send to Kindle extension sideloading hack

After inspecting the code of the Send to Kindle extension I discovered that it generates complete EPUB files and uploads them to S3 for further processing.

Therefore, the code can be modified to download the file to disk instead of uploading it to the cloud. This modification may prove useful for individuals who sideload their ebooks but still want to utilize the extension for web articles, etc., particularly considering the unresolved Amazon bug that wipes out sideloaded ebooks upon connecting to the network.

To implement this modification, follow these steps:

1. Locate the extension code on your system. For example, on my system, it resides in:

Code:
C:\Users\<Profile>\AppData\Local\Google\Chrome\User Data\Default\Extensions\cgdjpilhipecahhcilnafpblkieebhea
2. Copy the entire folder found at the above location (e.g., 2.1.1.7_0 - the current version of the extension) and paste it into a temporary location.

3. Remove the original extension from your browser.

4. In the copied folder, locate the manifest.json file and remove the "differential_fingerprint" key. Save the file.

5. Next, find the file named s2k-worker.js. Open it and search for the function called "sendWorkflow". Right after the "try {" statement, add the following lines:

Code:
const dataURI = `data:application/octet-stream;base64,${documentMetadata.epubString}`;
chrome.downloads.download({ url: dataURI, filename: 'download.epub' });
Optionally, if you don't want your documents to be uploaded to the cloud, add:
Code:
throw new Error();
6. In your browser, open the Extensions management page (chrome://extensions/). Toggle developer mode on the right. Then, drag the entire folder (e.g., 2.1.1.7_0 or whichever version you have) to that page. The extension may require you to log in again.

You can now use the extension as before. When you click "Send," you will be prompted to save the EPUB file.
endriu is offline   Reply With Quote
Old 04-04-2024, 04:25 PM   #2
tomsem
Grand Sorcerer
tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.
 
Posts: 6,772
Karma: 26974049
Join Date: Apr 2009
Location: USA
Device: iPhone 15PM, Kindle Scribe, iPad mini 6, PocketBook InkPad Color 3
Why not just use one of the extensions that converts (web articles etc) to ePub directly?
tomsem is offline   Reply With Quote
Advert
Old 04-04-2024, 04:27 PM   #3
slm
Fool
slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.
 
Posts: 424
Karma: 3585252
Join Date: Feb 2003
Device: Kindle: Voyage,PW1,KOA, Kobo: Clara Colour, Nook GLP, Pocketbook verse
That's cool.


It would be nice if there is a way to have Calibre send epubs to Kindle using Send to Kindle, instead of email. Do you think that you've learned enough about the Send to Kindle extension that there is a way to do that?
slm is offline   Reply With Quote
Old 04-04-2024, 04:41 PM   #4
tomsem
Grand Sorcerer
tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.
 
Posts: 6,772
Karma: 26974049
Join Date: Apr 2009
Location: USA
Device: iPhone 15PM, Kindle Scribe, iPad mini 6, PocketBook InkPad Color 3
Quote:
Originally Posted by slm View Post
That's cool.


It would be nice if there is a way to have Calibre send epubs to Kindle using Send to Kindle, instead of email. Do you think that you've learned enough about the Send to Kindle extension that there is a way to do that?
The extension is linked to your Amazon account. Calibre cannot do that, so you would need to supply your credentials (including 2nd factor) every time you send a book. Email doesn't require any credentials, just whitelist of the sender address.

OpenAudible has a way of registering with Audible: it uses an in-app web browser to login to Audible and after that it's 'trusted' to download AAX. Maybe some approach like that would work with calibre too. OpenAudible is open source so it's there for borrowing code.
tomsem is offline   Reply With Quote
Old 04-05-2024, 02:20 AM   #5
endriu
Enthusiast
endriu began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Apr 2013
Device: Kindle Paperwhite
Quote:
Originally Posted by tomsem View Post
Why not just use one of the extensions that converts (web articles etc) to ePub directly?
I just like the way Amazon does the conversion. I remember trying some other tools in the past and it wasn't that good.
endriu is offline   Reply With Quote
Advert
Old 04-05-2024, 03:57 AM   #6
endriu
Enthusiast
endriu began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Apr 2013
Device: Kindle Paperwhite
Quote:
Originally Posted by slm View Post
That's cool.


It would be nice if there is a way to have Calibre send epubs to Kindle using Send to Kindle, instead of email. Do you think that you've learned enough about the Send to Kindle extension that there is a way to do that?
Further down that "sendWorkflow" function there is code that fetches a pre-signed URL for S3 upload and then uploads the file to S3. Then I suppose it gets picked up and put in the conversion and distribution pipeline. To wire it up with Calibre it would require a plugin I guess.
endriu is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send new custom extension as a book format to device nami Devices 1 03-07-2024 08:57 AM
Chrome 73 and Send To Kindle extension hius07 Amazon Kindle 2 03-15-2019 02:54 PM
Send to Kindle iOS extension not working twowheels Amazon Kindle 3 02-13-2019 10:50 PM
Chrome Browser and send to Kindle extension janrey Amazon Kindle 14 12-08-2011 03:50 PM
Send websites / links to Kindle - extension for browser? scenox Kindle Developer's Corner 0 12-20-2010 01:23 PM


All times are GMT -4. The time now is 05:29 AM.


MobileRead.com is a privately owned, operated and funded community.