| @@ 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) |
|
| @@ 314-331 (lines=18) @@ | ||
| 311 | ]); |
|
| 312 | } |
|
| 313 | ||
| 314 | public function deleteServer(Request $request, $id, $force = null) |
|
| 315 | { |
|
| 316 | try { |
|
| 317 | $server = new ServerRepository; |
|
| 318 | $server->deleteServer($id, $force); |
|
| 319 | Alert::success('Server has been marked for deletion on the system.')->flash(); |
|
| 320 | ||
| 321 | return redirect()->route('admin.servers'); |
|
| 322 | } catch (DisplayException $ex) { |
|
| 323 | Alert::danger($ex->getMessage())->flash(); |
|
| 324 | } catch (\Exception $ex) { |
|
| 325 | Log::error($ex); |
|
| 326 | Alert::danger('An unhandled exception occured while attemping to delete this server. Please try again.')->flash(); |
|
| 327 | } |
|
| 328 | ||
| 329 | return redirect()->route('admin.servers.view', [ |
|
| 330 | 'id' => $id, |
|
| 331 | 'tab' => 'tab_delete', |
|
| 332 | ]); |
|
| 333 | } |
|
| 334 | ||
| @@ 335-352 (lines=18) @@ | ||
| 332 | ]); |
|
| 333 | } |
|
| 334 | ||
| 335 | public function postToggleInstall(Request $request, $id) |
|
| 336 | { |
|
| 337 | try { |
|
| 338 | $server = new ServerRepository; |
|
| 339 | $server->toggleInstall($id); |
|
| 340 | Alert::success('Server status was successfully toggled.')->flash(); |
|
| 341 | } catch (DisplayException $ex) { |
|
| 342 | Alert::danger($ex->getMessage())->flash(); |
|
| 343 | } catch (\Exception $ex) { |
|
| 344 | Log::error($ex); |
|
| 345 | Alert::danger('An unhandled exception occured while attemping to toggle this servers status.')->flash(); |
|
| 346 | } finally { |
|
| 347 | return redirect()->route('admin.servers.view', [ |
|
| 348 | 'id' => $id, |
|
| 349 | 'tab' => 'tab_manage', |
|
| 350 | ]); |
|
| 351 | } |
|
| 352 | } |
|
| 353 | ||
| 354 | public function postUpdateServerStartup(Request $request, $id) |
|
| 355 | { |
|
| @@ 354-373 (lines=20) @@ | ||
| 351 | } |
|
| 352 | } |
|
| 353 | ||
| 354 | public function postUpdateServerStartup(Request $request, $id) |
|
| 355 | { |
|
| 356 | try { |
|
| 357 | $server = new ServerRepository; |
|
| 358 | $server->updateStartup($id, $request->except([ |
|
| 359 | '_token', |
|
| 360 | ]), true); |
|
| 361 | Alert::success('Server startup variables were successfully updated.')->flash(); |
|
| 362 | } catch (\Pterodactyl\Exceptions\DisplayException $e) { |
|
| 363 | Alert::danger($e->getMessage())->flash(); |
|
| 364 | } catch (\Exception $e) { |
|
| 365 | Log::error($e); |
|
| 366 | Alert::danger('An unhandled exception occured while attemping to update startup variables for this server. Please try again.')->flash(); |
|
| 367 | } finally { |
|
| 368 | return redirect()->route('admin.servers.view', [ |
|
| 369 | 'id' => $id, |
|
| 370 | 'tab' => 'tab_startup', |
|
| 371 | ])->withInput(); |
|
| 372 | } |
|
| 373 | } |
|
| 374 | ||
| 375 | public function postDatabase(Request $request, $id) |
|
| 376 | { |
|
| @@ 401-418 (lines=18) @@ | ||
| 398 | ])->withInput(); |
|
| 399 | } |
|
| 400 | ||
| 401 | public function postSuspendServer(Request $request, $id) |
|
| 402 | { |
|
| 403 | try { |
|
| 404 | $repo = new ServerRepository; |
|
| 405 | $repo->suspend($id); |
|
| 406 | 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.'); |
|
| 407 | } catch (DisplayException $e) { |
|
| 408 | Alert::danger($e->getMessage())->flash(); |
|
| 409 | } catch (\Exception $e) { |
|
| 410 | Log::error($e); |
|
| 411 | Alert::danger('An unhandled exception occured while attemping to suspend this server. Please try again.')->flash(); |
|
| 412 | } finally { |
|
| 413 | return redirect()->route('admin.servers.view', [ |
|
| 414 | 'id' => $id, |
|
| 415 | 'tab' => 'tab_manage', |
|
| 416 | ]); |
|
| 417 | } |
|
| 418 | } |
|
| 419 | ||
| 420 | public function postUnsuspendServer(Request $request, $id) |
|
| 421 | { |
|
| @@ 420-437 (lines=18) @@ | ||
| 417 | } |
|
| 418 | } |
|
| 419 | ||
| 420 | public function postUnsuspendServer(Request $request, $id) |
|
| 421 | { |
|
| 422 | try { |
|
| 423 | $repo = new ServerRepository; |
|
| 424 | $repo->unsuspend($id); |
|
| 425 | Alert::success('Server has been unsuspended on the system. Access has been re-enabled.'); |
|
| 426 | } catch (DisplayException $e) { |
|
| 427 | Alert::danger($e->getMessage())->flash(); |
|
| 428 | } catch (\Exception $e) { |
|
| 429 | Log::error($e); |
|
| 430 | Alert::danger('An unhandled exception occured while attemping to unsuspend this server. Please try again.')->flash(); |
|
| 431 | } finally { |
|
| 432 | return redirect()->route('admin.servers.view', [ |
|
| 433 | 'id' => $id, |
|
| 434 | 'tab' => 'tab_manage', |
|
| 435 | ]); |
|
| 436 | } |
|
| 437 | } |
|
| 438 | ||
| 439 | public function postQueuedDeletionHandler(Request $request, $id) |
|
| 440 | { |
|