Add auto-updating support for Steam Workshop mods - #290
Open
JnCaoxia wants to merge 1 commit into
Open
Conversation
- Discover Workshop mods by reading publishedid from meta.cpp - Check for updates via the Steam Web API (GetPublishedFileDetails) and only download when time_updated is newer than the cached version - Download updates through SteamCMD (NOTIFY/MANUAL/AUTOMATIC profiles) - Cache steam-workshop-id and version in mods.yml - Add SteamWorkshopUpdateFinder and TaskSteamWorkshopModDownload - Tests: meta.cpp parsing, mod discovery, end-to-end update flow Builds upon the earlier work in PR Osiris-Team#280.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #215 — adds auto-updating support for Steam Workshop mods (e.g. DayZ server mods).
What changed
Discovery:
SteamWorkshopModscans the mods folder for directories containingmeta.cppand readspublishedid,nameandtimestamp.Update check: New
SteamWorkshopUpdateFinder(same per-task usage pattern asResourceFinder) queries the Steam Web API (GetPublishedFileDetails) and only reportsUPDATE_AVAILABLEwhentime_updatedis newer than the version cached inmods.yml— mods are not re-downloaded on every run.Download: New
TaskSteamWorkshopModDownload(mirrorsTaskModDownload) downloads the item via SteamCMDworkshop_download_item, honoring NOTIFY / MANUAL / AUTOMATIC profiles; with AUTOMATIC the content is copied back into the existing mod directory and the cached version is updated.Config:
steam-workshop-idis cached inmods.yml;mods-updater.pathand themods.ymlheader comments document the feature. The existingserver-updater.softwaresetting is reused as the Steam app-id (e.g.221100for DayZ) — no new config key needed.Review feedback from #280 addressed
Update-check logic extracted into its own class (
SteamWorkshopUpdateFinder), used likeResourceFinder, and integrated into the existing parallel executor instead of a separate flow.The version no longer defaults to the publishedId (the confusing line in Add DayZ workshop mod updates #280): a Workshop mod's version is its
meta.cpptimestamp when present, otherwise empty, so the first update check always runs.Update check only marks
UPDATE_AVAILABLEwhen the item actually changed (comparestime_updatedagainst the cached version).Download logic integrated into
doDownloadLogicviaTaskSteamWorkshopModDownload, following theTaskModDownloadpattern; both share the newModDownloadTaskinterface.A test showing the actual update process: see end-to-end tests below.
Note on the Steam Web API call
GetPublishedFileDetailsonly accepts POST form requests — GET returns an error (verified against the live API). Since jlib'sJson.get(url)performs a GET, it cannot be used here. The implementation uses a plainHttpURLConnectionPOST plus the already-present Gson dependency, so no new dependencies are introduced (per BOUNTY_TERMS §5).Testing
mvn -DskipTests compile— clean (OpenJDK 17, release 9 target)mvn -Dtest='SteamWorkshopModTest,SteamCMDTest#buildsWorkshopItemCommand' test— 5/5 green:meta.cpp parsing (id / name / timestamp)
Workshop mod discovery in the mods folder
E2E: metadata current → no download, no warnings, version kept
E2E: newer metadata → SteamCMD download → files copied into the mod dir → new version cached in mods.yml
SteamCMD workshop command building
AI-assisted contribution disclosure
Per BOUNTY_TERMS §4: this contribution was developed with AI assistance. All code has been reviewed line-by-line, compiled, and tested locally by me, and I take full responsibility for its behavior and quality.
Payment: my PayPal email is visible on my public GitHub profile (per BOUNTY_TERMS §2).