3DCoded/utm-templates

Is it possible to show the download size in the UI

Closed this issue · 7 comments

I was looking at the code and found the download link. If I remove /content from the URL, I get a JSON object that contains the file size of the ZIP file. I was thinking it's possible to parse the JSON, grab the download size, and then show in the UI.

Note this is not the same as the drive size, since the drive may be expandable up to 64GB (but not necessarily taking up that amount of space on the computer).

I'm always struggling for disk space, so knowing the download size is super helpful. Below is an example of the "Windows 10.utm.zip" VM url:

URL:
https://api.onedrive.com/v1.0/shares/u!aHR0cHM6Ly8xZHJ2Lm1zL3UvcyFBbzNpSVRXZV9FWmdwdElidHBEQV8tVmk4NlJhTmc_ZT1nZFFiUlo/root

API Response (truncated):

{
	...
        ...
	"lastModifiedDateTime": "2022-03-25T11:39:04.91Z",
	"name": "Windows 10.utm.zip",
	"parentReference": {
		"driveId": "6046fc9e3521e28d",
		"driveType": "personal"
	},
	"size": 5556485106,    // file size. I assume this is 5.5 GB
	"webUrl": "https://1drv.ms/u/s!Ao3iITWe_EZgptIbtpDA_-Vi86RaNg",
	"file": {
		"hashes": {
			"quickXorHash": "5LcKRAD//gDMG2F6lyJJy9e7FCI=",
			"sha1Hash": "9B97DC4D6114B7D1B00685E3AE2AC4B5F18FE3D7",
			"sha256Hash": "913AA67F5D7C842CB36E2D7C962E8281A8AB1384E712684E07A6E9ACDD740009"
		},
		"mimeType": "application/zip"
	},
         ...
         ...
}

OK. I can work on that. Also Pull Resuests are welcome.

I just added this. It is not released yet, but can be accessed from https://github.com/smattar2020/utm-templates/actions/runs/2241288196 in the artifacts

Awesome! As an aside, I'm curious how you got the macOS vm down to only 16GB. When I was running the macOS vm's from https://github.com/KhaosT/MacVM they were over 30GB.

For the download button text, I think it could use a little more contrast. The black on blue is kind of hard to read. Maybe white text on blue perhaps?

I created the Mac VM by:

  1. Open UTM
  2. Create a new VM
  3. Virtualize
  4. macOS 12+
  5. Leave IPSW empty
  6. 8GB RAM
  7. 4 CPU Cores
  8. 64 GB Storage
  9. Then save and run
  10. After install create dummy user
  11. zip

I think because it wasn't using all 64GB of the storage, the zip compressed it down to 16GB.

OK. I applied the fixes. Here is the download link: https://github.com/smattar2020/utm-templates/actions/runs/2241574926. The Sparkle Framework is not implemented yet, so it may give you errors if you try to do the auto update.

As of now, this is only displaying the compressed size, which may be misleading. I will work on a way to show the uncompressed size.

The functionality here is available as a beta at: https://github.com/smattar2020/utm-templates/releases/tag/v1.1.0-beta1