Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
<?php
declare(strict_types=1);
namespace App\Http\Middleware\App;
use App\Models\Invite;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class EnsureRegistrationEnabled
{
public function handle(Request $request, Closure $next): mixed
{
if (! config('trypost.self_hosted')) {
return $next($request);
}
// `query` covers the GET form; `input` covers the invite field posted
// with the registration form (a hidden input, not a query param).
$inviteId = $request->query('invite') ?? $request->input('invite') ?? $request->session()->get('pending_invite_id');
if (is_string($inviteId) && Invite::fromId($inviteId) !== null) {
$request->session()->put('pending_invite_id', $inviteId);
return $next($request);
}
throw new NotFoundHttpException;
}
}