aecreations / clippings

Clippings: an extension for Mozilla Firefox
20 stars 4 forks source link

Handle compressed sync data from Sync Clippings Helper #434

Closed aecreations closed 1 week ago

aecreations commented 10 months ago

A forum poster suggested compressing the synced clippings data into ZIP format to bypass the 1 MiB limit imposed by the native messaging API[1] to allow more data to be synced. Forum post: https://groups.io/g/aecreations-help/message/48

This will require that the user upgrade Sync Clippings Helper to a newer version that supports compressed sync data. See related issue: aecreations/sync-clippings#18.

Clippings should request the synced data from Sync Clippings Helper by sending a new native message, get-compressed-synced-clippings. It should then unzip the sync data in the native message response before refreshing the data in the Synced Clippings folder.

If the user doesn't have the new version of Sync Clippings Helper installed, then show a error notification and display an error message in Clippings Manager, if open. Then, retry sync by sending the old native message get-synced-clippings to retrieve the normal, uncompressed sync data.

-- [1] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging

aecreations commented 10 months ago

If using the Python gzip library in Sync Clippings Helper, then theoretically, the Compression Streams API can be used to decompress the data in Clippings: https://developer.mozilla.org/en-US/docs/Web/API/Compression_Streams_API.

This JavaScript API is available in Firefox 113 and newer.