Skip to content

Commit d5f2242

Browse files
committed
Merge branch 'develop' of https://github.com/Pterodactyl/Panel into develop
2 parents ef586bf + a967dbc commit d5f2242

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

app/Http/Controllers/Admin/ServersController.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Pterodactyl\Models\User;
1515
use Pterodactyl\Models\Mount;
1616
use Pterodactyl\Models\Server;
17+
use Pterodactyl\Models\MountServer;
1718
use Prologue\Alerts\AlertsMessageBag;
1819
use GuzzleHttp\Exception\RequestException;
1920
use Pterodactyl\Exceptions\DisplayException;
@@ -419,17 +420,16 @@ public function deleteDatabase($server, $database)
419420
*
420421
* @param Server $server
421422
* @param \Pterodactyl\Models\Mount $mount
422-
* @return \Illuminate\Http\RedirectResponse
423423
*
424-
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
425-
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
424+
* @return \Illuminate\Http\RedirectResponse
425+
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException|\Throwable
426426
*/
427427
public function addMount(Server $server, Mount $mount)
428428
{
429-
$server->mounts()->updateOrCreate([
430-
'mount_id' => $mount->id,
431-
'server_id' => $server->id,
432-
]);
429+
$mountServer = new MountServer;
430+
$mountServer->mount_id = $mount->id;
431+
$mountServer->server_id = $server->id;
432+
$mountServer->saveOrFail();
433433

434434
$data = $this->serverConfigurationStructureService->handle($server);
435435

@@ -458,10 +458,7 @@ public function addMount(Server $server, Mount $mount)
458458
*/
459459
public function deleteMount(Server $server, Mount $mount)
460460
{
461-
$server->mounts()
462-
->where('mount_id', $mount->id)
463-
->where('server_id', $server->id)
464-
->delete();
461+
MountServer::where('mount_id', $mount->id)->where('server_id', $server->id)->delete();
465462

466463
$data = $this->serverConfigurationStructureService->handle($server);
467464

app/Models/MountServer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ class MountServer extends Model
1111
*/
1212
protected $table = 'mount_server';
1313

14+
/**
15+
* @var bool
16+
*/
17+
public $timestamps = false;
18+
1419
/**
1520
* @var null
1621
*/

resources/scripts/routers/AuthenticationRouter.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useEffect } from 'react';
22
import ReactGA from 'react-ga';
3-
import { Route, RouteComponentProps, Switch } from 'react-router-dom';
3+
import { Route, RouteComponentProps, Switch, Redirect } from 'react-router-dom';
44
import LoginContainer from '@/components/auth/LoginContainer';
55
import ForgotPasswordContainer from '@/components/auth/ForgotPasswordContainer';
66
import ResetPasswordContainer from '@/components/auth/ResetPasswordContainer';
@@ -15,6 +15,7 @@ export default ({ location, history, match }: RouteComponentProps) => {
1515
return (
1616
<div className={'pt-8 xl:pt-32'}>
1717
<Switch location={location}>
18+
<Redirect from="/:url*(/+)" to={location.pathname.slice(0, -1)} />
1819
<Route path={`${match.path}/login`} component={LoginContainer} exact/>
1920
<Route path={`${match.path}/login/checkpoint`} component={LoginCheckpointContainer}/>
2021
<Route path={`${match.path}/password`} component={ForgotPasswordContainer} exact/>

resources/scripts/routers/DashboardRouter.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useEffect } from 'react';
22
import ReactGA from 'react-ga';
3-
import { NavLink, Route, RouteComponentProps, Switch } from 'react-router-dom';
3+
import { NavLink, Route, RouteComponentProps, Switch, Redirect } from 'react-router-dom';
44
import AccountOverviewContainer from '@/components/dashboard/AccountOverviewContainer';
55
import NavigationBar from '@/components/NavigationBar';
66
import DashboardContainer from '@/components/dashboard/DashboardContainer';
@@ -27,6 +27,7 @@ export default ({ location }: RouteComponentProps) => {
2727
}
2828
<TransitionRouter>
2929
<Switch location={location}>
30+
<Redirect from="/:url*(/+)" to={location.pathname.slice(0, -1)} />
3031
<Route path={'/'} component={DashboardContainer} exact />
3132
<Route path={'/account'} component={AccountOverviewContainer} exact/>
3233
<Route path={'/account/api'} component={AccountApiContainer} exact/>

resources/scripts/routers/ServerRouter.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useEffect, useState } from 'react';
22
import ReactGA from 'react-ga';
3-
import { NavLink, Route, RouteComponentProps, Switch } from 'react-router-dom';
3+
import { NavLink, Route, RouteComponentProps, Switch, Redirect } from 'react-router-dom';
44
import NavigationBar from '@/components/NavigationBar';
55
import ServerConsole from '@/components/server/ServerConsole';
66
import TransitionRouter from '@/TransitionRouter';
@@ -123,6 +123,7 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
123123
<>
124124
<TransitionRouter>
125125
<Switch location={location}>
126+
<Redirect from="/:url*(/+)" to={location.pathname.slice(0, -1)} />
126127
<Route path={`${match.path}`} component={ServerConsole} exact/>
127128
<Route
128129
path={`${match.path}/files`}

0 commit comments

Comments
 (0)