Skip to content

Commit 7cde76c

Browse files
authored
[1.x] Supports restricting private tunnel requests for local environment (#475)
* [1.x] Supports restricting private tunnel requests for `local` environment Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> --------- Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
1 parent d0ce776 commit 7cde76c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

composer.json

Lines changed: 2 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"
@@ -98,4 +99,4 @@
9899
"@php vendor/bin/pest"
99100
]
100101
}
101-
}
102+
}

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)