Web-based control panel for managing game servers on Simjang.
/var/www/games.cowens.com/C:\Users\cowens\Documents\game-admin\| Setting | Value |
|---|---|
| Server Name | GreyHaven |
| World Name | POTATO |
| Backups | Hourly, 10 max or 3 days |
| Location | /home/chuck/valheim/ |
Currently using hardcoded credentials in shared/auth.php.
Future: Migrate user management to Maekbak's PostgreSQL for centralized auth.
/valheim/includes/api.php)GET ?action=status - Server status & resourcesPOST action=start - Start serverPOST action=stop - Stop serverPOST action=restart - Restart server/valheim/includes/world_api.php)GET ?action=list_worlds - List all worldsPOST action=upload_world - Upload world filesPOST action=switch_world - Switch active worldGET ?action=download_world&world_name=X - Download worldCurrently Game Admin uses HTTP Basic Auth (htpasswd). Future plan is to migrate to Maekbak's centralized authentication.
shared/auth.phpMust complete:
/auth/login endpoint/auth/me endpointNew Login Flow:
User visits games.cowens.com
↓
No token? → Show login form
↓
Login form POSTs to Maekbak API /auth/login
↓
Store JWT in session/cookie
↓
All pages check token via /auth/me
Files to Modify:
| File | Changes |
|---|---|
shared/auth.php |
Replace hardcoded check with Maekbak API call |
shared/login.php |
New login form, calls Maekbak API |
| Nginx config | Remove auth_basic directive (if used) |
PHP Changes:
// shared/auth.php - New approach
function checkAuth() {
$token = $_SESSION['jwt_token'] ?? $_COOKIE['jwt_token'] ?? null;
if (!$token) return false;
// Validate with Maekbak API
$ch = curl_init('https://api.maekbak.cowens.com/auth/me');
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer $token"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $httpCode === 200;
}
Maekbak API Auth (Phase 1)
↓
Game Admin Migration (this)
↓
Other apps can follow same pattern