SchraderR / sp-tarkov-client

This is a project to automate installing and updating SPT-Mods without searching every mod again and repeat the workflow every god damn time
GNU General Public License v3.0
17 stars 3 forks source link

Speed up mod information fetch during install #128

Closed Markosz22 closed 2 months ago

Markosz22 commented 2 months ago

Hub has this mods.json with many useful information available very quickly: https://hub.sp-tarkov.com/mods.json

I figured it could be used to fetch the last version's direct download link, instead of reading it through a headless browser, which was by far the slowest part of installing/updating mods. It is now near instantaneous.

Workflow:

  1. Read out latest mod version in getModVersionAndLicenseInformation (Need version from normal mod hub to not download an older version which wasn't updated yet in the json as it's a 1 or 2 hours behind the actual mod hub.)
  2. When user clicks 'Download / Install', fetch the latest mods.json.
  3. During install, find the mod data by name.
  4. If version of a mod matches the version in the mod_data json, pass the download link to the download-link which will process it without needing to read it using the Browser.

To avoid users downloading an older version accidentally, we still have to rely on the actual mod hub page, but maybe another extra feature could be added in the future, something like "Use indexed mods" that could skip the entire /files/file/ query and version check and force the installer to use the latest link from mods.json. This would be useful in case the hub is overloaded and stops working - the mod manager could still work with direct links.

SchraderR commented 2 months ago

Could you merge the current master in your branch? And you could merge this as 0.2.13 in the master, if you want.

Thanks for your contribution. ~Good~ Awesome find.

Markosz22 commented 2 months ago

Sure! I changed the target to master and increased version number.

SchraderR commented 2 months ago

I would go the next step and add the toggle for the user / the additional information.

Code:

<mat-slide-toggle matTooltipClass="tooltip-multiline" [matTooltip]="'Use information from a indexed list. Normal process will be used as an fallback.\n\nThis mod list is updated every hour and could be not in sync with the hub.\n\nUse with caution.'">Use indexed mods</mat-slide-toggle>

Styles style.scss to display the multiline toolip

.tooltip-multiline {
  white-space: pre-line;
}

Result:

grafik

And this should be saved in the electron store. If you need an example, look at the code for the app.component -> getCurrentThemeSettings