Offline Support
dpw13 opened this issue · 2 comments
Is your feature request related to a problem? Please describe.
ficsit-cli doesn't behave well when the user is offline or SMR is down.
Describe the solution you'd like
Use the cached mods as a backup instead of SMR when SMR is inaccessible.
Describe alternatives you've considered
No response
Additional context
Imported from "SMM v3 ToDo"
We should specifically call out what capabilities should be supported in offline mode. As a bare minimum, enabling and disabling existing mods in a profile should be supported. The next level or support to me would be the ability to select which version of a mod is being used if multiple versions have been cached during a previous download. We could also potentially support installing a new mod into a profile if that mod has previously been downloaded.
Looks like calling ficsit.Mods()
is the main entry point for retrieving the list of mods from SMR. This is called from cmd.search.searchCmd
, tea.scenes.installed_mods.LoadModData()
, and tea.scenes.mods.NewMods()
.
In tea.scenes.installed_mods.LoadModData()
, the API call is made to retrieve mod info from the reference ID. Only the reference ID, version requirement, and whether the mod is enabled is actually stored in the profile (see cli.profiles.Profile*
).
Previously-downloaded mods are stored in os.UserCacheDir()
, but only the mod name and version is readily available. I propose downloading and storing the cached mod data as a map[String]ficsit.ModsModsGetModsModsMod
(or similar, will have to figure out how multiple versions are stored). A store of the mod information for all mods previously downloaded should be able to provide any reasonable amount of offline behavior needed once we decide what should be supported at minimum.
SMM already does this using an additional data provider. Its implementation parses the .uplugin
file in the zip and constructs the list of mods (and their dependencies) that way. The advantage of using the zip to query the mod data is that users can plop any set of manually-downloaded mods into the cache folder and they should work and be selectable as expected in the GUI or CLI.
https://github.com/mircearoata/SatisfactoryModManagerAPI/blob/master/src/mods/mod.ts#L41