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
fix: prevent double-publish race condition, media upload auth bypass, TokenExpired disconnected_at
Paulo Castellano9d0a860d8795
diff --git a/app/Console/Commands/ProcessScheduledPosts.php b/app/Console/Commands/ProcessScheduledPosts.phpindex acc3d7b34..37a4789e4 100644--- a/app/Console/Commands/ProcessScheduledPosts.php+++ b/app/Console/Commands/ProcessScheduledPosts.php@@ -4,6 +4,7 @@ declare(strict_types=1);namespace App\Console\Commands;+use App\Enums\Post\Status as PostStatus;use App\Jobs\PublishPost;use App\Models\Post;use Illuminate\Console\Command;@@ -18,9 +19,13 @@ class ProcessScheduledPosts extends Command{Post::query()->due()- ->with(['postPlatforms.socialAccount', 'postPlatforms.media'])- ->chunk(100, function ($posts) {- foreach ($posts as $post) {+ ->each(function (Post $post) {+ // Atomically claim the post — only dispatch if we successfully change its status+ $claimed = Post::where('id', $post->id)+ ->where('status', PostStatus::Scheduled)+ ->update(['status' => PostStatus::Publishing]);++ if ($claimed) {PublishPost::dispatch($post);}});diff --git a/app/Http/Controllers/App/MediaController.php b/app/Http/Controllers/App/MediaController.phpindex 7e587cd4c..c02278733 100644--- a/app/Http/Controllers/App/MediaController.php+++ b/app/Http/Controllers/App/MediaController.php@@ -9,6 +9,8 @@ use App\Http\Requests\App\Media\StoreMediaRequest;use App\Models\Media;use App\Models\Post;use App\Models\PostPlatform;+use App\Models\User;+use App\Models\Workspace;use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\Relations\Relation;use Illuminate\Http\JsonResponse;@@ -162,6 +164,16 @@ class MediaController extends Controllerif ($model->workspace_id !== $workspace->id) {abort(403);}+ } elseif ($model instanceof Workspace) {+ if ($model->id !== $workspace->id) {+ abort(403);+ }+ } elseif ($model instanceof User) {+ if ($model->id !== $request->user()->id) {+ abort(403);+ }+ } else {+ abort(403);}}diff --git a/app/Models/SocialAccount.php b/app/Models/SocialAccount.phpindex 8e2a47f44..9a2ccfc92 100644--- a/app/Models/SocialAccount.php+++ b/app/Models/SocialAccount.php@@ -136,6 +136,7 @@ class SocialAccount extends Model$this->update(['status' => Status::TokenExpired,'error_message' => $errorMessage,+ 'disconnected_at' => $this->disconnected_at ?? now(),]);}