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