diff --git a/app/Models/Mount.php b/app/Models/Mount.php index 81e9a57c1..ac0b5da9a 100644 --- a/app/Models/Mount.php +++ b/app/Models/Mount.php @@ -2,9 +2,6 @@ namespace Pterodactyl\Models; -use MountNode; -use MountServer; - /** * @property int $id * @property string $uuid @@ -48,6 +45,11 @@ class Mount extends Model */ protected $attributes = [ 'id' => 'int', + 'uuid' => 'string', + 'name' => 'string', + 'description' => 'string', + 'source' => 'string', + 'target' => 'string', 'read_only' => 'bool', 'user_mountable' => 'bool', ]; @@ -87,18 +89,20 @@ class Mount extends Model /** * Returns all nodes that have this mount assigned. * - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ public function nodes() { - return $this->hasManyThrough(Server::class, MountNode::class); + return $this->belongsToMany(Node::class); } /** - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough + * Returns all servers that have this mount assigned. + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ public function servers() { - return $this->hasManyThrough(Server::class, MountServer::class); + return $this->belongsToMany(Server::class); } } diff --git a/app/Models/MountNode.php b/app/Models/MountNode.php deleted file mode 100644 index 77f8bf3d5..000000000 --- a/app/Models/MountNode.php +++ /dev/null @@ -1,39 +0,0 @@ -belongsTo(Node::class); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function mount() - { - return $this->belongsTo(Mount::class); - } -} diff --git a/app/Models/MountServer.php b/app/Models/MountServer.php deleted file mode 100644 index 77b60208c..000000000 --- a/app/Models/MountServer.php +++ /dev/null @@ -1,39 +0,0 @@ -belongsTo(Server::class); - } - - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function mount() - { - return $this->belongsTo(Mount::class); - } -} diff --git a/app/Services/Servers/ServerConfigurationStructureService.php b/app/Services/Servers/ServerConfigurationStructureService.php index ec8bbf560..fea2eaac0 100644 --- a/app/Services/Servers/ServerConfigurationStructureService.php +++ b/app/Services/Servers/ServerConfigurationStructureService.php @@ -9,7 +9,6 @@ namespace Pterodactyl\Services\Servers; -use Pterodactyl\Models\Mount; use Pterodactyl\Models\Server; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; @@ -72,6 +71,17 @@ class ServerConfigurationStructureService */ protected function returnCurrentFormat(Server $server) { + $mounts = $server->mounts; + foreach ($mounts as $mount) { + unset($mount->id); + unset($mount->uuid); + unset($mount->name); + unset($mount->description); + $mount->read_only = $mount->read_only == 1; + unset($mount->user_mountable); + unset($mount->pivot); + } + return [ 'uuid' => $server->uuid, 'suspended' => (bool) $server->suspended, @@ -102,9 +112,7 @@ class ServerConfigurationStructureService ], 'mappings' => $server->getAllocationMappings(), ], - 'mounts' => $server->mounts->map(function (Mount $mount) { - return $mount->only('uuid', 'source', 'description', 'read_only'); - })->toArray(), + 'mounts' => $mounts, ]; } diff --git a/resources/views/templates/wrapper.blade.php b/resources/views/templates/wrapper.blade.php index 333a0f986..213f09358 100644 --- a/resources/views/templates/wrapper.blade.php +++ b/resources/views/templates/wrapper.blade.php @@ -35,21 +35,11 @@ @import url('//fonts.googleapis.com/css?family=IBM+Plex+Mono|IBM+Plex+Sans:500&display=swap'); - @section('assets') -{{-- {!! $asset->css('main.css') !!}--}} - @show + @yield('assets') @include('layouts.scripts') - @if(\Illuminate\Support\Str::contains(config('app.version'), ['-alpha', '-beta'])) -
-

- You are running a pre-release version of Pterodactyl. Please report any issues - via GitHub. -

-
- @endif @section('content') @yield('above-container') @yield('container')