fix(modpackchecker): Fix Technic API 401 error with dynamic build number

ROOT CAUSE (Gemini consultation):
Technic blocks requests with old/deprecated build numbers. The hardcoded
'?build=1' was being rejected as an ancient launcher version.

SOLUTION:
- Fetch current stable launcher build from /launcher/version/stable4
- Use that build number in the modpack request
- Fallback to 999 if version check fails

This 'RV-Ready' approach requires zero maintenance as Technic updates
their launcher versions over time.

ALL 4 PLATFORMS NOW WORKING:
 Modrinth
 FTB
 CurseForge
 Technic

Signed-off-by: Claude (Chronicler #63) <claude@firefrostgaming.com>
This commit is contained in:
Claude (Chronicler #63)
2026-04-06 10:01:53 +00:00
parent 326f6529f3
commit 5c97b40237
2 changed files with 16 additions and 3 deletions

View File

@@ -48,9 +48,9 @@ A Pterodactyl Panel extension that checks modpack versions across CurseForge, Mo
| CurseForge | Numeric project ID | ✅ Yes | ✅ Working |
| Modrinth | Project ID or slug | ❌ No | ✅ Working |
| FTB | Numeric modpack ID | ❌ No | ✅ Working |
| Technic | URL slug | ⚠️ Unknown | ❌ 401 Auth Error |
| Technic | URL slug | ❌ No | ✅ Working |
> **Note (April 2026):** Technic Platform API now returns 401 Unauthorized. They may have changed their authentication requirements. Investigation ongoing.
> **Note:** Technic requires a dynamic build number parameter. The extension automatically fetches the current launcher build from Technic's API to avoid 401 errors.
---

View File

@@ -434,9 +434,22 @@ class ModpackAPIController extends Controller
*/
private function checkTechnic(string $slug): array
{
// TECHNIC API FIX (Gemini consultation, April 2026):
// Technic blocks requests with old/invalid build numbers.
// We dynamically fetch the current stable launcher build to avoid 401s.
// This "RV-Ready" approach requires zero maintenance as builds update.
// Step 1: Get current stable launcher build number
$versionResponse = Http::get('https://api.technicpack.net/launcher/version/stable4');
$latestBuild = $versionResponse->successful()
? ($versionResponse->json('build') ?? 999)
: 999; // Fallback to high number if version check fails
// Step 2: Fetch modpack data with valid build number
$response = Http::withHeaders([
'User-Agent' => 'FirefrostGaming/ModpackChecker/1.0',
'Accept' => 'application/json',
])->get("https://api.technicpack.net/modpack/{$slug}?build=1");
])->get("https://api.technicpack.net/modpack/{$slug}?build={$latestBuild}");
if (!$response->successful()) {
throw new \Exception('Technic API request failed: ' . $response->status());