| @@ 264-282 (lines=19) @@ | ||
| 261 | } |
|
| 262 | } |
|
| 263 | ||
| 264 | public function deleteNode(Request $request, $id) |
|
| 265 | { |
|
| 266 | try { |
|
| 267 | $repo = new NodeRepository; |
|
| 268 | $repo->delete($id); |
|
| 269 | Alert::success('Successfully deleted the requested node from the panel.')->flash(); |
|
| 270 | ||
| 271 | return redirect()->route('admin.nodes'); |
|
| 272 | } catch (DisplayException $e) { |
|
| 273 | Alert::danger($e->getMessage())->flash(); |
|
| 274 | } catch (\Exception $e) { |
|
| 275 | Log::error($e); |
|
| 276 | Alert::danger('An unhandled exception occured while attempting to delete this node. Please try again.')->flash(); |
|
| 277 | } |
|
| 278 | ||
| 279 | return redirect()->route('admin.nodes.view', [ |
|
| 280 | 'id' => $id, |
|
| 281 | 'tab' => 'tab_delete', |
|
| 282 | ]); |
|
| 283 | } |
|
| 284 | ||
| 285 | public function getConfigurationToken(Request $request, $id) |
|
| @@ 301-318 (lines=18) @@ | ||
| 298 | ]); |
|
| 299 | } |
|
| 300 | ||
| 301 | public function deleteServer(Request $request, $id, $force = null) |
|
| 302 | { |
|
| 303 | try { |
|
| 304 | $server = new ServerRepository; |
|
| 305 | $server->deleteServer($id, $force); |
|
| 306 | Alert::success('Server has been marked for deletion on the system.')->flash(); |
|
| 307 | ||
| 308 | return redirect()->route('admin.servers'); |
|
| 309 | } catch (DisplayException $ex) { |
|
| 310 | Alert::danger($ex->getMessage())->flash(); |
|
| 311 | } catch (\Exception $ex) { |
|
| 312 | Log::error($ex); |
|
| 313 | Alert::danger('An unhandled exception occured while attemping to delete this server. Please try again.')->flash(); |
|
| 314 | } |
|
| 315 | ||
| 316 | return redirect()->route('admin.servers.view', [ |
|
| 317 | 'id' => $id, |
|
| 318 | 'tab' => 'tab_delete', |
|
| 319 | ]); |
|
| 320 | } |
|
| 321 | ||
| @@ 322-339 (lines=18) @@ | ||
| 319 | ]); |
|
| 320 | } |
|
| 321 | ||
| 322 | public function postToggleInstall(Request $request, $id) |
|
| 323 | { |
|
| 324 | try { |
|
| 325 | $server = new ServerRepository; |
|
| 326 | $server->toggleInstall($id); |
|
| 327 | Alert::success('Server status was successfully toggled.')->flash(); |
|
| 328 | } catch (DisplayException $ex) { |
|
| 329 | Alert::danger($ex->getMessage())->flash(); |
|
| 330 | } catch (\Exception $ex) { |
|
| 331 | Log::error($ex); |
|
| 332 | Alert::danger('An unhandled exception occured while attemping to toggle this servers status.')->flash(); |
|
| 333 | } finally { |
|
| 334 | return redirect()->route('admin.servers.view', [ |
|
| 335 | 'id' => $id, |
|
| 336 | 'tab' => 'tab_manage', |
|
| 337 | ]); |
|
| 338 | } |
|
| 339 | } |
|
| 340 | ||
| 341 | public function postUpdateServerStartup(Request $request, $id) |
|
| 342 | { |
|
| @@ 341-360 (lines=20) @@ | ||
| 338 | } |
|
| 339 | } |
|
| 340 | ||
| 341 | public function postUpdateServerStartup(Request $request, $id) |
|
| 342 | { |
|
| 343 | try { |
|
| 344 | $server = new ServerRepository; |
|
| 345 | $server->updateStartup($id, $request->except([ |
|
| 346 | '_token', |
|
| 347 | ]), true); |
|
| 348 | Alert::success('Server startup variables were successfully updated.')->flash(); |
|
| 349 | } catch (\Pterodactyl\Exceptions\DisplayException $e) { |
|
| 350 | Alert::danger($e->getMessage())->flash(); |
|
| 351 | } catch (\Exception $e) { |
|
| 352 | Log::error($e); |
|
| 353 | Alert::danger('An unhandled exception occured while attemping to update startup variables for this server. Please try again.')->flash(); |
|
| 354 | } finally { |
|
| 355 | return redirect()->route('admin.servers.view', [ |
|
| 356 | 'id' => $id, |
|
| 357 | 'tab' => 'tab_startup', |
|
| 358 | ])->withInput(); |
|
| 359 | } |
|
| 360 | } |
|
| 361 | ||
| 362 | public function postDatabase(Request $request, $id) |
|
| 363 | { |
|
| @@ 386-403 (lines=18) @@ | ||
| 383 | ])->withInput(); |
|
| 384 | } |
|
| 385 | ||
| 386 | public function postSuspendServer(Request $request, $id) |
|
| 387 | { |
|
| 388 | try { |
|
| 389 | $repo = new ServerRepository; |
|
| 390 | $repo->suspend($id); |
|
| 391 | 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.'); |
|
| 392 | } catch (DisplayException $e) { |
|
| 393 | Alert::danger($e->getMessage())->flash(); |
|
| 394 | } catch (\Exception $e) { |
|
| 395 | Log::error($e); |
|
| 396 | Alert::danger('An unhandled exception occured while attemping to suspend this server. Please try again.')->flash(); |
|
| 397 | } finally { |
|
| 398 | return redirect()->route('admin.servers.view', [ |
|
| 399 | 'id' => $id, |
|
| 400 | 'tab' => 'tab_manage', |
|
| 401 | ]); |
|
| 402 | } |
|
| 403 | } |
|
| 404 | ||
| 405 | public function postUnsuspendServer(Request $request, $id) |
|
| 406 | { |
|
| @@ 405-422 (lines=18) @@ | ||
| 402 | } |
|
| 403 | } |
|
| 404 | ||
| 405 | public function postUnsuspendServer(Request $request, $id) |
|
| 406 | { |
|
| 407 | try { |
|
| 408 | $repo = new ServerRepository; |
|
| 409 | $repo->unsuspend($id); |
|
| 410 | Alert::success('Server has been unsuspended on the system. Access has been re-enabled.'); |
|
| 411 | } catch (DisplayException $e) { |
|
| 412 | Alert::danger($e->getMessage())->flash(); |
|
| 413 | } catch (\Exception $e) { |
|
| 414 | Log::error($e); |
|
| 415 | Alert::danger('An unhandled exception occured while attemping to unsuspend this server. Please try again.')->flash(); |
|
| 416 | } finally { |
|
| 417 | return redirect()->route('admin.servers.view', [ |
|
| 418 | 'id' => $id, |
|
| 419 | 'tab' => 'tab_manage', |
|
| 420 | ]); |
|
| 421 | } |
|
| 422 | } |
|
| 423 | ||
| 424 | public function postQueuedDeletionHandler(Request $request, $id) |
|
| 425 | { |
|