From 7577029045d9773f83e06841675db10416560e73 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Mon, 25 May 2026 17:08:01 -0300 Subject: [PATCH 01/29] docs: add Star History section to README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 3e96fdeb..29c0ca18 100644 --- a/README.md +++ b/README.md @@ -114,3 +114,13 @@ ## License

Built openly by the community. Star us on GitHub and tell a friend.

+ +--- + +## Star History + +

+ + Star History Chart + +

From 5b9226569f100cf3bbb2cec6a6b5a042c09a4dc5 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Wed, 27 May 2026 14:40:35 -0300 Subject: [PATCH 02/29] feat(docker): publish multi-arch image to GHCR and add self-host compose Add a release workflow that builds docker/Dockerfile (production target) for linux/amd64 and linux/arm64 on native runners and publishes a single multi-arch manifest to ghcr.io/trypostit/trypost on every v*.*.* tag, tagged with semver (1.2.3, 1.2, 1) and latest. Add compose.prod.yaml: a self-host stack that pulls the published image alongside Postgres and Redis with persistent volumes. Config is inline with sectioned comments, including a commented S3/R2 block (storage already uses the default disk, so switching is config-only). No application code is changed. --- .github/workflows/release-docker.yml | 128 +++++++++++++++++++++++ compose.prod.yaml | 147 +++++++++++++++++++++++++++ 2 files changed, 275 insertions(+) create mode 100644 .github/workflows/release-docker.yml create mode 100644 compose.prod.yaml diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml new file mode 100644 index 00000000..2bd275ae --- /dev/null +++ b/.github/workflows/release-docker.yml @@ -0,0 +1,128 @@ +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 }} + 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 }} diff --git a/compose.prod.yaml b/compose.prod.yaml new file mode 100644 index 00000000..e407888e --- /dev/null +++ b/compose.prod.yaml @@ -0,0 +1,147 @@ +# 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) ===== + REVERB_APP_ID: "1001" + REVERB_APP_KEY: trypost-reverb-key + REVERB_APP_SECRET: change-me-reverb-secret # <- change me + REVERB_HOST: localhost # <- for a real domain, set to that host (and PORT 443 / SCHEME https) + 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//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 + +volumes: + pgdata: + redisdata: + storage: From 48727c80cd232d767914c28f90b90c152fa95b1e Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Wed, 27 May 2026 14:53:46 -0300 Subject: [PATCH 03/29] feat(docker): add Caddy reverse proxy and domain-portable Reverb config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an optional Caddy service (proxy profile) to compose.prod.yaml for automatic HTTPS on a custom domain, with a Caddyfile that transparently proxies WebSocket upgrades. Move Echo setup into resources/js/echo.ts and derive the Reverb host from window.location when VITE_REVERB_* is unset, so the published image's frontend connects on any domain without a rebuild. The release workflow bakes a fixed public Reverb key and leaves host/port/scheme empty to enable this; the Herd dev setup keeps its explicit VITE_REVERB_* values, so its behaviour is unchanged. Drop the now-unneeded 8080 host port — the WebSocket rides the main HTTP(S) port via the in-container nginx /app proxy. --- .github/workflows/release-docker.yml | 7 ++++++ Caddyfile | 6 +++++ compose.prod.yaml | 36 ++++++++++++++++++++++++---- resources/js/app.ts | 6 +---- resources/js/echo.ts | 15 ++++++++++++ 5 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 Caddyfile create mode 100644 resources/js/echo.ts diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 2bd275ae..dec1474b 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -63,6 +63,13 @@ jobs: target: production platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} + # Bake a fixed public Reverb key; leave host/port/scheme empty so the + # frontend derives them from window.location (works on any domain). + build-args: | + VITE_REVERB_APP_KEY=trypost-reverb-key + VITE_REVERB_HOST= + VITE_REVERB_PORT= + VITE_REVERB_SCHEME= 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 diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 00000000..add53be2 --- /dev/null +++ b/Caddyfile @@ -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 +} diff --git a/compose.prod.yaml b/compose.prod.yaml index e407888e..c105ae72 100644 --- a/compose.prod.yaml +++ b/compose.prod.yaml @@ -40,10 +40,13 @@ services: BROADCAST_CONNECTION: reverb # ===== WebSockets (Reverb) ===== + # These are the INTERNAL server->Reverb connection — leave as-is even on a + # domain. The browser derives the WebSocket host from its own URL, and the + # in-container nginx proxies it on /app, so it just works on any domain. REVERB_APP_ID: "1001" - REVERB_APP_KEY: trypost-reverb-key + REVERB_APP_KEY: trypost-reverb-key # matches the key baked into the published image REVERB_APP_SECRET: change-me-reverb-secret # <- change me - REVERB_HOST: localhost # <- for a real domain, set to that host (and PORT 443 / SCHEME https) + REVERB_HOST: localhost REVERB_PORT: "8080" REVERB_SCHEME: http @@ -102,8 +105,7 @@ services: # ANTHROPIC_API_KEY: "" # GEMINI_API_KEY: "" ports: - - "8000:80" # app (nginx) - - "8080:8080" # Reverb WebSocket + - "8000:80" # app (nginx); WebSocket rides this same port via /app volumes: - storage:/var/www/html/storage/app depends_on: @@ -141,7 +143,33 @@ services: 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://. + # 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: diff --git a/resources/js/app.ts b/resources/js/app.ts index c63c45ea..de757e69 100644 --- a/resources/js/app.ts +++ b/resources/js/app.ts @@ -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({ diff --git a/resources/js/echo.ts b/resources/js/echo.ts new file mode 100644 index 00000000..c378c0cd --- /dev/null +++ b/resources/js/echo.ts @@ -0,0 +1,15 @@ +import { configureEcho } from '@laravel/echo-vue'; + +const scheme = import.meta.env.VITE_REVERB_SCHEME || (window.location.protocol === 'https:' ? 'https' : 'http'); +const forceTLS = scheme === 'https'; +const port = Number(import.meta.env.VITE_REVERB_PORT || window.location.port || (forceTLS ? 443 : 80)); + +configureEcho({ + broadcaster: 'reverb', + key: import.meta.env.VITE_REVERB_APP_KEY, + wsHost: import.meta.env.VITE_REVERB_HOST || window.location.hostname, + wsPort: port, + wssPort: port, + forceTLS, + enabledTransports: ['ws', 'wss'], +}); From 09fa97d5396e46a0bba9e9e8faf6824c81053d47 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Wed, 27 May 2026 15:17:47 -0300 Subject: [PATCH 04/29] refactor(docker): align echo.ts with the shared sendkit config Make resources/js/echo.ts byte-identical to the sendkit Echo setup (VITE_REVERB_* read directly, no window.location derivation). The release workflow now bakes only VITE_REVERB_APP_KEY, and compose.prod.yaml restores the 8080 host port so the published image's Reverb client (baked at localhost:8080) works for local docker compose. A custom-domain deploy needs the image rebuilt with VITE_REVERB_HOST/PORT/SCHEME set. --- .github/workflows/release-docker.yml | 5 ----- compose.prod.yaml | 11 ++++++----- resources/js/echo.ts | 12 ++++-------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index dec1474b..9558ca02 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -63,13 +63,8 @@ jobs: target: production platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} - # Bake a fixed public Reverb key; leave host/port/scheme empty so the - # frontend derives them from window.location (works on any domain). build-args: | VITE_REVERB_APP_KEY=trypost-reverb-key - VITE_REVERB_HOST= - VITE_REVERB_PORT= - VITE_REVERB_SCHEME= 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 diff --git a/compose.prod.yaml b/compose.prod.yaml index c105ae72..d5bafaab 100644 --- a/compose.prod.yaml +++ b/compose.prod.yaml @@ -40,11 +40,11 @@ services: BROADCAST_CONNECTION: reverb # ===== WebSockets (Reverb) ===== - # These are the INTERNAL server->Reverb connection — leave as-is even on a - # domain. The browser derives the WebSocket host from its own URL, and the - # in-container nginx proxies it on /app, so it just works on any domain. + # The published image bakes the client at localhost:8080. For a custom + # domain, rebuild the image with --build-arg VITE_REVERB_HOST= + # VITE_REVERB_PORT=443 VITE_REVERB_SCHEME=https. REVERB_APP_ID: "1001" - REVERB_APP_KEY: trypost-reverb-key # matches the key baked into the published image + 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" @@ -105,7 +105,8 @@ services: # ANTHROPIC_API_KEY: "" # GEMINI_API_KEY: "" ports: - - "8000:80" # app (nginx); WebSocket rides this same port via /app + - "8000:80" # app (nginx) + - "8080:8080" # Reverb WebSocket volumes: - storage:/var/www/html/storage/app depends_on: diff --git a/resources/js/echo.ts b/resources/js/echo.ts index c378c0cd..9c5d42c7 100644 --- a/resources/js/echo.ts +++ b/resources/js/echo.ts @@ -1,15 +1,11 @@ import { configureEcho } from '@laravel/echo-vue'; -const scheme = import.meta.env.VITE_REVERB_SCHEME || (window.location.protocol === 'https:' ? 'https' : 'http'); -const forceTLS = scheme === 'https'; -const port = Number(import.meta.env.VITE_REVERB_PORT || window.location.port || (forceTLS ? 443 : 80)); - configureEcho({ broadcaster: 'reverb', key: import.meta.env.VITE_REVERB_APP_KEY, - wsHost: import.meta.env.VITE_REVERB_HOST || window.location.hostname, - wsPort: port, - wssPort: port, - forceTLS, + 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'], }); From 37d8699b1fb8b41598c21dc3e94cac6e49965c49 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Wed, 27 May 2026 17:54:16 -0300 Subject: [PATCH 05/29] Update GitHub funding username --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 451f220d..06984c35 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -github: [trypostit] +github: [paulocastellano] From 50477b97f03f960ffccd50c7a79cafbfe6c90cf1 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Fri, 29 May 2026 10:16:04 -0300 Subject: [PATCH 06/29] fix(tiktok): align UX strings and render processing notice for app review Match the literal copy the TikTok app reviewer looks for during the Content Posting API audit, per the Mixpost playbook (the only public account of how to pass). - Privacy dropdown placeholder: "Select who can view this post" - Tooltip on interaction toggles disabled by creator: "Turned off in your TikTok account settings" - Render the "may take a few minutes" notice that was translated but never displayed (processing_hint) Mirror both i18n changes in pt-BR and es. Add a feature test that locks the literal strings so they cannot drift before the next review cycle. --- lang/en/posts.php | 4 +-- lang/es/posts.php | 4 +-- lang/pt-BR/posts.php | 4 +-- .../posts/editor/TikTokSettings.vue | 5 +++ tests/Feature/TikTokI18nStringsTest.php | 35 +++++++++++++++++++ 5 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 tests/Feature/TikTokI18nStringsTest.php diff --git a/lang/en/posts.php b/lang/en/posts.php index 8488c29a..a4dd2a69 100644 --- a/lang/en/posts.php +++ b/lang/en/posts.php @@ -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', diff --git a/lang/es/posts.php b/lang/es/posts.php index cf988ea8..7bc4e1e9 100644 --- a/lang/es/posts.php +++ b/lang/es/posts.php @@ -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', diff --git a/lang/pt-BR/posts.php b/lang/pt-BR/posts.php index 6dc86360..bba789cc 100644 --- a/lang/pt-BR/posts.php +++ b/lang/pt-BR/posts.php @@ -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', diff --git a/resources/js/components/posts/editor/TikTokSettings.vue b/resources/js/components/posts/editor/TikTokSettings.vue index 3b53d1c2..795ebf5e 100644 --- a/resources/js/components/posts/editor/TikTokSettings.vue +++ b/resources/js/components/posts/editor/TikTokSettings.vue @@ -397,6 +397,11 @@ watch( {{ $t('posts.form.tiktok.compliance.music_usage') }}

