# Modpack Version Checker — Deployment Guide

**Status:** READY TO DEPLOY  
**Created:** 2026-03-29  
**Created By:** Chronicler #47 + Gemini (architecture consultation)  
**Prerequisite:** PHP proxy must be deployed before the dashboard will work

---

## Overview

A browser-based dashboard that automatically checks all Pterodactyl game servers for modpack version status (up to date vs update available). Uses a PHP proxy on the Billing VPS to handle API calls securely — no API keys in the browser.

**Platforms supported:**
- FTB — fully automatic (reads `.manifest.json`, compares against FTB public API)
- CurseForge — reads installed version from `manifest.json`; needs CF Project ID entered once per pack + CurseForge API key in `config.php`
- Modrinth — detects installed version; latest version lookup TBD

---

## Files

| File | Purpose |
|------|---------|
| `dashboard.html` | The browser dashboard — can be hosted anywhere |
| `proxy/proxy.php` | PHP proxy — deploy to Billing VPS |
| `proxy/config.php` | API keys config — deploy to Billing VPS, fill in real keys |
| `proxy/version-proxy.conf` | Nginx server block — deploy to Billing VPS |

---

## Deployment Steps

### Step 1: Verify Port 8080 is Free

SSH to Billing VPS and run:

```bash
ss -tlnp | grep 8080
```

If 8080 is taken, pick 8081 or 8090. Update the port in:
- `version-proxy.conf` (`listen 8080;`)
- `dashboard.html` (`const PROXY_URL = ...`)

### Step 2: Create Proxy Directory

```bash
sudo mkdir -p /var/www/version-proxy
sudo chown -R www-data:www-data /var/www/version-proxy
```

### Step 3: Upload Proxy Files

Copy `proxy.php` and `config.php` to `/var/www/version-proxy/` on the Billing VPS.

### Step 4: Fill In Real Keys

Edit `/var/www/version-proxy/config.php` with real values:
- `panel_key` — Pterodactyl client API key (`ptlc_NDkYX6yPPBHZacPmViFWtl4AvopzgxNcnHoQTOOtQEl`)
- `cf_key` — CurseForge API key (get from https://console.curseforge.com)

### Step 5: Enable Nginx Config

```bash
sudo cp version-proxy.conf /etc/nginx/sites-available/version-proxy.conf
sudo ln -s /etc/nginx/sites-available/version-proxy.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
```

### Step 6: Open Firewall Port

```bash
sudo ufw allow 8080/tcp
```

(Change 8080 to whichever port you confirmed is free.)

### Step 7: Test the Proxy

Open in browser:
```
http://38.68.14.188:8080/proxy.php?action=servers
```

Should return JSON list of your Pterodactyl servers.

### Step 8: Open the Dashboard

Open `dashboard.html` in any browser and click **Check All**.

---

## CurseForge Pack IDs

For packs without automatic version detection, enter the CurseForge Project ID in the card's input field. The dashboard saves these in browser localStorage so you only enter them once.

Known packs on your servers:

| Server | Pack | CF Project ID |
|--------|------|---------------|
| Mythcraft 5 - NC | MYTHCRAFT 5 | (find on CurseForge) |
| Ars Eclectica - TX | Ars Eclectica | (find on CurseForge) |
| Create Plus - TX | Create V0.9.0 | (find on CurseForge) |
| Society: Sunlit Valley - TX | Society: Sunlit Valley | (find on CurseForge) |

ATM10, ATM Sky, All The Mons — no version manifest detected on disk. Version will show "Not detected" until a manifest file exists.

---

## Architecture Notes

- PHP proxy lives at `/var/www/version-proxy/` — **isolated from Paymenter's Laravel routing**
- `config.php` is blocked from direct web access via Nginx (`location = /config.php { deny all; }`)
- FTB API calls are made directly from the browser (public API, no CORS issues)
- All Pterodactyl and CurseForge calls go through the proxy (API keys never reach the browser)
- CurseForge Project IDs stored in browser localStorage (persist between sessions)

---

## Revision History

| Version | Date | Author | Notes |
|---------|------|--------|-------|
| 1.0 | 2026-03-29 | Chronicler #47 + Gemini | Initial build. PHP proxy architecture by Gemini. Dashboard HTML by Chronicler #47. |
