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

WIP implement offline mode for installer #213

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

drojf
Copy link
Collaborator

@drojf drojf commented Jul 1, 2023

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

  • The steamgridextractor (updated icons and images for Steam) doesn't work in offline mode, because the "download manually" option doesn't list the steamgridextractor files for download currently (the steamgridextractor part of the code just attempts to download the files it needs at the very end of the install, so it's not part of the proper 'download list' that is generated when you preview an install).

TODO:

  • Resolve all the TODOs added by this PR
  • Add a popup when entering "offline mode" (unless this pr can be implemented without an "offline mode"), and make sure the "offline mode" works correctly
  • Force user to enable the "Manual Download" option, as the installer won't work without it enabled if you don't have internet.
  • Make sure that if aria2c just stalls that this all still works (normally if aria2c fails, then everything works OK, but if it just stalls indefinitely, the installer will stall too). Do this by adding a timeout?
  • Remove hardcoded common.Globals.OFFLINE_MODE = TRUE

@drojf drojf mentioned this pull request Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant