Compare commits
13
Commits
6bd3adc8f8
...
modified
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8efad9cf1b
|
||
|
|
f2fc143c03
|
||
|
|
cc1174f9c7
|
||
|
|
3088dc63ac
|
||
|
|
4e02f110cd
|
||
|
|
2e392bdf87
|
||
|
|
9553bb9c61
|
||
|
|
5ee2dcf2db
|
||
|
|
d6ad9a01a0
|
||
|
|
e259567c62
|
||
|
|
94051c6b55
|
||
|
|
876b1bce08
|
||
|
|
65d860e6cb
|
No files matched your search
@@ -1,8 +1,8 @@
|
|||||||
# Berry Dash Server
|
# Berry Dash Server
|
||||||
|
|
||||||
> [!CAUTION]
|
> [!CAUTION]
|
||||||
> This project has been discarded and a new API is under the Lncvrt Games originization.
|
> This project has been discarded and a new API is under the Lncvrt Games organization.
|
||||||
>
|
>
|
||||||
> You can find the new server API [here](https://github.com/Lncvrt-Games/api).
|
> You can find the new server API [here](https://git.lncvrt.xyz/Lncvrt-Games/api).
|
||||||
|
|
||||||
Legacy Server Source Code
|
Legacy Server Source Code
|
||||||
@@ -4,11 +4,11 @@ setPlainHeader();
|
|||||||
|
|
||||||
$conn0 = newConnection(0);
|
$conn0 = newConnection(0);
|
||||||
|
|
||||||
$stmt = $conn0->prepare("SELECT downloadUrlVersion FROM launcherversionmanifest WHERE HIDDEN = 0 AND game = 1 ORDER BY place DESC LIMIT 1");
|
$stmt = $conn0->prepare("SELECT versionName FROM launcherversionmanifest WHERE HIDDEN = 0 AND game = 1 ORDER BY place DESC LIMIT 1");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
$conn0->close();
|
$conn0->close();
|
||||||
|
|
||||||
echo $row["downloadUrlVersion"] ?? 'N/A';
|
echo $row["versionName"] ?? 'N/A';
|
||||||
@@ -14,14 +14,14 @@ if (
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$post = getPostData();
|
$post = getPostData();
|
||||||
$request_type = $post['type'] ?? '';
|
$request_type = $post['type'] ?? (isLauncher() ? '0' : '');
|
||||||
$conn0 = newConnection(0);
|
$conn0 = newConnection(0);
|
||||||
$conn1 = newConnection(1);
|
$conn1 = newConnection(1);
|
||||||
|
|
||||||
$request_value = "";
|
$request_value = "";
|
||||||
if ($request_type === "0") {
|
if ($request_type == "0") {
|
||||||
$request_value = "highScore";
|
$request_value = "highScore";
|
||||||
} else if ($request_type === "1") {
|
} else if ($request_type == "1") {
|
||||||
$request_value = match((int)$post['showType'] ?? 0) {
|
$request_value = match((int)$post['showType'] ?? 0) {
|
||||||
1 => "totalPoisonBerries",
|
1 => "totalPoisonBerries",
|
||||||
2 => "totalSlowBerries",
|
2 => "totalSlowBerries",
|
||||||
@@ -32,7 +32,7 @@ if ($request_type === "0") {
|
|||||||
7 => "totalAntiBerries",
|
7 => "totalAntiBerries",
|
||||||
default => "totalNormalBerries"
|
default => "totalNormalBerries"
|
||||||
};
|
};
|
||||||
} else if ($request_type !== "2" && $request_type !== "3" && $request_type !== "4") {
|
} else if ($request_type != "2" && $request_type != "3" && $request_type != "4") {
|
||||||
exitWithMessage(json_encode([]));
|
exitWithMessage(json_encode([]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
require __DIR__ . '/../../incl/util.php';
|
require __DIR__ . '/../../incl/util.php';
|
||||||
setPlainHeader();
|
setPlainHeader();
|
||||||
echo "-1";
|
echo "1.1.0";
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
require __DIR__ . '/../../incl/util.php';
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
$conn = newConnection(0);
|
||||||
|
|
||||||
|
$stmt = $conn->prepare("SELECT versionName, downloads, place FROM launcherversionmanifest WHERE hidden = 0 AND game = 1 ORDER BY id DESC");
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
$result_versions = $stmt->get_result();
|
||||||
|
$versions = array_map(function($row) use ($conn) {
|
||||||
|
$downloads = json_decode($row['downloads'], true);
|
||||||
|
|
||||||
|
$downloads = array_combine(
|
||||||
|
array_map(fn($k) => match($k) {
|
||||||
|
'windows-x86' => 'windows',
|
||||||
|
'windows-x64' => 'windows',
|
||||||
|
'linux-x64' => 'linux',
|
||||||
|
'macos-universal' => 'macos',
|
||||||
|
default => $k
|
||||||
|
}, array_keys($downloads)),
|
||||||
|
array_values($downloads)
|
||||||
|
);
|
||||||
|
|
||||||
|
$platforms = array_keys($downloads);
|
||||||
|
|
||||||
|
$downloadUrls = [];
|
||||||
|
foreach ($downloads as $platform => $fileId) {
|
||||||
|
$cdnStmt = $conn->prepare("SELECT path FROM files WHERE id = ?");
|
||||||
|
$cdnStmt->bind_param("i", $fileId);
|
||||||
|
$cdnStmt->execute();
|
||||||
|
$cdnResult = $cdnStmt->get_result()->fetch_assoc();
|
||||||
|
$downloadUrls[] = $cdnResult ? "https://archive.org/download/lncvrt-games-archive/" . $cdnResult['path'] : null;
|
||||||
|
$cdnStmt->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'id' => $row['place'],
|
||||||
|
'version' => $row['versionName'],
|
||||||
|
'displayName' => $row['versionName'],
|
||||||
|
'platforms' => $platforms,
|
||||||
|
'downloadUrls' => $downloadUrls,
|
||||||
|
'executables' => array_map(function($platform) use ($row) {
|
||||||
|
return match(true) {
|
||||||
|
in_array($platform, ['windows', 'windows-arm64']) => $row['place'] >= 16 ? 'Berry Dash.exe' : 'Foodie Dash.exe',
|
||||||
|
$platform === 'macos' => $row['place'] >= 16 ? 'Berry Dash.app' : 'Foodie Dash.app',
|
||||||
|
$platform === 'linux' => $row['place'] >= 16 ? 'Berry Dash.x86_64' : 'Foodie Dash.x86_64',
|
||||||
|
in_array($platform, ['android', 'ios']) => null,
|
||||||
|
default => null
|
||||||
|
};
|
||||||
|
}, $platforms)
|
||||||
|
];
|
||||||
|
}, $result_versions->fetch_all(MYSQLI_ASSOC));
|
||||||
|
|
||||||
|
echo json_encode($versions);
|
||||||
|
|
||||||
|
$conn->close();
|
||||||
+5
-1
@@ -27,9 +27,13 @@ function getClientVersion() {
|
|||||||
return $_SERVER['HTTP_CLIENTVERSION'];
|
return $_SERVER['HTTP_CLIENTVERSION'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isLauncher() {
|
||||||
|
return ($_SERVER['HTTP_REQUESTER'] == "BerryDashLauncher" && $_SERVER['HTTP_LAUNCHERVERSION'] == "1.1.0");
|
||||||
|
}
|
||||||
|
|
||||||
function encrypt($plainText) {
|
function encrypt($plainText) {
|
||||||
include __DIR__.'/../config/encryption.php';
|
include __DIR__.'/../config/encryption.php';
|
||||||
$key = $SERVER_SEND_TRANSFER_KEY_SPECIFIC[getClientVersion()];
|
$key = isLauncher() ? $SERVER_SEND_TRANSFER_KEY_SPECIFIC["1.6"] : $SERVER_SEND_TRANSFER_KEY_SPECIFIC[getClientVersion()];
|
||||||
if ($key == null) return;
|
if ($key == null) return;
|
||||||
$iv = random_bytes(16);
|
$iv = random_bytes(16);
|
||||||
$cipher = openssl_encrypt($plainText, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv);
|
$cipher = openssl_encrypt($plainText, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv);
|
||||||
|
|||||||
Reference in new issue
Block a user