HeyPuter / puter

🌐 The Internet OS! Free, Open-Source, and Self-Hostable.
https://puter.com
GNU Affero General Public License v3.0
25.55k stars 1.68k forks source link

Add Cancellation Button for Ongoing Zip Operations #116

Open jelveh opened 7 months ago

jelveh commented 7 months ago

Description:

Currently, when performing a zip operation on files or folders, a progress window is displayed to inform the user of the ongoing process. However, this progress window lacks a cancellation option. This means that users have no way to interrupt the zipping process once it has started, aside from potentially having to refresh Puter, which is neither convenient nor safe.

Suggested Solution

Implement a "Cancel" button within the progress window of zip operations. This button would allow users to safely terminate the zip process at any point.

SaiUddisa commented 7 months ago

can you elaborate more on this issue

SaiUddisa commented 7 months ago

i didnt see any progress window while using zip operation. Its just displaying a buffering animation and doing the task. Should I add the cancel button there or what?

AtkinsSJ commented 7 months ago

i didnt see any progress window while using zip operation. Its just displaying a buffering animation and doing the task. Should I add the cancel button there or what?

Yes, that's the progress window. It doesn't currently show how complete the task is, but eventually it will.

meetqy commented 7 months ago

When I tried to solve this problem, I found that jszip unsupport cancel. What should I do next?

https://github.com/Stuk/jszip/issues/594

jelveh commented 7 months ago

this sucks. Let me think about it a little.

AtkinsSJ commented 7 months ago

jszip seems to have stopped being developed a couple of years ago, so it's unlikely we could get it modified to add cancellation. But maybe we could fork it.

Alternatively, archiver looks like a decent alternative that does support aborting a request.

4nshuman commented 1 month ago

Hey @jelveh, @AtkinsSJ, I'd love to take a look at this issue. It might take some time given the fact that the original lib has not been updated in over 2 years. Our best bet might be to swtich over to a new lib. One that I had in mind was fflate, as mentioned on the original jsZip issues page. I'd also take a look at Archiver as suggested by @AtkinsSJ, I think Archiver as well has an abort module coded in.

Please let me know in case I can take it up.

jelveh commented 1 month ago

Hey @4nshuman. Go for it! I'm open to changing the module used for zim/unzip. fflate seems interesting, though it seems to have been inactive for several months.

Let me know if you need help.

4nshuman commented 1 month ago

Hi @jelveh, I looked into the available npm modules and I think I'll be proceeding with Archiver, it has better documentation and also has active development ongoing. This is gonna take some time but rest-assured I'm working on this.

jelveh commented 1 month ago

Thank you for the update @4nshuman. Sounds like a good choice. Let me know if you need help along the way.

4nshuman commented 3 weeks ago

Hey @jelveh. So I tried integrating the Archiver library onto Puter's client side compression mechanism. But there's a hiccup. Archiver is designed to be used server side and I tried to browserify it using polyfills and webpack, but the fs module just breaks the port. As I understand the puter JSOS uses the puter SDKs fs system for file management, I tried to plug it onto the Archiver port but the webpack browserification still broke apart. I feel that even if I manage to port Archiver at this point it'd be an overkill. Hence I'd like to proceed with fflate for time being. Please let me know of your thoughts/ideas to better implement this issue.

PS: Attaching some snaps from my unsuccessful attempt at porting Archiver for client side.

Screenshot 2024-09-28 at 4 39 48 AM Screenshot 2024-09-28 at 4 39 56 AM Screenshot 2024-09-28 at 4 40 36 AM Screenshot 2024-09-28 at 4 40 54 AM Screenshot 2024-09-28 at 4 41 00 AM
4nshuman commented 2 weeks ago

Hello @jelveh,

So I've been working on this issue for the last couple of weeks, and here's something interesting that I've noticed. On the current instance of Puter, the zip functionality seems to be broken:

Puter.com: image

image

When zipping a file/folder the size does not reduce and the file remains bloated. I was out to add a cancel functionality to the zipping mechanism but ended up fixing this issue as well: image image

I have a PR in draft with the zipping functionality complete. While I am still working on the unzip mechanism with the new fflate library, I'd appreciate your comments on the current draft PR : https://github.com/HeyPuter/puter/pull/787

jelveh commented 2 weeks ago

Hi @4nshuman. I missed your previous comment, sorry about that! Thank you for the detailed write-up and for going really deep into this. I'm going to review it soon and get back to you.