+ + +

+ {{ $t('posts.form.tiktok.processing_hint') }} +

diff --git a/tests/Feature/TikTokI18nStringsTest.php b/tests/Feature/TikTokI18nStringsTest.php new file mode 100644 index 00000000..d6a73a57 --- /dev/null +++ b/tests/Feature/TikTokI18nStringsTest.php @@ -0,0 +1,35 @@ +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'); +}); From 65afd86824fe49e6d6edc9ac0efe293084437432 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Fri, 29 May 2026 10:30:06 -0300 Subject: [PATCH 07/29] fix(tiktok): default disable_comment to true when meta omits allow_comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Vue computed property returns false for allow_comments when meta lacks the key (so the UI checkbox renders unchecked), but the backend defaulted allow_comments to true if the key was absent — sending disable_comment=false to TikTok. A post created without the user toggling the comment checkbox went out with comments enabled even though the UI showed them off. Align the backend default with what the UI displays: when meta omits allow_comments, treat it as off (matching duet and stitch, which already default to off). Adjust the existing default-settings test that locked in the old behaviour. --- app/Services/Social/TikTokPublisher.php | 4 ++-- tests/Feature/Services/Social/TikTokPublisherTest.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Services/Social/TikTokPublisher.php b/app/Services/Social/TikTokPublisher.php index d26a8a8a..55d08c84 100644 --- a/app/Services/Social/TikTokPublisher.php +++ b/app/Services/Social/TikTokPublisher.php @@ -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)) { diff --git a/tests/Feature/Services/Social/TikTokPublisherTest.php b/tests/Feature/Services/Social/TikTokPublisherTest.php index a727ebed..96016fa0 100644 --- a/tests/Feature/Services/Social/TikTokPublisherTest.php +++ b/tests/Feature/Services/Social/TikTokPublisherTest.php @@ -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']) From 4d3992747251a9660fd557ea24ef19fa68591408 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Fri, 29 May 2026 16:11:24 -0300 Subject: [PATCH 08/29] Update star history section for dark and light themes --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 29c0ca18..106e5c40 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,9 @@ ## License ## Star History

