07th-mod / python-patcher

Mod Installer for the Higurashi and Umineko Games
150 stars 12 forks source link

WIP implement offline mode for installer #213

Open drojf opened 1 year ago

drojf commented 1 year ago

This is a WIP / prototype PR (which technically works), which allows you to run the installer in offline.

Normally I would just add this feature, but I'm probably going to be busy/not feel like working on this for a while, so I thought I should write it down before I forget. I'm writing this up very quickly, mostly as a reminder to myself.


Now, I would imagine very few people would want to run the installer completely in offline mode, but there are some circumstances where users can't connect to our servers (either github or 07th-mod) due to an SSL error or some other internet issue, but can otherwise use the internet normally. These users should be able to use the "manual download" option to manually download the files, however the current installer requires you have access to the internet for a couple things, which logically it shouldn't need as long as we take a snapshot of all the internet relient stuff every now and then.

Specifically, I had a MacOS user who had an error (related to SSL?) which prevented them from using the installer, even though they should have been able to. I sent my prototype version to them and they were eventually able to install it (they had some other issues, which I'm not sure were specific to their setup).

Also, should our website or github go down (perhaps permanently), it would be nice that the installer can still be used. Eg. you could archive the mod files and the mod installer together, and still be able to run it standalone.

This WIP PR relies on snapshots of anything that would be downloaded from the internet (such as the installData.json), and also some information about the file downloads (cachedExtractableItems.json). The cachedExtractableItems.json is regenerated when you run the installer in dev mode (when you run the installer from a cloned git repository), the same way we currently generate the cachedDownloadSizes.json.

Additionally, when the installer is built in github actions, a cachedInstallData.json (just a copy of installData.json) is included with the installer, which is used instead of downloading the installData.json from github.


Offline Mode

The reason for implementing an actual "mode" for offline use, is to provide predictable behavior when using the installer. If the user has working internet, and for some reason a file failed to download/be queried, I wouldn't want any offline-fallbacks to trigger, as there may be some conflict between the old offline information, and the new information, creating some unpredictable situations.

Therefore, once entering offline mode, the installer will continue to use offline resources, even if you regain an internet connection.

I also want to set the expectation lower for the offline mode, since some stuff might not work properly in the installer, and the user should be aware of this.

A proper "offline mode" (with a popup to inform the user) has not yet been implemented in this PR.


Known Problems

TODO: