2026-01-15 01:13:44 +00:00
|
|
|
<?php
|
|
|
|
|
|
2026-03-29 22:24:28 +00:00
|
|
|
use App\Http\Middleware\Api\AuthenticateApiToken;
|
refactor: organize middleware/requests into App/ subdirs, add Resources, fix auth routes
- Move middleware to App/ subdir (HandleInertiaRequests, HandleAppearance,
EnsureSubscribed, EnsureUserSetupIsComplete) matching Sendkit pattern
- Move all Form Requests into organized subdirs (App/Post, App/Workspace,
App/Media, App/Invite, App/Settings, App/Auth)
- Create AuthUserResource and AuthWorkspaceResource for HandleInertiaRequests
shared data (role inside currentWorkspace, matching Sendkit pattern)
- Split auth.php into 3 route groups (no middleware, guest, auth) matching
Sendkit pattern exactly
- Fix UserFactory to include all nullable attributes (current_workspace_id,
stripe_id, pm_type, pm_last_four, trial_ends_at)
- Fix SocialAccountResource (display_name not name)
- Update frontend for new auth prop structure
- 702 tests passing (2 pre-existing Mastodon failures)
2026-03-30 00:13:30 +00:00
|
|
|
use App\Http\Middleware\App\EnsureSubscribed;
|
|
|
|
|
use App\Http\Middleware\App\HandleAppearance;
|
|
|
|
|
use App\Http\Middleware\App\HandleInertiaRequests;
|
refactor: auth split layout, subscribe redesign, onboarding, i18n, cookie locale
Auth pages:
- Create AuthSplitLayout with animated feature slides (6 slides, 3 languages)
- All auth pages use split layout (form left, visual right)
- Add show/hide password toggle with tooltip on Register
- Legal footer only shown on Register via showLegal prop
Subscribe page:
- Redesign to match auth card pattern (centered, clean)
- Platform icons, feature checklist, dynamic trial days (trialDays - 1)
- Add "Switch workspace" link
- Full i18n (en, es, pt-BR)
Onboarding:
- Rename URLs: step1 -> role, step2 -> connect
- Add enforceStep() to prevent skipping/going back steps
- Redirect /onboarding to /onboarding/role
- Redesign Step2 with AuthSplitLayout and compact platform list
- 21 tests covering all step enforcement scenarios
Workspaces page:
- Redesign with AuthSplitLayout (list with avatars, current badge)
Language system:
- Move locale from DB to cookie (forever, unencrypted, session.domain)
- Create SetLocale middleware (sets cookie if missing, validates against config)
- Rename lang/pt-br to lang/pt-BR
- Add dayjs es locale
Other:
- Copy utils.ts from sendkit (formatNumber, formatMoney, copyToClipboard)
- ConfirmDeleteModal with text confirmation (sendkit pattern)
- i18n for ConfirmDeleteModal internal strings (common.php)
- EmptyState component for posts index
- Exact match for "All" posts in sidebar
- Posts breadcrumbs show current status filter
- DialogFooter buttons aligned left
- API Keys page redesign with Table, DropdownMenu, EmptyState
- Extract CreateApiKeyDialog and InviteMemberDialog to components
- Remove API Keys from sidebar
- DropdownMenuItem destructive variant for Remove action
2026-03-30 14:53:42 +00:00
|
|
|
use App\Http\Middleware\App\SetLocale;
|
feat: implement MCP server with tools, Post API tests, auth middleware
- 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
2026-03-29 23:30:36 +00:00
|
|
|
use App\Http\Middleware\Mcp\AuthenticateMcpToken;
|
2026-01-15 01:13:44 +00:00
|
|
|
use Illuminate\Foundation\Application;
|
|
|
|
|
use Illuminate\Foundation\Configuration\Exceptions;
|
|
|
|
|
use Illuminate\Foundation\Configuration\Middleware;
|
|
|
|
|
use Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets;
|
2026-03-29 23:14:23 +00:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Routing\Middleware\ThrottleRequests;
|
|
|
|
|
use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException;
|
2026-01-15 01:13:44 +00:00
|
|
|
|
|
|
|
|
return Application::configure(basePath: dirname(__DIR__))
|
|
|
|
|
->withRouting(
|
|
|
|
|
web: __DIR__.'/../routes/web.php',
|
2026-03-29 22:24:28 +00:00
|
|
|
api: __DIR__.'/../routes/api.php',
|
|
|
|
|
apiPrefix: '',
|
2026-01-15 01:13:44 +00:00
|
|
|
commands: __DIR__.'/../routes/console.php',
|
2026-01-15 17:24:39 +00:00
|
|
|
channels: __DIR__.'/../routes/channels.php',
|
2026-01-15 01:13:44 +00:00
|
|
|
health: '/up',
|
|
|
|
|
)
|
|
|
|
|
->withMiddleware(function (Middleware $middleware): void {
|
2026-03-29 22:59:17 +00:00
|
|
|
$middleware->trustProxies(at: '*');
|
|
|
|
|
|
refactor: auth split layout, subscribe redesign, onboarding, i18n, cookie locale
Auth pages:
- Create AuthSplitLayout with animated feature slides (6 slides, 3 languages)
- All auth pages use split layout (form left, visual right)
- Add show/hide password toggle with tooltip on Register
- Legal footer only shown on Register via showLegal prop
Subscribe page:
- Redesign to match auth card pattern (centered, clean)
- Platform icons, feature checklist, dynamic trial days (trialDays - 1)
- Add "Switch workspace" link
- Full i18n (en, es, pt-BR)
Onboarding:
- Rename URLs: step1 -> role, step2 -> connect
- Add enforceStep() to prevent skipping/going back steps
- Redirect /onboarding to /onboarding/role
- Redesign Step2 with AuthSplitLayout and compact platform list
- 21 tests covering all step enforcement scenarios
Workspaces page:
- Redesign with AuthSplitLayout (list with avatars, current badge)
Language system:
- Move locale from DB to cookie (forever, unencrypted, session.domain)
- Create SetLocale middleware (sets cookie if missing, validates against config)
- Rename lang/pt-br to lang/pt-BR
- Add dayjs es locale
Other:
- Copy utils.ts from sendkit (formatNumber, formatMoney, copyToClipboard)
- ConfirmDeleteModal with text confirmation (sendkit pattern)
- i18n for ConfirmDeleteModal internal strings (common.php)
- EmptyState component for posts index
- Exact match for "All" posts in sidebar
- Posts breadcrumbs show current status filter
- DialogFooter buttons aligned left
- API Keys page redesign with Table, DropdownMenu, EmptyState
- Extract CreateApiKeyDialog and InviteMemberDialog to components
- Remove API Keys from sidebar
- DropdownMenuItem destructive variant for Remove action
2026-03-30 14:53:42 +00:00
|
|
|
$middleware->encryptCookies(except: ['appearance', 'sidebar_state', 'locale']);
|
2026-01-15 01:13:44 +00:00
|
|
|
|
|
|
|
|
$middleware->web(append: [
|
refactor: auth split layout, subscribe redesign, onboarding, i18n, cookie locale
Auth pages:
- Create AuthSplitLayout with animated feature slides (6 slides, 3 languages)
- All auth pages use split layout (form left, visual right)
- Add show/hide password toggle with tooltip on Register
- Legal footer only shown on Register via showLegal prop
Subscribe page:
- Redesign to match auth card pattern (centered, clean)
- Platform icons, feature checklist, dynamic trial days (trialDays - 1)
- Add "Switch workspace" link
- Full i18n (en, es, pt-BR)
Onboarding:
- Rename URLs: step1 -> role, step2 -> connect
- Add enforceStep() to prevent skipping/going back steps
- Redirect /onboarding to /onboarding/role
- Redesign Step2 with AuthSplitLayout and compact platform list
- 21 tests covering all step enforcement scenarios
Workspaces page:
- Redesign with AuthSplitLayout (list with avatars, current badge)
Language system:
- Move locale from DB to cookie (forever, unencrypted, session.domain)
- Create SetLocale middleware (sets cookie if missing, validates against config)
- Rename lang/pt-br to lang/pt-BR
- Add dayjs es locale
Other:
- Copy utils.ts from sendkit (formatNumber, formatMoney, copyToClipboard)
- ConfirmDeleteModal with text confirmation (sendkit pattern)
- i18n for ConfirmDeleteModal internal strings (common.php)
- EmptyState component for posts index
- Exact match for "All" posts in sidebar
- Posts breadcrumbs show current status filter
- DialogFooter buttons aligned left
- API Keys page redesign with Table, DropdownMenu, EmptyState
- Extract CreateApiKeyDialog and InviteMemberDialog to components
- Remove API Keys from sidebar
- DropdownMenuItem destructive variant for Remove action
2026-03-30 14:53:42 +00:00
|
|
|
SetLocale::class,
|
2026-01-15 01:13:44 +00:00
|
|
|
HandleAppearance::class,
|
|
|
|
|
HandleInertiaRequests::class,
|
|
|
|
|
AddLinkHeadersForPreloadedAssets::class,
|
|
|
|
|
]);
|
2026-01-17 02:46:30 +00:00
|
|
|
|
|
|
|
|
$middleware->alias([
|
|
|
|
|
'subscribed' => EnsureSubscribed::class,
|
2026-03-29 22:24:28 +00:00
|
|
|
'api.auth' => AuthenticateApiToken::class,
|
feat: implement MCP server with tools, Post API tests, auth middleware
- 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
2026-03-29 23:30:36 +00:00
|
|
|
'mcp.auth' => AuthenticateMcpToken::class,
|
2026-03-29 22:24:28 +00:00
|
|
|
]);
|
|
|
|
|
|
2026-03-29 22:59:17 +00:00
|
|
|
$middleware->preventRequestForgery(except: [
|
2026-03-29 22:24:28 +00:00
|
|
|
'stripe/*',
|
2026-01-17 02:46:30 +00:00
|
|
|
]);
|
2026-03-29 23:14:23 +00:00
|
|
|
|
|
|
|
|
$middleware->prependToPriorityList(
|
|
|
|
|
ThrottleRequests::class,
|
|
|
|
|
AuthenticateApiToken::class,
|
|
|
|
|
);
|
2026-01-15 01:13:44 +00:00
|
|
|
})
|
|
|
|
|
->withExceptions(function (Exceptions $exceptions): void {
|
2026-03-29 23:14:23 +00:00
|
|
|
$exceptions->renderable(function (TooManyRequestsHttpException $e, Request $request) {
|
|
|
|
|
if ($request->expectsJson()) {
|
|
|
|
|
$retryAfter = $e->getHeaders()['Retry-After'] ?? null;
|
|
|
|
|
$message = $retryAfter
|
|
|
|
|
? "Rate limit exceeded. Please retry after {$retryAfter} seconds."
|
|
|
|
|
: 'Rate limit exceeded. Please try again later.';
|
|
|
|
|
|
|
|
|
|
return response()->json([
|
|
|
|
|
'name' => 'rate_limit_exceeded',
|
|
|
|
|
'message' => $message,
|
|
|
|
|
], 429)->withHeaders($e->getHeaders());
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-01-15 01:13:44 +00:00
|
|
|
})->create();
|