Merge main into feat/automations-module

Conflict resolutions + integration fixes:
- CreatePost: kept the branch's merge-into-existing meta persistence (equivalent
  to main's #86 replace on create, and what the automations flow was built on).
- FacebookSettings.vue: kept both new defaults (previewOnly + meta).
- RunGenerateNode + GenerateNodeConfig.vue: ContentType::InstagramCarousel was
  removed on main (#80); an IG carousel is now a multi-image instagram_feed, so
  the carousel-capable list uses InstagramFeed.
- GenerateNodeTest: fixtures use the ContentType enum and the new instagram_feed
  carousel signal.
This commit is contained in:
Paulo Castellano 2026-06-10 17:09:54 -03:00
commit 21b14f7893
62 changed files with 1607 additions and 302 deletions

View file

@ -102,7 +102,10 @@ SPACES_BUCKET=
LINKEDIN_CLIENT_ID=
LINKEDIN_CLIENT_SECRET=
LINKEDIN_CLIENT_REDIRECT="${APP_URL}/accounts/linkedin/callback"
# LINKEDIN_SCOPES="openid,profile,email,w_member_social"
LINKEDIN_PAGE_CLIENT_REDIRECT="${APP_URL}/accounts/linkedin-page/callback"
LINKEDIN_PAGE_CLIENT_REDIRECT="${APP_URL}/accounts/linkedin-page/callback"
# LINKEDIN_PAGE_SCOPES="openid,profile,email,w_organization_social,r_organization_social,rw_organization_admin,w_member_social"
# X / Twitter (https://developer.twitter.com)
X_CLIENT_ID=

2
.github/FUNDING.yml vendored
View file

@ -1 +1 @@
github: [trypostit]
github: [paulocastellano]

45
.github/copilot-instructions.md vendored Normal file
View file

@ -0,0 +1,45 @@
# TryPost — Code Review Instructions
Laravel 13 + Inertia 3 (Vue 3 + TypeScript) + Tailwind 4, PHP 8.4, Pest 4. Flag violations of these project conventions; cite `file:line`. Skip nits the linters (Pint/ESLint) already catch.
## Backend validation
- Validation MUST live in a `FormRequest` subclass under `app/Http/Requests/App/<Group>/` (or `Api/`), type-hinted in the controller action. Name `<Verb><Resource>Request` (e.g. `StorePostRequest`). Flag any inline `$request->validate([...])` in a controller.
## Eloquent & responses
- API JSON MUST go through an Eloquent API Resource (`JsonResource`). Flag `response()->json([...])` that maps models inline.
- Explicit status codes use `Symfony\Component\HttpFoundation\Response` constants — `Response::HTTP_CREATED`, never `201`.
## PHP idioms
- In Action/service classes use `data_get($data, 'key', $default)` — flag direct `$data['key']` or `$data['k'] ?? $x`.
- Imports at the top via `use`; flag inline refs like `\DB::`, `\Str::uuid()`.
- Double-quoted interpolation with curly braces: `"workspace.{$id}"`, not `'workspace.'.$id`.
- Constructor property promotion; explicit return types + param type hints; `declare(strict_types=1)`; curly braces on every control structure (even one-liners); TitleCase enum keys; prefer PHPDoc (with array-shape types) over inline comments.
## Migrations (app is in production)
- Schema changes go in NEW migrations. Flag any edit to an existing migration file.
## Storage & external URLs
- Never pass a disk name to `Storage::` or `->store()` — use the default disk.
- Third-party API hosts / OAuth endpoints come from `config/trypost.php` (`platforms.<name>`), never hardcoded (e.g. `https://api.x.com`). Tests must `Http::fake` the same `config(...)` value, not a literal URL. Only the host is config; protocol path segments (`/oauth2/token`) stay inline.
## AI agents (`app/Ai/Agents`)
- Never embed prompts in PHP (heredocs / long string literals in `instructions()`). Instruction text lives in Blade under `resources/views/prompts/`; return `view('prompts....', [...])->render()` passing only needed vars.
## Frontend (Vue / TypeScript)
- Arrow functions only — flag `function` declarations.
- Icons from `@tabler/icons-vue` (Icon-prefixed, e.g. `IconCheck`). Flag `lucide-vue-next`.
- Dates: `@/dayjs` for calculation, `@/date` for display formatting — flag raw `new Date()`.
- Routes: Wayfinder helpers from `@/routes` / `@/actions` — flag hardcoded URLs like `href="/register"`. After route/controller changes, `wayfinder:generate` must be run.
- No HTML5 validation attributes (`required`, `minlength`, `pattern`, …) — rely solely on backend validation.
- Vue components have a single root element. Reuse existing components/composables before adding new ones.
- `<DialogFooter>`: primary action button FIRST in the markup, then cancel/secondary.
## Pagination
- Use `->paginate()` only (never `cursorPaginate()`). Paginated lists use Inertia scroll (`Inertia::scroll()` + `<InfiniteScroll>`) — flag traditional page-number/link pagination.
## Tests (required)
- Every behavioral change needs a test, new or updated. Flag logic changes shipped without tests.
- Feature & Dusk tests MUST use named routes via `route('...')` — flag hardcoded URL strings. Dusk interacts/asserts via `@dusk` selectors, never CSS classes, tags, or text.
## Git
- No `Co-Authored-By` lines or AI attribution in commit messages or PR descriptions.

130
.github/workflows/release-docker.yml vendored Normal file
View file

@ -0,0 +1,130 @@
name: Publish Docker image
# Builds the production image and publishes it to GitHub Container Registry
# (GHCR) on every version tag. amd64 and arm64 are built on native runners,
# then stitched into one multi-arch manifest — no QEMU emulation.
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
name: Build (${{ matrix.platform }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
runner: ubuntu-latest
- platform: linux/arm64
runner: ubuntu-24.04-arm
permissions:
contents: read
packages: write
steps:
- name: Prepare platform slug
run: echo "PLATFORM_PAIR=${platform//\//-}" >> "$GITHUB_ENV"
env:
platform: ${{ matrix.platform }}
- name: Checkout
uses: actions/checkout@v4
- name: Docker metadata (labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
target: production
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VITE_REVERB_APP_KEY=trypost-reverb-key
cache-from: type=gha,scope=${{ env.PLATFORM_PAIR }}
cache-to: type=gha,mode=max,scope=${{ env.PLATFORM_PAIR }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p "${{ runner.temp }}/digests"
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
merge:
name: Merge multi-arch manifest
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: read
packages: write
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker metadata (tags)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push manifest list
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create \
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
- name: Inspect published image
run: docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}

6
Caddyfile Normal file
View file

@ -0,0 +1,6 @@
# Caddy serves TryPost on your domain with automatic HTTPS (Let's Encrypt).
# APP_DOMAIN is provided by the caddy service in compose.prod.yaml.
# reverse_proxy transparently passes through WebSocket upgrades (Reverb on /app).
{$APP_DOMAIN} {
reverse_proxy app:80
}

View file

@ -114,3 +114,15 @@ ## License
<p align="center">
Built openly by the community. <a href="https://github.com/trypost-it/trypost/stargazers">Star us on GitHub</a> and tell a friend.
</p>
---
## Star History
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=trypostit/trypost&type=date&theme=dark&legend=top-left" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=trypostit/trypost&type=date&legend=top-left" />
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=trypostit/trypost&type=date&legend=top-left" />
</picture>
</p>

View file

@ -198,7 +198,7 @@ private function humanize(Workspace $workspace, array $structured, string $forma
* Derive the generator format and slide count from per-account content types.
*
* Carousel-capable content types:
* - instagram_carousel (Instagram feed carousel)
* - instagram_feed (Instagram feed carousel = multi-image feed post)
* - linkedin_carousel (LinkedIn personal carousel PDF)
* - linkedin_page_carousel (LinkedIn page carousel PDF)
* - pinterest_carousel (Pinterest carousel pin)
@ -215,7 +215,7 @@ private function humanize(Workspace $workspace, array $structured, string $forma
public function deriveFormat(array $accountsConfig, array $config): array
{
$carouselCapable = [
ContentType::InstagramCarousel->value,
ContentType::InstagramFeed->value,
ContentType::LinkedInCarousel->value,
ContentType::LinkedInPageCarousel->value,
ContentType::PinterestCarousel->value,

View file

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace App\Enums\PostPlatform;
enum AspectRatio: string
{
case Square = '1:1';
case Portrait = '4:5';
case Landscape = '16:9';
case Original = 'original';
/**
* Width-to-height ratio used to center-crop an image. `Original` means "no
* crop", so it resolves to a square (1.0) only as a safe fallback — callers
* should bypass cropping entirely for `Original`.
*/
public function toFloat(): float
{
return match ($this) {
self::Portrait => 4 / 5,
self::Landscape => 16 / 9,
self::Square, self::Original => 1.0,
};
}
}

View file

@ -10,7 +10,6 @@ enum ContentType: string
{
// Instagram
case InstagramFeed = 'instagram_feed';
case InstagramCarousel = 'instagram_carousel';
case InstagramReel = 'instagram_reel';
case InstagramStory = 'instagram_story';
@ -51,11 +50,16 @@ enum ContentType: string
// Mastodon
case MastodonPost = 'mastodon_post';
/**
* AI generation format for an Instagram carousel. Not a content type —
* carousel posts are persisted as InstagramFeed.
*/
public const CAROUSEL_FORMAT = 'instagram_carousel';
public function label(): string
{
return match ($this) {
self::InstagramFeed => 'Feed Post',
self::InstagramCarousel => 'Carousel',
self::InstagramReel => 'Reel',
self::InstagramStory => 'Story',
self::LinkedInPost, self::LinkedInPagePost => 'Post',
@ -84,7 +88,7 @@ public function description(): string
public function platform(): SocialPlatform
{
return match ($this) {
self::InstagramFeed, self::InstagramCarousel, self::InstagramReel, self::InstagramStory => SocialPlatform::Instagram,
self::InstagramFeed, self::InstagramReel, self::InstagramStory => SocialPlatform::Instagram,
self::LinkedInPost, self::LinkedInCarousel => SocialPlatform::LinkedIn,
self::LinkedInPagePost, self::LinkedInPageCarousel => SocialPlatform::LinkedInPage,
self::FacebookPost, self::FacebookReel, self::FacebookStory => SocialPlatform::Facebook,
@ -109,7 +113,6 @@ public function aiImageDimensions(): array
return match ($this) {
// Vertical 4:5 (Instagram preferred portrait, Threads mirrors it)
self::InstagramFeed,
self::InstagramCarousel,
self::ThreadsPost => ['width' => 1080, 'height' => 1350],
// Square 1:1 (LinkedIn, X, Facebook, Bluesky, Mastodon)
@ -135,7 +138,7 @@ public function aiImageDimensions(): array
public function aspectRatio(): ?string
{
return match ($this) {
self::InstagramFeed, self::InstagramCarousel => '4:5',
self::InstagramFeed => '4:5',
self::InstagramReel, self::InstagramStory => '9:16',
self::FacebookReel, self::FacebookStory => '9:16',
self::TikTokVideo, self::YouTubeShort => '9:16',
@ -149,8 +152,7 @@ public function aspectRatio(): ?string
public function maxMediaCount(): int
{
return match ($this) {
self::InstagramFeed => 1,
self::InstagramCarousel => 10,
self::InstagramFeed => 10,
self::InstagramReel, self::InstagramStory => 1,
self::LinkedInPost, self::LinkedInPagePost => 1,
self::LinkedInCarousel, self::LinkedInPageCarousel => 20,
@ -172,7 +174,6 @@ public function supportsVideo(): bool
{
return match ($this) {
self::InstagramFeed, self::InstagramReel, self::InstagramStory => true,
self::InstagramCarousel => false,
self::LinkedInPost, self::LinkedInPagePost => true,
self::LinkedInCarousel, self::LinkedInPageCarousel => false,
self::FacebookPost, self::FacebookReel, self::FacebookStory => true,
@ -237,7 +238,6 @@ public static function aiSupported(): array
{
return [
self::InstagramFeed,
self::InstagramCarousel,
self::InstagramStory,
self::LinkedInPost,
self::LinkedInPagePost,

View file

@ -75,7 +75,10 @@ public function update(UpdatePostRequest $request, Post $post): PostResource|Jso
);
}
return new PostResource(data_get($result, 'post'));
$updated = data_get($result, 'post');
$updated->load(['postPlatforms.socialAccount']);
return new PostResource($updated);
}
public function destroy(Request $request, Post $post): JsonResponse

View file

@ -22,14 +22,6 @@ class LinkedInController extends SocialController
protected SocialPlatform $platform = SocialPlatform::LinkedIn;
protected array $scopes = [
'openid',
'profile',
'email',
'r_basicprofile',
'w_member_social',
];
public function connect(Request $request): Response|RedirectResponse
{
$this->ensurePlatformEnabled();
@ -42,7 +34,7 @@ public function connect(Request $request): Response|RedirectResponse
$this->authorize('manageAccounts', $workspace);
return $this->redirectToProvider($request, $this->driver, $this->scopes);
return $this->redirectToProvider($request, $this->driver, config('trypost.platforms.linkedin.scopes'));
}
public function callback(Request $request): View

View file

@ -24,16 +24,6 @@ class LinkedInPageController extends SocialController
protected SocialPlatform $platform = SocialPlatform::LinkedInPage;
protected array $scopes = [
'openid',
'profile',
'email',
'w_organization_social',
'r_organization_social',
'rw_organization_admin',
'w_member_social',
];
public function connect(Request $request): SymfonyResponse|RedirectResponse
{
$this->ensurePlatformEnabled();
@ -55,7 +45,7 @@ public function connect(Request $request): SymfonyResponse|RedirectResponse
return Inertia::location(
Socialite::driver($this->driver)
->scopes($this->scopes)
->scopes(config('trypost.platforms.linkedin-page.scopes'))
->with([
'redirect_uri' => config('services.linkedin-openid.redirect_page'),
])
@ -80,7 +70,7 @@ public function callback(Request $request): View|RedirectResponse
try {
$socialUser = Socialite::driver($this->driver)
->scopes($this->scopes)
->scopes(config('trypost.platforms.linkedin-page.scopes'))
->with([
'redirect_uri' => config('services.linkedin-openid.redirect_page'),
])

View file

@ -4,6 +4,7 @@
namespace App\Http\Requests\Api\Post;
use App\Enums\PostPlatform\AspectRatio;
use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
use App\Models\SocialAccount;
@ -49,6 +50,8 @@ public function rules(): array
Rule::in(array_column(ContentType::cases(), 'value')),
new ContentTypeMatchesPlatform,
],
'platforms.*.meta' => ['sometimes', 'nullable', 'array'],
'platforms.*.meta.aspect_ratio' => ['sometimes', 'nullable', 'string', Rule::enum(AspectRatio::class)],
'scheduled_at' => ['nullable', 'date', 'after:now'],
'label_ids' => ['sometimes', 'array'],
'label_ids.*' => [

View file

@ -5,6 +5,7 @@
namespace App\Http\Requests\Api\Post;
use App\Enums\Post\Status;
use App\Enums\PostPlatform\AspectRatio;
use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
use App\Models\Post;
@ -51,6 +52,7 @@ public function rules(): array
new ContentTypeMatchesPostPlatform,
],
'platforms.*.meta' => ['nullable', 'array'],
'platforms.*.meta.aspect_ratio' => ['sometimes', 'nullable', 'string', Rule::enum(AspectRatio::class)],
'scheduled_at' => [
'nullable',
'date',

View file

@ -20,11 +20,14 @@ public function authorize(): bool
*/
public function rules(): array
{
$allowedFormats = array_map(fn (ContentType $t) => $t->value, ContentType::aiSupported());
$allowedFormats[] = ContentType::CAROUSEL_FORMAT;
return [
'format' => [
'required',
'string',
Rule::in(array_map(fn (ContentType $t) => $t->value, ContentType::aiSupported())),
Rule::in($allowedFormats),
],
'social_account_id' => ['nullable', 'uuid'],
'image_count' => ['nullable', 'integer', 'min:0', 'max:10'],

View file

@ -6,6 +6,7 @@
use App\Enums\Media\Source;
use App\Enums\Post\Status;
use App\Enums\PostPlatform\AspectRatio;
use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
use App\Rules\ContentFitsPlatformLimits;
@ -70,7 +71,7 @@ public function rules(): array
Rule::when($enforcesMediaCompatibility, [new ContentTypeCompatibleWithMedia]),
],
'platforms.*.meta' => ['nullable', 'array'],
'platforms.*.meta.aspect_ratio' => ['sometimes', 'nullable', 'string', Rule::in(['1:1', '4:5', '16:9', 'original'])],
'platforms.*.meta.aspect_ratio' => ['sometimes', 'nullable', 'string', Rule::enum(AspectRatio::class)],
'platforms.*.meta.privacy_level' => ['sometimes', 'nullable', 'string', Rule::in(['PUBLIC_TO_EVERYONE', 'MUTUAL_FOLLOW_FRIENDS', 'FOLLOWER_OF_CREATOR', 'SELF_ONLY'])],
'platforms.*.meta.auto_add_music' => ['sometimes', 'boolean'],
'platforms.*.meta.allow_comments' => ['sometimes', 'boolean'],

View file

@ -29,8 +29,8 @@ public function rules(): array
'brand_color' => $hex,
'background_color' => $hex,
'text_color' => $hex,
'brand_font' => ['required', 'string', Rule::in(BrandFont::values())],
'image_style' => ['required', 'string', Rule::in(ImageStyle::values())],
'brand_font' => ['sometimes', 'required', 'string', Rule::in(BrandFont::values())],
'image_style' => ['sometimes', 'required', 'string', Rule::in(ImageStyle::values())],
'content_language' => ['sometimes', 'string', 'in:en,pt-BR,es'],
];
}

View file

@ -18,6 +18,7 @@ public function toArray(Request $request): array
'id' => $this->id,
'platform' => $this->platform?->value,
'content_type' => $this->content_type?->value,
'meta' => $this->meta,
'status' => $this->status?->value,
'enabled' => $this->enabled,
'platform_url' => $this->platform_url,

View file

@ -52,7 +52,7 @@ public function handle(): void
$workspace = Workspace::findOrFail($this->workspaceId);
$socialAccount = $this->socialAccountId ? SocialAccount::find($this->socialAccountId) : null;
$isCarousel = $this->format === 'instagram_carousel';
$isCarousel = $this->format === ContentType::CAROUSEL_FORMAT;
$agentFormat = $isCarousel ? 'carousel' : 'single';
$slideCount = $isCarousel && $this->imageCount > 0 ? $this->imageCount : 1;
@ -120,13 +120,26 @@ public function handle(): void
*/
private function dimensionsForFormat(): array
{
$type = ContentType::tryFrom($this->format);
$type = $this->resolvedContentType();
return $type
? $type->aiImageDimensions()
: ['width' => TemplateImageGenerator::DEFAULT_WIDTH, 'height' => TemplateImageGenerator::DEFAULT_HEIGHT];
}
/**
* The stored content type for the requested generation format. The carousel
* generation format is persisted as an Instagram feed post.
*/
private function resolvedContentType(): ?ContentType
{
if ($this->format === ContentType::CAROUSEL_FORMAT) {
return ContentType::InstagramFeed;
}
return ContentType::tryFrom($this->format);
}
private function humanize(Workspace $workspace, array $structured, string $format): array
{
try {
@ -277,23 +290,20 @@ private function createPost(Workspace $workspace, string $content, array $media,
'date' => $this->date,
]);
$contentType = ContentType::tryFrom($this->format);
$contentType = $this->resolvedContentType();
if ($contentType && $socialAccount) {
$aspectRatio = $this->aspectRatioFor($contentType);
$platformContentType = $contentType === ContentType::InstagramCarousel
? ContentType::InstagramFeed
: $contentType;
$post->postPlatforms()
->where('social_account_id', $socialAccount->id)
->each(function ($platform) use ($aspectRatio, $platformContentType): void {
->each(function ($platform) use ($aspectRatio, $contentType): void {
$meta = $platform->meta ?? [];
if ($aspectRatio !== null) {
$meta['aspect_ratio'] = $aspectRatio;
}
$platform->meta = $meta;
$platform->content_type = $platformContentType->value;
$platform->content_type = $contentType->value;
$platform->enabled = true;
$platform->save();
});

View file

@ -5,6 +5,7 @@
namespace App\Mcp\Tools\Post;
use App\Actions\Post\CreatePost;
use App\Enums\PostPlatform\AspectRatio;
use App\Enums\PostPlatform\ContentType;
use App\Http\Resources\Api\PostResource;
use App\Rules\ContentTypeMatchesPlatform;
@ -37,6 +38,8 @@ public function handle(Request $request): ResponseFactory
->where('is_active', true),
],
'platforms.*.content_type' => ['required', 'string', Rule::in(array_column(ContentType::cases(), 'value')), new ContentTypeMatchesPlatform],
'platforms.*.meta' => ['sometimes', 'array'],
'platforms.*.meta.aspect_ratio' => ['sometimes', 'nullable', 'string', Rule::enum(AspectRatio::class)],
]);
$post = CreatePost::execute($workspace, $request->user(), $validated);
@ -58,6 +61,7 @@ public function schema(JsonSchema $schema): array
->items($schema->object(fn ($p) => [
'social_account_id' => $p->string()->required()->description('UUID of the connected social account.'),
'content_type' => $p->string()->required()->description('Format for this platform (e.g. linkedin_post, x_post, instagram_feed).'),
'meta' => $p->object()->description('Per-platform metadata (e.g. aspect_ratio: 1:1|4:5|16:9|original for Instagram/Facebook feed images).'),
]))
->description('Platforms to publish on. Accounts not listed remain available but disabled.'),
];

View file

@ -7,6 +7,7 @@
use App\Actions\Post\UpdatePost;
use App\Enums\Post\Action as PostAction;
use App\Enums\Post\Status;
use App\Enums\PostPlatform\AspectRatio;
use App\Enums\PostPlatform\ContentType;
use App\Http\Resources\Api\PostResource;
use App\Models\Post;
@ -49,6 +50,7 @@ public function handle(Request $request): Response|ResponseFactory
],
'platforms.*.content_type' => ['sometimes', 'string', Rule::in(array_column(ContentType::cases(), 'value')), new ContentTypeMatchesPostPlatform],
'platforms.*.meta' => ['sometimes', 'array'],
'platforms.*.meta.aspect_ratio' => ['sometimes', 'nullable', 'string', Rule::enum(AspectRatio::class)],
]);
$payload = collect($validated)->except('post_id')->all();

View file

@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
namespace App\Services\Social\Concerns;
use App\Enums\PostPlatform\AspectRatio;
use App\Exceptions\Social\SocialPublishException;
use App\Services\Media\MediaOptimizer;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
trait CropsImageForAspectRatio
{
private const CROP_DIRECTORY = 'social-crops';
/**
* Crop the image to the user-selected aspect ratio and return a public URL
* the platform can fetch. Returns the original URL untouched when no ratio
* is set or 'original' is selected.
*/
protected function cropImageForAspectRatio(string $imageUrl, ?string $aspectRatio): string
{
if (! $aspectRatio || $aspectRatio === 'original') {
return $imageUrl;
}
$ratio = $this->aspectRatioToFloat($aspectRatio);
$tempInput = tempnam(sys_get_temp_dir(), 'crop_in_');
try {
$download = Http::sink($tempInput)->timeout(120)->get($imageUrl);
if ($download->failed()) {
throw $this->cropFailureException('Failed to download image for cropping');
}
$cropped = app(MediaOptimizer::class)->cropToAspectRatio($tempInput, $ratio);
$path = self::CROP_DIRECTORY.'/'.Str::uuid()->toString().'.jpg';
Storage::put($path, file_get_contents($cropped));
@unlink($cropped);
return Storage::url($path);
} finally {
@unlink($tempInput);
}
}
protected function aspectRatioToFloat(string $ratio): float
{
return AspectRatio::tryFrom($ratio)?->toFloat() ?? 1.0;
}
/**
* The platform-specific exception thrown when the source image cannot be
* downloaded for cropping.
*/
abstract protected function cropFailureException(string $message): SocialPublishException;
}

View file

@ -7,7 +7,9 @@
use App\Enums\PostPlatform\ContentType;
use App\Exceptions\Social\ErrorCategory;
use App\Exceptions\Social\FacebookPublishException;
use App\Exceptions\Social\SocialPublishException;
use App\Models\PostPlatform;
use App\Services\Social\Concerns\CropsImageForAspectRatio;
use App\Services\Social\Concerns\HasSocialHttpClient;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Http\Client\Response;
@ -16,6 +18,7 @@
class FacebookPublisher
{
use CropsImageForAspectRatio;
use HasSocialHttpClient;
private string $baseUrl;
@ -46,16 +49,17 @@ public function publish(PostPlatform $postPlatform): array
$media = $postPlatform->post->mediaItems;
$contentType = $postPlatform->content_type;
$aspectRatio = data_get($postPlatform->meta, 'aspect_ratio');
return match ($contentType) {
ContentType::FacebookReel => $this->publishReel($pageId, $accessToken, $content, $media->first()),
ContentType::FacebookStory => $this->publishStory($pageId, $accessToken, $media->first()),
ContentType::FacebookPost => $this->publishPost($pageId, $accessToken, $content, $media),
ContentType::FacebookPost => $this->publishPost($pageId, $accessToken, $content, $media, $aspectRatio),
default => throw new \Exception("Unsupported Facebook content type: {$contentType?->value}"),
};
}
private function publishPost(string $pageId, string $accessToken, ?string $content, $media): array
private function publishPost(string $pageId, string $accessToken, ?string $content, $media, ?string $aspectRatio): array
{
// Text only post
if ($media->isEmpty()) {
@ -77,10 +81,10 @@ private function publishPost(string $pageId, string $accessToken, ?string $conte
if ($isImage) {
// Single or multiple images
if ($media->count() === 1) {
return $this->publishSingleImagePost($pageId, $accessToken, $content, $firstMedia);
return $this->publishSingleImagePost($pageId, $accessToken, $content, $firstMedia, $aspectRatio);
}
return $this->publishMultiImagePost($pageId, $accessToken, $content, $media);
return $this->publishMultiImagePost($pageId, $accessToken, $content, $media, $aspectRatio);
}
throw new \Exception('Unsupported media type for Facebook');
@ -110,10 +114,10 @@ private function publishTextPost(string $pageId, string $accessToken, string $co
];
}
private function publishSingleImagePost(string $pageId, string $accessToken, ?string $content, $media): array
private function publishSingleImagePost(string $pageId, string $accessToken, ?string $content, $media, ?string $aspectRatio): array
{
$payload = [
'url' => $media->url,
'url' => $this->cropImageForAspectRatio($media->url, $aspectRatio),
'access_token' => $accessToken,
];
@ -140,7 +144,7 @@ private function publishSingleImagePost(string $pageId, string $accessToken, ?st
];
}
private function publishMultiImagePost(string $pageId, string $accessToken, ?string $content, $mediaCollection): array
private function publishMultiImagePost(string $pageId, string $accessToken, ?string $content, $mediaCollection, ?string $aspectRatio): array
{
// Upload each image as unpublished
$attachedMedia = [];
@ -151,7 +155,7 @@ private function publishMultiImagePost(string $pageId, string $accessToken, ?str
}
$uploadResponse = $this->facebookHttp()->post("{$this->baseUrl}/{$pageId}/photos", [
'url' => $media->url,
'url' => $this->cropImageForAspectRatio($media->url, $aspectRatio),
'published' => 'false',
'access_token' => $accessToken,
]);
@ -392,4 +396,12 @@ private function handleApiError(Response $response): never
{
throw FacebookPublishException::fromApiResponse($response);
}
protected function cropFailureException(string $message): SocialPublishException
{
return new FacebookPublishException(
userMessage: $message,
category: ErrorCategory::ServerError,
);
}
}

View file

@ -7,17 +7,16 @@
use App\Enums\PostPlatform\ContentType;
use App\Exceptions\Social\ErrorCategory;
use App\Exceptions\Social\InstagramPublishException;
use App\Exceptions\Social\SocialPublishException;
use App\Models\PostPlatform;
use App\Services\Media\MediaOptimizer;
use App\Services\Social\Concerns\CropsImageForAspectRatio;
use App\Services\Social\Concerns\HasSocialHttpClient;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class InstagramPublisher
{
use CropsImageForAspectRatio;
use HasSocialHttpClient;
private string $baseUrl;
@ -80,7 +79,7 @@ private function publishFeed(string $instagramId, string $accessToken, ?string $
private function publishSingleImage(string $instagramId, string $accessToken, ?string $content, $media, ?string $aspectRatio): array
{
$imageUrl = $this->cropForFeed($media->url, $aspectRatio);
$imageUrl = $this->cropImageForAspectRatio($media->url, $aspectRatio);
// Step 1: Create container
$containerResponse = $this->socialHttp()->post("{$this->baseUrl}/{$instagramId}/media", [
@ -206,7 +205,7 @@ private function publishCarousel(string $instagramId, string $accessToken, ?stri
$params['video_url'] = $media->url;
$params['media_type'] = 'VIDEO';
} else {
$params['image_url'] = $this->cropForFeed($media->url, $aspectRatio);
$params['image_url'] = $this->cropImageForAspectRatio($media->url, $aspectRatio);
}
$containerResponse = $this->socialHttp()->post("{$this->baseUrl}/{$instagramId}/media", $params);
@ -311,52 +310,12 @@ private function publishContainer(string $instagramId, string $accessToken, stri
];
}
/**
* Crop the image to the user-selected aspect ratio and return a public URL
* Instagram can fetch. Returns the original URL untouched when no ratio is
* set or 'original' is selected (caller has already validated the original
* fits IG's 4:5 to 1.91:1 range).
*/
private function cropForFeed(string $imageUrl, ?string $aspectRatio): string
protected function cropFailureException(string $message): SocialPublishException
{
if (! $aspectRatio || $aspectRatio === 'original') {
return $imageUrl;
}
$ratio = $this->aspectRatioToFloat($aspectRatio);
$tempInput = tempnam(sys_get_temp_dir(), 'ig_crop_in_');
try {
$download = Http::sink($tempInput)->timeout(120)->get($imageUrl);
if ($download->failed()) {
throw new InstagramPublishException(
userMessage: 'Failed to download image for cropping',
category: ErrorCategory::ServerError,
);
}
$cropped = app(MediaOptimizer::class)->cropToAspectRatio($tempInput, $ratio);
$path = 'instagram-crops/'.Str::uuid()->toString().'.jpg';
Storage::put($path, file_get_contents($cropped));
@unlink($cropped);
return Storage::url($path);
} finally {
@unlink($tempInput);
}
}
private function aspectRatioToFloat(string $ratio): float
{
return match ($ratio) {
'4:5' => 4 / 5,
'16:9' => 16 / 9,
default => 1.0,
};
return new InstagramPublishException(
userMessage: $message,
category: ErrorCategory::ServerError,
);
}
private function waitForMediaProcessing(string $containerId, string $accessToken, int $maxAttempts = 30): void

View file

@ -108,7 +108,7 @@ private function buildVideoPostInfo(PostPlatform $postPlatform, ?string $content
'title' => $content ?? '',
'privacy_level' => $this->resolveRequiredPrivacyLevel($postPlatform),
'disable_duet' => ! data_get($meta, 'allow_duet', false),
'disable_comment' => ! data_get($meta, 'allow_comments', true),
'disable_comment' => ! data_get($meta, 'allow_comments', false),
'disable_stitch' => ! data_get($meta, 'allow_stitch', false),
];
@ -142,7 +142,7 @@ private function buildPhotoPostInfo(PostPlatform $postPlatform, ?string $content
$postInfo = [
'description' => $content ?? '',
'privacy_level' => $this->resolveRequiredPrivacyLevel($postPlatform),
'disable_comment' => ! data_get($meta, 'allow_comments', true),
'disable_comment' => ! data_get($meta, 'allow_comments', false),
];
if (data_get($meta, 'brand_content_toggle', false)) {

176
compose.prod.yaml Normal file
View file

@ -0,0 +1,176 @@
# TryPost — self-hosted production stack.
#
# 1. Generate an app key: docker compose -f compose.prod.yaml run --rm app php artisan key:generate --show
# Paste the value into APP_KEY below.
# 2. Edit APP_URL and the passwords marked "change me".
# 3. Start: docker compose -f compose.prod.yaml up -d
#
# This pulls the published image — no local build. Postgres, Redis, the queue
# workers, the scheduler and the WebSocket server all run for you.
services:
app:
image: ghcr.io/trypostit/trypost:latest
container_name: trypost
restart: unless-stopped
environment:
# ===== Required =====
APP_NAME: TryPost
APP_ENV: production
APP_DEBUG: "false"
APP_KEY: "" # <- run key:generate (see header) and paste here
APP_URL: http://localhost:8000 # <- your public URL, e.g. https://post.yourdomain.com
SELF_HOSTED: "true"
TRYPOST_TARGET: production
# ===== Database (bundled postgres service below) =====
DB_CONNECTION: pgsql
DB_HOST: pgsql
DB_PORT: "5432"
DB_DATABASE: trypost
DB_USERNAME: trypost
DB_PASSWORD: trypost-password # <- change me (must match POSTGRES_PASSWORD below)
# ===== Redis / queue / cache / broadcasting =====
REDIS_HOST: redis
REDIS_PORT: "6379"
QUEUE_CONNECTION: redis
CACHE_STORE: redis
SESSION_DRIVER: database
BROADCAST_CONNECTION: reverb
# ===== WebSockets (Reverb) =====
# The published image bakes the client at localhost:8080. For a custom
# domain, rebuild the image with --build-arg VITE_REVERB_HOST=<domain>
# VITE_REVERB_PORT=443 VITE_REVERB_SCHEME=https.
REVERB_APP_ID: "1001"
REVERB_APP_KEY: trypost-reverb-key # must match the key baked into the published image
REVERB_APP_SECRET: change-me-reverb-secret # <- change me
REVERB_HOST: localhost
REVERB_PORT: "8080"
REVERB_SCHEME: http
# ===== Storage =====
# Default: local disk, persisted in the "storage" volume below.
FILESYSTEM_DISK: public
#
# --- Cloudflare R2: set FILESYSTEM_DISK=r2 and fill these ---
# R2_ACCESS_KEY_ID: ""
# R2_SECRET_ACCESS_KEY: ""
# R2_ENDPOINT: ""
# R2_BUCKET: ""
# R2_URL: "" # public bucket URL (needed for media to display)
#
# --- AWS S3: set FILESYSTEM_DISK=s3 and fill these ---
# AWS_ACCESS_KEY_ID: ""
# AWS_SECRET_ACCESS_KEY: ""
# AWS_DEFAULT_REGION: us-east-1
# AWS_BUCKET: ""
# AWS_URL: ""
# ===== Mail =====
# Defaults to "log" (emails written to the container log). Configure SMTP
# for real password-reset / team-invite emails.
MAIL_MAILER: log
MAIL_FROM_ADDRESS: hello@example.com
MAIL_FROM_NAME: TryPost
# MAIL_MAILER: smtp
# MAIL_HOST: ""
# MAIL_PORT: "587"
# MAIL_USERNAME: ""
# MAIL_PASSWORD: ""
# MAIL_SCHEME: tls
# ===== Social platforms (fill in when you connect each network) =====
# Redirect URI in each portal: ${APP_URL}/accounts/<platform>/callback
# LINKEDIN_CLIENT_ID: ""
# LINKEDIN_CLIENT_SECRET: ""
# X_CLIENT_ID: ""
# X_CLIENT_SECRET: ""
# FACEBOOK_CLIENT_ID: ""
# FACEBOOK_CLIENT_SECRET: ""
# INSTAGRAM_CLIENT_ID: ""
# INSTAGRAM_CLIENT_SECRET: ""
# THREADS_CLIENT_ID: ""
# THREADS_CLIENT_SECRET: ""
# TIKTOK_CLIENT_ID: ""
# TIKTOK_CLIENT_SECRET: ""
# PINTEREST_CLIENT_ID: ""
# PINTEREST_CLIENT_SECRET: ""
# GOOGLE_CLIENT_ID: "" # YouTube + Google login
# GOOGLE_CLIENT_SECRET: ""
# ===== AI (optional — leave blank to disable AI features) =====
# OPENAI_API_KEY: ""
# ANTHROPIC_API_KEY: ""
# GEMINI_API_KEY: ""
ports:
- "8000:80" # app (nginx)
- "8080:8080" # Reverb WebSocket
volumes:
- storage:/var/www/html/storage/app
depends_on:
pgsql:
condition: service_healthy
redis:
condition: service_healthy
pgsql:
image: postgres:16-alpine
container_name: trypost-pgsql
restart: unless-stopped
environment:
POSTGRES_DB: trypost
POSTGRES_USER: trypost
POSTGRES_PASSWORD: trypost-password # <- must match DB_PASSWORD above
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U trypost -d trypost']
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: trypost-redis
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- redisdata:/data
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 10s
timeout: 3s
retries: 5
# Optional reverse proxy with automatic HTTPS (Let's Encrypt).
# To serve on a domain:
# 1. Point the domain's DNS at this host.
# 2. Set APP_DOMAIN below and APP_URL above to https://<that domain>.
# 3. Start with the proxy profile:
# docker compose -f compose.prod.yaml --profile proxy up -d
# Without the profile, the app is served directly on http://localhost:8000.
caddy:
image: caddy:2-alpine
container_name: trypost-caddy
restart: unless-stopped
profiles: [proxy]
environment:
APP_DOMAIN: post.example.com # <- your domain
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy-data:/data
- caddy-config:/config
depends_on:
- app
volumes:
pgdata:
redisdata:
storage:
caddy-data:
caddy-config:

264
composer.lock generated
View file

@ -8062,16 +8062,16 @@
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.6.0",
"version": "v3.7.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62"
"reference": "50f59d1f3ca46d41ac911f97a78626b6756af35b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62",
"reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/50f59d1f3ca46d41ac911f97a78626b6756af35b",
"reference": "50f59d1f3ca46d41ac911f97a78626b6756af35b",
"shasum": ""
},
"require": {
@ -8084,7 +8084,7 @@
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.6-dev"
"dev-main": "3.7-dev"
}
},
"autoload": {
@ -8109,7 +8109,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0"
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.0"
},
"funding": [
{
@ -8120,29 +8120,33 @@
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-09-25T14:21:43+00:00"
"time": "2026-04-13T15:52:40+00:00"
},
{
"name": "symfony/dom-crawler",
"version": "v8.0.8",
"version": "v8.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
"reference": "284ace90732b445b027728b5e0eec6418a17a364"
"reference": "77ca351474ea018daba5f2e473cbf1b9b8e72ac6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/284ace90732b445b027728b5e0eec6418a17a364",
"reference": "284ace90732b445b027728b5e0eec6418a17a364",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/77ca351474ea018daba5f2e473cbf1b9b8e72ac6",
"reference": "77ca351474ea018daba5f2e473cbf1b9b8e72ac6",
"shasum": ""
},
"require": {
"php": ">=8.4",
"php": ">=8.4.1",
"symfony/polyfill-ctype": "^1.8",
"symfony/polyfill-mbstring": "^1.0"
},
@ -8175,7 +8179,7 @@
"description": "Eases DOM navigation for HTML and XML documents",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/dom-crawler/tree/v8.0.8"
"source": "https://github.com/symfony/dom-crawler/tree/v8.1.0"
},
"funding": [
{
@ -8195,24 +8199,24 @@
"type": "tidelift"
}
],
"time": "2026-03-30T15:14:47+00:00"
"time": "2026-05-29T05:06:50+00:00"
},
{
"name": "symfony/error-handler",
"version": "v8.0.8",
"version": "v8.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/error-handler.git",
"reference": "c1119fe8dcfc3825ec74ec061b96ef0c8f281517"
"reference": "d8aeb1abd3fef84795567850d3a567bdb5945ee5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/c1119fe8dcfc3825ec74ec061b96ef0c8f281517",
"reference": "c1119fe8dcfc3825ec74ec061b96ef0c8f281517",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/d8aeb1abd3fef84795567850d3a567bdb5945ee5",
"reference": "d8aeb1abd3fef84795567850d3a567bdb5945ee5",
"shasum": ""
},
"require": {
"php": ">=8.4",
"php": ">=8.4.1",
"psr/log": "^1|^2|^3",
"symfony/polyfill-php85": "^1.32",
"symfony/var-dumper": "^7.4|^8.0"
@ -8256,7 +8260,7 @@
"description": "Provides tools to manage errors and ease debugging PHP code",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/error-handler/tree/v8.0.8"
"source": "https://github.com/symfony/error-handler/tree/v8.1.0"
},
"funding": [
{
@ -8276,24 +8280,25 @@
"type": "tidelift"
}
],
"time": "2026-03-30T15:14:47+00:00"
"time": "2026-05-29T05:06:50+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v8.0.9",
"version": "v8.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "0c3c1a17604c4dbbec4b93fe162c538482096e1f"
"reference": "f249ae3f680958b6f1f9dd76e5747cf0695b4102"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/0c3c1a17604c4dbbec4b93fe162c538482096e1f",
"reference": "0c3c1a17604c4dbbec4b93fe162c538482096e1f",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f249ae3f680958b6f1f9dd76e5747cf0695b4102",
"reference": "f249ae3f680958b6f1f9dd76e5747cf0695b4102",
"shasum": ""
},
"require": {
"php": ">=8.4",
"php": ">=8.4.1",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/event-dispatcher-contracts": "^2.5|^3"
},
"conflict": {
@ -8341,7 +8346,7 @@
"description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/event-dispatcher/tree/v8.0.9"
"source": "https://github.com/symfony/event-dispatcher/tree/v8.1.0"
},
"funding": [
{
@ -8361,20 +8366,20 @@
"type": "tidelift"
}
],
"time": "2026-04-18T13:51:42+00:00"
"time": "2026-05-29T05:06:50+00:00"
},
{
"name": "symfony/event-dispatcher-contracts",
"version": "v3.6.0",
"version": "v3.7.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher-contracts.git",
"reference": "59eb412e93815df44f05f342958efa9f46b1e586"
"reference": "ccba7060602b7fed0b03c85bf025257f76d9ef32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/59eb412e93815df44f05f342958efa9f46b1e586",
"reference": "59eb412e93815df44f05f342958efa9f46b1e586",
"url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/ccba7060602b7fed0b03c85bf025257f76d9ef32",
"reference": "ccba7060602b7fed0b03c85bf025257f76d9ef32",
"shasum": ""
},
"require": {
@ -8388,7 +8393,7 @@
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.6-dev"
"dev-main": "3.7-dev"
}
},
"autoload": {
@ -8421,7 +8426,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.6.0"
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.7.0"
},
"funding": [
{
@ -8432,12 +8437,16 @@
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-09-25T14:21:43+00:00"
"time": "2026-01-05T13:30:16+00:00"
},
{
"name": "symfony/filesystem",
@ -8579,20 +8588,21 @@
},
{
"name": "symfony/http-foundation",
"version": "v8.0.8",
"version": "v8.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "02656f7ebeae5c155d659e946f6b3a33df24051b"
"reference": "af11474600f06718086c2cda4fa6fa8d0a672e7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/02656f7ebeae5c155d659e946f6b3a33df24051b",
"reference": "02656f7ebeae5c155d659e946f6b3a33df24051b",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/af11474600f06718086c2cda4fa6fa8d0a672e7e",
"reference": "af11474600f06718086c2cda4fa6fa8d0a672e7e",
"shasum": ""
},
"require": {
"php": ">=8.4",
"php": ">=8.4.1",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/polyfill-mbstring": "^1.1"
},
"conflict": {
@ -8635,7 +8645,7 @@
"description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-foundation/tree/v8.0.8"
"source": "https://github.com/symfony/http-foundation/tree/v8.1.0"
},
"funding": [
{
@ -8655,34 +8665,38 @@
"type": "tidelift"
}
],
"time": "2026-03-30T15:14:47+00:00"
"time": "2026-05-29T05:06:50+00:00"
},
{
"name": "symfony/http-kernel",
"version": "v8.0.8",
"version": "v8.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "1770f6818d83b2fddc12185025b93f39a90cb628"
"reference": "cefeb37c82eed3e0c42fa25ba64cd3a908d90f39"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/1770f6818d83b2fddc12185025b93f39a90cb628",
"reference": "1770f6818d83b2fddc12185025b93f39a90cb628",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/cefeb37c82eed3e0c42fa25ba64cd3a908d90f39",
"reference": "cefeb37c82eed3e0c42fa25ba64cd3a908d90f39",
"shasum": ""
},
"require": {
"php": ">=8.4",
"php": ">=8.4.1",
"psr/log": "^1|^2|^3",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/error-handler": "^7.4|^8.0",
"symfony/event-dispatcher": "^7.4|^8.0",
"symfony/http-foundation": "^7.4|^8.0",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"symfony/dependency-injection": "<8.1",
"symfony/flex": "<2.10",
"symfony/http-client-contracts": "<2.5",
"symfony/translation-contracts": "<2.5",
"symfony/var-dumper": "<8.1",
"symfony/web-profiler-bundle": "<8.1",
"twig/twig": "<3.21"
},
"provide": {
@ -8695,13 +8709,14 @@
"symfony/config": "^7.4|^8.0",
"symfony/console": "^7.4|^8.0",
"symfony/css-selector": "^7.4|^8.0",
"symfony/dependency-injection": "^7.4|^8.0",
"symfony/dependency-injection": "^8.1",
"symfony/dom-crawler": "^7.4|^8.0",
"symfony/expression-language": "^7.4|^8.0",
"symfony/finder": "^7.4|^8.0",
"symfony/http-client-contracts": "^2.5|^3",
"symfony/process": "^7.4|^8.0",
"symfony/property-access": "^7.4|^8.0",
"symfony/rate-limiter": "^7.4|^8.0",
"symfony/routing": "^7.4|^8.0",
"symfony/serializer": "^7.4|^8.0",
"symfony/stopwatch": "^7.4|^8.0",
@ -8709,7 +8724,7 @@
"symfony/translation-contracts": "^2.5|^3",
"symfony/uid": "^7.4|^8.0",
"symfony/validator": "^7.4|^8.0",
"symfony/var-dumper": "^7.4|^8.0",
"symfony/var-dumper": "^8.1",
"symfony/var-exporter": "^7.4|^8.0",
"twig/twig": "^3.21"
},
@ -8739,7 +8754,7 @@
"description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-kernel/tree/v8.0.8"
"source": "https://github.com/symfony/http-kernel/tree/v8.1.0"
},
"funding": [
{
@ -8759,25 +8774,25 @@
"type": "tidelift"
}
],
"time": "2026-03-31T21:14:05+00:00"
"time": "2026-05-29T08:46:08+00:00"
},
{
"name": "symfony/mailer",
"version": "v8.0.8",
"version": "v8.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/mailer.git",
"reference": "ca5f6edaf8780ece814404b58a4482b22b509c56"
"reference": "9418d772df3a03a142e3bc06f602adb2b8724877"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mailer/zipball/ca5f6edaf8780ece814404b58a4482b22b509c56",
"reference": "ca5f6edaf8780ece814404b58a4482b22b509c56",
"url": "https://api.github.com/repos/symfony/mailer/zipball/9418d772df3a03a142e3bc06f602adb2b8724877",
"reference": "9418d772df3a03a142e3bc06f602adb2b8724877",
"shasum": ""
},
"require": {
"egulias/email-validator": "^2.1.10|^3|^4",
"php": ">=8.4",
"php": ">=8.4.1",
"psr/event-dispatcher": "^1",
"psr/log": "^1|^2|^3",
"symfony/event-dispatcher": "^7.4|^8.0",
@ -8819,7 +8834,7 @@
"description": "Helps sending emails",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/mailer/tree/v8.0.8"
"source": "https://github.com/symfony/mailer/tree/v8.1.0"
},
"funding": [
{
@ -8839,24 +8854,24 @@
"type": "tidelift"
}
],
"time": "2026-03-30T15:14:47+00:00"
"time": "2026-05-29T05:06:50+00:00"
},
{
"name": "symfony/mime",
"version": "v8.0.9",
"version": "v8.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "a9fcb293650c054b62a5b406f4e92e7b711ea333"
"reference": "b164ae7e3f7915aacfe9ee155f2f358502440664"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/a9fcb293650c054b62a5b406f4e92e7b711ea333",
"reference": "a9fcb293650c054b62a5b406f4e92e7b711ea333",
"url": "https://api.github.com/repos/symfony/mime/zipball/b164ae7e3f7915aacfe9ee155f2f358502440664",
"reference": "b164ae7e3f7915aacfe9ee155f2f358502440664",
"shasum": ""
},
"require": {
"php": ">=8.4",
"php": ">=8.4.1",
"symfony/polyfill-intl-idn": "^1.10",
"symfony/polyfill-mbstring": "^1.0"
},
@ -8905,7 +8920,7 @@
"mime-type"
],
"support": {
"source": "https://github.com/symfony/mime/tree/v8.0.9"
"source": "https://github.com/symfony/mime/tree/v8.1.0"
},
"funding": [
{
@ -8925,7 +8940,7 @@
"type": "tidelift"
}
],
"time": "2026-04-29T15:02:55+00:00"
"time": "2026-05-29T05:06:50+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -9182,16 +9197,16 @@
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.37.0",
"version": "v1.38.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3"
"reference": "dc21118016c039a66235cf93d96b435ffb282412"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/9614ac4d8061dc257ecc64cba1b140873dce8ad3",
"reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/dc21118016c039a66235cf93d96b435ffb282412",
"reference": "dc21118016c039a66235cf93d96b435ffb282412",
"shasum": ""
},
"require": {
@ -9245,7 +9260,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.37.0"
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.38.1"
},
"funding": [
{
@ -9265,20 +9280,20 @@
"type": "tidelift"
}
],
"time": "2024-09-10T14:38:51+00:00"
"time": "2026-05-25T15:22:23+00:00"
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.37.0",
"version": "v1.38.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
"reference": "3833d7255cc303546435cb650316bff708a1c75c"
"reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c",
"reference": "3833d7255cc303546435cb650316bff708a1c75c",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/2d446c214bdbe5b71bde5011b060a05fece3ae6b",
"reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b",
"shasum": ""
},
"require": {
@ -9330,7 +9345,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.37.0"
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.38.0"
},
"funding": [
{
@ -9350,20 +9365,20 @@
"type": "tidelift"
}
],
"time": "2024-09-09T11:45:10+00:00"
"time": "2026-05-25T13:48:31+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.37.0",
"version": "v1.38.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315"
"reference": "14c5439eec4ccff081ac14eca2dc57feb2a66d92"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6a21eb99c6973357967f6ce3708cd55a6bec6315",
"reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/14c5439eec4ccff081ac14eca2dc57feb2a66d92",
"reference": "14c5439eec4ccff081ac14eca2dc57feb2a66d92",
"shasum": ""
},
"require": {
@ -9415,7 +9430,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.37.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.38.1"
},
"funding": [
{
@ -9435,7 +9450,7 @@
"type": "tidelift"
}
],
"time": "2026-04-10T17:25:58+00:00"
"time": "2026-05-26T12:51:13+00:00"
},
{
"name": "symfony/polyfill-php80",
@ -9523,16 +9538,16 @@
},
{
"name": "symfony/polyfill-php83",
"version": "v1.37.0",
"version": "v1.38.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php83.git",
"reference": "3600c2cb22399e25bb226e4a135ce91eeb2a6149"
"reference": "8339098cae28673c15cce00d80734af0453054e2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/3600c2cb22399e25bb226e4a135ce91eeb2a6149",
"reference": "3600c2cb22399e25bb226e4a135ce91eeb2a6149",
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/8339098cae28673c15cce00d80734af0453054e2",
"reference": "8339098cae28673c15cce00d80734af0453054e2",
"shasum": ""
},
"require": {
@ -9579,7 +9594,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php83/tree/v1.37.0"
"source": "https://github.com/symfony/polyfill-php83/tree/v1.38.1"
},
"funding": [
{
@ -9599,7 +9614,7 @@
"type": "tidelift"
}
],
"time": "2026-04-10T17:25:58+00:00"
"time": "2026-05-26T12:51:13+00:00"
},
{
"name": "symfony/polyfill-php84",
@ -9683,16 +9698,16 @@
},
{
"name": "symfony/polyfill-php85",
"version": "v1.37.0",
"version": "v1.38.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php85.git",
"reference": "fcfa4973a9917cef23f2e38774da74a2b7d115ee"
"reference": "ba2ba04f3352cfa2dcbbcb90aee13ed967f505b1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/fcfa4973a9917cef23f2e38774da74a2b7d115ee",
"reference": "fcfa4973a9917cef23f2e38774da74a2b7d115ee",
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/ba2ba04f3352cfa2dcbbcb90aee13ed967f505b1",
"reference": "ba2ba04f3352cfa2dcbbcb90aee13ed967f505b1",
"shasum": ""
},
"require": {
@ -9739,7 +9754,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php85/tree/v1.37.0"
"source": "https://github.com/symfony/polyfill-php85/tree/v1.38.1"
},
"funding": [
{
@ -9759,7 +9774,7 @@
"type": "tidelift"
}
],
"time": "2026-04-26T13:10:57+00:00"
"time": "2026-05-26T02:25:22+00:00"
},
{
"name": "symfony/polyfill-php86",
@ -10078,20 +10093,20 @@
},
{
"name": "symfony/routing",
"version": "v8.0.9",
"version": "v8.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "75d1bd8e5da3424e4db2fc3ff0222cb4d0c73038"
"reference": "fe0bfec72c8a806109fb9c3a5f2b898fe0c76eb3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/75d1bd8e5da3424e4db2fc3ff0222cb4d0c73038",
"reference": "75d1bd8e5da3424e4db2fc3ff0222cb4d0c73038",
"url": "https://api.github.com/repos/symfony/routing/zipball/fe0bfec72c8a806109fb9c3a5f2b898fe0c76eb3",
"reference": "fe0bfec72c8a806109fb9c3a5f2b898fe0c76eb3",
"shasum": ""
},
"require": {
"php": ">=8.4",
"php": ">=8.4.1",
"symfony/deprecation-contracts": "^2.5|^3"
},
"require-dev": {
@ -10134,7 +10149,7 @@
"url"
],
"support": {
"source": "https://github.com/symfony/routing/tree/v8.0.9"
"source": "https://github.com/symfony/routing/tree/v8.1.0"
},
"funding": [
{
@ -10154,20 +10169,20 @@
"type": "tidelift"
}
],
"time": "2026-04-29T15:02:55+00:00"
"time": "2026-05-29T05:06:50+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v3.6.1",
"version": "v3.7.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "45112560a3ba2d715666a509a0bc9521d10b6c43"
"reference": "d25d82433a80eba6aa0e6c24b61d7370d99e444a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/45112560a3ba2d715666a509a0bc9521d10b6c43",
"reference": "45112560a3ba2d715666a509a0bc9521d10b6c43",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/d25d82433a80eba6aa0e6c24b61d7370d99e444a",
"reference": "d25d82433a80eba6aa0e6c24b61d7370d99e444a",
"shasum": ""
},
"require": {
@ -10185,7 +10200,7 @@
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.6-dev"
"dev-main": "3.7-dev"
}
},
"autoload": {
@ -10221,7 +10236,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v3.6.1"
"source": "https://github.com/symfony/service-contracts/tree/v3.7.0"
},
"funding": [
{
@ -10241,7 +10256,7 @@
"type": "tidelift"
}
],
"time": "2025-07-15T11:30:57+00:00"
"time": "2026-03-28T09:44:51+00:00"
},
{
"name": "symfony/string",
@ -10588,20 +10603,20 @@
},
{
"name": "symfony/var-dumper",
"version": "v8.0.8",
"version": "v8.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "cfb7badd53bf4177f6e9416cfbbccc13c0e773a1"
"reference": "c2c4df1d21477cc21c9f6dc1b14d07c3abc4963e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/cfb7badd53bf4177f6e9416cfbbccc13c0e773a1",
"reference": "cfb7badd53bf4177f6e9416cfbbccc13c0e773a1",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/c2c4df1d21477cc21c9f6dc1b14d07c3abc4963e",
"reference": "c2c4df1d21477cc21c9f6dc1b14d07c3abc4963e",
"shasum": ""
},
"require": {
"php": ">=8.4",
"php": ">=8.4.1",
"symfony/polyfill-mbstring": "^1.0"
},
"conflict": {
@ -10651,7 +10666,7 @@
"dump"
],
"support": {
"source": "https://github.com/symfony/var-dumper/tree/v8.0.8"
"source": "https://github.com/symfony/var-dumper/tree/v8.1.0"
},
"funding": [
{
@ -10671,31 +10686,32 @@
"type": "tidelift"
}
],
"time": "2026-03-31T07:15:36+00:00"
"time": "2026-05-29T05:06:50+00:00"
},
{
"name": "symfony/yaml",
"version": "v8.0.8",
"version": "v8.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "54174ab48c0c0f9e21512b304be17f8150ccf8f1"
"reference": "efb42bd2c6f4f3ccfd4683583449938b5fc146b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/54174ab48c0c0f9e21512b304be17f8150ccf8f1",
"reference": "54174ab48c0c0f9e21512b304be17f8150ccf8f1",
"url": "https://api.github.com/repos/symfony/yaml/zipball/efb42bd2c6f4f3ccfd4683583449938b5fc146b0",
"reference": "efb42bd2c6f4f3ccfd4683583449938b5fc146b0",
"shasum": ""
},
"require": {
"php": ">=8.4",
"php": ">=8.4.1",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"symfony/console": "<7.4"
},
"require-dev": {
"symfony/console": "^7.4|^8.0"
"symfony/console": "^7.4|^8.0",
"yaml/yaml-test-suite": "*"
},
"bin": [
"Resources/bin/yaml-lint"
@ -10726,7 +10742,7 @@
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v8.0.8"
"source": "https://github.com/symfony/yaml/tree/v8.1.0"
},
"funding": [
{
@ -10746,7 +10762,7 @@
"type": "tidelift"
}
],
"time": "2026-03-30T15:14:47+00:00"
"time": "2026-05-29T05:06:50+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",

View file

@ -80,10 +80,14 @@
'api' => env('LINKEDIN_API', 'https://api.linkedin.com'),
// OAuth host is different from the data API (api.linkedin.com).
'oauth_api' => env('LINKEDIN_OAUTH_API', 'https://www.linkedin.com'),
// Scopes for LinkedIn authentication
'scopes' => array_values(array_filter(array_map('trim', explode(',', (string) env('LINKEDIN_SCOPES', 'openid,profile,email,w_member_social'))))),
],
'linkedin-page' => [
'enabled' => env('LINKEDIN_PAGE_ENABLED', true),
'api' => env('LINKEDIN_PAGE_API', 'https://api.linkedin.com'),
// Scopes for LinkedIn Page authentication
'scopes' => array_values(array_filter(array_map('trim', explode(',', (string) env('LINKEDIN_PAGE_SCOPES', 'openid,profile,email,w_organization_social,r_organization_social,rw_organization_admin,w_member_social'))))),
],
'x' => [
'enabled' => env('X_ENABLED', true),

View file

@ -89,7 +89,9 @@ R2_URL=
LINKEDIN_CLIENT_ID=
LINKEDIN_CLIENT_SECRET=
LINKEDIN_CLIENT_REDIRECT="${APP_URL}/accounts/linkedin/callback"
# LINKEDIN_SCOPES="openid,profile,email,w_member_social"
LINKEDIN_PAGE_CLIENT_REDIRECT="${APP_URL}/accounts/linkedin-page/callback"
# LINKEDIN_PAGE_SCOPES="openid,profile,email,w_organization_social,r_organization_social,rw_organization_admin,w_member_social"
X_CLIENT_ID=
X_CLIENT_SECRET=

View file

@ -61,7 +61,7 @@
],
'posting_to' => 'Posting to',
'privacy_level' => 'Who can see this video?',
'privacy_placeholder' => 'Select visibility',
'privacy_placeholder' => 'Select who can view this post',
'privacy' => [
'public' => 'Public to everyone',
'friends' => 'Mutual follow friends',
@ -87,7 +87,7 @@
'compliance_incomplete' => 'You need to indicate if your content promotes yourself, a third party, or both.',
'privacy_required' => 'TikTok privacy level is required when publishing.',
'branded_cleared_private' => 'Privacy was cleared because Branded Content cannot be private.',
'interaction_disabled_by_creator' => 'Disabled by your TikTok account settings.',
'interaction_disabled_by_creator' => 'Turned off in your TikTok account settings',
'max_duration_exceeded' => 'Video is :duration s long but this account can only post videos up to :max s.',
'processing_hint' => 'After publishing, it may take a few minutes for the content to process and appear on your TikTok profile.',
'brand_organic' => 'Your brand',
@ -127,6 +127,13 @@
'reel' => 'Reel',
'story' => 'Story',
],
'aspect_label' => 'Aspect ratio',
'aspect' => [
'square' => 'Square (1:1)',
'portrait' => 'Portrait (4:5)',
'landscape' => 'Landscape (16:9)',
'original' => 'Original',
],
],
'linkedin' => [
'settings' => 'LinkedIn Settings',
@ -313,7 +320,7 @@
'tabs' => [
'preview' => 'Preview',
'schedule' => 'Schedule',
'channels' => 'Channels',
'comments' => 'Comments',
'comments_empty' => 'No comments yet.',
],

View file

@ -61,7 +61,7 @@
],
'posting_to' => 'Publicando en',
'privacy_level' => '¿Quién puede ver este video?',
'privacy_placeholder' => 'Selecciona la visibilidad',
'privacy_placeholder' => 'Selecciona quién puede ver esta publicación',
'privacy' => [
'public' => 'Público para todos',
'friends' => 'Amigos mutuos',
@ -87,7 +87,7 @@
'compliance_incomplete' => 'Debes indicar si tu contenido promociona a ti mismo, a un tercero o a ambos.',
'privacy_required' => 'La visibilidad de TikTok es obligatoria al publicar.',
'branded_cleared_private' => 'La visibilidad se borró porque el contenido de marca no puede ser privado.',
'interaction_disabled_by_creator' => 'Desactivado por la configuración de tu cuenta TikTok.',
'interaction_disabled_by_creator' => 'Desactivado en la configuración de tu cuenta TikTok',
'max_duration_exceeded' => 'El video dura :duration s pero esta cuenta solo permite videos de hasta :max s.',
'processing_hint' => 'Después de publicar, puede tardar unos minutos en procesarse y aparecer en tu perfil de TikTok.',
'brand_organic' => 'Tu marca',
@ -127,6 +127,13 @@
'reel' => 'Reel',
'story' => 'Historia',
],
'aspect_label' => 'Proporción',
'aspect' => [
'square' => 'Cuadrado (1:1)',
'portrait' => 'Vertical (4:5)',
'landscape' => 'Horizontal (16:9)',
'original' => 'Original',
],
],
'linkedin' => [
'settings' => 'Configuración de LinkedIn',
@ -313,7 +320,7 @@
'tabs' => [
'preview' => 'Vista previa',
'schedule' => 'Programación',
'channels' => 'Canales',
'comments' => 'Comentarios',
'comments_empty' => 'Todavía no hay comentarios.',
],

View file

@ -61,7 +61,7 @@
],
'posting_to' => 'Publicando em',
'privacy_level' => 'Quem pode ver este vídeo?',
'privacy_placeholder' => 'Selecione a visibilidade',
'privacy_placeholder' => 'Selecione quem pode ver este post',
'privacy' => [
'public' => 'Público para todos',
'friends' => 'Amigos em comum',
@ -87,7 +87,7 @@
'compliance_incomplete' => 'Você precisa indicar se o conteúdo promove você mesmo, terceiros ou ambos.',
'privacy_required' => 'A visibilidade do TikTok é obrigatória ao publicar.',
'branded_cleared_private' => 'A visibilidade foi limpa porque conteúdo de marca não pode ser privado.',
'interaction_disabled_by_creator' => 'Desativado pelas configurações da sua conta TikTok.',
'interaction_disabled_by_creator' => 'Desativado nas configurações da sua conta TikTok',
'max_duration_exceeded' => 'Vídeo tem :duration s mas esta conta só permite vídeos de até :max s.',
'processing_hint' => 'Após publicar, pode levar alguns minutos para o conteúdo ser processado e aparecer no seu perfil TikTok.',
'brand_organic' => 'Sua marca',
@ -127,6 +127,13 @@
'reel' => 'Reel',
'story' => 'Story',
],
'aspect_label' => 'Proporção',
'aspect' => [
'square' => 'Quadrado (1:1)',
'portrait' => 'Retrato (4:5)',
'landscape' => 'Paisagem (16:9)',
'original' => 'Original',
],
],
'linkedin' => [
'settings' => 'Configurações do LinkedIn',
@ -313,7 +320,7 @@
'tabs' => [
'preview' => 'Pré-visualização',
'schedule' => 'Agendamento',
'channels' => 'Canais',
'comments' => 'Comentários',
'comments_empty' => 'Nenhum comentário ainda.',
],

View file

@ -0,0 +1,6 @@
## What's Changed
* docs: add Star History section to README by @paulocastellano in https://github.com/trypostit/trypost/pull/63
* feat(docker): publish multi-arch image to GHCR + self-host compose by @paulocastellano in https://github.com/trypostit/trypost/pull/65
**Full Changelog**: https://github.com/trypostit/trypost/compare/v1.0.0...v1.0.1

25
releases/v1.0.1/email.md Normal file
View file

@ -0,0 +1,25 @@
---
subject: "Changelog: TryPost v1.0.1 — Self-host with the official Docker image"
---
# Changelog: TryPost v1.0.1 — Self-host with the official Docker image
By Paulo Castellano • Release v1.0.1
Hello! Welcome to this week's update. Here's what's new in TryPost.
## Self-host TryPost with one command
You can now run TryPost from an official Docker image. Every release builds one (Intel and ARM), so you pull it and go, no building from source. The compose setup brings up TryPost with its database and Redis alongside it, and your posts, drafts and uploads stay in volumes on your own machine.
Want it on a real domain? There's a built-in option that sorts out HTTPS for you, so you don't have to fight with certificates to get a secure install. And if you'd rather not keep uploads on the box, you can point storage at S3 or Cloudflare R2.
## New features
- An official Docker image you can pull and run (Intel + ARM).
- A one-command self-host stack with PostgreSQL and Redis included.
- Automatic HTTPS for your own domain.
- Media storage on S3 or Cloudflare R2.
Cheers,
Paulo Castellano from TryPost.it

View file

@ -1,7 +1,7 @@
import '../css/app.css';
import './echo';
import { createInertiaApp, router } from '@inertiajs/vue3';
import { configureEcho } from '@laravel/echo-vue';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { i18nVue } from 'laravel-vue-i18n';
import type { DefineComponent } from 'vue';
@ -12,10 +12,6 @@ import dayjs from './dayjs';
import { capturePageview, initializePostHog, syncPostHogContext } from './posthog';
import type { Auth } from './types';
configureEcho({
broadcaster: 'reverb',
});
const appName = import.meta.env.VITE_APP_NAME || 'TryPost.it';
createInertiaApp({

View file

@ -197,10 +197,10 @@ const getCreatorInfo = (account: SocialAccount): TikTokCreatorInfo | null =>
const getBoards = (account: SocialAccount): PinterestBoard[] =>
pinterestBoards.value[account.id] ?? [];
// Carousel-capable content types: instagram_carousel, linkedin_carousel,
// Carousel-capable content types: instagram_feed, linkedin_carousel,
// linkedin_page_carousel, pinterest_carousel, tiktok_photo.
const carouselCapableContentTypes = new Set([
ContentType.InstagramCarousel,
ContentType.InstagramFeed,
ContentType.LinkedInCarousel,
ContentType.LinkedInPageCarousel,
ContentType.PinterestCarousel,

View file

@ -42,8 +42,11 @@ const emit = defineEmits<{
cancel: [];
}>();
const CAROUSEL_FORMAT = 'instagram_carousel' as const;
type AiFormat = ContentTypeValue | typeof CAROUSEL_FORMAT;
// Selections
const selectedFormat = ref<ContentTypeValue | null>(null);
const selectedFormat = ref<AiFormat | null>(null);
const selectedAccountId = ref<string | null>(null);
const includeImages = ref(true);
const imageCount = ref(2);
@ -59,9 +62,9 @@ const httpStart = useHttp<{
date: string | null;
}>({ format: null, social_account_id: null, image_count: 0, prompt: '', date: null });
const AI_FORMATS: Array<{ value: ContentTypeValue; platforms: string[] }> = [
const AI_FORMATS: Array<{ value: AiFormat; platforms: string[] }> = [
{ value: ContentType.InstagramFeed, platforms: ['instagram', 'instagram-facebook'] },
{ value: ContentType.InstagramCarousel, platforms: ['instagram', 'instagram-facebook'] },
{ value: CAROUSEL_FORMAT, platforms: ['instagram', 'instagram-facebook'] },
{ value: ContentType.InstagramStory, platforms: ['instagram', 'instagram-facebook'] },
{ value: ContentType.LinkedInPost, platforms: ['linkedin'] },
{ value: ContentType.LinkedInPagePost, platforms: ['linkedin-page'] },
@ -95,7 +98,7 @@ const accountsForFormat = computed(() => {
return props.socialAccounts.filter((a) => format.platforms.includes(a.platform));
});
const isCarousel = computed(() => selectedFormat.value === ContentType.InstagramCarousel);
const isCarousel = computed(() => selectedFormat.value === CAROUSEL_FORMAT);
const requiresImage = computed(() =>
selectedFormat.value === ContentType.FacebookPost ||
selectedFormat.value === ContentType.PinterestPin ||
@ -140,11 +143,11 @@ watch(accountsForFormat, (accounts) => {
}
});
const selectFormat = (format: ContentTypeValue) => {
const selectFormat = (format: AiFormat) => {
selectedFormat.value = format;
// Sensible default per format. Picking a format always pre-selects an
// image option so the user sees a chip highlighted on arrival.
if (format === ContentType.InstagramCarousel) {
if (format === CAROUSEL_FORMAT) {
imageCount.value = 5;
} else if (format === ContentType.InstagramFeed) {
imageCount.value = 1;

View file

@ -5,6 +5,7 @@ import { computed, ref } from 'vue';
import { Avatar } from '@/components/ui/avatar';
import { getMediaValidationWarning } from '@/composables/useMedia';
import { getPlatformLogo } from '@/composables/usePlatformLogo';
import { ContentType } from '@/enums/content-type';
import type { MediaItem } from '@/types/media';
interface SocialAccount {
@ -19,6 +20,7 @@ interface Props {
socialAccount: SocialAccount | null;
contentType: string;
media: MediaItem[];
meta?: Record<string, any>;
disabled?: boolean;
previewOnly?: boolean;
}
@ -26,25 +28,42 @@ interface Props {
const props = withDefaults(defineProps<Props>(), {
disabled: false,
previewOnly: false,
meta: () => ({}),
});
const emit = defineEmits<{
'update:contentType': [value: string];
'update:meta': [meta: Record<string, any>];
}>();
const open = ref(false);
const variants = [
{ value: 'facebook_post', labelKey: 'posts.form.facebook.variant.post' },
{ value: 'facebook_reel', labelKey: 'posts.form.facebook.variant.reel' },
{ value: 'facebook_story', labelKey: 'posts.form.facebook.variant.story' },
{ value: ContentType.FacebookPost, labelKey: 'posts.form.facebook.variant.post' },
{ value: ContentType.FacebookReel, labelKey: 'posts.form.facebook.variant.reel' },
{ value: ContentType.FacebookStory, labelKey: 'posts.form.facebook.variant.story' },
];
const aspectRatios = [
{ value: '1:1', labelKey: 'posts.form.facebook.aspect.square' },
{ value: '4:5', labelKey: 'posts.form.facebook.aspect.portrait' },
{ value: '16:9', labelKey: 'posts.form.facebook.aspect.landscape' },
{ value: 'original', labelKey: 'posts.form.facebook.aspect.original' },
];
const isFeed = computed(() => props.contentType === ContentType.FacebookPost);
const selectedAspectRatio = computed(() => props.meta.aspect_ratio ?? 'original');
const pickVariant = (value: string) => {
if (props.disabled) return;
emit('update:contentType', value);
};
const pickAspectRatio = (value: string) => {
if (props.disabled) return;
emit('update:meta', { ...props.meta, aspect_ratio: value });
};
const warning = computed(() => getMediaValidationWarning(props.contentType, props.media));
</script>
@ -101,6 +120,25 @@ const warning = computed(() => getMediaValidationWarning(props.contentType, prop
</div>
</div>
<div v-if="isFeed" class="space-y-2">
<p class="text-[11px] font-black uppercase tracking-widest text-foreground/60">{{ $t('posts.form.facebook.aspect_label') }}</p>
<div class="flex flex-wrap gap-2">
<button
v-for="ratio in aspectRatios"
:key="ratio.value"
type="button"
class="cursor-pointer rounded-full border-2 px-3 py-1 text-xs font-bold uppercase tracking-widest transition-colors disabled:cursor-not-allowed disabled:opacity-50"
:class="selectedAspectRatio === ratio.value
? 'border-foreground bg-violet-100 text-foreground shadow-2xs'
: 'border-foreground/30 text-foreground/70 hover:border-foreground hover:text-foreground'"
:disabled="disabled"
@click="pickAspectRatio(ratio.value)"
>
{{ $t(ratio.labelKey) }}
</button>
</div>
</div>
<p
v-if="warning && !previewOnly"
class="flex items-start gap-2 rounded-lg border-2 border-foreground bg-rose-50 p-2 text-xs font-semibold text-rose-700"

View file

@ -93,7 +93,7 @@ defineExpose({
<Tabs v-model="activeTab" class="h-full flex flex-col">
<TabsList class="mx-4 mt-4 w-fit shrink-0 self-start">
<TabsTrigger value="preview">{{ $t('posts.edit.tabs.preview') }}</TabsTrigger>
<TabsTrigger value="schedule">{{ $t('posts.edit.tabs.schedule') }}</TabsTrigger>
<TabsTrigger value="schedule">{{ $t('posts.edit.tabs.channels') }}</TabsTrigger>
<TabsTrigger value="comments">{{ $t('posts.edit.tabs.comments') }}</TabsTrigger>
</TabsList>
@ -107,7 +107,7 @@ defineExpose({
/>
</TabsContent>
<TabsContent value="schedule" class="flex-1 overflow-y-auto p-4">
<TabsContent value="schedule" force-mount :class="['flex-1 overflow-y-auto p-4', { hidden: activeTab !== 'schedule' }]">
<ScheduleTab
:post-platforms="post.post_platforms"
:selected-platform-ids="selectedPlatformIds"

View file

@ -94,7 +94,7 @@ const activeContentType = computed((): string | undefined => {
</div>
</div>
<div class="flex flex-1 items-start justify-center bg-foreground/5 px-4 pb-8 pt-6">
<div class="flex flex-1 items-start justify-center px-4 pb-8 pt-6">
<PhoneMockup v-if="activePlatform">
<PlatformPreview
:platform="activePlatform.platform"

View file

@ -315,8 +315,10 @@ const contentTypeErrorFor = (pp: PostPlatform): string | undefined => {
:social-account="pp.social_account"
:content-type="platformContentTypes[pp.id] ?? ''"
:media="media ?? []"
:meta="platformMeta[pp.id] ?? {}"
:disabled="isReadOnly"
@update:content-type="emit('update:platformContentType', pp.id, $event)"
@update:meta="emit('update:platformMeta', pp.id, $event)"
/>
</div>

View file

@ -399,6 +399,11 @@ watch(
{{ $t('posts.form.tiktok.compliance.music_usage') }}
</a>
</p>
<!-- Post-publish notice required by TikTok Content Sharing Guidelines -->
<p class="mt-3 text-xs text-muted-foreground">
{{ $t('posts.form.tiktok.processing_hint') }}
</p>
</div>
</div>
</template>

View file

@ -18,6 +18,7 @@ interface Props {
content: string;
media: MediaItem[];
contentType?: string;
meta?: Record<string, any>;
charCount?: number;
maxLength?: number;
isValid?: boolean;
@ -31,6 +32,21 @@ const isReel = computed(() => props.contentType === 'facebook_reel');
const isStory = computed(() => props.contentType === 'facebook_story');
const isFeed = computed(() => !isReel.value && !isStory.value);
// Padding-bottom percentage = height/width. Reflects the user's chosen crop in
// the feed preview. `null` (original / unset) keeps the natural fill layout.
const ASPECT_PADDING: Record<string, number> = {
'1:1': 100,
'4:5': 125,
'16:9': 56.25,
};
const feedAspectPadding = computed<number | null>(() => ASPECT_PADDING[props.meta?.aspect_ratio ?? ''] ?? null);
const feedMediaProps = {
placeholderIcon: IconPhoto,
dotActiveClass: 'bg-[#1877f2]',
placeholderClass: 'w-full h-full flex items-center justify-center bg-[#f0f2f5] dark:bg-[#3a3b3c]',
};
// Format numbers like Facebook
const formatNumber = (num: number): string => {
if (num >= 1000000) {
@ -122,14 +138,18 @@ const displayName = computed(() => props.socialAccount.display_name || props.soc
</p>
</div>
<!-- Post Media -->
<div class="flex-1 relative bg-black min-h-0">
<PostMediaPreview
:media="media"
:placeholder-icon="IconPhoto"
dot-active-class="bg-[#1877f2]"
placeholder-class="w-full h-full flex items-center justify-center bg-[#f0f2f5] dark:bg-[#3a3b3c]"
/>
<!-- Post Media - Aspect ratio matches user's chosen crop -->
<div
v-if="feedAspectPadding !== null"
class="relative w-full shrink-0 bg-black"
:style="{ paddingBottom: `${feedAspectPadding}%` }"
>
<div class="absolute inset-0">
<PostMediaPreview :media="media" v-bind="feedMediaProps" />
</div>
</div>
<div v-else class="flex-1 relative bg-black min-h-0">
<PostMediaPreview :media="media" v-bind="feedMediaProps" />
</div>
<!-- Reactions Bar -->

11
resources/js/echo.ts Normal file
View file

@ -0,0 +1,11 @@
import { configureEcho } from '@laravel/echo-vue';
configureEcho({
broadcaster: 'reverb',
key: import.meta.env.VITE_REVERB_APP_KEY,
wsHost: import.meta.env.VITE_REVERB_HOST,
wsPort: import.meta.env.VITE_REVERB_PORT ?? 80,
wssPort: import.meta.env.VITE_REVERB_PORT ?? 443,
forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
enabledTransports: ['ws', 'wss'],
});

View file

@ -18,7 +18,6 @@ import { PostStatus } from '@/types/post';
interface PostPlatform {
id: string;
platform: string;
content: string;
status: string;
social_account: {
id: string;
@ -31,6 +30,7 @@ interface PostPlatform {
interface Post {
id: string;
status: string;
content: string | null;
scheduled_at: string;
post_platforms: PostPlatform[];
}
@ -297,7 +297,7 @@ const formatTime = (scheduledAt: string): string => {
<div v-if="dayPosts.length > 0" class="space-y-3">
<Link v-for="post in dayPosts" :key="post.id" :href="getPostUrl(post)" class="block">
<div
class="rounded-xl border-2 border-foreground p-4 shadow-2xs transition-all hover:-translate-y-0.5 hover:shadow-md"
class="rounded-xl border-2 border-foreground p-4 shadow-2xs transition-all hover:shadow-md"
:class="getStatusColor(post.status)"
>
<div class="flex items-start justify-between gap-3">
@ -334,7 +334,7 @@ const formatTime = (scheduledAt: string): string => {
<!-- Content Preview -->
<p class="line-clamp-2 text-sm font-medium text-foreground/80">
{{ post.post_platforms[0]?.content || $t('calendar.no_content') }}
{{ post.content?.trim() || $t('calendar.no_content') }}
</p>
</div>
</div>
@ -383,7 +383,7 @@ const formatTime = (scheduledAt: string): string => {
<!-- Posts -->
<Link v-for="post in getPostsForDay(day)" :key="post.id" :href="getPostUrl(post)" class="block">
<div
class="rounded-lg border-2 border-foreground p-2 text-sm shadow-2xs transition-all hover:-translate-y-0.5 hover:shadow-sm"
class="rounded-lg border-2 border-foreground p-2 text-sm shadow-2xs transition-all hover:shadow-sm"
:class="getStatusColor(post.status)"
>
<!-- Time -->
@ -418,7 +418,7 @@ const formatTime = (scheduledAt: string): string => {
<!-- Content Preview -->
<p class="line-clamp-2 text-xs font-medium text-foreground/80">
{{ post.post_platforms[0]?.content || $t('calendar.no_content') }}
{{ post.content?.trim() || $t('calendar.no_content') }}
</p>
</div>
</Link>
@ -479,12 +479,13 @@ const formatTime = (scheduledAt: string): string => {
</div>
<!-- Posts -->
<div class="min-h-0 flex-1 space-y-1 overflow-y-auto">
<div class="min-h-0 flex-1 space-y-1 overflow-y-auto px-1">
<Link v-for="post in getPostsForDay(day).slice(0, 3)" :key="post.id" :href="getPostUrl(post)" class="block">
<div
class="flex items-center justify-between gap-1.5 rounded-md border-2 border-foreground px-2 py-1 text-xs shadow-2xs transition-all hover:-translate-y-0.5 hover:shadow-sm"
class="flex flex-col gap-1 rounded-md border-2 border-foreground px-2 py-1 text-xs shadow-2xs transition-all hover:shadow-sm"
:class="getStatusColor(post.status)"
>
<div class="flex items-center justify-between gap-1.5">
<span class="shrink-0 font-bold">{{ formatTime(post.scheduled_at) }}</span>
<div class="flex shrink-0 -space-x-1">
<TooltipProvider
@ -513,6 +514,10 @@ const formatTime = (scheduledAt: string): string => {
+{{ post.post_platforms.length - 3 }}
</span>
</div>
</div>
<p class="line-clamp-1 font-medium text-foreground/80">
{{ post.content?.trim() || $t('calendar.no_content') }}
</p>
</div>
</Link>
<div

View file

@ -10,7 +10,7 @@ import AiRegenerateImageDialog from '@/components/posts/ai/AiRegenerateImageDial
import AiReviewDialog from '@/components/posts/ai/AiReviewDialog.vue';
import PostEditorComposer from '@/components/posts/editor/PostEditorComposer.vue';
import PostEditorHeader from '@/components/posts/editor/PostEditorHeader.vue';
import PostEditorSidebar from '@/components/posts/editor/PostEditorSidebar.vue';
import PostEditorTabs from '@/components/posts/editor/PostEditorTabs.vue';
import { usePostEcho } from '@/composables/echo/usePostEcho';
import {
firstCompatibleVariant,
@ -206,7 +206,7 @@ const initialTabFromQuery = (() => {
const initialHighlightCommentId = queryParams?.get('comment') ?? null;
const activeTab = ref(initialTabFromQuery);
const deleteModal = ref<InstanceType<typeof ConfirmDeleteModal> | null>(null);
const editorSidebarRef = ref<InstanceType<typeof PostEditorSidebar> | null>(null);
const editorTabsRef = ref<InstanceType<typeof PostEditorTabs> | null>(null);
const snapToCompatibleVariant = (platformId: string) => {
const pp = post.value.post_platforms.find((p) => p.id === platformId);
@ -339,9 +339,9 @@ usePostEcho(post.value.id, '.post.platform.status.updated', () => {
// Echo: listen for real-time comments
usePostEcho(post.value.id, '.post.comment.created', (e: any) => {
if (e.mentioned_users) {
editorSidebarRef.value?.registerMentionedUsers(e.mentioned_users);
editorTabsRef.value?.registerMentionedUsers(e.mentioned_users);
}
editorSidebarRef.value?.addCommentFromBroadcast(e.comment);
editorTabsRef.value?.addCommentFromBroadcast(e.comment);
});
</script>
@ -402,8 +402,8 @@ usePostEcho(post.value.id, '.post.comment.created', (e: any) => {
</div>
<div class="hidden lg:block lg:w-1/3 overflow-hidden">
<PostEditorSidebar
ref="editorSidebarRef"
<PostEditorTabs
ref="editorTabsRef"
v-model:active-tab="activeTab"
:post="post"
:workspace-id="workspace.id"

View file

@ -1,6 +1,5 @@
export const ContentType = {
InstagramFeed: 'instagram_feed',
InstagramCarousel: 'instagram_carousel',
InstagramStory: 'instagram_story',
InstagramReel: 'instagram_reel',
LinkedInPost: 'linkedin_post',

View file

@ -50,6 +50,26 @@
->assertJsonValidationErrors(['format']);
});
test('start accepts instagram_carousel as a generation format', function () {
Bus::fake();
$account = SocialAccount::factory()->create([
'workspace_id' => $this->workspace->id,
'platform' => Platform::Instagram,
]);
$this->actingAs($this->user)
->postJson(route('app.posts.ai.create'), [
'prompt' => 'Five tips about productivity',
'format' => 'instagram_carousel',
'social_account_id' => $account->id,
'image_count' => 5,
])
->assertStatus(Response::HTTP_ACCEPTED);
Bus::assertDispatched(StreamPostCreation::class, fn ($job) => $job->format === 'instagram_carousel');
});
test('start rejects social_account_id from another workspace', function () {
Bus::fake();

View file

@ -0,0 +1,91 @@
<?php
declare(strict_types=1);
use App\Ai\Agents\PostContentGenerator;
use App\Ai\Agents\PostContentHumanizer;
use App\Enums\PostPlatform\ContentType;
use App\Enums\UserWorkspace\Role;
use App\Jobs\Ai\StreamPostCreation;
use App\Models\PostPlatform;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Laravel\Ai\Image;
beforeEach(function () {
Bus::fake();
Storage::fake();
Image::fake();
$this->user = User::factory()->create();
$this->workspace = Workspace::factory()->create(['user_id' => $this->user->id]);
$this->workspace->members()->attach($this->user->id, ['role' => Role::Member->value]);
$this->user->update(['current_workspace_id' => $this->workspace->id]);
$this->account = SocialAccount::factory()->instagram()->create([
'workspace_id' => $this->workspace->id,
]);
});
function runStreamPostCreation(string $format, SocialAccount $account, int $imageCount): void
{
(new StreamPostCreation(
userId: $account->workspace->user_id,
creationId: (string) Str::uuid(),
workspaceId: $account->workspace_id,
format: $format,
socialAccountId: $account->id,
imageCount: $imageCount,
prompt: 'Five tips about productivity',
))->handle();
}
test('AI carousel generation stores the post as an instagram feed, never instagram_carousel', function () {
// Empty image_keywords make TemplateImageGenerator::render() return null, so
// the storage decision is exercised without touching the image pipeline.
PostContentGenerator::fake([[
'caption' => 'Swipe to see the tips',
'slides' => [
['title' => 'Tip 1', 'body' => 'First tip', 'image_keywords' => []],
['title' => 'Tip 2', 'body' => 'Second tip', 'image_keywords' => []],
],
]]);
PostContentHumanizer::fake([[
'caption' => 'Swipe to see the tips',
'slides' => [
['title' => 'Tip 1', 'body' => 'First tip'],
['title' => 'Tip 2', 'body' => 'Second tip'],
],
]]);
runStreamPostCreation('instagram_carousel', $this->account, 2);
$platform = PostPlatform::where('social_account_id', $this->account->id)->firstOrFail();
expect($platform->content_type)->toBe(ContentType::InstagramFeed);
expect($platform->meta['aspect_ratio'] ?? null)->toBe('4:5');
});
test('AI single feed generation stores the post as an instagram feed', function () {
PostContentGenerator::fake([[
'content' => 'A single productivity tip',
'image_title' => 'Tip',
'image_body' => 'Do less',
'image_keywords' => [],
]]);
PostContentHumanizer::fake([[
'content' => 'A single productivity tip',
'image_title' => 'Tip',
'image_body' => 'Do less',
]]);
runStreamPostCreation('instagram_feed', $this->account, 0);
$platform = PostPlatform::where('social_account_id', $this->account->id)->firstOrFail();
expect($platform->content_type)->toBe(ContentType::InstagramFeed);
});

View file

@ -167,6 +167,39 @@
->assertOk();
});
it('rejects creating a post with instagram_carousel — carousel is not a stored content_type', function () {
$this->withHeaders(['Authorization' => 'Bearer '.$this->plainToken])
->postJson(route('api.posts.store'), [
'platforms' => [
['social_account_id' => $this->socialAccount->id, 'content_type' => 'instagram_carousel'],
],
])
->assertJsonValidationErrors(['platforms.0.content_type']);
});
it('rejects updating a post with instagram_carousel — carousel is not a stored content_type', function () {
$post = Post::factory()->create([
'workspace_id' => $this->workspace->id,
'user_id' => $this->user->id,
'status' => PostStatus::Draft,
]);
$postPlatform = PostPlatform::factory()->linkedin()->create([
'post_id' => $post->id,
'social_account_id' => $this->socialAccount->id,
'enabled' => true,
]);
$this->withHeaders(['Authorization' => 'Bearer '.$this->plainToken])
->putJson(route('api.posts.update', $post), [
'status' => 'draft',
'platforms' => [
['id' => $postPlatform->id, 'content_type' => 'instagram_carousel'],
],
])
->assertJsonValidationErrors(['platforms.0.content_type']);
});
it('cannot update post from another workspace', function () {
$otherWorkspace = Workspace::factory()->create();
$otherSocialAccount = SocialAccount::factory()->create([
@ -544,3 +577,89 @@
->assertOk()
->assertJsonStructure(['id', 'status', 'scheduled_at', 'published_at']);
});
it('creates a post with platform meta (aspect_ratio) and returns it', function () {
$this->withHeaders(['Authorization' => 'Bearer '.$this->plainToken])
->postJson(route('api.posts.store'), [
'platforms' => [
['social_account_id' => $this->socialAccount->id, 'content_type' => 'linkedin_post', 'meta' => ['aspect_ratio' => '4:5']],
],
])
->assertCreated()
->assertJsonPath('platforms.0.meta.aspect_ratio', '4:5');
$platform = Post::where('workspace_id', $this->workspace->id)->first()
->postPlatforms()->where('social_account_id', $this->socialAccount->id)->first();
expect($platform->meta['aspect_ratio'])->toBe('4:5');
});
it('rejects creating a post with an invalid aspect_ratio', function () {
$this->withHeaders(['Authorization' => 'Bearer '.$this->plainToken])
->postJson(route('api.posts.store'), [
'platforms' => [
['social_account_id' => $this->socialAccount->id, 'content_type' => 'linkedin_post', 'meta' => ['aspect_ratio' => '3:2']],
],
])
->assertJsonValidationErrors(['platforms.0.meta.aspect_ratio']);
});
it('rejects updating a post with an invalid aspect_ratio', function () {
$post = Post::factory()->create([
'workspace_id' => $this->workspace->id,
'user_id' => $this->user->id,
'status' => PostStatus::Draft,
]);
$postPlatform = PostPlatform::factory()->linkedin()->create([
'post_id' => $post->id,
'social_account_id' => $this->socialAccount->id,
'enabled' => true,
]);
$this->withHeaders(['Authorization' => 'Bearer '.$this->plainToken])
->putJson(route('api.posts.update', $post), [
'status' => 'draft',
'platforms' => [
['id' => $postPlatform->id, 'content_type' => 'linkedin_post', 'meta' => ['aspect_ratio' => '3:2']],
],
])
->assertJsonValidationErrors(['platforms.0.meta.aspect_ratio']);
});
it('accepts a valid aspect_ratio on update and persists it', function () {
$post = Post::factory()->create([
'workspace_id' => $this->workspace->id,
'user_id' => $this->user->id,
'status' => PostStatus::Draft,
]);
$postPlatform = PostPlatform::factory()->linkedin()->create([
'post_id' => $post->id,
'social_account_id' => $this->socialAccount->id,
'enabled' => true,
]);
$this->withHeaders(['Authorization' => 'Bearer '.$this->plainToken])
->putJson(route('api.posts.update', $post), [
'status' => 'draft',
'platforms' => [
['id' => $postPlatform->id, 'content_type' => 'linkedin_post', 'meta' => ['aspect_ratio' => '16:9']],
],
])
->assertOk()
->assertJsonPath('platforms.0.meta.aspect_ratio', '16:9');
expect($postPlatform->fresh()->meta['aspect_ratio'])->toBe('16:9');
});
it('accepts the original aspect_ratio (no crop) on create', function () {
$this->withHeaders(['Authorization' => 'Bearer '.$this->plainToken])
->postJson(route('api.posts.store'), [
'platforms' => [
['social_account_id' => $this->socialAccount->id, 'content_type' => 'linkedin_post', 'meta' => ['aspect_ratio' => 'original']],
],
])
->assertCreated();
$platform = Post::where('workspace_id', $this->workspace->id)->first()
->postPlatforms()->where('social_account_id', $this->socialAccount->id)->first();
expect($platform->meta['aspect_ratio'])->toBe('original');
});

View file

@ -4,6 +4,7 @@
use App\Ai\Agents\PostContentGenerator;
use App\Ai\Agents\PostContentHumanizer;
use App\Enums\Post\Status as PostStatus;
use App\Enums\PostPlatform\ContentType;
use App\Models\AutomationRun;
use App\Models\Post;
use App\Models\SocialAccount;
@ -92,7 +93,7 @@
$action = app(RunGenerateNode::class);
$accountsConfig = [
['social_account_id' => (string) $account->id, 'content_type' => 'instagram_carousel', 'meta' => []],
['social_account_id' => (string) $account->id, 'content_type' => ContentType::InstagramFeed->value, 'meta' => []],
];
['format' => $format, 'slide_count' => $slideCount] = $action->deriveFormat($accountsConfig, ['target_slide_count' => 5]);
@ -108,7 +109,7 @@
$action = app(RunGenerateNode::class);
$accountsConfig = [
['social_account_id' => (string) $account->id, 'content_type' => 'instagram_carousel', 'meta' => []],
['social_account_id' => (string) $account->id, 'content_type' => ContentType::InstagramFeed->value, 'meta' => []],
];
['format' => $format, 'slide_count' => $slideCount] = $action->deriveFormat($accountsConfig, ['target_slide_count' => 1]);
@ -121,8 +122,8 @@
$action = app(RunGenerateNode::class);
$accountsConfig = [
['social_account_id' => '1', 'content_type' => 'x_post', 'meta' => []],
['social_account_id' => '2', 'content_type' => 'instagram_feed', 'meta' => []],
['social_account_id' => '1', 'content_type' => ContentType::XPost->value, 'meta' => []],
['social_account_id' => '2', 'content_type' => ContentType::InstagramReel->value, 'meta' => []],
];
['format' => $format, 'slide_count' => $slideCount] = $action->deriveFormat($accountsConfig, ['target_slide_count' => 5]);

View file

@ -9,7 +9,9 @@
use App\Mcp\Tools\Post\DeletePostTool;
use App\Mcp\Tools\Post\GetPostTool;
use App\Mcp\Tools\Post\ListPostsTool;
use App\Mcp\Tools\Post\UpdatePostTool;
use App\Models\Post;
use App\Models\PostPlatform;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
@ -177,6 +179,38 @@
$response->assertHasErrors();
});
test('create post rejects instagram_carousel — carousel is not a stored content_type', function () {
$response = TryPostServer::actingAs($this->user)
->tool(CreatePostTool::class, [
'platforms' => [
['social_account_id' => $this->socialAccount->id, 'content_type' => 'instagram_carousel'],
],
]);
$response->assertHasErrors();
});
test('update post rejects instagram_carousel — carousel is not a stored content_type', function () {
$post = Post::factory()->create([
'workspace_id' => $this->workspace->id,
'user_id' => $this->user->id,
]);
$platform = PostPlatform::factory()->create([
'post_id' => $post->id,
'social_account_id' => $this->socialAccount->id,
]);
$response = TryPostServer::actingAs($this->user)
->tool(UpdatePostTool::class, [
'post_id' => $post->id,
'platforms' => [
['id' => $platform->id, 'content_type' => 'instagram_carousel'],
],
]);
$response->assertHasErrors();
});
test('create post rejects a content_type that does not match the social account platform', function () {
// x_post on a LinkedIn account — ContentTypeMatchesPlatform should reject.
$response = TryPostServer::actingAs($this->user)
@ -242,3 +276,83 @@
$response->assertHasErrors();
});
test('create post persists platform meta (aspect_ratio)', function () {
$response = TryPostServer::actingAs($this->user)
->tool(CreatePostTool::class, [
'platforms' => [
['social_account_id' => $this->socialAccount->id, 'content_type' => 'linkedin_post', 'meta' => ['aspect_ratio' => '4:5']],
],
]);
$response->assertOk();
$platform = Post::where('workspace_id', $this->workspace->id)->first()
->postPlatforms()->where('social_account_id', $this->socialAccount->id)->first();
expect($platform->meta['aspect_ratio'])->toBe('4:5');
});
test('create post rejects an invalid aspect_ratio', function () {
$response = TryPostServer::actingAs($this->user)
->tool(CreatePostTool::class, [
'platforms' => [
['social_account_id' => $this->socialAccount->id, 'content_type' => 'linkedin_post', 'meta' => ['aspect_ratio' => '3:2']],
],
]);
$response->assertHasErrors();
});
test('update post rejects an invalid aspect_ratio', function () {
$post = Post::factory()->create([
'workspace_id' => $this->workspace->id,
'user_id' => $this->user->id,
]);
$platform = PostPlatform::factory()->create([
'post_id' => $post->id,
'social_account_id' => $this->socialAccount->id,
]);
$response = TryPostServer::actingAs($this->user)
->tool(UpdatePostTool::class, [
'post_id' => $post->id,
'platforms' => [
['id' => $platform->id, 'meta' => ['aspect_ratio' => '3:2']],
],
]);
$response->assertHasErrors();
});
test('create post returns the platform meta in the response (read-back)', function () {
TryPostServer::actingAs($this->user)
->tool(CreatePostTool::class, [
'platforms' => [
['social_account_id' => $this->socialAccount->id, 'content_type' => 'linkedin_post', 'meta' => ['aspect_ratio' => '4:5']],
],
])
->assertOk()
->assertStructuredContent(fn (AssertableJson $json) => $json->where('platforms.0.meta.aspect_ratio', '4:5')->etc());
});
test('update post accepts a valid aspect_ratio and persists it', function () {
$post = Post::factory()->create([
'workspace_id' => $this->workspace->id,
'user_id' => $this->user->id,
]);
$platform = PostPlatform::factory()->create([
'post_id' => $post->id,
'social_account_id' => $this->socialAccount->id,
]);
TryPostServer::actingAs($this->user)
->tool(UpdatePostTool::class, [
'post_id' => $post->id,
'platforms' => [
['id' => $platform->id, 'meta' => ['aspect_ratio' => '16:9']],
],
])
->assertOk();
expect($platform->fresh()->meta['aspect_ratio'])->toBe('16:9');
});

View file

@ -176,6 +176,27 @@
);
});
test('calendar payload exposes post content for rendering', function () {
$scheduledAt = now('UTC')->startOfWeek()->addDays(2)->setTime(12, 0);
Post::factory()->create([
'workspace_id' => $this->workspace->id,
'user_id' => $this->user->id,
'content' => 'Caption visible in the calendar',
'status' => PostStatus::Scheduled,
'scheduled_at' => $scheduledAt,
]);
$dateKey = $scheduledAt->format('Y-m-d');
$response = $this->actingAs($this->user)->get(route('app.calendar'));
$response->assertOk();
$response->assertInertia(fn ($page) => $page
->where("posts.{$dateKey}.0.content", 'Caption visible in the calendar')
);
});
// Create tests
test('create requires authentication', function () {
$response = $this->get(route('app.posts.create'));

View file

@ -13,6 +13,17 @@
use App\Models\Workspace;
use App\Services\Social\FacebookPublisher;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Storage;
use Intervention\Image\Drivers\Gd\Driver;
use Intervention\Image\ImageManager;
function facebookJpegBytes(int $width = 1200, int $height = 800): string
{
$manager = new ImageManager(Driver::class);
$image = $manager->createImage($width, $height)->fill('888888');
return (string) $image->encodeUsingMediaType('image/jpeg', quality: 80);
}
beforeEach(function () {
$this->user = User::factory()->create();
@ -636,3 +647,163 @@
&& ! array_key_exists('description', $data);
});
});
test('facebook single image post applies the selected aspect ratio crop and uploads the crop', function (string $ratio, float $expected) {
Storage::fake();
$this->postPlatform->update(['meta' => ['aspect_ratio' => $ratio]]);
$this->post->update([
'media' => [
['id' => 'm1', 'path' => 'media/a.jpg', 'url' => 'https://example.com/media/a.jpg', 'mime_type' => 'image/jpeg', 'original_filename' => 'a.jpg'],
],
]);
Http::fake([
'https://example.com/media/a.jpg' => Http::response(facebookJpegBytes(1600, 900), 200),
'*/page_123/photos' => Http::response(['id' => 'photo_1', 'post_id' => 'post_1'], 200),
]);
$this->publisher->publish($this->postPlatform);
$crops = collect(Storage::allFiles())->filter(fn (string $path) => str_starts_with($path, 'social-crops/'));
expect($crops)->toHaveCount(1);
$manager = new ImageManager(Driver::class);
$tempFile = tempnam(sys_get_temp_dir(), 'verify_');
file_put_contents($tempFile, Storage::get($crops->first()));
$image = $manager->decodePath($tempFile);
expect(round($image->width() / $image->height(), 2))->toBe(round($expected, 2));
@unlink($tempFile);
Http::assertSent(fn ($request) => str_contains($request->url(), '/page_123/photos')
&& str_contains($request['url'], 'social-crops/')
&& ! str_contains($request['url'], 'example.com'));
})->with([
'1:1' => ['1:1', 1.0],
'4:5' => ['4:5', 4 / 5],
'16:9' => ['16:9', 16 / 9],
]);
test('facebook multi image post applies the chosen aspect ratio crop to every image', function (string $aspectRatio, float $expected) {
Storage::fake();
$this->postPlatform->update(['meta' => ['aspect_ratio' => $aspectRatio]]);
$this->post->update([
'media' => [
['id' => 'm1', 'path' => 'media/a.jpg', 'url' => 'https://example.com/media/a.jpg', 'mime_type' => 'image/jpeg', 'original_filename' => 'a.jpg'],
['id' => 'm2', 'path' => 'media/b.jpg', 'url' => 'https://example.com/media/b.jpg', 'mime_type' => 'image/jpeg', 'original_filename' => 'b.jpg'],
],
]);
Http::fake([
'https://example.com/media/a.jpg' => Http::response(facebookJpegBytes(1600, 900), 200),
'https://example.com/media/b.jpg' => Http::response(facebookJpegBytes(900, 1600), 200),
'*/page_123/photos' => Http::sequence()
->push(['id' => 'up_1'], 200)
->push(['id' => 'up_2'], 200),
'*/page_123/feed' => Http::response(['id' => 'post_1'], 200),
]);
$this->publisher->publish($this->postPlatform);
$crops = collect(Storage::allFiles())->filter(fn (string $path) => str_starts_with($path, 'social-crops/'));
expect($crops)->toHaveCount(2);
$manager = new ImageManager(Driver::class);
foreach ($crops as $cropPath) {
$tempFile = tempnam(sys_get_temp_dir(), 'verify_');
file_put_contents($tempFile, Storage::get($cropPath));
$image = $manager->decodePath($tempFile);
expect(abs($image->width() / $image->height() - $expected))->toBeLessThan(0.01);
@unlink($tempFile);
}
Http::assertSent(fn ($request) => str_contains($request->url(), '/page_123/photos')
&& str_contains($request['url'] ?? '', 'social-crops/'));
})->with([
'1:1' => ['1:1', 1.0],
'4:5' => ['4:5', 4 / 5],
]);
test('facebook multi image post aborts entirely when one image cannot be downloaded for cropping', function () {
Storage::fake();
$this->postPlatform->update(['meta' => ['aspect_ratio' => '4:5']]);
$this->post->update([
'media' => [
['id' => 'm1', 'path' => 'media/a.jpg', 'url' => 'https://example.com/media/a.jpg', 'mime_type' => 'image/jpeg', 'original_filename' => 'a.jpg'],
['id' => 'm2', 'path' => 'media/b.jpg', 'url' => 'https://example.com/media/b.jpg', 'mime_type' => 'image/jpeg', 'original_filename' => 'b.jpg'],
],
]);
Http::fake([
'https://example.com/media/a.jpg' => Http::response('', 404),
'https://example.com/media/b.jpg' => Http::response(facebookJpegBytes(900, 1600), 200),
'*/page_123/photos' => Http::response(['id' => 'up'], 200),
'*/page_123/feed' => Http::response(['id' => 'post_1'], 200),
]);
expect(fn () => $this->publisher->publish($this->postPlatform))
->toThrow(FacebookPublishException::class, 'Failed to download image for cropping');
});
test('facebook image post throws when the source image cannot be downloaded for cropping', function () {
Storage::fake();
$this->postPlatform->update(['meta' => ['aspect_ratio' => '4:5']]);
$this->post->update([
'media' => [
['id' => 'm1', 'path' => 'media/a.jpg', 'url' => 'https://example.com/media/a.jpg', 'mime_type' => 'image/jpeg', 'original_filename' => 'a.jpg'],
],
]);
Http::fake([
'https://example.com/media/a.jpg' => Http::response('', 404),
]);
expect(fn () => $this->publisher->publish($this->postPlatform))
->toThrow(FacebookPublishException::class, 'Failed to download image for cropping');
});
test('facebook single image post without aspect ratio uploads the original image (no crop)', function () {
Storage::fake();
$this->post->update([
'media' => [
['id' => 'm1', 'path' => 'media/a.jpg', 'url' => 'https://example.com/media/a.jpg', 'mime_type' => 'image/jpeg', 'original_filename' => 'a.jpg'],
],
]);
Http::fake([
'*/page_123/photos' => Http::response(['id' => 'photo_1', 'post_id' => 'post_1'], 200),
]);
$this->publisher->publish($this->postPlatform);
expect(collect(Storage::allFiles())->filter(fn (string $path) => str_starts_with($path, 'social-crops/')))->toBeEmpty();
Http::assertSent(fn ($request) => str_contains($request->url(), '/page_123/photos')
&& $request['url'] === 'https://example.com/media/a.jpg');
});
test('facebook single image post with original aspect ratio uploads the original image (no crop)', function () {
Storage::fake();
$this->postPlatform->update(['meta' => ['aspect_ratio' => 'original']]);
$this->post->update([
'media' => [
['id' => 'm1', 'path' => 'media/a.jpg', 'url' => 'https://example.com/media/a.jpg', 'mime_type' => 'image/jpeg', 'original_filename' => 'a.jpg'],
],
]);
Http::fake([
'*/page_123/photos' => Http::response(['id' => 'photo_1', 'post_id' => 'post_1'], 200),
]);
$this->publisher->publish($this->postPlatform);
expect(collect(Storage::allFiles())->filter(fn (string $path) => str_starts_with($path, 'social-crops/')))->toBeEmpty();
Http::assertSent(fn ($request) => str_contains($request->url(), '/page_123/photos')
&& $request['url'] === 'https://example.com/media/a.jpg');
});

View file

@ -4,6 +4,7 @@
use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
use App\Exceptions\Social\InstagramPublishException;
use App\Exceptions\TokenExpiredException;
use App\Models\Post;
use App\Models\PostPlatform;
@ -726,10 +727,10 @@ function fakeJpegBytes(int $width = 1200, int $height = 800): string
->toThrow(Exception::class);
});
test('feed image is cropped to chosen aspect ratio before publishing', function () {
test('feed image is cropped to chosen aspect ratio before publishing', function (string $aspectRatio, float $expected) {
Storage::fake();
$this->postPlatform->update(['meta' => ['aspect_ratio' => '4:5']]);
$this->postPlatform->update(['meta' => ['aspect_ratio' => $aspectRatio]]);
$this->post->update([
'media' => [
@ -753,15 +754,14 @@ function fakeJpegBytes(int $width = 1200, int $height = 800): string
$this->publisher->publish($this->postPlatform);
$cropped = collect(Storage::allFiles())->first(fn (string $path) => str_starts_with($path, 'instagram-crops/'));
$cropped = collect(Storage::allFiles())->first(fn (string $path) => str_starts_with($path, 'social-crops/'));
expect($cropped)->not->toBeNull();
$manager = new ImageManager(Driver::class);
$tempFile = tempnam(sys_get_temp_dir(), 'verify_');
file_put_contents($tempFile, Storage::get($cropped));
$image = $manager->decodePath($tempFile);
$ratio = $image->width() / $image->height();
expect(abs($ratio - 0.8))->toBeLessThan(0.01);
expect(abs($image->width() / $image->height() - $expected))->toBeLessThan(0.01);
@unlink($tempFile);
Http::assertSent(function ($request) {
@ -770,9 +770,31 @@ function fakeJpegBytes(int $width = 1200, int $height = 800): string
}
$imageUrl = $request['image_url'] ?? '';
return str_contains($imageUrl, 'instagram-crops/')
return str_contains($imageUrl, 'social-crops/')
&& ! str_contains($imageUrl, 'example.com/media/test.jpg');
});
})->with([
'1:1' => ['1:1', 1.0],
'4:5' => ['4:5', 4 / 5],
'16:9' => ['16:9', 16 / 9],
]);
test('feed image throws when the source image cannot be downloaded for cropping', function () {
Storage::fake();
$this->postPlatform->update(['meta' => ['aspect_ratio' => '4:5']]);
$this->post->update([
'media' => [
['id' => 'm1', 'path' => 'media/a.jpg', 'url' => 'https://example.com/media/a.jpg', 'mime_type' => 'image/jpeg', 'original_filename' => 'a.jpg'],
],
]);
Http::fake([
'https://example.com/media/a.jpg' => Http::response('', 404),
]);
expect(fn () => $this->publisher->publish($this->postPlatform))
->toThrow(InstagramPublishException::class, 'Failed to download image for cropping');
});
test('feed image with original aspect ratio bypasses crop', function () {
@ -847,10 +869,10 @@ function fakeJpegBytes(int $width = 1200, int $height = 800): string
});
});
test('carousel applies aspect ratio crop to every image', function () {
test('carousel applies the chosen aspect ratio crop to every image', function (string $aspectRatio, float $expected) {
Storage::fake();
$this->postPlatform->update(['meta' => ['aspect_ratio' => '1:1']]);
$this->postPlatform->update(['meta' => ['aspect_ratio' => $aspectRatio]]);
$this->post->update([
'media' => [
@ -875,7 +897,7 @@ function fakeJpegBytes(int $width = 1200, int $height = 800): string
$this->publisher->publish($this->postPlatform);
$crops = collect(Storage::allFiles())->filter(fn (string $path) => str_starts_with($path, 'instagram-crops/'));
$crops = collect(Storage::allFiles())->filter(fn (string $path) => str_starts_with($path, 'social-crops/'));
expect($crops)->toHaveCount(2);
$manager = new ImageManager(Driver::class);
@ -883,7 +905,10 @@ function fakeJpegBytes(int $width = 1200, int $height = 800): string
$tempFile = tempnam(sys_get_temp_dir(), 'verify_');
file_put_contents($tempFile, Storage::get($cropPath));
$image = $manager->decodePath($tempFile);
expect($image->width())->toBe($image->height());
expect(abs($image->width() / $image->height() - $expected))->toBeLessThan(0.01);
@unlink($tempFile);
}
});
})->with([
'1:1' => ['1:1', 1.0],
'4:5' => ['4:5', 4 / 5],
]);

View file

@ -605,9 +605,10 @@
$body = json_decode($request->body(), true);
$postInfo = data_get($body, 'post_info');
// privacy_level passes through; toggles use safe defaults (duet/stitch off, comments on).
// privacy_level passes through; all interaction toggles default to OFF to match
// the UI checkbox state (TikTok UX guideline: none should be checked by default).
return $postInfo['privacy_level'] === 'PUBLIC_TO_EVERYONE'
&& $postInfo['disable_comment'] === false
&& $postInfo['disable_comment'] === true
&& $postInfo['disable_duet'] === true
&& $postInfo['disable_stitch'] === true
&& ! isset($postInfo['is_aigc'])

View file

@ -39,6 +39,57 @@
expect(session('social_connect_workspace'))->toBe($this->workspace->id);
});
/**
* Mock the LinkedIn Socialite driver, hit /connect, and return the scopes
* the controller requested.
*
* @return array<int, string>
*/
$captureConnectScopes = function (object $test): array {
$captured = [];
$driverMock = Mockery::mock();
$driverMock->shouldReceive('scopes')
->withArgs(function (array $scopes) use (&$captured) {
$captured = $scopes;
return true;
})
->andReturnSelf();
$driverMock->shouldReceive('redirect')->andReturn(Mockery::mock([
'getTargetUrl' => 'https://www.linkedin.com/oauth/v2/authorization?test=1',
]));
Socialite::shouldReceive('driver')
->with('linkedin')
->andReturn($driverMock);
$test->actingAs($test->user)
->withHeader('X-Inertia', 'true')
->get(route('app.social.linkedin.connect'));
return $captured;
};
test('linkedin connect requests the default scope set', function () use ($captureConnectScopes) {
config(['trypost.platforms.linkedin.scopes' => ['openid', 'profile', 'email', 'w_member_social']]);
expect($captureConnectScopes($this))->toEqualCanonicalizing([
'openid', 'profile', 'email', 'w_member_social',
]);
});
test('linkedin connect requests the scopes configured via LINKEDIN_SCOPES', function () use ($captureConnectScopes) {
// Operators whose LinkedIn app has legacy/enterprise products approved
// override the default set via LINKEDIN_SCOPES (exploded into the config
// array), e.g. re-adding r_basicprofile to restore the vanityName lookup.
config(['trypost.platforms.linkedin.scopes' => ['openid', 'profile', 'email', 'w_member_social', 'r_basicprofile']]);
expect($captureConnectScopes($this))->toEqualCanonicalizing([
'openid', 'profile', 'email', 'w_member_social', 'r_basicprofile',
]);
});
test('linkedin oauth callback creates account', function () {
session([
'social_connect_workspace' => $this->workspace->id,
@ -99,7 +150,7 @@
// splits on space (the OAuth 2.0 default), so approvedScopes lands as
// a single-element array with the whole CSV inside. The save path
// must normalize back to individual tokens.
$socialiteUser->approvedScopes = ['email,openid,profile,r_basicprofile,w_member_social'];
$socialiteUser->approvedScopes = ['email,openid,profile,w_member_social'];
Socialite::shouldReceive('driver')
->with('linkedin')
@ -116,7 +167,7 @@
$account = SocialAccount::where('platform_user_id', 'abc123xyz')->first();
expect($account->scopes)->toEqualCanonicalizing([
'email', 'openid', 'profile', 'r_basicprofile', 'w_member_social',
'email', 'openid', 'profile', 'w_member_social',
]);
});

View file

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
test('tiktok english strings match the wording the app reviewer expects', function () {
expect(__('posts.form.tiktok.privacy_placeholder', [], 'en'))
->toBe('Select who can view this post');
expect(__('posts.form.tiktok.interaction_disabled_by_creator', [], 'en'))
->toBe('Turned off in your TikTok account settings');
expect(__('posts.form.tiktok.processing_hint', [], 'en'))
->toBe('After publishing, it may take a few minutes for the content to process and appear on your TikTok profile.');
expect(__('posts.form.tiktok.compliance_incomplete', [], 'en'))
->toBe('You need to indicate if your content promotes yourself, a third party, or both.');
expect(__('posts.form.tiktok.privacy.private_disabled_branded', [], 'en'))
->toBe('Branded content visibility cannot be set to private.');
expect(__('posts.form.tiktok.promotional_organic_title', [], 'en'))
->toBe('Your photo/video will be labeled as "Promotional content".');
expect(__('posts.form.tiktok.promotional_paid_title', [], 'en'))
->toBe('Your photo/video will be labeled as "Paid partnership".');
expect(__('posts.form.tiktok.compliance.agree', [], 'en'))
->toBe("By posting, you agree to TikTok's");
expect(__('posts.form.tiktok.compliance.music_usage', [], 'en'))
->toBe('Music Usage Confirmation');
expect(__('posts.form.tiktok.compliance.branded_policy', [], 'en'))
->toBe('Branded Content Policy');
});

View file

@ -525,3 +525,19 @@
expect(data_get($this->post->media, '0.source'))->toBe('ai');
expect(data_get($this->post->media, '0.source_meta.title'))->toBe('Fix ECP typo');
});
test('instagram_carousel is rejected as a content_type — carousel is a feed post with multiple images', function () {
$response = $this->actingAs($this->user)
->put(route('app.posts.update', $this->post), [
'status' => Status::Draft->value,
'platforms' => [
[
'id' => $this->postPlatform->id,
'content_type' => 'instagram_carousel',
'meta' => [],
],
],
]);
$response->assertSessionHasErrors('platforms.0.content_type');
});

View file

@ -232,6 +232,27 @@
expect($this->workspace->refresh()->image_style->value)->toBe('minimalist');
});
test('update workspace settings updates the name when only the name is submitted', function () {
$this->actingAs($this->user)
->from(route('app.workspace.settings'))
->put(route('app.workspace.settings.update'), [
'name' => 'Name Only Update',
])
->assertRedirect(route('app.workspace.settings'))
->assertSessionHasNoErrors();
expect($this->workspace->refresh()->name)->toBe('Name Only Update');
});
test('update workspace settings still requires brand_font and image_style when submitted empty', function () {
$this->actingAs($this->user)
->put(route('app.workspace.settings.update'), [
'name' => $this->workspace->name,
'brand_font' => '',
'image_style' => '',
])->assertSessionHasErrors(['brand_font', 'image_style']);
});
test('update workspace settings rejects unknown image_style values', function () {
$this->actingAs($this->user)
->put(route('app.workspace.settings.update'), [

View file

@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
use App\Enums\PostPlatform\AspectRatio;
test('aspect ratio has the expected cases and values', function () {
expect(array_column(AspectRatio::cases(), 'value'))
->toEqualCanonicalizing(['1:1', '4:5', '16:9', 'original']);
});
test('aspect ratio maps to the correct crop float', function (string $value, float $expected) {
expect(AspectRatio::from($value)->toFloat())->toBe($expected);
})->with([
'1:1' => ['1:1', 1.0],
'4:5' => ['4:5', 4 / 5],
'16:9' => ['16:9', 16 / 9],
'original' => ['original', 1.0],
]);

View file

@ -53,9 +53,12 @@
expect(ContentType::XPost->aspectRatio())->toBeNull();
});
test('instagram_carousel is not a content type — it is an AI generation format only', function () {
expect(ContentType::tryFrom('instagram_carousel'))->toBeNull();
});
test('content type has correct max media count', function () {
expect(ContentType::InstagramFeed->maxMediaCount())->toBe(1);
expect(ContentType::InstagramCarousel->maxMediaCount())->toBe(10);
expect(ContentType::InstagramFeed->maxMediaCount())->toBe(10);
expect(ContentType::InstagramReel->maxMediaCount())->toBe(1);
expect(ContentType::LinkedInCarousel->maxMediaCount())->toBe(20);
expect(ContentType::XPost->maxMediaCount())->toBe(4);