Skip to content

Commit 4990eda

Browse files
committed
PUSH
- More Customization is now limited to premium users :( [sorry guys :<] - Plugins can be installed from a url now :) - Fixed a problem where vip_only can be null or not set (For some reason :0) - Fixed a problem where users were not deleted from dashboard! - Fixed server deletion problems - Plugin settings encryption was fixed - Fix egg creation problems
1 parent b1cc3a3 commit 4990eda

File tree

29 files changed

+301
-200
lines changed

29 files changed

+301
-200
lines changed

CHANGELOG.md

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
1-
# v3-remastered 1.2
1+
# v3.2.0-Nexus
22

33
## Bug Fixes
44

5-
- Resolved ticket component having no translation!
6-
- Reverted the change for vite: `MPA` app!
7-
- Added null and type checks in `Register.php` to prevent 'Trying to access array offset on value of type bool' and 'getTokenFromUUID(): Argument #1 ($uuid) must be of type string, null given' errors.
8-
- Improved error handling in `Callback/Discord.php` for failed HTTP requests and missing array keys to prevent warnings and fatal errors.
9-
- Added null check for `$session` in `PermissionMiddleware.php` to prevent 'Call to a member function hasPermission() on null' fatal error.
10-
- Fixed a bug where users above id 100 matching a char will not be found!
11-
- Fixed useless components being rendered behind!
12-
13-
## New Features
14-
15-
- Validation logic on frontend and backend to reduce false input provided to pterodactyl panel!
16-
- Servers now get deleted after renew has reached day 0!
17-
- New logic to check the users existence into pterodactyl!
18-
- Ability for users to see server in deployment!
19-
- Ability for users to delete the server that are in deployment stage!
20-
- Init command actually helps you now lol
21-
- Clear license cache command
22-
23-
## Features Removed
24-
25-
- Ability to disable telemetry via UI (Requires a plugin now!)
5+
- Fixed missing translations in ticket component
6+
- Reverted Vite MPA (Multi-Page Application) configuration changes
7+
- Enhanced type safety in `Register.php` to prevent null reference and type coercion errors
8+
- Improved error handling for Discord API callbacks to prevent warnings and fatal errors
9+
- Added session null check in `PermissionMiddleware.php` to prevent fatal errors
10+
- Fixed user-character matching for user IDs above 100
11+
- Removed unnecessary component rendering in background layers
12+
- Resolved VIP-only flag initialization issues
13+
- Fixed user deletion functionality in dashboard
14+
- Resolved server deletion issues
15+
- Fixed plugin settings encryption system
16+
17+
## Enhancements
18+
19+
- Implemented comprehensive validation on both frontend and backend for Pterodactyl panel inputs
20+
- Added automatic server cleanup on renewal expiration
21+
- Enhanced user verification logic for Pterodactyl integration
22+
- Added server deployment status visibility for users
23+
- Implemented server deletion capability during deployment phase
24+
- Improved initialization command functionality
25+
- Added command to clear license cache
26+
- Introduced URL-based plugin installation support
27+
28+
## Breaking Changes
29+
30+
- Telemetry controls moved to plugin system (UI controls removed)
31+
- Advanced customization features restricted to premium users
2632

2733
## Updates
2834

@@ -50,7 +56,7 @@
5056
- Updated `symfony/console` to v7.3.1
5157
- Updated `symfony/yaml` to v7.3.1
5258

53-
# v3-remastered 1.1
59+
# v3-remastered 1.0
5460

5561
## Bug Fixes
5662

backend/app/Api/Admin/Eggs/Categories/EggCategories.php

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@
3232
PermissionMiddleware::handle($appInstance, Permissions::ADMIN_NESTS_LIST, $session);
3333
$nests = Nests::getNests();
3434

