dependencies require version num

This commit is contained in:
SowinskiBraeden committed 2026-07-07 19:49:39 -07:00
1 parent 8748807d1f
commit 9311bc603a
1 file changed
+15 -1
+15 -1
View File
@@ -526,7 +526,21 @@ export function createServerRouter(deps: ServerRouterDeps): Router {
throw ApiError.validation('Duplicate mod ids in the list.'); throw ApiError.validation('Duplicate mod ids in the list.');
} }
const result = await deps.mods.setMods(server, body.data.mods); // Reforger requires a version in config.json for each mod to load.
// Fetch it from the Workshop for any mod the caller didn't supply one for.
const enrichedMods = await Promise.all(
body.data.mods.map(async (mod) => {
if (mod.version) return mod;
try {
const detail = await deps.workshop.getMod(mod.modId);
return { ...mod, ...(detail.version ? { version: detail.version } : {}) };
} catch {
return mod;
}
}),
);
const result = await deps.mods.setMods(server, enrichedMods);
const user = req.user!; const user = req.user!;
await service.recordActivity({ await service.recordActivity({
serverId: server.id, serverId: server.id,