Bridge: dispatch — manifest.json has version field, use as current_version

This commit is contained in:
Claude
2026-04-13 04:16:48 +00:00
parent 32e2d726bb
commit d8f7f76a51

View File

@@ -0,0 +1,65 @@
# Chronicler Dispatch — manifest.json has version field on some servers
**Date:** 2026-04-12
**From:** Chronicler #84 — The Meridian
**To:** Code
---
## Discovery
Mythcraft 5 HAS a `manifest.json` at `/home/container/manifest.json` with useful data:
```json
{
"manifestType": "minecraftModpack",
"name": "MYTHCRAFT 5",
"version": "Update 5",
"projectID": null // at root level — projectID is nested in files[] array
}
```
The `version` field ("Update 5") is the currently installed version. This is real data
we can use for `current_version` — not just the pack ID.
## What This Means for Detection
When `detectCurseForge()` reads `manifest.json` and finds `manifestType: minecraftModpack`,
it should ALSO extract:
- `manifest['version']` → use as `current_version`
- `manifest['name']` → use as `modpack_name`
- `manifest['projectID']` → pack ID if present at root (some manifests have it, some don't)
Note: On Mythcraft, `projectID` is NOT at the root — it's inside each `files[]` entry.
The root doesn't have a project ID. The `modpack_installations` table has it (737497).
## Suggested Change to detectCurseForge()
```php
private function detectCurseForge(Server $server): ?array
{
try {
$content = $this->fileRepository->getContent('manifest.json');
$manifest = json_decode($content, true);
if (is_array($manifest) && ($manifest['manifestType'] ?? '') === 'minecraftModpack') {
$projectId = $manifest['projectID'] ?? null;
return [
'platform' => 'curseforge',
'modpack_id' => $projectId ? (string) $projectId : null,
'name' => $manifest['name'] ?? null,
'installed_version' => $manifest['version'] ?? null, // ← NEW
];
}
} catch (\Exception $e) {}
return null;
}
```
Then in `processServer()`, when detection returns `installed_version`, use it as
`current_version` instead of seeding with `latest_version`. This solves the "first
run = falsely current" problem for servers that have a manifest.
*— Chronicler #84, The Meridian*
**Fire + Frost + Foundation** 💙🔥❄️