Update to current files
This commit is contained in:
33
README.md
33
README.md
@@ -2,37 +2,10 @@
|
||||
|
||||
> [!CAUTION]
|
||||
> This project has moved to the Lncvrt Games originization.
|
||||
> You can find the new repository [here](https://github.com/Lncvrt-Games/servers)
|
||||
> You can find the new repository [here](https://github.com/Lncvrt-Games/servers).
|
||||
> NOTE: This is also the branch that is being modified so it can continue to work for 1.8.2 and lower.
|
||||
> Find old branch [here](https://github.com/BerryDash/server/tree/main)
|
||||
|
||||
---
|
||||
|
||||
This is the new rewritten server source code for Berry Dash.
|
||||
|
||||
## Setup
|
||||
|
||||
> [!CAUTION]
|
||||
> Do not share any keys with anybody, and store them safely on your computer.
|
||||
> Encryption keys are meant to increase the security of the game and prevent cheaters.
|
||||
|
||||
1. Upload the files on a webserver
|
||||
2. Import database.sql into a MySQL/MariaDB database
|
||||
3. Configure everything in `config/` folder (use `python3 genkeys.py` for `encryption.php`)
|
||||
4. Use `git clone https://github.com/BerryDash/source.git` to clone the client and configure `Assets/Scripts/SensitiveInfo.cs`
|
||||
|
||||
**Note:**
|
||||
|
||||
When configuring keys in the client, `SERVER_RECEIVE_TRANSFER_KEY` will the key `SERVER_SEND_TRANSFER_KEY` from the server, and the other way around too.
|
||||
|
||||
If this isn't configured properly, you will not be able to make requests to the server you have setup.
|
||||
|
||||
Example:
|
||||
|
||||
```cs
|
||||
public static readonly string SERVER_DATABASE_PREFIX = "https://berrydash.lncvrt.xyz/database/";
|
||||
public static readonly string SERVER_RECEIVE_TRANSFER_KEY = "02b3c624552588ba0929e43fbad36221"; // This would be `SERVER_SEND_TRANSFER_KEY` from the server
|
||||
public static readonly string SERVER_SEND_TRANSFER_KEY = "d4269db023de05fd59bf05378fa57324"; // This would be `SERVER_RECEIVE_TRANSFER_KEY` from the server
|
||||
public static readonly string BAZOOKA_MANAGER_KEY = "19387a0e6b861e79d38657d0059bce8c";
|
||||
public static readonly string BAZOOKA_MANAGER_FILE_KEY = "7fb47db04d9babf42ee3713289516208";
|
||||
```
|
||||
|
||||
In conclusion: `SERVER_RECEIVE_TRANSFER_KEY` and `SERVER_SEND_TRANSFER_KEY` are swapped between client and server. This may be changed in the future.
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
$latestVersion = "1.8.2";
|
||||
$latestBetaVersion = $latestVersion;
|
||||
$latestLauncherVersion = "1.1.0";
|
||||
$allowedVersions = [$latestVersion, $latestBetaVersion, "1.8.1", "1.8", "1.7.1", "1.7", "1.6.3", "1.6.2", "1.6.1", "1.6", "1.5.2", "1.5.1", "1.5.0", "1.4.1", "1.4.0", "1.4.0-beta1"];
|
||||
$allowedDatabaseVersions = [$latestVersion, $latestBetaVersion, "1.8.1", "1.8", "1.7.1", "1.7", "1.6.3", "1.6.2", "1.6.1", "1.6", "1.5.2", "1.5.1", "1.5.0", "1.4.1", "1.4.0", "1.4.0-beta1", "1.33", "1.3", "1.3-beta2", "1.3-beta1", "1.21", "1.2", "1.2-beta2"];
|
||||
305
database.sql
305
database.sql
@@ -1,305 +0,0 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.2
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: 127.0.0.1:3306
|
||||
-- Generation Time: Oct 04, 2025 at 10:18 PM
|
||||
-- Server version: 11.8.3-MariaDB-ubu2404
|
||||
-- PHP Version: 8.1.33
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `berrydashdatabase`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `chatroom_reports`
|
||||
--
|
||||
|
||||
CREATE TABLE `chatroom_reports` (
|
||||
`id` int(11) NOT NULL,
|
||||
`chatId` int(11) NOT NULL,
|
||||
`userId` int(11) NOT NULL,
|
||||
`reason` longtext NOT NULL,
|
||||
`timestamp` bigint(20) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `chats`
|
||||
--
|
||||
|
||||
CREATE TABLE `chats` (
|
||||
`id` int(11) NOT NULL,
|
||||
`userId` int(11) NOT NULL,
|
||||
`content` longtext NOT NULL,
|
||||
`timestamp` bigint(20) NOT NULL,
|
||||
`deleted_at` bigint(1) NOT NULL DEFAULT 0
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `launchercategories`
|
||||
--
|
||||
|
||||
CREATE TABLE `launchercategories` (
|
||||
`id` int(11) NOT NULL,
|
||||
`name` text NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `launcherversions`
|
||||
--
|
||||
|
||||
CREATE TABLE `launcherversions` (
|
||||
`id` int(11) NOT NULL,
|
||||
`version` text NOT NULL,
|
||||
`displayName` text DEFAULT NULL,
|
||||
`releaseDate` bigint(20) NOT NULL,
|
||||
`downloadUrls` text NOT NULL,
|
||||
`platforms` text NOT NULL,
|
||||
`executables` text NOT NULL,
|
||||
`hidden` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`category` int(11) NOT NULL DEFAULT 0
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `marketplaceicons`
|
||||
--
|
||||
|
||||
CREATE TABLE `marketplaceicons` (
|
||||
`id` int(11) NOT NULL,
|
||||
`uuid` text DEFAULT NULL,
|
||||
`userId` int(11) NOT NULL,
|
||||
`data` longtext NOT NULL,
|
||||
`hash` varchar(128) NOT NULL,
|
||||
`timestamp` bigint(20) NOT NULL,
|
||||
`state` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`price` int(11) NOT NULL DEFAULT 0,
|
||||
`name` text NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `presets`
|
||||
--
|
||||
|
||||
CREATE TABLE `presets` (
|
||||
`id` int(11) NOT NULL,
|
||||
`uuid` text DEFAULT NULL,
|
||||
`userId` int(11) NOT NULL,
|
||||
`data` longtext NOT NULL,
|
||||
`timestamp` bigint(20) NOT NULL,
|
||||
`name` text NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `userposts`
|
||||
--
|
||||
|
||||
CREATE TABLE `userposts` (
|
||||
`id` int(11) NOT NULL,
|
||||
`userId` int(11) NOT NULL,
|
||||
`content` text NOT NULL,
|
||||
`timestamp` int(11) NOT NULL,
|
||||
`likes` bigint(20) NOT NULL DEFAULT 0,
|
||||
`deleted_at` int(11) NOT NULL DEFAULT 0,
|
||||
`votes` text NOT NULL DEFAULT '[]'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `users`
|
||||
--
|
||||
|
||||
CREATE TABLE `users` (
|
||||
`id` int(11) NOT NULL,
|
||||
`username` varchar(255) DEFAULT NULL,
|
||||
`password` varchar(60) DEFAULT NULL,
|
||||
`email` varchar(255) DEFAULT NULL,
|
||||
`token` varchar(512) NOT NULL,
|
||||
`latest_ip` varchar(255) DEFAULT NULL,
|
||||
`register_time` int(11) DEFAULT NULL,
|
||||
`banned` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`leaderboardsBanned` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`save_data` longtext NOT NULL DEFAULT '\'{}\'',
|
||||
`legacy_high_score` bigint(20) NOT NULL DEFAULT 0
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `chatroom_reports`
|
||||
--
|
||||
ALTER TABLE `chatroom_reports`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `userId` (`userId`),
|
||||
ADD KEY `chatId` (`chatId`);
|
||||
|
||||
--
|
||||
-- Indexes for table `chats`
|
||||
--
|
||||
ALTER TABLE `chats`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `fk_userId` (`userId`);
|
||||
|
||||
--
|
||||
-- Indexes for table `launchercategories`
|
||||
--
|
||||
ALTER TABLE `launchercategories`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
--
|
||||
-- Indexes for table `launcherversions`
|
||||
--
|
||||
ALTER TABLE `launcherversions`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `fk_category` (`category`);
|
||||
|
||||
--
|
||||
-- Indexes for table `marketplaceicons`
|
||||
--
|
||||
ALTER TABLE `marketplaceicons`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `fk_userId` (`userId`);
|
||||
|
||||
--
|
||||
-- Indexes for table `presets`
|
||||
--
|
||||
ALTER TABLE `presets`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `fk_userId` (`userId`);
|
||||
|
||||
--
|
||||
-- Indexes for table `userposts`
|
||||
--
|
||||
ALTER TABLE `userposts`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `fk_userposts_userId` (`userId`);
|
||||
|
||||
--
|
||||
-- Indexes for table `users`
|
||||
--
|
||||
ALTER TABLE `users`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `chatroom_reports`
|
||||
--
|
||||
ALTER TABLE `chatroom_reports`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `chats`
|
||||
--
|
||||
ALTER TABLE `chats`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `launchercategories`
|
||||
--
|
||||
ALTER TABLE `launchercategories`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `launcherversions`
|
||||
--
|
||||
ALTER TABLE `launcherversions`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `marketplaceicons`
|
||||
--
|
||||
ALTER TABLE `marketplaceicons`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `presets`
|
||||
--
|
||||
ALTER TABLE `presets`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `userposts`
|
||||
--
|
||||
ALTER TABLE `userposts`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `users`
|
||||
--
|
||||
ALTER TABLE `users`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- Constraints for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Constraints for table `chatroom_reports`
|
||||
--
|
||||
ALTER TABLE `chatroom_reports`
|
||||
ADD CONSTRAINT `chatId` FOREIGN KEY (`chatId`) REFERENCES `chats` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `userId` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `chats`
|
||||
--
|
||||
ALTER TABLE `chats`
|
||||
ADD CONSTRAINT `fk_userId` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `launcherversions`
|
||||
--
|
||||
ALTER TABLE `launcherversions`
|
||||
ADD CONSTRAINT `fk_category` FOREIGN KEY (`category`) REFERENCES `launchercategories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `marketplaceicons`
|
||||
--
|
||||
ALTER TABLE `marketplaceicons`
|
||||
ADD CONSTRAINT `fk_marketplaceicons_userId` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `presets`
|
||||
--
|
||||
ALTER TABLE `presets`
|
||||
ADD CONSTRAINT `fk_presets_userId` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `userposts`
|
||||
--
|
||||
ALTER TABLE `userposts`
|
||||
ADD CONSTRAINT `fk_userposts_userId` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
1
database/backported/.htaccess
Normal file
1
database/backported/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
Require all denied
|
||||
@@ -1,23 +1,4 @@
|
||||
<?php
|
||||
require __DIR__ . '/../config/general.php';
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
|
||||
$clientVersion = $_SERVER['HTTP_CLIENTVERSION'] ?? "0";
|
||||
if (($_SERVER['HTTP_REQUESTER'] ?? "0") != "BerryDashClient" && ($_SERVER['HTTP_USER_AGENT'] ?? "0") != "BerryDashClient" && ($clientVersion == "1.4.1" || $clientVersion == "1.4.0" || $clientVersion == "1.4.0-beta1")) {
|
||||
exitWithMessage("-1", false);
|
||||
}
|
||||
if (isAllowedVersion($clientVersion) && $clientVersion == "1.4.0-beta1") {
|
||||
exitWithMessage("1", false);
|
||||
}
|
||||
if (isLatestVersion($clientVersion)) {
|
||||
echo "1";
|
||||
} else if (isBetaVersion($clientVersion)) {
|
||||
echo "4";
|
||||
} else if (isAllowedVersion($clientVersion) && isAllowedDatabaseVersion($clientVersion)) {
|
||||
echo "2";
|
||||
} else if (isAllowedVersion($clientVersion)) {
|
||||
echo "3";
|
||||
} else {
|
||||
echo "-1";
|
||||
}
|
||||
echo '1';
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
checkClientDatabaseVersion();
|
||||
$conn = newConnection();
|
||||
|
||||
$post = getPostData();
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
if (isAllowedDatabaseVersion(getClientVersion())) {
|
||||
if (getClientVersion() == "1.3-beta1") {
|
||||
require __DIR__ . '/backported/1.3-beta1/changeAccountUsername.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") {
|
||||
require __DIR__ . '/backported/1.3-beta2/changeAccountUsername.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.3-beta1") {
|
||||
require __DIR__ . '/backported/1.3-beta1/changeAccountUsername.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") {
|
||||
require __DIR__ . '/backported/1.3-beta2/changeAccountUsername.php';
|
||||
exit;
|
||||
}
|
||||
checkClientDatabaseVersion();
|
||||
$conn = newConnection();
|
||||
|
||||
$post = getPostData();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
checkClientDatabaseVersion();
|
||||
$conn = newConnection();
|
||||
|
||||
$post = getPostData();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
checkClientDatabaseVersion();
|
||||
|
||||
$post = getPostData();
|
||||
$id = $post['id'] ?? '';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
checkClientDatabaseVersion();
|
||||
|
||||
$post = getPostData();
|
||||
$id = $post['id'] ?? '';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
checkClientDatabaseVersion();
|
||||
|
||||
$post = getPostData();
|
||||
$uesrId = $post['uesrId'] ?? '';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
checkClientDatabaseVersion();
|
||||
$conn = newConnection();
|
||||
|
||||
$post = getPostData();
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
if (isAllowedDatabaseVersion(getClientVersion())) {
|
||||
if (getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5.1/getChatroomMessages.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5.1/getChatroomMessages.php';
|
||||
exit;
|
||||
}
|
||||
checkClientDatabaseVersion();
|
||||
$conn = newConnection();
|
||||
|
||||
$stmt = $conn->prepare("
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
require __DIR__ . '/../config/general.php';
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
echo $latestVersion;
|
||||
echo "1.8.2";
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
checkClientDatabaseVersion();
|
||||
$conn = newConnection();
|
||||
|
||||
$post = getPostData();
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
if (getClientVersion() == "0" && isAllowedDatabaseVersion("1.4.0-beta1") && isAllowedDatabaseVersion("1.4.0") && isAllowedDatabaseVersion("1.4.1")) {
|
||||
if (getClientVersion() == "0") {
|
||||
require __DIR__ . '/backported/1.4.0-beta1/getTopPlayers.php';
|
||||
exit;
|
||||
}
|
||||
if (isAllowedDatabaseVersion(getClientVersion())) {
|
||||
if (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") {
|
||||
require __DIR__ . '/backported/1.3-beta2/getTopPlayers.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5/getTopPlayers.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") {
|
||||
require __DIR__ . '/backported/1.3-beta2/getTopPlayers.php';
|
||||
exit;
|
||||
}
|
||||
if ($_SERVER['HTTP_REQUESTER'] != 'BerryDashLauncher') {
|
||||
checkClientDatabaseVersion();
|
||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5/getTopPlayers.php';
|
||||
exit;
|
||||
}
|
||||
$post = getPostData();
|
||||
$request_type = $post['type'] ?? '';
|
||||
|
||||
3
database/launcher/latest.php
Executable file → Normal file
3
database/launcher/latest.php
Executable file → Normal file
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
require __DIR__ . '/../../incl/util.php';
|
||||
require __DIR__ . '/../../config/general.php';
|
||||
setPlainHeader();
|
||||
echo $latestLauncherVersion;
|
||||
echo "-1";
|
||||
|
||||
13
database/launcher/versions.php
Executable file → Normal file
13
database/launcher/versions.php
Executable file → Normal file
@@ -9,17 +9,6 @@ $stmt->execute();
|
||||
$result_versions = $stmt->get_result();
|
||||
$versions = array_map(fn($row) => ['id' => $row['id'], 'version' => $row['version'], 'releaseDate' => $row['releaseDate'], 'displayName' => empty($row['displayName']) ? $row['version'] : $row['displayName'], 'platforms' => json_decode($row['platforms']), 'downloadUrls' => json_decode($row['downloadUrls']), 'executables' => json_decode($row['executables']), 'category' => $row['category']], $result_versions->fetch_all(MYSQLI_ASSOC));
|
||||
|
||||
$stmt = $conn->prepare("SELECT * FROM launchercategories ORDER BY id DESC");
|
||||
$stmt->execute();
|
||||
|
||||
$result_categories = $stmt->get_result();
|
||||
$rows = $result_categories->fetch_all(MYSQLI_ASSOC);
|
||||
|
||||
$categories = [];
|
||||
foreach ($rows as $row) {
|
||||
$categories[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
echo json_encode(["versions" => $versions, "categories" => $categories]);
|
||||
echo json_encode($versions);
|
||||
|
||||
$conn->close();
|
||||
@@ -1,17 +1,14 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
if (isAllowedDatabaseVersion(getClientVersion())) {
|
||||
if (getClientVersion() == "1.4.0-beta1") {
|
||||
require __DIR__ . '/backported/1.4.0-beta1/loadAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5/loadAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.4.0-beta1") {
|
||||
require __DIR__ . '/backported/1.4.0-beta1/loadAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5/loadAccount.php';
|
||||
exit;
|
||||
}
|
||||
checkClientDatabaseVersion();
|
||||
|
||||
$post = getPostData();
|
||||
$token = $post['token'] ?? '';
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
if (isAllowedDatabaseVersion(getClientVersion())) {
|
||||
if (
|
||||
getClientVersion() == "1.2-beta2" ||
|
||||
getClientVersion() == "1.2" ||
|
||||
getClientVersion() == "1.21" ||
|
||||
getClientVersion() == "1.3-beta1"
|
||||
) {
|
||||
require __DIR__ . '/backported/1.2-beta2/loginAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") {
|
||||
require __DIR__ . '/backported/1.3-beta2/loginAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.4.0-beta1") {
|
||||
require __DIR__ . '/backported/1.4.0-beta1/loginAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5/loginAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (
|
||||
getClientVersion() == "1.2-beta2" ||
|
||||
getClientVersion() == "1.2" ||
|
||||
getClientVersion() == "1.21" ||
|
||||
getClientVersion() == "1.3-beta1"
|
||||
) {
|
||||
require __DIR__ . '/backported/1.2-beta2/loginAccount.php';
|
||||
exit;
|
||||
}
|
||||
checkClientDatabaseVersion();
|
||||
if (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") {
|
||||
require __DIR__ . '/backported/1.3-beta2/loginAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.4.0-beta1") {
|
||||
require __DIR__ . '/backported/1.4.0-beta1/loginAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5/loginAccount.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$conn = newConnection();
|
||||
|
||||
$post = getPostData();
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
if (isAllowedDatabaseVersion(getClientVersion())) {
|
||||
if (getClientVersion() == "1.2-beta2" || getClientVersion() == "1.2") {
|
||||
require __DIR__ . '/backported/1.2-beta2/registerAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (
|
||||
getClientVersion() == "1.21" ||
|
||||
getClientVersion() == "1.3-beta1" ||
|
||||
getClientVersion() == "1.3-beta2" ||
|
||||
getClientVersion() == "1.3"
|
||||
) {
|
||||
require __DIR__ . '/backported/1.21/registerAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5/registerAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.2-beta2" || getClientVersion() == "1.2") {
|
||||
require __DIR__ . '/backported/1.2-beta2/registerAccount.php';
|
||||
exit;
|
||||
}
|
||||
checkClientDatabaseVersion();
|
||||
if (
|
||||
getClientVersion() == "1.21" ||
|
||||
getClientVersion() == "1.3-beta1" ||
|
||||
getClientVersion() == "1.3-beta2" ||
|
||||
getClientVersion() == "1.3"
|
||||
) {
|
||||
require __DIR__ . '/backported/1.21/registerAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5/registerAccount.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$conn = newConnection();
|
||||
|
||||
$post = getPostData();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
checkClientDatabaseVersion();
|
||||
|
||||
$post = getPostData();
|
||||
$id = $post['id'] ?? '';
|
||||
|
||||
@@ -1,29 +1,26 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
if (isAllowedDatabaseVersion(getClientVersion())) {
|
||||
if (
|
||||
getClientVersion() == "1.2-beta2" ||
|
||||
getClientVersion() == "1.2" ||
|
||||
getClientVersion() == "1.21" ||
|
||||
getClientVersion() == "1.3-beta1" ||
|
||||
getClientVersion() == "1.3-beta2" ||
|
||||
getClientVersion() == "1.3" ||
|
||||
getClientVersion() == "1.33"
|
||||
) {
|
||||
require __DIR__ . '/backported/1.2-beta2/syncAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.4.0-beta1") {
|
||||
require __DIR__ . '/backported/1.4.0-beta1/saveAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5/saveAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (
|
||||
getClientVersion() == "1.2-beta2" ||
|
||||
getClientVersion() == "1.2" ||
|
||||
getClientVersion() == "1.21" ||
|
||||
getClientVersion() == "1.3-beta1" ||
|
||||
getClientVersion() == "1.3-beta2" ||
|
||||
getClientVersion() == "1.3" ||
|
||||
getClientVersion() == "1.33"
|
||||
) {
|
||||
require __DIR__ . '/backported/1.2-beta2/syncAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.4.0-beta1") {
|
||||
require __DIR__ . '/backported/1.4.0-beta1/saveAccount.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5/saveAccount.php';
|
||||
exit;
|
||||
}
|
||||
checkClientDatabaseVersion();
|
||||
|
||||
$post = getPostData();
|
||||
$token = $post['token'] ?? '';
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
if (isAllowedDatabaseVersion(getClientVersion())) {
|
||||
if (getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5.1/sendChatroomMessage.php';
|
||||
exit;
|
||||
}
|
||||
if (getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||
require __DIR__ . '/backported/1.5.1/sendChatroomMessage.php';
|
||||
exit;
|
||||
}
|
||||
checkClientDatabaseVersion();
|
||||
|
||||
$post = getPostData();
|
||||
$request_content = $post['content'] ?? '';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
checkClientDatabaseVersion();
|
||||
|
||||
$post = getPostData();
|
||||
$request_content = $post['content'] ?? '';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
checkClientDatabaseVersion();
|
||||
|
||||
$post = getPostData();
|
||||
$token = $post['token'] ?? '';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
checkClientDatabaseVersion();
|
||||
$conn = newConnection();
|
||||
|
||||
$post = getPostData();
|
||||
|
||||
@@ -53,38 +53,6 @@ function exitWithMessage($message, $encrypt = true) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function isLatestVersion($version) {
|
||||
global $latestVersion;
|
||||
if (!isset($latestVersion)) require __DIR__ . '/../config/general.php';
|
||||
return $version === $latestVersion;
|
||||
}
|
||||
|
||||
function isBetaVersion($version) {
|
||||
global $latestBetaVersion;
|
||||
if (!isset($latestBetaVersion)) require __DIR__ . '/../config/general.php';
|
||||
return $version === $latestBetaVersion;
|
||||
}
|
||||
|
||||
function isAllowedVersion($version) {
|
||||
global $allowedVersions;
|
||||
if (!isset($allowedVersions)) require __DIR__ . '/../config/general.php';
|
||||
return in_array($version, $allowedVersions);
|
||||
}
|
||||
|
||||
function isAllowedDatabaseVersion($version) {
|
||||
global $allowedDatabaseVersions;
|
||||
if (!isset($allowedDatabaseVersions)) require __DIR__ . '/../config/general.php';
|
||||
return in_array($version, $allowedDatabaseVersions);
|
||||
}
|
||||
|
||||
function checkClientDatabaseVersion() {
|
||||
global $allowedDatabaseVersions;
|
||||
if (!isset($allowedDatabaseVersions)) require __DIR__ . '/../config/general.php';
|
||||
if (!isset($_SERVER['HTTP_REQUESTER'])) exitWithMessage("-998");
|
||||
if ($_SERVER['HTTP_REQUESTER'] != "BerryDashClient") exitWithMessage("-998");
|
||||
if (!in_array($_SERVER['HTTP_CLIENTVERSION'] ?? '', $allowedDatabaseVersions)) exitWithMessage("-998");
|
||||
}
|
||||
|
||||
function getPostData() {
|
||||
$raw = file_get_contents("php://input");
|
||||
parse_str($raw, $postData);
|
||||
|
||||
Reference in New Issue
Block a user