View Single Post
Old 04-04-2024, 03:46 AM   #1
endriu
Enthusiast
endriu began at the beginning.
 
Posts: 32
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