mpawlowski / r2modman-headless

r2modman profile extractor for dedicated servers.
MIT License
5 stars 0 forks source link

Feature Request: Update mods #4

Open onyxraven opened 5 months ago

onyxraven commented 5 months ago

Currently the app only pulls in the version as specified in the r2modman config. This is great from a stability standpoint. However, it is somewhat awkward to update mods when they receive updates, and my server's users have either turned on auto updates, or blindly click the update mods button :).

Right now, the workflow is to create a new export from the "real" r2modman, and update using that new export. This works, but is multiple steps.

I'd like to propose a few options for doing version number updates.

  1. A separate utility that downloads from the metadata api, and can auto update all, or a specific named package, and save that out to an export (or replace the existing). This is the most granular, and doesn't pollute the existing utility with too many options. This probably has the work needed to do it as part of the core utility as well.
  2. a flag in the headless util that autoupdates versions. This could optionally write out to the export, but may not be necessary (eg: if you have the flag, it will always get the latest versions at update. Otherwise, it'll have whatever is in your existing export)

Theres the easy workaround for this today, so this is not a critical issue. I'd also be willing to work on this utility (either as a contrib to this repo or a separate repo) over the next few weeks.

mpawlowski commented 5 months ago

My server has definitely run into this issue, and we work around it as you describe until I find the time to actually update the mods on the server side. I'm not opposed to having option 2 as a flag to auto-update mods as the program runs. If you wan to take a stab at it, feel free, otherwise I'll probably add it at some point.

Right now I'm making some assumptions about where to download the mod from. The cdn to download from is passed as CLI flag, and the path format is hard-coded to use the Major / Minor / Patch versions from the zip export. Ideally a non-updating run should find the URL for the correct version from the metadata response and just use that one, and an updating one should just use the latest. Doing this would also make the thunderstore-cdn-host flag unnecessary.

https://github.com/mpawlowski/r2modman-headless/blob/115c445f131c4199f3de9f3532b2ea554402c6ac/r2modman/doc.go#L25-L27