+
+ {file.mode}
+
+
+
{file.isFile ?
:
diff --git a/resources/scripts/components/server/files/NewDirectoryButton.tsx b/resources/scripts/components/server/files/NewDirectoryButton.tsx
index dc91377bc..56b58e17e 100644
--- a/resources/scripts/components/server/files/NewDirectoryButton.tsx
+++ b/resources/scripts/components/server/files/NewDirectoryButton.tsx
@@ -25,7 +25,8 @@ const schema = object().shape({
const generateDirectoryData = (name: string): FileObject => ({
key: `dir_${name.split('/', 1)[0] ?? name}`,
name: name.replace(/^(\/*)/, '').split('/', 1)[0] ?? name,
- mode: '0644',
+ mode: 'drwxr-xr-x',
+ modeBits: '0755',
size: 0,
isFile: false,
isSymlink: false,
diff --git a/resources/scripts/helpers.ts b/resources/scripts/helpers.ts
index 84358193b..fdeef7ecd 100644
--- a/resources/scripts/helpers.ts
+++ b/resources/scripts/helpers.ts
@@ -20,3 +20,33 @@ export const randomInt = (low: number, high: number) => Math.floor(Math.random()
export const cleanDirectoryPath = (path: string) => path.replace(/(^#\/*)|(\/(\/*))|(^$)/g, '/');
export const capitalize = (s: string) => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
+
+export function fileBitsToString (mode: string, directory: boolean): string {
+ const m = parseInt(mode, 8);
+
+ let buf = '';
+ 'dalTLDpSugct?'.split('').forEach((c, i) => {
+ if ((m & (1 << (32 - 1 - i))) !== 0) {
+ buf = buf + c;
+ }
+ });
+
+ if (buf.length === 0) {
+ // If the file is directory, make sure it has the directory flag.
+ if (directory) {
+ buf = 'd';
+ } else {
+ buf = '-';
+ }
+ }
+
+ 'rwxrwxrwx'.split('').forEach((c, i) => {
+ if ((m & (1 << (9 - 1 - i))) !== 0) {
+ buf = buf + c;
+ } else {
+ buf = buf + '-';
+ }
+ });
+
+ return buf;
+}
From bd0b7127d23426758fb3b6f8ee6860ba31d4a478 Mon Sep 17 00:00:00 2001
From: Matthew Penner
Date: Sun, 29 Nov 2020 14:47:18 -0700
Subject: [PATCH 07/10] Fix validation rules for ChmodFilesRequest.php
---
.../Requests/Api/Client/Servers/Files/ChmodFilesRequest.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php b/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php
index ed6540219..03a90564b 100644
--- a/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php
+++ b/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php
@@ -24,8 +24,7 @@ class ChmodFilesRequest extends ClientApiRequest implements ClientPermissionsReq
return [
'root' => 'required|nullable|string',
'files' => 'required|array',
- 'files.file' => 'string',
- 'files.mode' => 'integer',
+ 'files.*' => 'string',
];
}
}
From 3e1dbbaeddc800500c7e97054472a7b1e63051c2 Mon Sep 17 00:00:00 2001
From: Matthew Penner
Date: Sun, 29 Nov 2020 16:02:20 -0700
Subject: [PATCH 08/10] Fix validation rules for ChmodFilesRequest.php, again..
---
.../Requests/Api/Client/Servers/Files/ChmodFilesRequest.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php b/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php
index 03a90564b..158a0a7fd 100644
--- a/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php
+++ b/app/Http/Requests/Api/Client/Servers/Files/ChmodFilesRequest.php
@@ -24,7 +24,8 @@ class ChmodFilesRequest extends ClientApiRequest implements ClientPermissionsReq
return [
'root' => 'required|nullable|string',
'files' => 'required|array',
- 'files.*' => 'string',
+ 'files.*.file' => 'required|string',
+ 'files.*.mode' => 'required|numeric',
];
}
}
From 7c2888641f888d0c10492364d198c2eaac8c33e6 Mon Sep 17 00:00:00 2001
From: Stepan Fedotov
Date: Fri, 4 Dec 2020 19:56:44 +0200
Subject: [PATCH 09/10] Fix application API's ServerVariableTransformer
---
.../Api/Application/ServerVariableTransformer.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/Transformers/Api/Application/ServerVariableTransformer.php b/app/Transformers/Api/Application/ServerVariableTransformer.php
index 73cd169b2..3f7eeac49 100644
--- a/app/Transformers/Api/Application/ServerVariableTransformer.php
+++ b/app/Transformers/Api/Application/ServerVariableTransformer.php
@@ -2,7 +2,7 @@
namespace Pterodactyl\Transformers\Api\Application;
-use Pterodactyl\Models\ServerVariable;
+use Pterodactyl\Models\EggVariable;
use Pterodactyl\Services\Acl\Api\AdminAcl;
class ServerVariableTransformer extends BaseTransformer
@@ -27,10 +27,10 @@ class ServerVariableTransformer extends BaseTransformer
/**
* Return a generic transformed server variable array.
*
- * @param \Pterodactyl\Models\ServerVariable $variable
+ * @param \Pterodactyl\Models\EggVariable $variable
* @return array
*/
- public function transform(ServerVariable $variable)
+ public function transform(EggVariable $variable)
{
return $variable->toArray();
}
@@ -38,11 +38,11 @@ class ServerVariableTransformer extends BaseTransformer
/**
* Return the parent service variable data.
*
- * @param \Pterodactyl\Models\ServerVariable $variable
+ * @param \Pterodactyl\Models\EggVariable $variable
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
*/
- public function includeParent(ServerVariable $variable)
+ public function includeParent(EggVariable $variable)
{
if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) {
return $this->null();
From e32c4d4f0518cb0344c372c872c1aa4f31c096a7 Mon Sep 17 00:00:00 2001
From: Stepan Fedotov
Date: Fri, 4 Dec 2020 19:58:09 +0200
Subject: [PATCH 10/10] Documentate fix
---
CHANGELOG.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cfc6c0f9c..43ed825c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,10 @@ This file is a running track of new features and fixes to each version of the pa
This project follows [Semantic Versioning](http://semver.org) guidelines.
+## Unreleased
+### Fixed
+* Fixes the application API unable to return server's variables.
+
## v1.1.3
### Fixed
* Server bulk power actions command will no longer attempt to run commands against installing or suspended servers.