From b1fa3927c17b7c34c3b12aa6e8825a3de1a81d04 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Thu, 11 Apr 2024 10:42:18 -0600 Subject: [PATCH 1/3] api(remote): fix oops in BackupStatusController --- .../Controllers/Api/Remote/Backups/BackupStatusController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php index 042fbd0506..75f039d285 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php @@ -34,8 +34,8 @@ public function index(ReportBackupCompleteRequest $request, string $backup): Jso /** @var \Pterodactyl\Models\Node $node */ $node = $request->attributes->get('node'); - /** @var \Pterodactyl\Models\Backup $backup */ - $backup = Backup::query() + /** @var \Pterodactyl\Models\Backup $model */ + $model = Backup::query() ->where('node_id', $node->id) ->where('uuid', $backup) ->firstOrFail(); From 0dad4c5a488661f9adc27dd311542516d9bfa0f2 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Thu, 11 Apr 2024 10:47:00 -0600 Subject: [PATCH 2/3] ui(admin): better handling of manual HTML rendering --- public/themes/pterodactyl/js/admin/new-server.js | 16 +++++++++++----- resources/views/admin/nodes/view/index.blade.php | 10 ++++++++-- .../views/admin/servers/view/startup.blade.php | 16 +++++++++++----- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/public/themes/pterodactyl/js/admin/new-server.js b/public/themes/pterodactyl/js/admin/new-server.js index 1fd80a9218..1437c04e2a 100644 --- a/public/themes/pterodactyl/js/admin/new-server.js +++ b/public/themes/pterodactyl/js/admin/new-server.js @@ -109,6 +109,12 @@ $('#pEggId').on('change', function (event) { ), }); + function escapeHtml(str) { + var div = document.createElement('div'); + div.appendChild(document.createTextNode(str)); + return div.innerHTML; + } + const variableIds = {}; $('#appendVariablesTo').html(''); $.each(_.get(objectChain, 'variables', []), function (i, item) { @@ -117,11 +123,11 @@ $('#pEggId').on('change', function (event) { let isRequired = (item.required === 1) ? 'Required ' : ''; let dataAppend = ' \
\ - \ - \ -

' + item.description + '
\ - Access in Startup: {{' + item.env_variable + '}}
\ - Validation Rules: ' + item.rules + '

\ + \ + \ +

' + escapeHtml(item.description) + '
\ + Access in Startup: {{' + escapeHtml(item.env_variable) + '}}
\ + Validation Rules: ' + escapeHtml(item.rules) + '

\
\ '; $('#appendVariablesTo').append(dataAppend); diff --git a/resources/views/admin/nodes/view/index.blade.php b/resources/views/admin/nodes/view/index.blade.php index 2d0bb32874..defa0d366e 100644 --- a/resources/views/admin/nodes/view/index.blade.php +++ b/resources/views/admin/nodes/view/index.blade.php @@ -145,14 +145,20 @@ @section('footer-scripts') @parent