Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for compressed disk images #204

Open
Tracked by #166
mihaip opened this issue Aug 7, 2023 · 9 comments
Open
Tracked by #166

Add support for compressed disk images #204

mihaip opened this issue Aug 7, 2023 · 9 comments
Labels
Project Bigger projects

Comments

@mihaip
Copy link
Owner

mihaip commented Aug 7, 2023

Ideally without having to recompress the disk image (which would go over CPU use limits of the Cloudflare Worker), but this may not be possible for all compression formats (see https://github.com/vasi/lzopfs#what-compression-formats-are-supported).

A pattern like https://github.com/mattgodbolt/zindex or https://github.com/circulosmeos/gztool where we build an index may be possible.

Requested for https://archive.org/details/macpeople-1998-no-2 and others

@mihaip
Copy link
Owner Author

mihaip commented Dec 26, 2023

@gingerbeardman I looked into implementing this using the download links that you mentioned in #273, but I was not able to make it work when running on Cloudflare Workers. I tried two different approaches:

  1. Download the entire (decompressed) file and put it into Cloudflare's cache. The docs say that you can then make range requests against the cache, but while that works locally, it doesn't when deployed (I always get back the full body with a 200 status, instead of a partial response with a 206 status)
  2. Download the entire file and then chop it up into 128K chunks that are cached. That runs into limitation of subrequests that can be issued.

I'll look into doing this entirely on the client, it looks like the archive.org server for archive contents has liberal CORS headers.

@gingerbeardman
Copy link

Thanks for your efforts so far!

@mihaip
Copy link
Owner Author

mihaip commented Dec 26, 2023

Looks like that works, albeit very slowly. Here's an example: https://infinitemac.org/1996/KanjiTalk%207.5.3?cdrom=https://archive.org/download/bmac-vol3-1996-03/BMAC-VOL3-1996-03.ISO.7z

mihaip added a commit that referenced this issue Dec 26, 2023
archive.org can serve specific files from 7zip and zip archive, so we
can use that to handle compressed images. We need to fetch the entire
file first though, since the archive.org endpoint doesn't support range
requests.

Updates #204
mihaip added a commit that referenced this issue Dec 26, 2023
@gingerbeardman
Copy link

I need better WiFi. I'll check it after the Christmas break

@that-ben
Copy link

that-ben commented Dec 27, 2023

Looks like that works, albeit very slowly. Here's an example: https://infinitemac.org/1996/KanjiTalk%207.5.3?cdrom=https://archive.org/download/bmac-vol3-1996-03/BMAC-VOL3-1996-03.ISO.7z

Does not work in Firefox under macOS 14:

Screenshot 2023-12-27 at 11 00 22 AM Screenshot 2023-12-27 at 11 03 18 AM

@mihaip
Copy link
Owner Author

mihaip commented Dec 27, 2023

@that-ben Oops, some leftover code that was affecting Firefox only. Should work now.

@that-ben
Copy link

that-ben commented Dec 27, 2023

So basically, as it is right now, when you request a .7z file, it downloads the whole file, then decompresses it and attaches it to the emulator, correct? And if so, what would happen if we requested a 7zipped 4.7GB DVD image, would it still work?

Also, is it supposed to work with .zip archives too or is it only for .7z files?

...wanted to close the Japanese yellow bulb info window in the Finder after spending half an hour downloading that ARCHIVE.ORG 7z file in your link only to end up hitting CMD-W and closing the whole InfiniteMac browser tab. Well that sucks. Again.

@mihaip
Copy link
Owner Author

mihaip commented Dec 27, 2023

That sounds about right. Any size image should work, but it'll take longer to download (depending on your internet connection and archive.org's state) and in Firefox it'll end up being held in-memory, which may not work for a DVD image.

It also works with .zip (if there are other archive types that archive.org displays the contents of, I can add those too).

@that-ben
Copy link

that-ben commented Dec 27, 2023

Try .sit ... JK 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project Bigger projects
Projects
None yet
Development

No branches or pull requests

3 participants