Backport 1.5 leaderboards

This commit is contained in:
2025-09-12 07:20:59 -07:00
parent e15d5f997b
commit 03243fcde7
5 changed files with 64 additions and 9 deletions

View File

@@ -21,10 +21,14 @@ function newConnection() {
return $conn;
}
function getClientVersion() {
return $_SERVER['HTTP_CLIENTVERSION'];
}
function encrypt($plainText) {
include __DIR__.'/../config/encryption.php';
$iv = random_bytes(16);
$cipher = openssl_encrypt($plainText, 'aes-256-cbc', $SERVER_SEND_TRANSFER_KEY, OPENSSL_RAW_DATA, $iv);
$cipher = openssl_encrypt($plainText, 'aes-256-cbc', $SERVER_SEND_TRANSFER_KEY_SPECIFIC[getClientVersion()] ?? $SERVER_SEND_TRANSFER_KEY, OPENSSL_RAW_DATA, $iv);
return base64_encode($iv . $cipher);
}
@@ -33,7 +37,7 @@ function decrypt($dataB64) {
$data = base64_decode($dataB64);
$iv = substr($data, 0, 16);
$cipher = substr($data, 16);
$decrypted = openssl_decrypt($cipher, 'aes-256-cbc', $SERVER_RECEIVE_TRANSFER_KEY, OPENSSL_RAW_DATA, $iv);
$decrypted = openssl_decrypt($cipher, 'aes-256-cbc', $SERVER_RECEIVE_TRANSFER_KEY_SPECIFIC[getClientVersion()] ?? $SERVER_RECEIVE_TRANSFER_KEY, OPENSSL_RAW_DATA, $iv);
if ($decrypted === false) {
exit(encrypt('-997'));
}
@@ -49,10 +53,6 @@ function exitWithMessage($message, $encrypt = true) {
exit;
}
function getClientVersion() {
return $_SERVER['HTTP_CLIENTVERSION'];
}
function isLatestVersion($version) {
global $latestVersion;
if (!isset($latestVersion)) require __DIR__ . '/../config/general.php';