diff --git a/pterodactyl/pterodactyl.php b/pterodactyl/pterodactyl.php index 12af1b6..9e15e05 100644 --- a/pterodactyl/pterodactyl.php +++ b/pterodactyl/pterodactyl.php @@ -644,3 +644,25 @@ function pterodactyl_ClientArea(array $params) { // Ignore } } + +function pterodactyl_ServiceSingleSignOn(array $params) { + if($params['moduletype'] !== 'pterodactyl') return; + + try { + $hostname = pterodactyl_GetHostname($params); + $serverData = pterodactyl_GetServerID($params, true); + $response = ['redirectUrl' => $hostname]; + if($serverData['status_code'] !== 404 && isset($serverData['attributes']['id'])) + $response['redirectUrl'] = $hostname . '/server/' . $serverData['attributes']['identifier']; + + return [ + 'success' => true, + 'redirectTo' => $response['redirectUrl'], + ]; + } catch (Exception $e) { + return [ + 'success' => false, + 'errorMsg' => $e->getMessage(), + ]; + } +}