diff --git a/services/modpack-version-checker/blueprint-extension/CHANGELOG.md b/services/modpack-version-checker/blueprint-extension/CHANGELOG.md new file mode 100644 index 0000000..ea75353 --- /dev/null +++ b/services/modpack-version-checker/blueprint-extension/CHANGELOG.md @@ -0,0 +1,32 @@ +# Changelog + +All notable changes to ModpackChecker will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.0] - 2026-04-06 + +### Added +- Initial release +- Dashboard badge showing update status (🟠 update available / 🟢 up to date) +- Console widget with "Check for Updates" button +- Support for 4 modpack platforms: + - CurseForge (requires API key) + - Modrinth (no key required) + - FTB via modpacks.ch (no key required) + - Technic (no key required, dynamic build detection) +- Admin panel for CurseForge API key configuration +- Cron command for automated background checks +- Rate limiting: 2 manual checks per minute per server +- 60-second TTL cache for dashboard badges +- Foreign key cascade delete for data integrity + +### Architecture +- Centralized `ModpackApiService` for all platform API calls +- Cached Technic launcher build number (12-hour TTL) +- Database table `modpackchecker_servers` for status caching + +--- + +*Fire + Frost + Foundation = Where Love Builds Legacy* 🔥❄️💙 diff --git a/services/modpack-version-checker/blueprint-extension/README.md b/services/modpack-version-checker/blueprint-extension/README.md index 49f1939..a97c179 100644 --- a/services/modpack-version-checker/blueprint-extension/README.md +++ b/services/modpack-version-checker/blueprint-extension/README.md @@ -1,8 +1,8 @@ # ModpackChecker — Pterodactyl Blueprint Extension **Version:** 1.0.0 -**Author:** Firefrost Gaming -**License:** Proprietary (Commercial product for BuiltByBit) +**Author:** Firefrost Gaming / Frostystyle +**License:** Commercial License - Unauthorized redistribution, resale, or sharing of this source code is strictly prohibited. A Pterodactyl Panel extension that checks modpack versions across CurseForge, Modrinth, FTB, and Technic platforms. Shows update status on the dashboard and provides manual version checks from the server console. @@ -19,7 +19,7 @@ A Pterodactyl Panel extension that checks modpack versions across CurseForge, Mo 7. [Development](#development) 8. [API Reference](#api-reference) 9. [Troubleshooting](#troubleshooting) -10. [Design Decisions](#design-decisions) +10. [Support](#support) --- @@ -30,17 +30,18 @@ A Pterodactyl Panel extension that checks modpack versions across CurseForge, Mo - **🟠 Orange (Fire #FF6B35):** Update available - **🟢 Teal (Frost #4ECDC4):** Up to date - Hover for version details tooltip -- Single API call per page load (cached globally) +- Single API call per page load (cached with 60s TTL) ### Console Widget - "Check for Updates" button on each server's console page - Real-time version check against platform API -- Shows modpack name, current version, and latest version +- Rate limited: 2 checks per minute per server +- Shows modpack name and latest version ### Admin Panel - Configure CurseForge API key -- View extension status -- (Future: Rate limit settings, notification preferences) +- View supported platforms +- PRO features: Discord notifications, custom check intervals ### Supported Platforms | Platform | ID Type | API Key Required | Status | @@ -50,8 +51,6 @@ A Pterodactyl Panel extension that checks modpack versions across CurseForge, Mo | FTB | Numeric modpack ID | ❌ No | ✅ Working | | Technic | URL slug | ❌ No | ✅ Working | -> **Note:** Technic requires a dynamic build number parameter. The extension automatically fetches the current launcher build from Technic's API to avoid 401 errors. - --- ## Architecture Overview @@ -59,17 +58,11 @@ A Pterodactyl Panel extension that checks modpack versions across CurseForge, Mo ``` ┌─────────────────────────────────────────────────────────────────────────────┐ │ MODPACK VERSION CHECKER │ -│ Architecture Diagram │ └─────────────────────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────┐ │ CRON JOB (runs every 4-6 hrs) │ │ php artisan modpackchecker:check │ - │ │ - │ • Finds servers with MODPACK_* │ - │ • Calls platform APIs one by one │ - │ • 2-second delay between calls │ - │ • Stores results in database │ └──────────────────┬──────────────────┘ │ ▼ @@ -77,10 +70,10 @@ A Pterodactyl Panel extension that checks modpack versions across CurseForge, Mo │ DATABASE CACHE │ │ modpackchecker_servers table │ │ │ - │ • server_id, server_uuid │ + │ • server_uuid │ │ • platform, modpack_id │ │ • current_version, latest_version │ - │ • update_available (boolean) │ + │ • status (string) │ │ • last_checked timestamp │ └──────────────────┬──────────────────┘ │ @@ -92,116 +85,76 @@ A Pterodactyl Panel extension that checks modpack versions across CurseForge, Mo │ (UpdateBadge.tsx) │ │ (wrapper.tsx) │ │ │ │ │ │ • Reads from cache ONLY │ │ • Manual "Check" button │ - │ • Never calls external │ │ • LIVE API call │ - │ • One API call per page │ │ • Single server only │ - │ • Shows 🟠 or 🟢 dot │ │ • Shows full details │ + │ • 60-second TTL │ │ • LIVE API call │ + │ • Shows 🟠 or 🟢 dot │ │ • Rate limited (2/min) │ └───────────────────────────┘ └───────────────────────────┘ ``` -### Why This Architecture? - -**The Problem:** A panel with 50 servers and 20 active users could generate thousands of API calls per day if each dashboard view triggered live checks. - -**The Solution:** -1. Cron job handles external API calls with rate limiting -2. Dashboard reads from local cache only -3. Console provides on-demand checks for specific servers - -This was validated by Gemini AI during architectural review. - --- ## File Structure ``` blueprint-extension/ -├── README.md # This file -├── conf.yml # Blueprint configuration -├── build.sh # Injection script (runs during blueprint -build) -├── icon.png # Extension icon (128x128, Gemini-designed) +├── README.md +├── CHANGELOG.md +├── conf.yml +├── build.sh +├── icon.png │ -├── app/ # Merges into Pterodactyl's app/ via requests.app -│ ├── Console/ -│ │ └── Commands/ -│ │ └── CheckModpackUpdates.php # Laravel cron command -│ └── Http/ -│ └── Controllers/ -│ └── ModpackAPIController.php # API endpoints (manualCheck, getStatus) +├── app/ +│ ├── Console/Commands/ +│ │ └── CheckModpackUpdates.php +│ ├── Http/Controllers/ +│ │ └── ModpackAPIController.php +│ └── Services/ +│ └── ModpackApiService.php │ ├── admin/ -│ ├── controller.php # Admin panel logic -│ └── view.blade.php # Admin panel UI +│ ├── controller.php +│ └── view.blade.php │ -├── database/ -│ └── migrations/ -│ └── 2026_04_06_000000_create_modpackchecker_servers_table.php +├── database/migrations/ +│ └── 2026_04_06_000000_create_modpackchecker_servers_table.php │ ├── routes/ -│ └── client.php # API route definitions +│ └── client.php │ └── views/ - ├── server/ - │ └── wrapper.tsx # Console "Check for Updates" widget - └── dashboard/ - └── UpdateBadge.tsx # Dashboard status dot component + ├── server/wrapper.tsx + └── dashboard/UpdateBadge.tsx ``` -### Why the `app/` folder structure? - -Blueprint's `requests.app` field merges the contents of your `app/` folder directly into Pterodactyl's `app/` directory. This means: - -1. **PSR-4 Autoloading:** Your classes are automatically found by Laravel's autoloader -2. **Correct Namespaces:** Use `Pterodactyl\Http\Controllers` (not custom Blueprint namespaces) -3. **Case Sensitivity:** Linux requires exact folder casing — `Controllers/` not `controllers/` - -This architecture was validated through painful debugging and Gemini AI consultation. - --- ## Installation -### Prerequisites -- Pterodactyl Panel v1.11+ -- Blueprint Framework (beta-2026-01 or newer) -- PHP 8.1+ -- Node.js 18+ +### Standard Installation (BuiltByBit) -### Steps +1. Upload the downloaded `modpackchecker.blueprint` file to your Pterodactyl panel's root directory (usually `/var/www/pterodactyl`). -1. **Copy extension to Blueprint directory:** +2. Run the Blueprint installation command: ```bash - cp -r blueprint-extension /var/www/pterodactyl/.blueprint/extensions/modpackchecker - chown -R www-data:www-data /var/www/pterodactyl/.blueprint/extensions/modpackchecker + blueprint -install modpackchecker ``` -2. **Build the extension:** - ```bash - cd /var/www/pterodactyl - blueprint -build - ``` +3. The framework will automatically inject the frontend components and rebuild the panel assets. -3. **Compile frontend assets:** +4. Set up the cron job for automated checks: ```bash - export NODE_OPTIONS=--openssl-legacy-provider - yarn build:production - ``` - -4. **Run database migration:** - ```bash - php artisan migrate - ``` - -5. **Restart PHP-FPM:** - ```bash - systemctl restart php8.3-fpm - ``` - -6. **Set up cron job:** - ```bash - # Add to /etc/crontab or crontab -e + # Add to crontab 0 */6 * * * www-data cd /var/www/pterodactyl && php artisan modpackchecker:check >> /dev/null 2>&1 ``` +### Developer/Manual Installation + +If installing from raw source: +```bash +cp -r blueprint-extension /var/www/pterodactyl/.blueprint/extensions/modpackchecker +chown -R www-data:www-data /var/www/pterodactyl/.blueprint/extensions/modpackchecker +blueprint -build +``` + --- ## Configuration @@ -218,9 +171,9 @@ For modpack detection, set these variables in your server's egg: ### CurseForge API Key -CurseForge requires an API key. To configure: +CurseForge requires an API key: -1. Apply for API access at https://docs.curseforge.com/ +1. Apply for API access at https://console.curseforge.com/ 2. Go to **Admin Panel → Extensions → ModpackChecker** 3. Enter your API key and save @@ -229,7 +182,7 @@ CurseForge requires an API key. To configure: ## Usage ### Dashboard Badge -No action needed — badges appear automatically for servers that: +Badges appear automatically for servers that: - Have `MODPACK_PLATFORM` egg variable set - Have been checked by the cron job at least once @@ -241,55 +194,41 @@ No action needed — badges appear automatically for servers that: ### Cron Command Run manually for testing: ```bash -cd /var/www/pterodactyl php artisan modpackchecker:check ``` -Output: -``` -Starting modpack update check... -Found 12 servers with modpack configuration -Checking: ATM9 Server (a1b2c3d4-...) - 🟠 UPDATE AVAILABLE: All The Mods 9 - 0.2.60 -Checking: Vanilla+ (e5f6g7h8-...) - 🟢 Up to date: Vanilla+ - 1.2.0 -Modpack update check complete! -``` - --- ## Development -### Local Development -1. Enable Blueprint developer mode in admin panel -2. Make changes in `.blueprint/dev/` or `.blueprint/extensions/modpackchecker/` -3. Run `blueprint -build` after changes -4. Run `yarn build:production` for frontend changes +### Adding a New Platform + +1. Open `app/Services/ModpackApiService.php` +2. Add your new platform check method (e.g., `private function checkNewPlatform(string $id): array`) +3. Add the platform key to the `match()` statement inside the `fetchLatestVersion()` method +4. The Controller and Cron Command will automatically inherit the new logic +5. Update this README to reflect the newly supported platform ### Testing API Endpoints ```bash # Manual check (requires auth token) -curl -X POST "https://panel.example.com/api/client/servers/{uuid}/ext/modpackchecker/check" \ +curl -X POST "https://panel.example.com/api/client/extensions/modpackchecker/servers/{uuid}/check" \ -H "Authorization: Bearer {token}" -# Get all statuses (requires auth token) +# Get all statuses curl "https://panel.example.com/api/client/extensions/modpackchecker/status" \ -H "Authorization: Bearer {token}" ``` -### Adding a New Platform -1. Add check method to `ModpackAPIController.php` (e.g., `checkNewPlatform()`) -2. Add to the `match()` statement in `checkVersion()` -3. Add same method to `CheckModpackUpdates.php` -4. Update this README - --- ## API Reference -### POST /api/client/servers/{server}/ext/modpackchecker/check +### POST `/api/client/extensions/modpackchecker/servers/{server}/check` -Manual version check for a specific server. Makes live API call. +Manual version check for a specific server. Triggers a live API call to the modpack platform. + +**Rate Limit:** 2 requests per minute per server **Response:** ```json @@ -303,7 +242,7 @@ Manual version check for a specific server. Makes live API call. } ``` -### GET /api/client/extensions/modpackchecker/status +### GET `/api/client/extensions/modpackchecker/status` Get cached status for all servers accessible to the authenticated user. @@ -315,12 +254,6 @@ Get cached status for all servers accessible to the authenticated user. "modpack_name": "All The Mods 9", "current_version": "0.2.51", "latest_version": "0.2.60" - }, - "e5f6g7h8-...": { - "update_available": false, - "modpack_name": "Adrenaserver", - "current_version": "1.7.0", - "latest_version": "1.7.0" } } ``` @@ -344,36 +277,24 @@ Get cached status for all servers accessible to the authenticated user. 2. Verify controller namespace: `Pterodactyl\Http\Controllers` 3. Restart PHP-FPM: `systemctl restart php8.3-fpm` -### Build.sh not running -1. Ensure file is executable: `chmod +x build.sh` -2. Check Blueprint version supports build scripts -3. Run manually from panel root: `bash .blueprint/extensions/modpackchecker/build.sh` +### "Rate limit reached" message +The manual check is limited to 2 requests per minute per server. Wait 60 seconds and try again. --- -## Design Decisions +## Support -### Why cache instead of live checks? -Rate limits. CurseForge allows ~1000 requests/day for personal keys. A busy panel could exhaust that in hours without caching. - -### Why 2-second sleep in cron? -Prevents burst traffic to APIs. 50 servers × 2 seconds = ~2 minute runtime, which is acceptable for a background job. - -### Why inline styles in React? -The component is injected into Pterodactyl's build. Adding CSS classes would require modifying their build pipeline. Inline styles are self-contained. - -### Why separate console widget and dashboard badge? -Different use cases: -- Dashboard: Quick overview, needs to be fast → cached -- Console: User wants current info → live API call is acceptable +**Need help?** Join our Discord for support: +- **Discord:** [discord.firefrostgaming.com](https://discord.firefrostgaming.com) +- **Email:** dev@firefrostgaming.com +- **Website:** [firefrostgaming.com](https://firefrostgaming.com) --- ## Credits **Developed by:** Firefrost Gaming / Frostystyle -**Contact:** dev@firefrostgaming.com -**Website:** https://firefrostgaming.com +**Architecture Review:** Gemini AI **Part of Firefrost Gaming** *Fire + Frost + Foundation = Where Love Builds Legacy* 🔥❄️💙 diff --git a/services/modpack-version-checker/blueprint-extension/admin/view.blade.php b/services/modpack-version-checker/blueprint-extension/admin/view.blade.php index c90c87b..e331495 100644 --- a/services/modpack-version-checker/blueprint-extension/admin/view.blade.php +++ b/services/modpack-version-checker/blueprint-extension/admin/view.blade.php @@ -92,32 +92,26 @@ - +
- Receive alerts when modpack updates are available. - Create a webhook in your Discord server settings. + Upgrade to Professional to receive automated update alerts in your Discord server.
+ Join our Discord for support: discord.firefrostgaming.com +
+{server.name}