Skip to content

Commit

Permalink
Added a rickrolling feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeraymonddowning committed Nov 27, 2020
1 parent 7e6b200 commit 797f92f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'features' => [
Features::spammerIpTracking(),
Features::blockSpammersGlobally(),
// Features::neverGonnaGiveYouUp(),
],

/**
Expand Down
10 changes: 10 additions & 0 deletions src/Features.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,14 @@ public static function blockSpammersGloballyIsEnabled()
{
return static::enabled(static::blockSpammersGlobally());
}

public static function neverGonnaGiveYouUp()
{
return 'rickroll';
}

public static function rickrollingEnabled()
{
return static::enabled(static::neverGonnaGiveYouUp());
}
}
9 changes: 8 additions & 1 deletion src/Providers/HoneyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
Expand Down Expand Up @@ -39,7 +40,13 @@ protected static function getChecks()

protected static function defaultMethodOfFailing()
{
return fn() => abort(422, "You shall not pass!");
return function() {
if (Features::rickrollingEnabled()) {
throw new HttpResponseException(redirect('https://youtu.be/dQw4w9WgXcQ'));
}

abort(422, "You shall not pass!");
};
}

protected static function getInputNameSelectorClass()
Expand Down

0 comments on commit 797f92f

Please sign in to comment.