35-
$appInstance->OK('Pterodactyl nests', [
36-
'nests' => $nests,
37-
]);
35+
if (empty($nests)) {
36+
$appInstance->BadRequest('No nests found', ['error_code' => 'ERROR_NO_NESTS_FOUND']);
37+
} else {
38+
$appInstance->OK('Pterodactyl nests', [
39+
'nests' => $nests,
40+
]);
41+
}
3842
});
3943

4044
$router->get('/api/admin/egg-categories/pterodactyl-nests/(.*)/eggs', function ($nestId): void {
@@ -46,9 +50,13 @@
4650
PermissionMiddleware::handle($appInstance, Permissions::ADMIN_NESTS_LIST, $session);
4751
$eggs = Eggs::getEggs((int) $nestId);
4852

49-
$appInstance->OK('Pterodactyl eggs', [
50-
'eggs' => $eggs,
51-
]);
53+
if (empty($eggs)) {
54+
$appInstance->BadRequest('No eggs found', ['error_code' => 'ERROR_NO_EGGS_FOUND']);
55+
} else {
56+
$appInstance->OK('Pterodactyl eggs', [
57+
'eggs' => $eggs,
58+
]);
59+
}
5260
});
5361

5462
$router->get('/api/admin/egg-categories', function (): void {
@@ -60,9 +68,13 @@
6068
PermissionMiddleware::handle($appInstance, Permissions::ADMIN_NESTS_LIST, $session);
6169
$categories = EggCategories::getCategories();
6270

63-
$appInstance->OK('Egg Categories', [
64-
'categories' => $categories,
65-
]);
71+
if (empty($categories)) {
72+
$appInstance->BadRequest('No categories found', ['error_code' => 'ERROR_NO_CATEGORIES_FOUND']);
73+
} else {
74+
$appInstance->OK('Egg Categories', [
75+
'categories' => $categories,
76+
]);
77+
}
6678
});
6779

6880
$router->post('/api/admin/egg-categories/create', function (): void {

backend/app/Api/Admin/Eggs/Eggs/Eggs.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@
3333
PermissionMiddleware::handle($appInstance, Permissions::ADMIN_NESTS_LIST, $session);
3434
$eggs = Eggs::getEggs((int) $nestId);
3535

36-
$appInstance->OK('Pterodactyl eggs', [
37-
'eggs' => $eggs,
38-
]);
36+
if (empty($eggs)) {
37+
$appInstance->BadRequest('No eggs found', ['error_code' => 'ERROR_NO_EGGS_FOUND']);
38+
} else {
39+
$appInstance->OK('Pterodactyl eggs', [
40+
'eggs' => $eggs,
41+
]);
42+
}
3943
});
4044

4145
// Get all eggs from all nests
@@ -47,10 +51,13 @@
4751

4852
PermissionMiddleware::handle($appInstance, Permissions::ADMIN_EGG_LIST, $session);
4953
$eggs = Eggs::getAllEggs();
50-
51-
$appInstance->OK('All Pterodactyl eggs', [
52-
'eggs' => $eggs,
53-
]);
54+
if (empty($eggs)) {
55+
$appInstance->BadRequest('No eggs found', ['error_code' => 'ERROR_NO_EGGS_FOUND']);
56+
} else {
57+
$appInstance->OK('All Pterodactyl eggs', [
58+
'eggs' => $eggs,
59+
]);
60+
}
5461
});
5562

5663
// Get a specific egg by ID

