Skip to content

Commit 2881176

Browse files
committed
[1.x] Supports restricting private tunnel requests for local environment
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
1 parent faced50 commit 2881176

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"illuminate/routing": "^10.48.4|^11.0.8|^12.0",
3434
"illuminate/support": "^10.48.4|^11.0.8|^12.0",
3535
"illuminate/view": "^10.48.4|^11.0.8|^12.0",
36+
"laravel/sentinel": "^1.0",
3637
"livewire/livewire": "^3.6.4|^4.0",
3738
"symfony/console": "^6.0|^7.0",
3839
"nesbot/carbon": "^2.67|^3.0"
@@ -81,6 +82,9 @@
8182
},
8283
"sort-packages": true
8384
},
85+
"repositories": [
86+
{ "type": "vcs", "url": "https://github.com/laravel-labs/sentinel" }
87+
],
8488
"minimum-stability": "dev",
8589
"prefer-stable": true,
8690
"scripts": {
@@ -98,4 +102,4 @@
98102
"@php vendor/bin/pest"
99103
]
100104
}
101-
}
105+
}

src/PulseServiceProvider.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Illuminate\Queue\Events\Looping;
1414
use Illuminate\Queue\Events\WorkerStopping;
1515
use Illuminate\Routing\Router;
16+
use Illuminate\Support\Facades\Route;
1617
use Illuminate\Support\ServiceProvider;
1718
use Illuminate\Support\Str;
1819
use Illuminate\View\Compilers\BladeCompiler;
@@ -24,6 +25,7 @@
2425
use Laravel\Pulse\Ingests\RedisIngest;
2526
use Laravel\Pulse\Ingests\StorageIngest;
2627
use Laravel\Pulse\Storage\DatabaseStorage;
28+
use Laravel\Sentinel\Http\Middleware\SentinelMiddleware;
2729
use Livewire\LivewireManager;
2830
use RuntimeException;
2931

@@ -73,6 +75,11 @@ public function boot(): void
7375
$this->app->make(Pulse::class)->stopRecording();
7476
}
7577

78+
Route::middlewareGroup('pulse', [
79+
SentinelMiddleware::class.':pulse',
80+
...$this->app->make('config')->get('pulse.middleware', []),
81+
]);
82+
7683
$this->registerAuthorization();
7784
$this->registerRoutes();
7885
$this->registerComponents();
@@ -101,7 +108,7 @@ protected function registerRoutes(): void
101108
$router->group([
102109
'domain' => $app->make('config')->get('pulse.domain', null),
103110
'prefix' => $app->make('config')->get('pulse.path'),
104-
'middleware' => $app->make('config')->get('pulse.middleware'),
111+
'middleware' => 'pulse',
105112
], function (Router $router) {
106113
$router->get('/', function (Pulse $pulse, ViewFactory $view) {
107114
return $view->make('pulse::dashboard');

0 commit comments

Comments
 (0)