| @@ 395-412 (lines=18) @@ | ||
| 392 | ]); |
|
| 393 | } |
|
| 394 | ||
| 395 | public function deleteServer(Request $request, $id, $force = null) |
|
| 396 | { |
|
| 397 | try { |
|
| 398 | $server = new ServerRepository; |
|
| 399 | $server->deleteServer($id, $force); |
|
| 400 | Alert::success('Server has been marked for deletion on the system.')->flash(); |
|
| 401 | ||
| 402 | return redirect()->route('admin.servers'); |
|
| 403 | } catch (DisplayException $ex) { |
|
| 404 | Alert::danger($ex->getMessage())->flash(); |
|
| 405 | } catch (\Exception $ex) { |
|
| 406 | Log::error($ex); |
|
| 407 | Alert::danger('An unhandled exception occured while attemping to delete this server. Please try again.')->flash(); |
|
| 408 | } |
|
| 409 | ||
| 410 | return redirect()->route('admin.servers.view', [ |
|
| 411 | 'id' => $id, |
|
| 412 | 'tab' => 'tab_delete', |
|
| 413 | ]); |
|
| 414 | } |
|
| 415 | ||
| @@ 416-433 (lines=18) @@ | ||
| 413 | ]); |
|
| 414 | } |
|
| 415 | ||
| 416 | public function postToggleInstall(Request $request, $id) |
|
| 417 | { |
|
| 418 | try { |
|
| 419 | $server = new ServerRepository; |
|
| 420 | $server->toggleInstall($id); |
|
| 421 | Alert::success('Server status was successfully toggled.')->flash(); |
|
| 422 | } catch (DisplayException $ex) { |
|
| 423 | Alert::danger($ex->getMessage())->flash(); |
|
| 424 | } catch (\Exception $ex) { |
|
| 425 | Log::error($ex); |
|
| 426 | Alert::danger('An unhandled exception occured while attemping to toggle this servers status.')->flash(); |
|
| 427 | } finally { |
|
| 428 | return redirect()->route('admin.servers.view', [ |
|
| 429 | 'id' => $id, |
|
| 430 | 'tab' => 'tab_manage', |
|
| 431 | ]); |
|
| 432 | } |
|
| 433 | } |
|
| 434 | ||
| 435 | public function postUpdateServerStartup(Request $request, $id) |
|
| 436 | { |
|
| @@ 435-454 (lines=20) @@ | ||
| 432 | } |
|
| 433 | } |
|
| 434 | ||
| 435 | public function postUpdateServerStartup(Request $request, $id) |
|
| 436 | { |
|
| 437 | try { |
|
| 438 | $server = new ServerRepository; |
|
| 439 | $server->updateStartup($id, $request->except([ |
|
| 440 | '_token', |
|
| 441 | ]), true); |
|
| 442 | Alert::success('Server startup variables were successfully updated.')->flash(); |
|
| 443 | } catch (\Pterodactyl\Exceptions\DisplayException $e) { |
|
| 444 | Alert::danger($e->getMessage())->flash(); |
|
| 445 | } catch (\Exception $e) { |
|
| 446 | Log::error($e); |
|
| 447 | Alert::danger('An unhandled exception occured while attemping to update startup variables for this server. Please try again.')->flash(); |
|
| 448 | } finally { |
|
| 449 | return redirect()->route('admin.servers.view', [ |
|
| 450 | 'id' => $id, |
|
| 451 | 'tab' => 'tab_startup', |
|
| 452 | ])->withInput(); |
|
| 453 | } |
|
| 454 | } |
|
| 455 | ||
| 456 | public function postDatabase(Request $request, $id) |
|
| 457 | { |
|
| @@ 480-497 (lines=18) @@ | ||
| 477 | ])->withInput(); |
|
| 478 | } |
|
| 479 | ||
| 480 | public function postSuspendServer(Request $request, $id) |
|
| 481 | { |
|
| 482 | try { |
|
| 483 | $repo = new ServerRepository; |
|
| 484 | $repo->suspend($id); |
|
| 485 | Alert::success('Server has been suspended on the system. All running processes have been stopped and will not be startable until it is un-suspended.'); |
|
| 486 | } catch (DisplayException $e) { |
|
| 487 | Alert::danger($e->getMessage())->flash(); |
|
| 488 | } catch (\Exception $e) { |
|
| 489 | Log::error($e); |
|
| 490 | Alert::danger('An unhandled exception occured while attemping to suspend this server. Please try again.')->flash(); |
|
| 491 | } finally { |
|
| 492 | return redirect()->route('admin.servers.view', [ |
|
| 493 | 'id' => $id, |
|
| 494 | 'tab' => 'tab_manage', |
|
| 495 | ]); |
|
| 496 | } |
|
| 497 | } |
|
| 498 | ||
| 499 | public function postUnsuspendServer(Request $request, $id) |
|
| 500 | { |
|
| @@ 499-516 (lines=18) @@ | ||
| 496 | } |
|
| 497 | } |
|
| 498 | ||
| 499 | public function postUnsuspendServer(Request $request, $id) |
|
| 500 | { |
|
| 501 | try { |
|
| 502 | $repo = new ServerRepository; |
|
| 503 | $repo->unsuspend($id); |
|
| 504 | Alert::success('Server has been unsuspended on the system. Access has been re-enabled.'); |
|
| 505 | } catch (DisplayException $e) { |
|
| 506 | Alert::danger($e->getMessage())->flash(); |
|
| 507 | } catch (\Exception $e) { |
|
| 508 | Log::error($e); |
|
| 509 | Alert::danger('An unhandled exception occured while attemping to unsuspend this server. Please try again.')->flash(); |
|
| 510 | } finally { |
|
| 511 | return redirect()->route('admin.servers.view', [ |
|
| 512 | 'id' => $id, |
|
| 513 | 'tab' => 'tab_manage', |
|
| 514 | ]); |
|
| 515 | } |
|
| 516 | } |
|
| 517 | ||
| 518 | public function postQueuedDeletionHandler(Request $request, $id) |
|
| 519 | { |
|
| @@ 261-279 (lines=19) @@ | ||
| 258 | } |
|
| 259 | } |
|
| 260 | ||
| 261 | public function deleteNode(Request $request, $id) |
|
| 262 | { |
|
| 263 | try { |
|
| 264 | $repo = new NodeRepository; |
|
| 265 | $repo->delete($id); |
|
| 266 | Alert::success('Successfully deleted the requested node from the panel.')->flash(); |
|
| 267 | ||
| 268 | return redirect()->route('admin.nodes'); |
|
| 269 | } catch (DisplayException $e) { |
|
| 270 | Alert::danger($e->getMessage())->flash(); |
|
| 271 | } catch (\Exception $e) { |
|
| 272 | Log::error($e); |
|
| 273 | Alert::danger('An unhandled exception occured while attempting to delete this node. Please try again.')->flash(); |
|
| 274 | } |
|
| 275 | ||
| 276 | return redirect()->route('admin.nodes.view', [ |
|
| 277 | 'id' => $id, |
|
| 278 | 'tab' => 'tab_delete', |
|
| 279 | ]); |
|
| 280 | } |
|
| 281 | ||
| 282 | public function getConfigurationToken(Request $request, $id) |
|