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: code review issues — Instagram arg count, LinkedIn file handle, TikTok data_get, YouTube token timestamp
Paulo Castellanoaa6bc88335e8
diff --git a/app/Services/Social/InstagramPublisher.php b/app/Services/Social/InstagramPublisher.phpindex eeac921b3..e216254a2 100644--- a/app/Services/Social/InstagramPublisher.php+++ b/app/Services/Social/InstagramPublisher.php@@ -233,7 +233,7 @@ class InstagramPublisherLog::error('Instagram carousel container creation failed', ['body' => $carouselResponse->body(),]);- $this->handleApiError($carouselResponse, 'Instagram API error');+ $this->handleApiError($carouselResponse);}$carouselId = $carouselResponse->json()['id'] ?? null;diff --git a/app/Services/Social/LinkedInPagePublisher.php b/app/Services/Social/LinkedInPagePublisher.phpindex a1ce5cb69..38026eb72 100644--- a/app/Services/Social/LinkedInPagePublisher.php+++ b/app/Services/Social/LinkedInPagePublisher.php@@ -367,17 +367,16 @@ class LinkedInPagePublisher// Step 2: Upload chunks$uploadedPartIds = [];+ $handle = fopen($tempFile, 'r');foreach ($uploadInstructions as $index => $instruction) {- $uploadUrl = $instruction['uploadUrl'];- $firstByte = $instruction['firstByte'];- $lastByte = $instruction['lastByte'];+ $uploadUrl = data_get($instruction, 'uploadUrl');+ $firstByte = data_get($instruction, 'firstByte');+ $lastByte = data_get($instruction, 'lastByte');$chunkLength = $lastByte - $firstByte + 1;- $handle = fopen($tempFile, 'r');fseek($handle, $firstByte);$chunkData = fread($handle, $chunkLength);- fclose($handle);Log::info('LinkedIn Page uploading video chunk', ['index' => $index,@@ -410,6 +409,8 @@ class LinkedInPagePublisherLog::info('LinkedIn Page video chunk uploaded', ['index' => $index, 'etag' => $etag]);}+ fclose($handle);+// Step 3: Finalize uploadLog::info('LinkedIn Page finalizing video upload', ['videoUrn' => $videoUrn]);diff --git a/app/Services/Social/LinkedInPublisher.php b/app/Services/Social/LinkedInPublisher.phpindex be659ca1f..790d36307 100644--- a/app/Services/Social/LinkedInPublisher.php+++ b/app/Services/Social/LinkedInPublisher.php@@ -348,17 +348,16 @@ class LinkedInPublisher// Step 2: Upload chunks$uploadedPartIds = [];+ $handle = fopen($tempFile, 'r');foreach ($uploadInstructions as $index => $instruction) {- $uploadUrl = $instruction['uploadUrl'];- $firstByte = $instruction['firstByte'];- $lastByte = $instruction['lastByte'];+ $uploadUrl = data_get($instruction, 'uploadUrl');+ $firstByte = data_get($instruction, 'firstByte');+ $lastByte = data_get($instruction, 'lastByte');$chunkLength = $lastByte - $firstByte + 1;- $handle = fopen($tempFile, 'r');fseek($handle, $firstByte);$chunkData = fread($handle, $chunkLength);- fclose($handle);Log::info('LinkedIn uploading video chunk', ['index' => $index,@@ -391,6 +390,8 @@ class LinkedInPublisherLog::info('LinkedIn video chunk uploaded', ['index' => $index, 'etag' => $etag]);}+ fclose($handle);+// Step 3: Finalize uploadLog::info('LinkedIn finalizing video upload', ['videoUrn' => $videoUrn]);diff --git a/app/Services/Social/TikTokPublisher.php b/app/Services/Social/TikTokPublisher.phpindex df47c19a2..06419ca9b 100644--- a/app/Services/Social/TikTokPublisher.php+++ b/app/Services/Social/TikTokPublisher.php@@ -128,7 +128,7 @@ class TikTokPublisherLog::info('TikTok video init response', ['data' => $data]);- $publishId = data_get($data, 'data')['publish_id'] ?? null;+ $publishId = data_get($data, 'data.publish_id');if (! $publishId) {throw new \Exception('TikTok did not return a publish_id');@@ -191,7 +191,7 @@ class TikTokPublisherLog::info('TikTok photo init response', ['data' => $data]);- $publishId = data_get($data, 'data')['publish_id'] ?? null;+ $publishId = data_get($data, 'data.publish_id');if (! $publishId) {throw new \Exception('TikTok did not return a publish_id');@@ -226,7 +226,7 @@ class TikTokPublisher}$data = $response->json();- $status = data_get($data, 'data')['status'] ?? 'UNKNOWN';+ $status = data_get($data, 'data.status', 'UNKNOWN');Log::info('TikTok publish status', ['status' => $status,diff --git a/app/Services/Social/YouTubePublisher.php b/app/Services/Social/YouTubePublisher.phpindex b182dae0b..1c6e8b58f 100644--- a/app/Services/Social/YouTubePublisher.php+++ b/app/Services/Social/YouTubePublisher.php@@ -51,12 +51,14 @@ class YouTubePublisher$client->setClientId(config('services.google.client_id'));$client->setClientSecret(config('services.google.client_secret'));+ $remainingSeconds = $account->token_expires_at+ ? max(0, (int) now()->diffInSeconds($account->token_expires_at, false))+ : 3600;+$tokenData = ['access_token' => $account->access_token,- 'created' => $account->token_expires_at- ? $account->token_expires_at->subHour()->getTimestamp()- : time(),- 'expires_in' => 3600,+ 'created' => time(),+ 'expires_in' => $remainingSeconds,];if ($account->refresh_token) {