- - Star History Chart - + + + + Star History Chart +

From 33ccd0a0df7293c2eb0bf5994983cdb9d2e1fbd6 Mon Sep 17 00:00:00 2001 From: sebastian-works <60854302+sebastian-works@users.noreply.github.com> Date: Sun, 31 May 2026 00:43:01 +0200 Subject: [PATCH 09/29] fix: update symfony packages to 8.1.0 for security advisories (CVE-2026-45067 et al.) --- composer.lock | 264 ++++++++++++++++++++++++++------------------------ 1 file changed, 140 insertions(+), 124 deletions(-) diff --git a/composer.lock b/composer.lock index 87a52d7c..4f28b729 100644 --- a/composer.lock +++ b/composer.lock @@ -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", From 2f047f2f7e93da6580af5c06ae3d6a108832a433 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Tue, 2 Jun 2026 08:45:11 -0300 Subject: [PATCH 10/29] Fix workspace name-only update rejected by required brand fields The Workspace and Brand settings tabs both submit to the same updateSettings endpoint, but the Workspace tab sends only the name. UpdateWorkspaceRequest marked brand_font and image_style as required, so the name-only request failed validation silently (the form only renders the name error). Mark both brand fields as sometimes|required so a name-only update succeeds while the Brand tab still validates them. Closes #74 --- .../App/Workspace/UpdateWorkspaceRequest.php | 4 ++-- tests/Feature/WorkspaceControllerTest.php | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php b/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php index 3abeec7f..40514942 100644 --- a/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php +++ b/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php @@ -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'], ]; } diff --git a/tests/Feature/WorkspaceControllerTest.php b/tests/Feature/WorkspaceControllerTest.php index 1922f0c5..aa0ed4f2 100644 --- a/tests/Feature/WorkspaceControllerTest.php +++ b/tests/Feature/WorkspaceControllerTest.php @@ -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'), [ From ba98f01530e5d3782cc975f3f42f73ba3c5b6b3c Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Tue, 2 Jun 2026 09:12:14 -0300 Subject: [PATCH 11/29] Fix calendar showing 'no content' for every post MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The calendar read each post's caption from post_platforms[0].content, but post_platforms has no content column — the caption lives on posts.content. As a result every cell fell back to the 'no content' placeholder. Read post.content instead (matching the list view) and drop the phantom content field from the PostPlatform interface. Also surface the caption in the month view (it previously showed only the time and platform icons), add horizontal padding to the month post list so the card border is not clipped inside the overflow-y scroll container, and standardise the hover effect across day/week/month views to a shadow-only highlight (no lift). Closes #70 --- resources/js/pages/posts/Calendar.vue | 19 ++++++++++++------- tests/Feature/PostControllerTest.php | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/resources/js/pages/posts/Calendar.vue b/resources/js/pages/posts/Calendar.vue index 1d93b385..e68e8f6b 100644 --- a/resources/js/pages/posts/Calendar.vue +++ b/resources/js/pages/posts/Calendar.vue @@ -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 => {
@@ -334,7 +334,7 @@ const formatTime = (scheduledAt: string): string => {

- {{ post.post_platforms[0]?.content || $t('calendar.no_content') }} + {{ post.content?.trim() || $t('calendar.no_content') }}

@@ -383,7 +383,7 @@ const formatTime = (scheduledAt: string): string => {
@@ -418,7 +418,7 @@ const formatTime = (scheduledAt: string): string => {

- {{ post.post_platforms[0]?.content || $t('calendar.no_content') }} + {{ post.content?.trim() || $t('calendar.no_content') }}

@@ -479,12 +479,13 @@ const formatTime = (scheduledAt: string): string => {
-
+
+
{{ formatTime(post.scheduled_at) }}
{ +{{ post.post_platforms.length - 3 }}
+
+

+ {{ post.content?.trim() || $t('calendar.no_content') }} +

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')); From cca7893e0f0caafffb807210def3ef396203be8c Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Thu, 4 Jun 2026 17:08:57 -0300 Subject: [PATCH 12/29] Stop persisting instagram_carousel as a content type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instagram carousels were stored as content_type=instagram_carousel, which the publisher's match() did not handle — publishing failed with "Unsupported Instagram content type: instagram_carousel" for any post created via API, MCP, or template (the AI flow worked only thanks to an inline band-aid that rewrote carousel to feed before saving). A carousel is just an Instagram feed post with multiple images: the editor, preview, and publisher already treat a multi-image feed as a carousel. So instagram_carousel is a generation format, not a stored content type. Remove it from the ContentType enum entirely; it now lives only as an AI generation-format string (wizard card + slide structure + carousel templates are untouched), and posts always persist as instagram_feed. - ContentType: drop the InstagramCarousel case; InstagramFeed maxMediaCount 1 -> 10 - StreamPostCreation: resolvedContentType() maps carousel -> feed; band-aid removed - StartPostCreationRequest: accept instagram_carousel as a generation format - Frontend: carousel becomes a wizard-local AiFormat; UI/UX unchanged - API/MCP now reject instagram_carousel as a content_type (Rule::in no longer lists it) --- app/Enums/PostPlatform/ContentType.php | 18 ++-- .../App/Ai/StartPostCreationRequest.php | 5 +- app/Jobs/Ai/StreamPostCreation.php | 26 ++++-- .../components/posts/create/AiPostWizard.vue | 15 +-- resources/js/enums/content-type.ts | 1 - tests/Feature/Ai/PostAiCreateTest.php | 20 ++++ tests/Feature/Ai/StreamPostCreationTest.php | 91 +++++++++++++++++++ tests/Feature/Api/PostApiTest.php | 33 +++++++ tests/Feature/Mcp/PostToolTest.php | 34 +++++++ tests/Feature/UpdatePostRequestTest.php | 16 ++++ tests/Unit/Enums/ContentTypeTest.php | 7 +- 11 files changed, 239 insertions(+), 27 deletions(-) create mode 100644 tests/Feature/Ai/StreamPostCreationTest.php diff --git a/app/Enums/PostPlatform/ContentType.php b/app/Enums/PostPlatform/ContentType.php index 3dc02193..6fdf0e3d 100644 --- a/app/Enums/PostPlatform/ContentType.php +++ b/app/Enums/PostPlatform/ContentType.php @@ -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, diff --git a/app/Http/Requests/App/Ai/StartPostCreationRequest.php b/app/Http/Requests/App/Ai/StartPostCreationRequest.php index 2977f7b1..40fe56a4 100644 --- a/app/Http/Requests/App/Ai/StartPostCreationRequest.php +++ b/app/Http/Requests/App/Ai/StartPostCreationRequest.php @@ -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'], diff --git a/app/Jobs/Ai/StreamPostCreation.php b/app/Jobs/Ai/StreamPostCreation.php index 780a32a2..1406c11c 100644 --- a/app/Jobs/Ai/StreamPostCreation.php +++ b/app/Jobs/Ai/StreamPostCreation.php @@ -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(); }); diff --git a/resources/js/components/posts/create/AiPostWizard.vue b/resources/js/components/posts/create/AiPostWizard.vue index 2ea974ba..bcbc6783 100644 --- a/resources/js/components/posts/create/AiPostWizard.vue +++ b/resources/js/components/posts/create/AiPostWizard.vue @@ -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(null); +const selectedFormat = ref(null); const selectedAccountId = ref(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; diff --git a/resources/js/enums/content-type.ts b/resources/js/enums/content-type.ts index 8daea55f..3d8a22bb 100644 --- a/resources/js/enums/content-type.ts +++ b/resources/js/enums/content-type.ts @@ -1,6 +1,5 @@ export const ContentType = { InstagramFeed: 'instagram_feed', - InstagramCarousel: 'instagram_carousel', InstagramStory: 'instagram_story', InstagramReel: 'instagram_reel', LinkedInPost: 'linkedin_post', diff --git a/tests/Feature/Ai/PostAiCreateTest.php b/tests/Feature/Ai/PostAiCreateTest.php index 99003add..297da2d7 100644 --- a/tests/Feature/Ai/PostAiCreateTest.php +++ b/tests/Feature/Ai/PostAiCreateTest.php @@ -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(); diff --git a/tests/Feature/Ai/StreamPostCreationTest.php b/tests/Feature/Ai/StreamPostCreationTest.php new file mode 100644 index 00000000..55963bd2 --- /dev/null +++ b/tests/Feature/Ai/StreamPostCreationTest.php @@ -0,0 +1,91 @@ +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); +}); diff --git a/tests/Feature/Api/PostApiTest.php b/tests/Feature/Api/PostApiTest.php index 592ed299..5c6018a8 100644 --- a/tests/Feature/Api/PostApiTest.php +++ b/tests/Feature/Api/PostApiTest.php @@ -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([ diff --git a/tests/Feature/Mcp/PostToolTest.php b/tests/Feature/Mcp/PostToolTest.php index 07bdb5f0..f06b46d7 100644 --- a/tests/Feature/Mcp/PostToolTest.php +++ b/tests/Feature/Mcp/PostToolTest.php @@ -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) diff --git a/tests/Feature/UpdatePostRequestTest.php b/tests/Feature/UpdatePostRequestTest.php index 74b740e3..5bba5d0b 100644 --- a/tests/Feature/UpdatePostRequestTest.php +++ b/tests/Feature/UpdatePostRequestTest.php @@ -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'); +}); diff --git a/tests/Unit/Enums/ContentTypeTest.php b/tests/Unit/Enums/ContentTypeTest.php index b2a34d3c..7a771504 100644 --- a/tests/Unit/Enums/ContentTypeTest.php +++ b/tests/Unit/Enums/ContentTypeTest.php @@ -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); From e25b320ad2ba40b715206b5b4ec7072feb0495a3 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Fri, 5 Jun 2026 18:01:45 -0300 Subject: [PATCH 13/29] Add aspect ratio selection for Facebook posts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Facebook feed posts now have the same aspect ratio selector as Instagram (1:1, 4:5, 16:9, Original), letting users control how their image is cropped before publishing instead of leaving it to Facebook's auto-crop. The Facebook Graph API has no crop/aspect-ratio parameter for organic Page photo posts (image crops are ads-only) — Facebook displays the bytes it receives at their native ratio. So, exactly like Instagram, the crop is done server-side before upload. - Extract the Instagram crop logic into a shared CropsImageForAspectRatio concern (download -> crop -> store -> URL), with a per-publisher cropFailureException hook. InstagramPublisher refactored to use it (behaviour identical; existing tests unchanged). - FacebookPublisher reads meta.aspect_ratio and crops single- and multi-image feed posts (facebook-crops/ prefix). Reels/Stories are unaffected. - FacebookSettings: aspect ratio picker on the Feed variant (default Original -> no crop). ScheduleTab wires meta; FacebookPreview reflects the chosen ratio. Adds posts.form.facebook.aspect.* in en/es/pt-BR. Closes #69 --- .../Concerns/CropsImageForAspectRatio.php | 64 +++++++++ app/Services/Social/FacebookPublisher.php | 28 ++-- app/Services/Social/InstagramPublisher.php | 61 ++------- lang/en/posts.php | 7 + lang/es/posts.php | 7 + lang/pt-BR/posts.php | 7 + .../posts/editor/FacebookSettings.vue | 44 ++++++- .../components/posts/editor/ScheduleTab.vue | 2 + .../posts/previews/FacebookPreview.vue | 36 +++-- .../Services/Social/FacebookPublisherTest.php | 124 ++++++++++++++++++ 10 files changed, 310 insertions(+), 70 deletions(-) create mode 100644 app/Services/Social/Concerns/CropsImageForAspectRatio.php diff --git a/app/Services/Social/Concerns/CropsImageForAspectRatio.php b/app/Services/Social/Concerns/CropsImageForAspectRatio.php new file mode 100644 index 00000000..f006ee8b --- /dev/null +++ b/app/Services/Social/Concerns/CropsImageForAspectRatio.php @@ -0,0 +1,64 @@ +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 = "{$pathPrefix}/".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 match ($ratio) { + '4:5' => 4 / 5, + '16:9' => 16 / 9, + default => 1.0, + }; + } + + /** + * The platform-specific exception thrown when the source image cannot be + * downloaded for cropping. + */ + abstract protected function cropFailureException(string $message): SocialPublishException; +} diff --git a/app/Services/Social/FacebookPublisher.php b/app/Services/Social/FacebookPublisher.php index b7133e36..20080e93 100644 --- a/app/Services/Social/FacebookPublisher.php +++ b/app/Services/Social/FacebookPublisher.php @@ -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, 'facebook-crops'), '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, 'facebook-crops'), '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, + ); + } } diff --git a/app/Services/Social/InstagramPublisher.php b/app/Services/Social/InstagramPublisher.php index c22bef71..79540f01 100644 --- a/app/Services/Social/InstagramPublisher.php +++ b/app/Services/Social/InstagramPublisher.php @@ -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, 'instagram-crops'); // 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, 'instagram-crops'); } $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 diff --git a/lang/en/posts.php b/lang/en/posts.php index 8488c29a..3c9dd900 100644 --- a/lang/en/posts.php +++ b/lang/en/posts.php @@ -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', diff --git a/lang/es/posts.php b/lang/es/posts.php index cf988ea8..4523a56c 100644 --- a/lang/es/posts.php +++ b/lang/es/posts.php @@ -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', diff --git a/lang/pt-BR/posts.php b/lang/pt-BR/posts.php index 6dc86360..1d33f786 100644 --- a/lang/pt-BR/posts.php +++ b/lang/pt-BR/posts.php @@ -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', diff --git a/resources/js/components/posts/editor/FacebookSettings.vue b/resources/js/components/posts/editor/FacebookSettings.vue index 1451dd2e..00711fcb 100644 --- a/resources/js/components/posts/editor/FacebookSettings.vue +++ b/resources/js/components/posts/editor/FacebookSettings.vue @@ -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,30 +20,48 @@ interface Props { socialAccount: SocialAccount | null; contentType: string; media: MediaItem[]; + meta?: Record; disabled?: boolean; } const props = withDefaults(defineProps(), { disabled: false, + meta: () => ({}), }); const emit = defineEmits<{ 'update:contentType': [value: string]; + 'update:meta': [meta: Record]; }>(); 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)); @@ -99,6 +118,25 @@ const warning = computed(() => getMediaValidationWarning(props.contentType, prop
+
+

{{ $t('posts.form.facebook.aspect_label') }}

+
+ +
+
+

{ :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)" />

diff --git a/resources/js/components/posts/previews/FacebookPreview.vue b/resources/js/components/posts/previews/FacebookPreview.vue index bb5c4422..f0302ae2 100644 --- a/resources/js/components/posts/previews/FacebookPreview.vue +++ b/resources/js/components/posts/previews/FacebookPreview.vue @@ -18,6 +18,7 @@ interface Props { content: string; media: MediaItem[]; contentType?: string; + meta?: Record; 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 = { + '1:1': 100, + '4:5': 125, + '16:9': 56.25, +}; +const feedAspectPadding = computed(() => 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

- -
- + +
+
+ +
+
+
+
diff --git a/tests/Feature/Services/Social/FacebookPublisherTest.php b/tests/Feature/Services/Social/FacebookPublisherTest.php index cad4cfc0..4a8ce7b3 100644 --- a/tests/Feature/Services/Social/FacebookPublisherTest.php +++ b/tests/Feature/Services/Social/FacebookPublisherTest.php @@ -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,116 @@ && ! 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, 'facebook-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'], 'facebook-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 aspect ratio crop to every image', function () { + Storage::fake(); + + $this->postPlatform->update(['meta' => ['aspect_ratio' => '1:1']]); + $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, 'facebook-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($image->width())->toBe($image->height()); + @unlink($tempFile); + } + + Http::assertSent(fn ($request) => str_contains($request->url(), '/page_123/photos') + && str_contains($request['url'] ?? '', 'facebook-crops/')); +}); + +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, 'facebook-crops/')))->toBeEmpty(); + + Http::assertSent(fn ($request) => str_contains($request->url(), '/page_123/photos') + && $request['url'] === 'https://example.com/media/a.jpg'); +}); From 1b096f9ede2cd6ac7d6dc3536aa6158f14fc8a1e Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Fri, 5 Jun 2026 18:30:17 -0300 Subject: [PATCH 14/29] Unify crop storage folder and make IG/FB crop tests symmetric MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CropsImageForAspectRatio: drop the per-publisher path-prefix argument; crops from both platforms go to a single `social-crops/` directory (the folder has no functional meaning — the platform fetches by URL and nothing reads it back; UUID filenames prevent collisions). - Close the IG/FB test asymmetry surfaced in review: Instagram single-image crop now runs across 1:1/4:5/16:9 (dataset) and has a crop-download-failure test; Facebook gains an explicit 'original' bypass test. Both platforms now cover the same matrix (crop per ratio + uploaded-URL is the crop, original/no-meta bypass, multi-image, download-failure exception). Follow-up tracked in #83 (orphaned crops are never pruned from storage). --- .../Concerns/CropsImageForAspectRatio.php | 6 ++-- app/Services/Social/FacebookPublisher.php | 4 +-- app/Services/Social/InstagramPublisher.php | 4 +-- .../Services/Social/FacebookPublisherTest.php | 32 ++++++++++++++--- .../Social/InstagramPublisherTest.php | 36 +++++++++++++++---- 5 files changed, 64 insertions(+), 18 deletions(-) diff --git a/app/Services/Social/Concerns/CropsImageForAspectRatio.php b/app/Services/Social/Concerns/CropsImageForAspectRatio.php index f006ee8b..f807e62a 100644 --- a/app/Services/Social/Concerns/CropsImageForAspectRatio.php +++ b/app/Services/Social/Concerns/CropsImageForAspectRatio.php @@ -12,12 +12,14 @@ 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 $pathPrefix): string + protected function cropImageForAspectRatio(string $imageUrl, ?string $aspectRatio): string { if (! $aspectRatio || $aspectRatio === 'original') { return $imageUrl; @@ -36,7 +38,7 @@ protected function cropImageForAspectRatio(string $imageUrl, ?string $aspectRati $cropped = app(MediaOptimizer::class)->cropToAspectRatio($tempInput, $ratio); - $path = "{$pathPrefix}/".Str::uuid()->toString().'.jpg'; + $path = self::CROP_DIRECTORY.'/'.Str::uuid()->toString().'.jpg'; Storage::put($path, file_get_contents($cropped)); @unlink($cropped); diff --git a/app/Services/Social/FacebookPublisher.php b/app/Services/Social/FacebookPublisher.php index 20080e93..9816fc9d 100644 --- a/app/Services/Social/FacebookPublisher.php +++ b/app/Services/Social/FacebookPublisher.php @@ -117,7 +117,7 @@ private function publishTextPost(string $pageId, string $accessToken, string $co private function publishSingleImagePost(string $pageId, string $accessToken, ?string $content, $media, ?string $aspectRatio): array { $payload = [ - 'url' => $this->cropImageForAspectRatio($media->url, $aspectRatio, 'facebook-crops'), + 'url' => $this->cropImageForAspectRatio($media->url, $aspectRatio), 'access_token' => $accessToken, ]; @@ -155,7 +155,7 @@ private function publishMultiImagePost(string $pageId, string $accessToken, ?str } $uploadResponse = $this->facebookHttp()->post("{$this->baseUrl}/{$pageId}/photos", [ - 'url' => $this->cropImageForAspectRatio($media->url, $aspectRatio, 'facebook-crops'), + 'url' => $this->cropImageForAspectRatio($media->url, $aspectRatio), 'published' => 'false', 'access_token' => $accessToken, ]); diff --git a/app/Services/Social/InstagramPublisher.php b/app/Services/Social/InstagramPublisher.php index 79540f01..23e684d8 100644 --- a/app/Services/Social/InstagramPublisher.php +++ b/app/Services/Social/InstagramPublisher.php @@ -79,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->cropImageForAspectRatio($media->url, $aspectRatio, 'instagram-crops'); + $imageUrl = $this->cropImageForAspectRatio($media->url, $aspectRatio); // Step 1: Create container $containerResponse = $this->socialHttp()->post("{$this->baseUrl}/{$instagramId}/media", [ @@ -205,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->cropImageForAspectRatio($media->url, $aspectRatio, 'instagram-crops'); + $params['image_url'] = $this->cropImageForAspectRatio($media->url, $aspectRatio); } $containerResponse = $this->socialHttp()->post("{$this->baseUrl}/{$instagramId}/media", $params); diff --git a/tests/Feature/Services/Social/FacebookPublisherTest.php b/tests/Feature/Services/Social/FacebookPublisherTest.php index 4a8ce7b3..79b9c6ac 100644 --- a/tests/Feature/Services/Social/FacebookPublisherTest.php +++ b/tests/Feature/Services/Social/FacebookPublisherTest.php @@ -665,7 +665,7 @@ function facebookJpegBytes(int $width = 1200, int $height = 800): string $this->publisher->publish($this->postPlatform); - $crops = collect(Storage::allFiles())->filter(fn (string $path) => str_starts_with($path, 'facebook-crops/')); + $crops = collect(Storage::allFiles())->filter(fn (string $path) => str_starts_with($path, 'social-crops/')); expect($crops)->toHaveCount(1); $manager = new ImageManager(Driver::class); @@ -676,7 +676,7 @@ function facebookJpegBytes(int $width = 1200, int $height = 800): string @unlink($tempFile); Http::assertSent(fn ($request) => str_contains($request->url(), '/page_123/photos') - && str_contains($request['url'], 'facebook-crops/') + && str_contains($request['url'], 'social-crops/') && ! str_contains($request['url'], 'example.com')); })->with([ '1:1' => ['1:1', 1.0], @@ -706,7 +706,7 @@ function facebookJpegBytes(int $width = 1200, int $height = 800): string $this->publisher->publish($this->postPlatform); - $crops = collect(Storage::allFiles())->filter(fn (string $path) => str_starts_with($path, 'facebook-crops/')); + $crops = collect(Storage::allFiles())->filter(fn (string $path) => str_starts_with($path, 'social-crops/')); expect($crops)->toHaveCount(2); $manager = new ImageManager(Driver::class); @@ -719,7 +719,7 @@ function facebookJpegBytes(int $width = 1200, int $height = 800): string } Http::assertSent(fn ($request) => str_contains($request->url(), '/page_123/photos') - && str_contains($request['url'] ?? '', 'facebook-crops/')); + && str_contains($request['url'] ?? '', 'social-crops/')); }); test('facebook image post throws when the source image cannot be downloaded for cropping', function () { @@ -755,7 +755,29 @@ function facebookJpegBytes(int $width = 1200, int $height = 800): string $this->publisher->publish($this->postPlatform); - expect(collect(Storage::allFiles())->filter(fn (string $path) => str_starts_with($path, 'facebook-crops/')))->toBeEmpty(); + 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'); diff --git a/tests/Feature/Services/Social/InstagramPublisherTest.php b/tests/Feature/Services/Social/InstagramPublisherTest.php index fd45ee73..c32db466 100644 --- a/tests/Feature/Services/Social/InstagramPublisherTest.php +++ b/tests/Feature/Services/Social/InstagramPublisherTest.php @@ -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 () { @@ -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); From 5be0abfae330a38924ddd3f041914ddcd0476296 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Fri, 5 Jun 2026 18:45:48 -0300 Subject: [PATCH 15/29] Cover carousel/multi crop per-ratio and FB multi abort-on-crop-failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Instagram carousel and Facebook multi-image crop tests now run as datasets over 1:1 and 4:5, asserting each image's real cropped ratio (previously 1:1 only) — proving the chosen ratio flows through the multi-image paths. - Add a Facebook test that a multi-image post aborts entirely (throws FacebookPublishException) when one image can't be downloaded for cropping. --- .../Services/Social/FacebookPublisherTest.php | 31 +++++++++++++++++-- .../Social/InstagramPublisherTest.php | 11 ++++--- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/tests/Feature/Services/Social/FacebookPublisherTest.php b/tests/Feature/Services/Social/FacebookPublisherTest.php index 79b9c6ac..a5e8e37e 100644 --- a/tests/Feature/Services/Social/FacebookPublisherTest.php +++ b/tests/Feature/Services/Social/FacebookPublisherTest.php @@ -684,10 +684,10 @@ function facebookJpegBytes(int $width = 1200, int $height = 800): string '16:9' => ['16:9', 16 / 9], ]); -test('facebook multi image post applies the aspect ratio crop to every image', function () { +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' => '1:1']]); + $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'], @@ -714,12 +714,37 @@ function facebookJpegBytes(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); } 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 () { diff --git a/tests/Feature/Services/Social/InstagramPublisherTest.php b/tests/Feature/Services/Social/InstagramPublisherTest.php index c32db466..30ff943b 100644 --- a/tests/Feature/Services/Social/InstagramPublisherTest.php +++ b/tests/Feature/Services/Social/InstagramPublisherTest.php @@ -869,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' => [ @@ -905,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], +]); From bc443885701615d4fe0988c6adf6dfe780ab04f6 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Wed, 10 Jun 2026 13:01:32 -0300 Subject: [PATCH 16/29] feat(seeder): conditionally seed UserSeeder for self-hosted setups Added logic to the DatabaseSeeder to call UserSeeder only if the application is configured for self-hosting. This ensures that user data is seeded appropriately based on the deployment environment. --- database/seeders/DatabaseSeeder.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index b1f2022a..000d7d0c 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -15,7 +15,12 @@ public function run(): void { $this->call([ PlanSeeder::class, - PassportSeeder::class, + PassportSeeder::class ]); + + // If self-hosted, seed the user seeder + if(config('trypost.self_hosted')) { + $this->call(UserSeeder::class); + } } } From d3e9be54b61c8360f17fd7abc5d6948225eac91f Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Wed, 10 Jun 2026 13:06:48 -0300 Subject: [PATCH 17/29] refactor(seeder): remove conditional UserSeeder call from DatabaseSeeder Removed the logic that conditionally seeds the UserSeeder based on the self-hosting configuration. This simplifies the DatabaseSeeder and assumes user data will be handled externally. --- database/seeders/DatabaseSeeder.php | 5 ----- releases/v1.0.1/changelog.md | 6 ++++++ releases/v1.0.1/email.md | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 releases/v1.0.1/changelog.md create mode 100644 releases/v1.0.1/email.md diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 000d7d0c..2400f150 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -17,10 +17,5 @@ public function run(): void PlanSeeder::class, PassportSeeder::class ]); - - // If self-hosted, seed the user seeder - if(config('trypost.self_hosted')) { - $this->call(UserSeeder::class); - } } } diff --git a/releases/v1.0.1/changelog.md b/releases/v1.0.1/changelog.md new file mode 100644 index 00000000..0d1d3db8 --- /dev/null +++ b/releases/v1.0.1/changelog.md @@ -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 diff --git a/releases/v1.0.1/email.md b/releases/v1.0.1/email.md new file mode 100644 index 00000000..033758e9 --- /dev/null +++ b/releases/v1.0.1/email.md @@ -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 From 410eb9612ef3e48966e244247a16fdcddce2dede Mon Sep 17 00:00:00 2001 From: Falconiere Barbosa Date: Thu, 28 May 2026 00:54:26 -0300 Subject: [PATCH 18/29] fix(linkedin): drop deprecated r_basicprofile from default scopes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make r_basicprofile opt-in via LINKEDIN_EXTRA_SCOPES so self-hosted users unblock by default and ops with legacy/enterprise products keep working. Why --- LinkedIn rejects OAuth authorize requests with a generic "Bummer, something went wrong" page when an app asks for a scope it can't grant. `r_basicprofile` is a legacy scope deprecated in 2018; new LinkedIn dev apps don't have it, so every self-hosted user hits the rejection immediately on `/connect/linkedin`. The two products LinkedIn actually grants to standard apps today are: - Sign In with LinkedIn using OpenID Connect → `openid profile email` - Share on LinkedIn → `w_member_social` That set is enough for the connect flow. The only piece of data `r_basicprofile` was buying us is `/v2/me`'s `vanityName` (pretty `linkedin.com/in/`). `fetchVanityName()` already handles HTTP failure gracefully (returns null), and the only downstream consumer — `LinkedInPagePublisher`'s post-URL builder — already falls back to a numeric `linkedin.com/feed/update/` URL when `$account->username` is null. Backward compatibility ---------------------- Ops with legacy or enterprise LinkedIn products approved on their dev app (so they DO have `r_basicprofile`) can opt back in via env: LINKEDIN_EXTRA_SCOPES=r_basicprofile `LinkedInController::resolveScopes()` merges this comma-separated list into the default scope array. The connect flow's `Socialite::scopes()` call then includes the legacy scope, preserving the pre-PR behaviour end-to-end (including `vanityName` lookup). Net effect for users without `r_basicprofile`: - Connect flow works (was previously rejected by LinkedIn). - Posts publish exactly the same way. - Generated post URLs use the numeric form instead of the vanity slug. Tests ----- - `linkedin connect requests the default scope set when LINKEDIN_EXTRA_SCOPES is unset` - `linkedin connect appends LINKEDIN_EXTRA_SCOPES to the default scope set` - Existing `splits comma-separated approvedScopes` fixture updated to match the new default set. --- .env.example | 5 ++ .../Controllers/Auth/LinkedInController.php | 22 +++++- config/services.php | 6 ++ docker/.env.docker.example | 5 ++ .../Feature/Social/LinkedInControllerTest.php | 67 ++++++++++++++++++- 5 files changed, 101 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 6d4c3104..3ac86820 100644 --- a/.env.example +++ b/.env.example @@ -103,6 +103,11 @@ LINKEDIN_CLIENT_ID= LINKEDIN_CLIENT_SECRET= LINKEDIN_CLIENT_REDIRECT="${APP_URL}/accounts/linkedin/callback" LINKEDIN_PAGE_CLIENT_REDIRECT="${APP_URL}/accounts/linkedin-page/callback" +# Optional: comma-separated extra OAuth scopes appended to the personal +# LinkedIn connect flow. Use this if your LinkedIn dev app has legacy or +# enterprise products approved — e.g. `r_basicprofile` re-enables +# vanityName lookup via /v2/me. Leave empty for the safe default set. +# LINKEDIN_EXTRA_SCOPES=r_basicprofile # X / Twitter (https://developer.twitter.com) X_CLIENT_ID= diff --git a/app/Http/Controllers/Auth/LinkedInController.php b/app/Http/Controllers/Auth/LinkedInController.php index 4dd59e4e..c619d210 100644 --- a/app/Http/Controllers/Auth/LinkedInController.php +++ b/app/Http/Controllers/Auth/LinkedInController.php @@ -26,7 +26,6 @@ class LinkedInController extends SocialController 'openid', 'profile', 'email', - 'r_basicprofile', 'w_member_social', ]; @@ -42,7 +41,26 @@ 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, $this->resolveScopes()); + } + + /** + * Merge $this->scopes with any extra scopes the operator configured via + * `LINKEDIN_EXTRA_SCOPES` — comma-separated, e.g. `r_basicprofile`. Useful + * when the connected LinkedIn dev app has legacy or enterprise products + * not covered by the default Sign-In + Share-on-LinkedIn pair. + */ + protected function resolveScopes(): array + { + $extra = (string) config('services.linkedin.extra_scopes', ''); + + if ($extra === '') { + return $this->scopes; + } + + $extraScopes = array_filter(array_map('trim', explode(',', $extra))); + + return array_values(array_unique([...$this->scopes, ...$extraScopes])); } public function callback(Request $request): View diff --git a/config/services.php b/config/services.php index b6c194cc..f920d9ed 100644 --- a/config/services.php +++ b/config/services.php @@ -41,6 +41,12 @@ 'client_id' => env('LINKEDIN_CLIENT_ID'), 'client_secret' => env('LINKEDIN_CLIENT_SECRET'), 'redirect' => env('LINKEDIN_CLIENT_REDIRECT'), + // Comma-separated list of OAuth scopes to request beyond the defaults + // (openid, profile, email, w_member_social). Useful for apps with + // legacy or enterprise products approved — e.g. set + // `LINKEDIN_EXTRA_SCOPES=r_basicprofile` to re-enable vanityName + // lookup via /v2/me. + 'extra_scopes' => env('LINKEDIN_EXTRA_SCOPES'), ], 'linkedin-openid' => [ diff --git a/docker/.env.docker.example b/docker/.env.docker.example index aaacd5fd..e91739af 100644 --- a/docker/.env.docker.example +++ b/docker/.env.docker.example @@ -90,6 +90,11 @@ LINKEDIN_CLIENT_ID= LINKEDIN_CLIENT_SECRET= LINKEDIN_CLIENT_REDIRECT="${APP_URL}/accounts/linkedin/callback" LINKEDIN_PAGE_CLIENT_REDIRECT="${APP_URL}/accounts/linkedin-page/callback" +# Optional: comma-separated extra OAuth scopes appended to the personal +# LinkedIn connect flow. Use this if your LinkedIn dev app has legacy or +# enterprise products approved — e.g. `r_basicprofile` re-enables +# vanityName lookup via /v2/me. Leave empty for the safe default set. +# LINKEDIN_EXTRA_SCOPES=r_basicprofile X_CLIENT_ID= X_CLIENT_SECRET= diff --git a/tests/Feature/Social/LinkedInControllerTest.php b/tests/Feature/Social/LinkedInControllerTest.php index c95465a7..43fc5cf4 100644 --- a/tests/Feature/Social/LinkedInControllerTest.php +++ b/tests/Feature/Social/LinkedInControllerTest.php @@ -39,6 +39,69 @@ expect(session('social_connect_workspace'))->toBe($this->workspace->id); }); +test('linkedin connect requests the default scope set when LINKEDIN_EXTRA_SCOPES is unset', function () { + config(['services.linkedin.extra_scopes' => null]); + + $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); + + $this->actingAs($this->user) + ->withHeader('X-Inertia', 'true') + ->get(route('app.social.linkedin.connect')); + + expect($captured)->toEqualCanonicalizing([ + 'openid', 'profile', 'email', 'w_member_social', + ]); +}); + +test('linkedin connect appends LINKEDIN_EXTRA_SCOPES to the default scope set', function () { + // Backward-compatibility: ops who have legacy products approved on + // their LinkedIn app (e.g. r_basicprofile) opt back in via env. + config(['services.linkedin.extra_scopes' => 'r_basicprofile, r_emailaddress']); + + $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); + + $this->actingAs($this->user) + ->withHeader('X-Inertia', 'true') + ->get(route('app.social.linkedin.connect')); + + expect($captured)->toEqualCanonicalizing([ + 'openid', 'profile', 'email', 'w_member_social', + 'r_basicprofile', 'r_emailaddress', + ]); +}); + test('linkedin oauth callback creates account', function () { session([ 'social_connect_workspace' => $this->workspace->id, @@ -99,7 +162,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 +179,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', ]); }); From 159e1a34f314c4538e84504b07f4773e034980f4 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Wed, 10 Jun 2026 13:58:20 -0300 Subject: [PATCH 19/29] feat(PostEditorTabs): add a new component for managing post editing tabs including preview, schedule, and comments functionalities --- .../posts/editor/{PostEditorSidebar.vue => PostEditorTabs.vue} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename resources/js/components/posts/editor/{PostEditorSidebar.vue => PostEditorTabs.vue} (100%) diff --git a/resources/js/components/posts/editor/PostEditorSidebar.vue b/resources/js/components/posts/editor/PostEditorTabs.vue similarity index 100% rename from resources/js/components/posts/editor/PostEditorSidebar.vue rename to resources/js/components/posts/editor/PostEditorTabs.vue From 3fe70b1402435bb50ae0bfa20a96d09c40f8c190 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Wed, 10 Jun 2026 13:58:45 -0300 Subject: [PATCH 20/29] refactor(PostEditor): update PostEditorTabs integration and enhance schedule tab visibility logic --- package-lock.json | 1 - .../js/components/posts/editor/PostEditorTabs.vue | 2 +- resources/js/components/posts/editor/PreviewTab.vue | 2 +- resources/js/pages/posts/Edit.vue | 12 ++++++------ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 96a8f02c..bbf85de6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,7 +4,6 @@ "requires": true, "packages": { "": { - "name": "trypost", "dependencies": { "@inertiajs/vue3": "^3.0.0", "@tabler/icons-vue": "^3.36.1", diff --git a/resources/js/components/posts/editor/PostEditorTabs.vue b/resources/js/components/posts/editor/PostEditorTabs.vue index 6938ecb2..e175112c 100644 --- a/resources/js/components/posts/editor/PostEditorTabs.vue +++ b/resources/js/components/posts/editor/PostEditorTabs.vue @@ -107,7 +107,7 @@ defineExpose({ /> - + {
-
+
{ const initialHighlightCommentId = queryParams?.get('comment') ?? null; const activeTab = ref(initialTabFromQuery); const deleteModal = ref | null>(null); -const editorSidebarRef = ref | null>(null); +const editorTabsRef = ref | 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); }); @@ -402,8 +402,8 @@ usePostEcho(post.value.id, '.post.comment.created', (e: any) => {