- Create TryPostServer MCP server with 17 tools: Post (List, Get, Create, Delete), Hashtag (List, Create, Update, Delete), Label (List, Create, Update, Delete), Workspace (Get), ApiKey (List, Create, Delete) - Create AuthenticateMcpToken middleware (logs in workspace owner) - Register mcp.auth middleware alias in bootstrap/app.php - Create routes/ai.php with mcp.trypost.test subdomain - Add PostApiTest with 6 tests (list, show, create, delete, isolation) - Fix PostApiTest assertions for pagination/resource wrapping - 704 tests passing, frontend build passing
65 lines
1.6 KiB
PHP
65 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Laravel\Telescope\IncomingEntry;
|
|
use Laravel\Telescope\Telescope;
|
|
use Laravel\Telescope\TelescopeApplicationServiceProvider;
|
|
|
|
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
// Telescope::night();
|
|
|
|
$this->hideSensitiveRequestDetails();
|
|
|
|
$isLocal = $this->app->environment('local');
|
|
|
|
Telescope::filter(function (IncomingEntry $entry) use ($isLocal) {
|
|
return $isLocal ||
|
|
$entry->isReportableException() ||
|
|
$entry->isFailedRequest() ||
|
|
$entry->isFailedJob() ||
|
|
$entry->isScheduledTask() ||
|
|
$entry->hasMonitoredTag();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Prevent sensitive request details from being logged by Telescope.
|
|
*/
|
|
protected function hideSensitiveRequestDetails(): void
|
|
{
|
|
if ($this->app->environment('local')) {
|
|
return;
|
|
}
|
|
|
|
Telescope::hideRequestParameters(['_token']);
|
|
|
|
Telescope::hideRequestHeaders([
|
|
'cookie',
|
|
'x-csrf-token',
|
|
'x-xsrf-token',
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Register the Telescope gate.
|
|
*
|
|
* This gate determines who can access Telescope in non-local environments.
|
|
*/
|
|
protected function gate(): void
|
|
{
|
|
Gate::define('viewTelescope', function (User $user) {
|
|
return in_array($user->email, [
|
|
//
|
|
]);
|
|
});
|
|
}
|
|
}
|