GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 36-41 lines in 2 locations

app/Repositories/ServerRepository.php 2 locations

@@ 444-484 (lines=41) @@
441
     * @throws \Pterodactyl\Exceptions\DisplayException
442
     * @throws \Pterodactyl\Exceptions\DisplayValidationException
443
     */
444
    public function updateContainer($id, array $data)
445
    {
446
        $validator = Validator::make($data, [
447
            'docker_image' => 'required|string',
448
        ]);
449
450
        // Run validator, throw catchable and displayable exception if it fails.
451
        // Exception includes a JSON result of failed validation rules.
452
        if ($validator->fails()) {
453
            throw new DisplayValidationException(json_encode($validator->errors()));
454
        }
455
456
        DB::beginTransaction();
457
        try {
458
            $server = Models\Server::findOrFail($id);
459
460
            $server->image = $data['docker_image'];
461
            $server->save();
462
463
            $server->node->guzzleClient([
464
                'X-Access-Server' => $server->uuid,
465
                'X-Access-Token' => $server->node->daemonSecret,
466
            ])->request('PATCH', '/server', [
467
                'json' => [
468
                    'build' => [
469
                        'image' => $server->image,
470
                    ],
471
                ],
472
            ]);
473
474
            DB::commit();
475
476
            return true;
477
        } catch (TransferException $ex) {
478
            DB::rollBack();
479
            throw new DisplayException('A TransferException occured while attempting to update the container image. Is the daemon online? This error has been logged.', $ex);
480
        } catch (\Exception $ex) {
481
            DB::rollBack();
482
            throw $ex;
483
        }
484
    }
485
486
    /**
487
     * Update the build details for a server.
@@ 897-932 (lines=36) @@
894
     * @throws \Pterodactyl\Exceptions\DisplayException
895
     * @throws \Pterodactyl\Exceptions\DisplayValidationException
896
     */
897
    public function updateSFTPPassword($id, $password)
898
    {
899
        $server = Models\Server::with('node')->findOrFail($id);
900
901
        $validator = Validator::make(['password' => $password], [
902
            'password' => 'required|regex:/^((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})$/',
903
        ]);
904
905
        if ($validator->fails()) {
906
            throw new DisplayValidationException(json_encode($validator->errors()));
907
        }
908
909
        DB::beginTransaction();
910
        $server->sftp_password = Crypt::encrypt($password);
911
912
        try {
913
            $server->save();
914
915
            $server->node->guzzleClient([
916
                'X-Access-Token' => $server->node->daemonSecret,
917
                'X-Access-Server' => $server->uuid,
918
            ])->request('POST', '/server/password', [
919
                'json' => ['password' => $password],
920
            ]);
921
922
            DB::commit();
923
924
            return true;
925
        } catch (TransferException $ex) {
926
            DB::rollBack();
927
            throw new DisplayException('There was an error while attmping to contact the remote service to change the password.', $ex);
928
        } catch (\Exception $ex) {
929
            DB::rollBack();
930
            throw $ex;
931
        }
932
    }
933
}
934