backend/app/Api/Admin/Plugins/plugins.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
$settings = PluginSettings::getSettings($identifier);
5353
$settingsList = [];
5454
foreach ($settings as $setting) {
55-
$settingsList[$setting['key']] = $appInstance->decrypt($setting['value']);
55+
$settingsList[$setting['key']] = $setting['value'];
5656
}
5757
$appInstance->OK('Plugin config fetched successfully', ['config' => $info, 'plugin' => $info, 'settings' => $settingsList]);
5858
} else {
@@ -87,8 +87,6 @@
8787

8888
if (isset($_POST['value']) && !empty($_POST['value'])) {
8989
$value = $_POST['value'];
90-
$valueNonEncrypted = $value;
91-
$value = $appInstance->encrypt($value);
9290
} else {
9391
$appInstance->BadRequest('Missing value parameter', ['error_code' => 'MISSING_VALUE']);
9492

@@ -108,12 +106,12 @@
108106
$eventManager->emit(PluginsSettingsEvent::onPluginSettingUpdate(), [
109107
'identifier' => $identifier,
110108
'key' => $key,
111-
'value' => $valueNonEncrypted,
109+
'value' => $value,
112110
]);
113111
$appInstance->OK('Setting updated successfully', [
114112
'identifier' => $identifier,
115113
'key' => $key,
116-
'value' => $valueNonEncrypted,
114+
'value' => $value,
117115
]);
118116
} catch (Exception $e) {
119117
$appInstance->InternalServerError('Failed to update setting', [

backend/app/Api/System/License.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,57 @@
1414
use MythicalDash\App;
1515
use MythicalDash\Config\ConfigInterface;
1616

17+
$router->add('/api/system/license/theme-customization', function (): void {
18+
App::init();
19+
$appInstance = App::getInstance(true);
20+
$config = $appInstance->getConfig();
21+
22+
$licenseSystem = $appInstance->getLicenseSystem();
23+
try {
24+
$keyData = $licenseSystem->validateLicense($config->getSetting(ConfigInterface::LICENSE_KEY, 'NULL'), $config->getSetting(ConfigInterface::APP_URL, 'true'));
25+
} catch (Exception $e) {
26+
App::OK('License is invalid!', ['valid' => false]);
27+
}
28+
if ($keyData['valid']) {
29+
$licenseData = $keyData['data'];
30+
$project_info = $licenseData['project_info'];
31+
32+
if (isset($project_info['features']) && in_array('More Customization', $project_info['features'])) {
33+
App::OK('License is valid!', ['valid' => true]);
34+
} else {
35+
App::OK('License is invalid! More Customization feature not found.', ['valid' => false]);
36+
}
37+
} else {
38+
App::OK('License is invalid!', ['valid' => false]);
39+
}
40+
41+
});
42+
43+
$router->add('/api/system/license/beta', function (): void {
44+
App::init();
45+
$appInstance = App::getInstance(true);
46+
$config = $appInstance->getConfig();
47+
48+
$licenseSystem = $appInstance->getLicenseSystem();
49+
try {
50+
$keyData = $licenseSystem->validateLicense($config->getSetting(ConfigInterface::LICENSE_KEY, 'NULL'), $config->getSetting(ConfigInterface::APP_URL, 'true'));
51+
} catch (Exception $e) {
52+
App::OK('License is invalid!', ['valid' => false]);
53+
}
54+
if ($keyData['valid']) {
55+
$licenseData = $keyData['data'];
56+
$project_info = $licenseData['project_info'];
57+
58+
if (isset($project_info['features']) && in_array('Beta Features', $project_info['features'])) {
59+
App::OK('License is valid!', ['valid' => true]);
60+
} else {
61+
App::OK('License is invalid! Beta features not found.', ['valid' => false]);
62+
}
63+
} else {
64+
App::OK('License is invalid!', ['valid' => false]);
65+
}
66+
});
67+
1768
$router->add('/api/system/license/branding-removal', function (): void {
1869
App::init();
1970
$appInstance = App::getInstance(true);

backend/app/Api/User/Server/actions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -727,14 +727,14 @@
727727
$eggInfo = Eggs::getById($egg_id);
728728

729729
// Check if location is VIP only and user doesn't have VIP permission
730-
if ($locationInfo['vip_only'] === 'true' && !$session->hasPermission(Permissions::USER_PERMISSION_VIP)) {
730+
if (isset($locationInfo['vip_only']) && $locationInfo['vip_only'] === 'true' && !$session->hasPermission(Permissions::USER_PERMISSION_VIP)) {
731731
$appInstance->BadRequest('Location is VIP only', ['error_code' => 'LOCATION_VIP_ONLY']);
732732

733733
return;
734734
}
735735

736736
// Check if egg is VIP only and user doesn't have VIP permission
737-
if ($eggInfo['vip_only'] === 'true' && !$session->hasPermission(Permissions::USER_PERMISSION_VIP)) {
737+
if (isset($eggInfo['vip_only']) && $eggInfo['vip_only'] === 'true' && !$session->hasPermission(Permissions::USER_PERMISSION_VIP)) {
738738
$appInstance->BadRequest('Egg is VIP only', ['error_code' => 'EGG_VIP_ONLY']);
739739

740740
return;
@@ -800,10 +800,10 @@
800800
$session = new Session($appInstance);
801801
$accountToken = $session->SESSION_KEY;
802802
$serverQueue = ServerQueue::getByUserAndId($session->getInfo(UserColumns::UUID, false), (int) $id);
803-
if (!$serverQueue) {
803+
if (empty($serverQueue)) {
804804
$appInstance->BadRequest('Server queue item not found', ['error_code' => 'SERVER_QUEUE_ITEM_NOT_FOUND', 'server_queue' => $serverQueue]);
805805
}
806-
ServerQueue::delete((int) $serverQueue['id']);
806+
ServerQueue::delete((int) $serverQueue['id'] ?? 0);
807807
$appInstance->OK('Server queue item deleted successfully.', ['error_code' => 'SERVER_QUEUE_ITEM_DELETED']);
808808
});
809809

@@ -820,7 +820,7 @@
820820
$server = Servers::getServerPterodactylDetails((int) $id);
821821

822822
if (empty($server)) {
823-
$appInstance->Forbidden('Server not found or you do not have permission to access it', ['error_code' => 'SERVER_NOT_FOUND']);
823+
$appInstance->Forbidden('Server not found or you do not have permission to access it', ['error_code' => 'SERVER_NOT_FOUND', 'server' => $server]);
824824

825825
return;
826826
}

backend/app/Chat/Eggs/Eggs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public static function getById(int $id): array
152152

153153
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
154154

155-
return $result ? [$result] : [];
155+
return $result ?? [];
156156
} catch (\Exception $e) {
157157
self::db_Error('Failed to get egg: ' . $e->getMessage());
158158

backend/app/Chat/Servers/ServerQueue.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ public static function getByUser(string $user, array $filters = [], bool $includ
8080
}
8181
}
8282

83-
public static function getByUserAndId(string $user, int $id): ?array
83+
public static function getByUserAndId(string $user, int $id): array
8484
{
8585
$items = self::getByUser($user, [], false);
8686
foreach ($items as $item) {
8787
if ($item['id'] == $id) {
88-
return $item;
88+
return $item ?: [];
8989
}
9090
}
9191

92-
return null;
92+
return []; // Type errors :>
9393
}
9494

9595
public static function hasAtLeastOnePendingItem(string $user): bool
@@ -234,6 +234,9 @@ public static function updateStatus(int $id, string $status): bool
234234
*/
235235
public static function delete(int $id): bool
236236
{
237+
if ($id == 0) {
238+
return false;
239+
}
237240
try {
238241
$dbConn = Database::getPdoConnection();
239242

backend/app/Chat/Servers/ServerQueueLogs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static function getAll(): array
3434
try {
3535
$dbConn = Database::getPdoConnection();
3636

37-
$query = 'SELECT * FROM ' . self::getTableName() . ' WHERE deleted = "false"';
37+
$query = 'SELECT * FROM ' . self::getTableName() . ' WHERE deleted = "false" ORDER BY created_at DESC';
3838

3939
$stmt = $dbConn->prepare($query);
4040
$stmt->execute();

0 commit comments

Comments
 (0)