Merge branch 'develop' of https://github.com/Pterodactyl/Panel into develop

This commit is contained in:
Dane Everitt 2020-10-12 20:15:22 -07:00
commit d5f2242c89
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
5 changed files with 19 additions and 14 deletions

View file

@ -14,6 +14,7 @@ use Illuminate\Http\Request;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Models\Mount; use Pterodactyl\Models\Mount;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Pterodactyl\Models\MountServer;
use Prologue\Alerts\AlertsMessageBag; use Prologue\Alerts\AlertsMessageBag;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
@ -419,17 +420,16 @@ class ServersController extends Controller
* *
* @param Server $server * @param Server $server
* @param \Pterodactyl\Models\Mount $mount * @param \Pterodactyl\Models\Mount $mount
* @return \Illuminate\Http\RedirectResponse
* *
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException * @return \Illuminate\Http\RedirectResponse
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException|\Throwable
*/ */
public function addMount(Server $server, Mount $mount) public function addMount(Server $server, Mount $mount)
{ {
$server->mounts()->updateOrCreate([ $mountServer = new MountServer;
'mount_id' => $mount->id, $mountServer->mount_id = $mount->id;
'server_id' => $server->id, $mountServer->server_id = $server->id;
]); $mountServer->saveOrFail();
$data = $this->serverConfigurationStructureService->handle($server); $data = $this->serverConfigurationStructureService->handle($server);
@ -458,10 +458,7 @@ class ServersController extends Controller
*/ */
public function deleteMount(Server $server, Mount $mount) public function deleteMount(Server $server, Mount $mount)
{ {
$server->mounts() MountServer::where('mount_id', $mount->id)->where('server_id', $server->id)->delete();
->where('mount_id', $mount->id)
->where('server_id', $server->id)
->delete();
$data = $this->serverConfigurationStructureService->handle($server); $data = $this->serverConfigurationStructureService->handle($server);

View file

@ -11,6 +11,11 @@ class MountServer extends Model
*/ */
protected $table = 'mount_server'; protected $table = 'mount_server';
/**
* @var bool
*/
public $timestamps = false;
/** /**
* @var null * @var null
*/ */

View file

@ -1,6 +1,6 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import ReactGA from 'react-ga'; import ReactGA from 'react-ga';
import { Route, RouteComponentProps, Switch } from 'react-router-dom'; import { Route, RouteComponentProps, Switch, Redirect } from 'react-router-dom';
import LoginContainer from '@/components/auth/LoginContainer'; import LoginContainer from '@/components/auth/LoginContainer';
import ForgotPasswordContainer from '@/components/auth/ForgotPasswordContainer'; import ForgotPasswordContainer from '@/components/auth/ForgotPasswordContainer';
import ResetPasswordContainer from '@/components/auth/ResetPasswordContainer'; import ResetPasswordContainer from '@/components/auth/ResetPasswordContainer';
@ -15,6 +15,7 @@ export default ({ location, history, match }: RouteComponentProps) => {
return ( return (
<div className={'pt-8 xl:pt-32'}> <div className={'pt-8 xl:pt-32'}>
<Switch location={location}> <Switch location={location}>
<Redirect from="/:url*(/+)" to={location.pathname.slice(0, -1)} />
<Route path={`${match.path}/login`} component={LoginContainer} exact/> <Route path={`${match.path}/login`} component={LoginContainer} exact/>
<Route path={`${match.path}/login/checkpoint`} component={LoginCheckpointContainer}/> <Route path={`${match.path}/login/checkpoint`} component={LoginCheckpointContainer}/>
<Route path={`${match.path}/password`} component={ForgotPasswordContainer} exact/> <Route path={`${match.path}/password`} component={ForgotPasswordContainer} exact/>

View file

@ -1,6 +1,6 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import ReactGA from 'react-ga'; import ReactGA from 'react-ga';
import { NavLink, Route, RouteComponentProps, Switch } from 'react-router-dom'; import { NavLink, Route, RouteComponentProps, Switch, Redirect } from 'react-router-dom';
import AccountOverviewContainer from '@/components/dashboard/AccountOverviewContainer'; import AccountOverviewContainer from '@/components/dashboard/AccountOverviewContainer';
import NavigationBar from '@/components/NavigationBar'; import NavigationBar from '@/components/NavigationBar';
import DashboardContainer from '@/components/dashboard/DashboardContainer'; import DashboardContainer from '@/components/dashboard/DashboardContainer';
@ -27,6 +27,7 @@ export default ({ location }: RouteComponentProps) => {
} }
<TransitionRouter> <TransitionRouter>
<Switch location={location}> <Switch location={location}>
<Redirect from="/:url*(/+)" to={location.pathname.slice(0, -1)} />
<Route path={'/'} component={DashboardContainer} exact /> <Route path={'/'} component={DashboardContainer} exact />
<Route path={'/account'} component={AccountOverviewContainer} exact/> <Route path={'/account'} component={AccountOverviewContainer} exact/>
<Route path={'/account/api'} component={AccountApiContainer} exact/> <Route path={'/account/api'} component={AccountApiContainer} exact/>

View file

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import ReactGA from 'react-ga'; import ReactGA from 'react-ga';
import { NavLink, Route, RouteComponentProps, Switch } from 'react-router-dom'; import { NavLink, Route, RouteComponentProps, Switch, Redirect } from 'react-router-dom';
import NavigationBar from '@/components/NavigationBar'; import NavigationBar from '@/components/NavigationBar';
import ServerConsole from '@/components/server/ServerConsole'; import ServerConsole from '@/components/server/ServerConsole';
import TransitionRouter from '@/TransitionRouter'; import TransitionRouter from '@/TransitionRouter';
@ -123,6 +123,7 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
<> <>
<TransitionRouter> <TransitionRouter>
<Switch location={location}> <Switch location={location}>
<Redirect from="/:url*(/+)" to={location.pathname.slice(0, -1)} />
<Route path={`${match.path}`} component={ServerConsole} exact/> <Route path={`${match.path}`} component={ServerConsole} exact/>
<Route <Route
path={`${match.path}/files`} path={`${match.path}/files`}