kairi003 / Get-cookies.txt-LOCALLY

Get cookies.txt, NEVER send information outside.
MIT License
412 stars 38 forks source link

[Feature request] Ability to overwrite the older cookie file if it exists while exporting & also the ability to change default path for downloading when clicking "export". #74

Open jnxr opened 3 months ago

jnxr commented 3 months ago

The saved cookie file name normally follows the renaming scheme of the OS when it encounters an older file with the same name. The requested feature would make it possible to overwrite the older file while exporting, instead of using the "Export as" function and renaming the cookie file to the original file and then choosing to overwrite it manually every-time.

The second feature would allow the user to change the path used by the "Export" option to one chosen by the user, instead of the browser's download folder.

kairi003 commented 3 months ago

Is this technically possible? "Export" is the browser's ability to download files, and "Export as" is the ability to get an access handle to a specific file path via the File System API and "save as". For security reasons, user UI operation is required to obtain an access handle.

To achieve export to an arbitrary default directory, it would be necessary to maintain an access handle to the directory. This could be stored in IndexedDB, for example, but that is not something the extension should touch. Also, it would be host specific. Can the handle be stored in the chrome.storage API? I don't know.

I don't know if this would be implemented in this extension, but if anyone knows of a smart way to do it, please let me know.

jnxr commented 3 months ago

How about manipulating the api to put only the cookie files into a different folder in Downloads? Inside the downloads folder should be manipulable, right..? What about overwriting? Can it be done?

kairi003 commented 3 months ago

Inside the downloads folder should be manipulable, right..?

No. It only allows downloading. Browser APIs don't allow simple filesystem manipulation for security reasons.

However, I found that I could access indexeddb in popup context. This allows me to store a FileSystemFileHandle, which might allow me to implement the proposed functionality.

But due to our busy schedule, please forgive us that implementation will not be immediate.