Compare commits

..

435 Commits

Author SHA1 Message Date
84b33a7849 fix(auth): close JWT type-confusion bypass (upstream a5affe62)
Ports upstream's "fix: jwt bypass" into our fork. All of Postiz's JWT
tokens (login, password reset, team invite, integration no-auth action,
enterprise billing portal) are signed with the same secret and were only
checked for the presence of certain fields, not their type or mutual
exclusivity - so a token minted for one purpose (e.g. a password-reset or
team-invite link, which a recipient's browser sends on every request)
could be replayed against a different endpoint (billing, integration
actions, enterprise webhooks) that happened to accept a payload shaped
similarly enough.

Tightens every one of those JWT consumers to:
- require the expected fields to be the correct type (string), not just
  truthy
- reject payloads carrying fields unique to a different token kind
  (`timeLimit` = team invite, `expires` = password reset)
- cross-check `provider`/`providerIdentifier` on the no-auth integration
  action endpoint, closing a path where the wrong provider's integration
  could be targeted
- select only `id` from Prisma integration updates instead of returning
  the full row (defense in depth, matches the credential-model rule in
  CLAUDE.md)

No functional change for any legitimate token flow; verified with
`tsc --noEmit` on apps/backend (zero new errors vs the pre-cherry-pick
baseline - the handful of reported errors are pre-existing, unrelated
`noImplicitAny` issues in agent/media/email files this change never
touches).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-26 17:44:31 +03:00
8e84e2c343 docs: log round 3 build (internal approval workflow) 2026-10-24 01:16:16 +03:00
baa9f112db feat(posts): wire up internal approval workflow for queuing posts
Organization.requireApprovalForQueue and Post.pendingApproval existed in
the schema but were never wired up. Adds the ADMIN-only settings toggle,
gates a USER-level member's schedule/publish-now save behind it (held as
a pendingApproval draft instead), and gives ADMIN/SUPERADMIN approve/
reject actions both inline on the calendar card and in a dedicated
Pending Approvals list on the team settings page.
2026-10-24 01:15:39 +03:00
12ec89030d docs: log round 2 build and carry over round 1 architecture/strategy docs
Adds the round-1 architecture and strategy research docs that an
earlier session produced but never committed, and logs round 2's work
(public API bulk endpoints + webhook event filters verified, comment
mentions/assignment wired end to end, evergreen content recycling
built) with the remaining backlog and build verification notes.
2026-10-24 00:54:15 +03:00
1180195e7c feat(posts): add evergreen content recycling
The /compare/socialbee page shipped last round already claims Postiz
supports recycle-after-days evergreen content rotation, but the feature
didn't exist beyond an unused EvergreenRecycle Prisma model and a
RECYCLE enum value an earlier session had added and never wired up.
Built it for real so that claim is true.

- EvergreenRepository/EvergreenService (mirrors the existing
  PostEngagementRepository/Service pattern) - create/list/pause/
  resume/remove a recycle schedule for an already-published post, plus
  a bounded (25/run) runDueBatch() that clones a due post's
  content/media/settings into a brand-new Post (own id/group/Comments
  thread, CreationMethod.RECYCLE) through the same validatePosts ->
  mapTypeToPost -> createPost pipeline every other post-creation path
  uses. A failed entry is pushed one interval out instead of retried
  immediately; a schedule whose original post was deleted deactivates
  itself.
- New daily Temporal workflow evergreenRecycleWorkflow, modeled on the
  existing bestTimeToPostWorkflow infinite-loop pattern.
- POST|GET /posts/:id/evergreen and PUT|DELETE /posts/evergreen/:id;
  only an already-PUBLISHED post can get a recycle schedule.
- Frontend: a recycle-icon calendar action (published posts only)
  opening a modal to view/add/pause/remove recycle schedules.

Verified apps/backend, apps/orchestrator (nest build) and apps/frontend
(full production next build) all build clean with the already-generated
Prisma client.
2026-10-24 00:54:08 +03:00
6e962170ad feat(posts): wire comment @mentions and assignment end to end
Schema and some DTO/repository scaffolding for this already existed
uncommitted, but nothing called any of it - createPublicComment silently
dropped mentions/assignedToId even if a client sent them.

- createPublicComment resolves mentions/assignedToId against the org's
  team list and rejects anyone not a member, but only for an
  authenticated team member - the public no-auth preview link can never
  set either field, checked server-side rather than relying on DTO
  validation alone.
- New assignComment (+ PUT /posts/comments/:commentId/assign) to change
  or clear a root comment's assignee, same org/root-only restrictions as
  the existing resolveComment.
- New GET /posts/comments/team-members (any authenticated org member)
  backs the mention/assign pickers.
- NotificationService.notifyUser sends a best-effort per-user in-app
  notification on a mention or new assignment.
- Data-exposure fix: getComments is shared by the fully public preview
  GET and a new authenticated GET (/posts/:id/comments) - mentioned
  users' and assignees' names are only included once the caller is
  verified as a logged-in member of the post's own org, so an external
  reviewer on the public link never sees internal team member names.
  Frontend fetches from the authenticated route when logged into the
  owning org, the public route otherwise.
- Frontend: mention checkboxes + assign-to select in the composer,
  reassign control and a "cc:" line of mentioned names on each thread.

Verified apps/backend, apps/orchestrator, and apps/frontend (full
production next build, including /p/[id]) all build clean.
2026-10-24 00:53:49 +03:00
7b4bd338cd feat(public-api): add bulk post create/delete and webhook event filters
Finish an in-progress, uncommitted implementation of two backlog items:

- POST/DELETE /public/v1/posts/bulk (up to 25 creates / 50 deletes per
  call), sharing the single-post create/delete pipeline per item so one
  bad entry never aborts the batch.
- Webhooks.events (additive, empty = every event) lets a webhook
  subscribe to just post.published and/or post.failed instead of
  everything; wired into the publish and failure delivery paths plus a
  frontend checkbox picker.

Verified apps/backend, apps/orchestrator, and apps/frontend all build
clean with the generated Prisma client.
2026-10-24 00:53:35 +03:00
640c307cae docs: log round 1 build (webhook reliability, compare pages, build fix) 2026-10-23 15:35:16 +03:00
65da57ccc7 feat(frontend): add /compare/* competitor landing pages
Adds 7 bottom-of-funnel SEO/conversion pages (/compare/buffer,
hootsuite, later, socialbee, metricool, publer, mixpost) as a new
public route group under apps/frontend/src/app/(app)/(compare)/,
content-driven from compare.data.ts (pricing pulled from the live
pricing.ts config, competitor numbers from STRATEGY-2026-10-23.md's
sourced research) through a shared compare.page.component.tsx layout:
a 4-box structural-moat checklist, a pricing table, a feature
checklist, a verdict, and FAQ entries.

Also fixes proxy.ts (the app's auth middleware), which redirected
every signed-out visitor to /auth by default - without this, the new
pages would 307 for the exact anonymous-searcher audience they target.
Added /compare/ to the existing public-path allowlist alongside
/p/, /provider/, /uploads/.
2026-10-23 15:35:06 +03:00
4198fa47e4 fix(mastodon): match generateAuthUrl to the IAuthenticator interface
MastodonCustomProvider.generateAuthUrl declared (refresh?: string,
external?: ClientInformation) and called generateUrlDynamic with 5
arguments against its 4-argument signature, which doesn't type-check
against IAuthenticator.generateAuthUrl(clientInformation?) and broke
the apps/backend production build. The only real caller
(integrations.controller.ts) already passes a single ClientInformation
argument; align the signature to that and drop the unused refresh param.
2026-10-23 15:34:50 +03:00
88c724bbb3 feat(webhooks): sign, retry, and log webhook deliveries
Backend: adds a per-webhook HMAC-SHA256 signing secret, a WebhookDelivery
log model, and WebhooksService.sendWithRetry (3 attempts, exponential
backoff on 5xx/429/408, always persists the outcome). Wires the
orchestrator's post-publish webhook send and the manual /webhooks/send
test endpoint through it instead of a raw fetch with a silently
discarded failure. Adds secret regeneration and a paginated
deliveries/redeliver API.

Frontend: adds a delivery-log modal (apps/frontend/src/components/webhooks/webhook.deliveries.tsx)
with redeliver, a secret-reveal modal on create/regenerate, and wires
up the previously-dead "Regenerate secret" button.
2026-10-23 15:34:39 +03:00
32270f3f3a docs: add deep pages/APIs/features build plan 2026-10-23 06:55:44 +03:00
ba6d7f8796 fix: enable self-hosted Mastodon instances via the custom provider
MastodonCustomProvider was fully implemented but disabled in the
registry and inherited MastodonProvider's requiredEnvVars, which would
have blocked every self-hosted instance behind a "not configured on
this server" check even though it registers its own OAuth app per
instance via externalUrl() and needs no global env vars.

- re-enable registration in integration.manager.ts
- clear inherited requiredEnvVars, add a connect toolTip
- map the mastodon-custom identifier to the existing Mastodon composer
  component so posts to custom instances render instead of falling
  back to the empty composer
2026-10-23 06:54:58 +03:00
034d2023ea fix(auth): match cookie names exactly instead of by substring (closes #2135)
document.cookie.split(';').find(p => p.includes('auth=')) matched any
cookie whose string contains that substring, e.g. a `_pin_unauth`
cookie set by another app on the same parent domain. If it sorted
before the real `auth` cookie, Postiz sent it as the auth token, the
backend rejected it, and the user was bounced straight back to login.
Same substring bug existed for showorg/impersonate. Now matches the
exact cookie name via a shared getCookieValue() helper.
2026-10-22 03:33:02 +03:00
77b91f1437 docs: note the lack of a reachable live Postiz deployment
No Postiz container found on railyard-box (the only box reachable via
SSH this session); `box` 130.61.180.42 refuses SSH on port 22 and
recoder-micro rejects the shared deploy key, so neither could be
checked. Recorded as an owner-only blocker instead of guessing at a
deploy target.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 18:37:13 +03:00
3e1980a0db feat: let a team member leave an organization themselves
Previously the only way out of an organization you no longer wanted to
be part of was deleting your entire Postiz account - deleteTeamMember()
is admin-only (and, after the same-level/self fix in this series, never
allows removing yourself), and there was no self-service alternative.

Adds POST /settings/team/leave: OrganizationService.leaveOrganization()
removes the caller from their current org, blocking the two cases that
would otherwise break the account - leaving your only organization (the
auth middleware always needs at least one non-disabled org to fall back
into) and leaving as the organization's only Super Admin (nobody left
able to manage the team or billing). OrganizationRepository gains
countSuperAdmins() to check the latter.

The team settings page (teams.component.tsx) adds a "Leave organization"
button next to "Add another member", shown only when the user belongs to
more than one organization (reusing the 'organizations' SWR cache key
already used by the org switcher), following the existing confirm-dialog
and toast-on-error pattern used by member removal and invites.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 18:34:43 +03:00
e6d5302996 fix(security): block removing a same-level or self team member via the API
DELETE /settings/team/:id only blocked removal when the caller's role
level was strictly below the target's (`myLevel < userLevel`). The team
settings UI only ever shows the remove action when the caller's level is
strictly above the target's (teams.component.tsx:
`+myLevel > +getLevel(p.role)`) - it never lets you remove a same-level
peer or yourself. The backend was looser than the UI it backs: calling
the endpoint directly let a SUPERADMIN remove another SUPERADMIN, or
remove themselves - including as the organization's only SUPERADMIN,
orphaning the org with nobody left able to manage the team or billing.
Tightened the check to `myLevel <= userLevel` so the API can't do
anything the UI doesn't already allow. Account deletion's own cleanup
calls the repository method directly and is unaffected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 18:28:10 +03:00
782a88fdde fix: don't let one failing org stop a RevenueCat webhook from syncing the rest
processWebhook() looped over every organization id in a RevenueCat event
(app_user_id, original_app_user_id, transferred_from, transferred_to) and
awaited syncSubscription() for each with no try/catch. A TRANSFER event
carries both sides of the transfer, and a transient RevenueCat API error
or an unrecognized product id on the first organization threw out of the
loop, so later organizations in the same event were silently never
synced - exactly the "webhook throws -> billing state half-applied"
failure this codebase already calls out for Stripe/RevenueCat webhook
code. Each organization's sync is now wrapped individually and logs
instead of propagating, matching the console.error pattern already used
in SubscriptionService.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 18:28:02 +03:00
d8200a631c fix: show a clear error instead of sending an empty client ID to OAuth providers
On a self-hosted instance with a provider's *_CLIENT_ID/SECRET env vars
unset, "Add channel" still listed it and sent the user straight to the
provider with an empty or literal "undefined" client id - the provider's
own error page gave no hint that a Postiz env var was missing, and X's
failure was swallowed into a generic "Unknown Error" toast with nothing
logged server-side (closes #2238).

Adds a generic, provider-declared check instead of a provider-specific
if/else in shared code: SocialAbstract.missingEnvVars() filters each
provider's declared requiredEnvVars against process.env. Every OAuth
provider from the report now declares its required vars; GMB overrides
missingEnvVars() directly since it's configured via its own creds or a
fallback to YOUTUBE_CLIENT_ID/SECRET, not a plain AND of fixed names.
getIntegrationUrl() checks this before building the auth URL and returns
a message naming the missing vars instead of an empty-client-id redirect,
and its catch block now logs the provider and error message instead of
silently swallowing it. The frontend toast shows that message when
present.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 16:39:13 +03:00
e922a545e7 fix: re-check post state after the scheduling sleep, before publishing
The publish workflow only checked firstPost.state === 'QUEUE' once, at
workflow start, then slept until the scheduled publishDate - which can be
days or weeks out. Nothing re-validated the post's state after waking up,
so a post reverted to DRAFT, deleted, or otherwise moved out of QUEUE
during that wait still reached the provider once the sleep ended (#2275).

New post.workflow.v1.1.3 (post.workflow.v1.1.2 is already in production
and workflow files can't be edited in place) adds that re-check right
after the sleep, using the same "Already posted" ERROR path the pre-sleep
check already uses. startWorkflow() and the missing-posts sweep's
signalWithStart() both now start postWorkflowV113 for new executions;
already-running postWorkflowV112 executions keep running under their
original code.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 16:26:11 +03:00
cc2fecf2a7 fix: don't create a junk org when registering via a valid invite link
routeAuth() always called createOrgAndUser() for a new LOCAL registration
before checking for a pending invite, then only afterwards tried to also
add the user to the inviting org via addUserToOrg(). A user registering
through a valid invite link ended up SUPERADMIN of a brand-new throwaway
organization, with the invited org as a bonus membership rather than the
intended destination (closes #2199).

When a valid invite is present, create the user without an organization
and add them straight to the inviting org. Only fall back to a standalone
org if the invite can no longer be redeemed (already used, or the org hit
its seat limit), so the account never ends up with zero organizations.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 16:20:32 +03:00
344662a527 fix(security): allowlist methods callable via third-party function dispatch
/third-party/function/:id/:functionName let any authenticated org member
invoke ANY method found on a third-party provider instance (checkConnection,
sendData, or a future internal helper) just by naming it in the URL - no
allowlist, unlike the analogous video-function dispatch endpoint which
already guards with @ExposeVideoFunction/checkAvailableVideoFunction.

Add the same allowlist shape for third-party providers:
@ExposeThirdPartyFunction + checkAvailableThirdPartyFunction, mark the
handful of methods the frontend actually dispatches this way
(HeyGen generateVoice/voices/avatars, Reel.Farm listMedia), and reject
everything else with a 400 in ThirdPartyController#callFunction.

Added libraries/nestjs-libraries/src/3rdparties/thirdparty.manager.standalone.spec.ts
(RED before the interface export existed, GREEN after); full
*.standalone.spec.ts suite (8 suites/50 tests) still green.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 03:46:17 +03:00
60a29ee456 fix(x): surface X credits-depleted 402 as a clear error instead of Unknown Error
X's v2 API answers an out-of-credits post with an RFC 7807 problem response
(HTTP 402, body like {"detail":"credits depleted",...}). XProvider.handleErrors
had no case for this body, so fetch() fell through to its generic "Unknown
Error" bad-body message, leaving the bell notification and calendar card
tooltip with no real explanation for why the post never reached X (closes
gitroomhq/postiz-app#2231).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-20 15:44:39 +03:00
c43f517149 fix(security): redact sensitive headers from axios errors generically (#2220)
The Moltbook provider leaked its API key into error output via
AxiosError.config.headers; a prior fix sanitized every Moltbook call
site individually. This adds a second, broader layer: a response
interceptor on the shared axios instances every social provider gets
from getSsrfSafeAxios() redacts Authorization, Cookie, Set-Cookie,
Proxy-Authorization, X-Api-Key, Api-Key and X-Auth-Token from
error.config.headers before a rejected request can propagate to logs,
Sentry, or activity failure records.

This closes the same leak for providers that don't individually wrap
every axios call (confirmed real unsanitized-raw-AxiosError paths in
discord.provider.ts and dribbble.provider.ts), without touching the
global `axios` default export used elsewhere in the codebase.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-20 03:32:57 +03:00
8497a30e74 fix: carry the refresh token over when reconnecting an existing channel (closes #2233)
Reconnecting an existing OAuth channel (e.g. YouTube "Add Channel" on
an already-connected channel) creates a temporary integration holding
the fresh refreshToken/tokenExpiration, but saveProviderPage() only
forwards picture/internalId/name/token/profile to updateIntegration().
The temp record then gets soft-deleted and params (missing the refresh
token) is applied to the pre-existing record instead, so the new
refresh token is silently dropped and the channel breaks about an hour
later when the access token expires.

updateIntegration() now reads the temp record's refreshToken/
tokenExpiration before it's soft-deleted and carries them onto the
surviving record's params, but only when the caller didn't explicitly
pass a refreshToken (new-channel connections are unaffected).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-20 03:32:49 +03:00
0c785fd37c fix: don't require an off-session card hold for India-issued trial cards (closes #2245)
checkValidCard() placed a $1 off-session verification hold on every
trial signup. Per Stripe's India recurring-payments rules, networks
treat any off-session charge as recurring: without a mandate the hold
is declined outright, and even with one it sits in `processing` for
~26h and never reaches `requires_capture`. A valid India-issued card
that already passed 3DS/OTP at Checkout could never complete signup.

Skip the hold entirely for India-issued cards (card.country === 'IN'),
trusting the 3DS the Checkout Session already confirmed. Also fixes a
related bug on the failure path: it detached paymentMethods.data[0]
instead of the latestMethod actually being tested.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-20 03:32:44 +03:00
bb2b7fd0fe feat: add best-time-to-post suggestions backed by a bounded daily batch job
Adds the "best time to post" recommendation gap identified against
Buffer/Later, using the bounded design the prior session deliberately
held back instead of unbounded live provider calls per request:

- New PostEngagementSnapshot model: one row per post (upserted in place),
  storing UTC day-of-week/hour-of-day and an engagement score derived from
  the platform's own existing post analytics.
- New daily Temporal workflow (bestTimeToPostWorkflow, modeled on the
  existing missingPostWorkflow infinite-loop pattern) drains up to a hard
  capped number of published posts per run via PostEngagementService,
  reusing PostsService.checkPostAnalytics rather than any new live-call
  path. Expired-token integrations are skipped (not force-refreshed) to
  avoid a background job silently disconnecting a channel; transient
  provider failures are left as candidates for a later run instead of
  permanently excluding a post from its channel's recommendation.
- New read-only GET /analytics/best-time/:integration endpoint aggregates
  only the stored snapshots (plain DB groupBy, no provider calls), scoped
  to the calling org's integration.
- Frontend: a "Suggested Best Times" panel in the per-channel time-slot
  settings modal, with an explicit empty state when there isn't enough
  history yet (no fake data), and an "Add" action that feeds a suggestion
  straight into the existing autopost time-slot mechanism.

Also fixes an unrelated pre-existing implicit-any (TS7018) on the bulk
schedule post-validation payload in posts.service.ts, found while adding
test coverage for the new aggregation math.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-20 02:41:11 +03:00
0cd822caa1 feat: add CSV bulk scheduling and client-facing post approval
Closes two real feature-parity gaps vs Buffer/Hootsuite/Later found during
a competitive audit (calendar view and per-post/per-platform analytics
already existed in this codebase, so those were not duplicated):

- Bulk CSV scheduling: POST /posts/bulk-schedule schedules many posts from
  a pasted CSV (date,content), reusing the exact validatePosts ->
  mapTypeToPost -> createPost pipeline the single-post endpoint already
  uses, one row at a time, so a bad row never aborts the batch. Scoped to
  the providers that need no extra settings beyond __type (threads,
  mastodon, bluesky, telegram, nostr, vk) via new providerNeedsSettings()/
  simpleTextProviders() helpers derived from the existing allProviders()
  data, not a hardcoded per-provider branch. New "Bulk schedule from CSV"
  button next to Create Post in the launches sidebar; the channel picker
  fetches the supported-provider list from
  GET /posts/bulk-schedule/supported-providers instead of duplicating it.

- Client-facing approval: the public preview link already had a
  comments/review flow (recaptcha + reviewer-name capture) but no way for
  an external client to actually approve a draft. New
  POST /public/posts/:id/approve lets them flip a DRAFT post to QUEUE
  through the same changePostStatus() path the internal "schedule" button
  uses (so the Temporal publish workflow actually starts), and records a
  system comment (new additive Comments.isApproval boolean) so the
  approval shows in the thread. Only works on posts currently in DRAFT.

Schema: additive only (CreationMethod.BULK_CSV, Comments.isApproval
default false), applied via the existing prisma db push flow.

Also adds jest.standalone.config.js + a test:standalone script: this repo
has no working test runner (@nx/jest's getJestProjects() can't discover
anything without an nx.json), so the pure-logic units added here
(provider-capability check, CSV parsing) get a minimal, self-contained
ts-jest config instead of shipping untested.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-20 02:07:16 +03:00
91051e2e66 fix: retry Mastodon 503s with backoff like other providers
MastodonProvider's handleErrors had no case for HTTP 503, so a
temporarily-unavailable instance fell through to this.fetch's generic
`status === 500` retry branch, which 503 doesn't match, and failed the
post immediately. Add a 503 case returning type: 'retry', the same
pattern TumblrProvider already uses, so this.fetch's existing
retry-with-backoff (and runStreamedUpload's, for media uploads) kicks
in instead of failing on a transient outage.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 13:42:55 +03:00
86475231d1 fix: gate Stripe.js load behind the billing-enabled flag
loadStripe() injects the js.stripe.com script (and its fingerprinting
requests) as soon as it's called, regardless of whether the key is
valid, and FirstBillingComponent called it unconditionally on mount.
It relied entirely on its parent only rendering it when billing is on.
Check billingEnabled/stripeClient directly before loading Stripe so it
never loads when billing is disabled for this deployment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 13:42:52 +03:00
bf2998a3f9 fix: count Threads post length by Unicode codepoint, not UTF-8 bytes
countLength('threads', text) used TextEncoder().encode(text).length,
which counts UTF-8 bytes - 2 to 4 per non-ASCII character (accents,
CJK, emoji). That double/quadruple-counted real content against
Threads' 500-character limit in both the UI counter and backend
validation. Array.from(text).length counts actual codepoints, so every
character counts once regardless of encoding width.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 13:42:49 +03:00
456d84041f fix: stop Moltbook API key leaking via raw AxiosError
Every axios call in MoltbookProvider sent the agent's API key in an
Authorization header and let failures throw the raw AxiosError, which
carries the full request config (including that header) on
err.config/err.toJSON(). That raw error could reach logs, Sentry, or
activity failure details. Catch each call site and rethrow a plain
Error built only from the response status/body, never the config.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 13:42:46 +03:00
9203a696a6 fix: don't crash backend startup when Mastra/Postgres init fails
startMcp() connects Mastra to Postgres on first use; a DB outage or
misconfiguration there rejected start() before app.listen() ever ran,
taking down every route in the backend, not just /mcp and /copilot.
Wrap it in try/catch so a failure is logged and the rest of the
backend still boots.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 13:42:43 +03:00
Nevo David
08b1e6b46f Merge remote-tracking branch 'origin/main' 2026-10-15 22:23:33 +03:00
Nevo David
20609d33a0 feat: hubspot integration 2026-10-15 22:23:09 +03:00
Gilad Resisi
021c2ee076
Merge pull request #2266 from gitroomhq/feat/self-host-plus-jakarta-sans
fix(frontend): self-host Plus Jakarta Sans instead of next/font/google
2026-10-15 11:36:47 +00:00
Nevo David
adb8a1a7b2
Merge pull request #2269 from gitroomhq/fix/return-url-same-origin
fix(auth): only follow a returnUrl on this app after signing in
2026-10-15 13:55:39 +03:00
Nevo David
6634bb7e06
Merge pull request #2267 from gitroomhq/feat/hubspot-installed-modal
feat(hubspot): explain the HubSpot install on the calendar
2026-10-15 13:55:15 +03:00
Nevo David
9a88959839 fix(auth): only follow a returnUrl on this app after signing in
ReturnUrlComponent stored ?returnUrl= whenever it contained "http", and
layout.context sent the browser there after login or sign-up. That made the
login an open redirect, and a javascript: value could run script on the
Postiz origin. returnUrl is now kept only when it is an http(s) address on
the app's own origin, checked when it is stored and again when it is read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 13:49:26 +03:00
Nevo David
ef8c7b8c44 feat(hubspot): explain the HubSpot install on the calendar
The HubSpot app's redirect URL (/oauth/hubspot/callback) dropped people on
the bare calendar, so nothing said the install worked or what to do next.
It now lands on /launches?hubspot=installed, where HubspotInstalled opens a
modal with the next steps in HubSpot (Agent Builder > MCP Servers > Postiz
MCP) and then clears the param. returnUrl brings someone who has to sign in
first back to it. Two new strings in en and the 14 Lingo locales.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 13:40:07 +03:00
Nevo David
0956d49ab7 feat: hubspot 2026-10-15 12:53:26 +03:00
Gilad Resisi
ea9c820160 fix(frontend): self-host Plus Jakarta Sans instead of next/font/google
The frontend build fetched Plus Jakarta Sans from Google Fonts at build
time, and a few CI builds failed with "Can't resolve
'@vercel/turbopack-next/internal/font/google/font'". The font is now
loaded with next/font/local from woff2 files in the repo, so the build
no longer depends on Google.

The files are the variable fonts from tokotype/PlusJakartaSans commit
18d1cd2f (the same files google/fonts ships, SIL OFL 1.1, license
included), converted to woff2. All four layouts share one 500-700
upright + italic definition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 16:35:27 +07:00
Nevo David
d758146320 Merge remote-tracking branch 'origin/main' 2026-10-15 12:14:46 +03:00
Gilad Resisi
f4628143f6
Merge pull request #2265 from gitroomhq/fix/facebook-video-insights-metric
fix(facebook): stop requesting total_video_impressions in video post analytics
2026-10-15 09:04:06 +00:00
Gilad Resisi
b64b2c0048 fix(facebook): stop requesting total_video_impressions in video post analytics
Since early October the Graph API rejects total_video_impressions on the
video_insights edge with "(#100) The value must be a valid insights
metric", on reels and feed videos alike and on every API version. The
metric is requested together with the others in one call, so the whole
request fails and videoPostAnalytics returns [] for every Facebook video
and reel post. Production logs show 100+ such rejections per hour.

Drop the metric and its Impressions case; the remaining metrics
(total_video_views, total_video_reactions_by_type_total and the reels
ones) are still accepted individually and together.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-15 15:58:43 +07:00
Gilad Resisi
ba8cb48143
Merge pull request #2263 from gitroomhq/fix/pinterest-transient-error-main
fix(pinterest): retry transient 'Something went wrong on our end' errors
2026-10-15 08:44:07 +00:00
Gilad Resisi
fc29b82590
Merge pull request #2264 from gitroomhq/fix/vk-api-domain-ru
fix(vk): call VK ID and VK API on the vk.ru domains
2026-10-15 08:36:37 +00:00
Gilad Resisi
5a5da1aed4 fix(vk): call VK ID and VK API on the vk.ru domains
VK asked integrations to move from the vk.com hosts to vk.ru
(api.vk.ru, id.vk.ru) by 2025-09-30. Switch the authorize, token,
user_info and API method URLs; the post releaseURL links stay on vk.com.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 15:29:29 +07:00
Gilad Resisi
a7666b5e2b
Merge pull request #2258 from gitroomhq/fix/youtube-thumbnail-keep-release-url-main
fix(youtube): keep the video id and URL on a post that fails only at the thumbnail step
2026-10-15 07:37:52 +00:00
Gilad Resisi
304538bbac
Merge pull request #2235 from gitroomhq/mastra-protocol-update
fix(mcp): serve the streamable endpoints in Mastra's dual-era mode
2026-10-15 07:31:00 +00:00
Gilad Resisi
3168c1e148
Merge branch 'main' into fix/pinterest-transient-error-main 2026-10-15 12:47:33 +07:00
Gilad Resisi
18a312b6ba fix(pinterest): retry transient 'Something went wrong on our end' errors
Pinterest's pin creation endpoint intermittently answers with
{"code":2787,"message":"Sorry! Something went wrong on our end."}.
It was unmapped in handleErrors, so the post failed immediately as a
non-retryable BadBody with the 'Unknown Error' placeholder, even though
identical requests succeed minutes later.

Map it to a retry (3 attempts, 5s apart) with a curated message so a
short Pinterest hiccup no longer fails the post, and if it persists the
user sees what actually happened instead of 'Unknown Error'.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-15 12:33:46 +07:00
Gilad Resisi
05e8efb972
Merge pull request #2262 from gitroomhq/fix/telegram-connect-input-readonly
fix(telegram): mark connect command input as read-only
2026-10-15 05:29:24 +00:00
Gilad Resisi
388da50112
Merge pull request #2261 from gitroomhq/fix/instagram-media-fetch-retryable-main
fix(instagram): make 'Media fetch failed' (2207052) retryable
2026-10-15 05:20:00 +00:00
Gilad Resisi
aff38f99e6 fix(telegram): mark connect command input as read-only
The connect command input had a controlled value without onChange,
which made React log a console error when opening the Telegram
connect modal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 12:19:38 +07:00
Nevo David
7ca9c39ce6 Merge branch 'main' into feat/hubspot-mcp-oauth 2026-10-15 08:09:24 +03:00
Gilad Resisi
b95e1e2cb4 fix(instagram): make media fetch failed (2207052) retryable
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-15 12:05:19 +07:00
Gilad Resisi
cefb5e7c86
Merge pull request #2260 from gitroomhq/fix/instagram-collaborator-error-main
fix(instagram): report untaggable collaborators instead of "Unknown Error"
2026-10-15 04:24:46 +00:00
Gilad Resisi
c1fd5cffbe fix(instagram): report untaggable collaborators instead of "Unknown Error"
Instagram rejects a media container when a collaborator handle cannot be
tagged, with error_subcode 2207018 ("Invalid user id"). handleErrors had no
branch for it, so it fell through to the generic BadBody fallback and the
customer's failure email read "An error occurred while posting to Instagram:
Unknown Error", with nothing pointing at the collaborator tag.

Map 2207018 to a bad-body message naming the three real causes: wrong handle,
private account, or collaborator invites disabled. instagram.standalone
delegates to this handleErrors, so both channel types are covered.

Meta's own error_user_msg is not surfaced instead: it comes back localized to
the connected account's language (Hebrew, in the reproduction), so it is not
usable as user-facing text.

Verified against a live Instagram channel by creating a media container with
the customer's exact handle: pre-fix "Unknown Error", post-fix the new message.
2026-10-15 10:19:44 +07:00
Gilad Resisi
0c93578825
Merge pull request #2257 from gitroomhq/fix/youtube-thumbnail-verify-message-main
fix(youtube): clarify unverified-channel thumbnail error message
2026-10-15 02:50:26 +00:00
Gilad Resisi
23beddcd09 fix(youtube): keep the video id and URL on a post that fails only at the thumbnail step
The video is already live when thumbnails.set is rejected, but the post
ended in ERROR with no release URL, so users re-uploaded duplicates. The
provider now throws PublishedWithError with the video id and URL; the post
activity persists them through PostsService.updateResolvedRelease (the
existing org-scoped repository write, state untouched) and rethrows
BadBody, so every workflow version still marks the post ERROR while the
calendar can link to the live video.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 09:40:09 +07:00
Gilad Resisi
afdd37c11e
Merge pull request #2256 from gitroomhq/fix/instagram-comment-not-added
fix(instagram): map the rejected comment error 1772107 to a readable message
2026-10-15 02:26:46 +00:00
Gilad Resisi
b2897ff7d9 fix(youtube): clarify unverified-channel thumbnail error message
The youtube.thumbnail error mapping said 'Your account is not verified',
which customers read as their Postiz account/channel connection - one
customer disconnected and re-added their YouTube channel trying to fix
it. The video is actually live on YouTube in this scenario; only the
thumbnails.set call is rejected because custom thumbnails require a
phone-verified YouTube channel.

The new text states the video was published, names the real requirement
(phone-verified channel, youtube.com/verify) and tells the user how to
set this video's thumbnail manually in YouTube Studio.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-15 09:26:00 +07:00
Gilad Resisi
454553c4ff fix(instagram): map the rejected comment error 1772107 to a readable message
Meta returns subcode 1772107 ("Instagram Comment Not Added") from the
first comment call after the post itself was published. It fell back to
"Unknown Error", which hid it from the calendar tooltip and suggested
the whole post failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 09:21:33 +07:00
Gilad Resisi
6cac1d23f3
Merge pull request #2255 from gitroomhq/fix/posts-valid-crash
fix(frontend): handle a failed /posts/valid response in the post modal
2026-10-15 02:03:16 +00:00
Gilad Resisi
57e1a73c78
Merge pull request #2254 from gitroomhq/fix/invite-cookie-expiry-main
fix(auth): align invite and showorg cookie lifetimes with the token expiry
2026-10-15 02:03:07 +00:00
Gilad Resisi
81292402ed fix(frontend): handle a failed /posts/valid response in the post modal 2026-10-15 08:53:55 +07:00
Gilad Resisi
b958c5d591 fix(auth): align invite and showorg cookie lifetimes with the token expiry
The frontend proxy stored the team-invite token (org cookie) and the
selected-org cookie (showorg) for only 15 minutes. An invitee who opened
the invite link but finished signing up later lost the invite, even
though the link itself is valid for 2 days since #1643, and a member who
joined via the link fell back to the default org after 15 minutes.

Complementary to the invite token expiry extension in #1643: the org
cookie now lives 2 days to match the link, and showorg gets the same
365-day lifetime the backend already uses for it.
2026-10-15 08:36:12 +07:00
Nevo David
59a50e8bdf Merge remote-tracking branch 'origin/main' 2026-10-14 23:06:27 +03:00
Nevo David
668c971171 feat: delete tool 2026-10-14 23:03:45 +03:00
Gilad Resisi
25916f1274
Merge pull request #2253 from gitroomhq/feat/billing-ai-credits
feat(billing): show the renewal date and remaining AI credits on the billing page
2026-10-14 09:52:46 +00:00
Gilad Resisi
8cfe73a5f6
Merge branch 'main' into feat/billing-ai-credits 2026-10-14 16:44:27 +07:00
Gilad Resisi
5a982c60d6 fix(billing): wait for the stored period too before writing the confirmed plan
On a same-plan Monthly/Yearly switch the stored tier already matches
before the webhook, so the first poll wrote a stale snapshot that
reverted the period toggle and could restore cancelAt. showConfirmedPlan
now waits until both the stored tier and period match the change; the
webhook writes tier, period and cancelAt in one update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 16:34:18 +07:00
Gilad Resisi
f5963e74c8 fix(billing): refresh the card's totals and credits only once the new plan is stored
The in-place plan change only updates Stripe, the stored plan follows
with the webhook, so refetching the credits right away still returned
the old plan's. The billing cycle card now takes its plan from the
stored subscription and, after a plan change, polls /user/subscription
until it matches, then writes the three credit counts and the
subscription into the cache together. Any failure or a webhook slower
than about 10 seconds leaves the previous values in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 16:24:24 +07:00
Gilad Resisi
0688bccc81
Merge pull request #2249 from gitroomhq/feat/public-api-mentions
feat(linkedin): expose company mention lookup to the public API and MCP
2026-10-14 08:51:30 +00:00
Gilad Resisi
d561502032
Merge pull request #2248 from gitroomhq/fix/mention-dropdown-dark-mode
fix(editor): make the mention dropdown readable in dark mode
2026-10-14 08:37:22 +00:00
Gilad Resisi
7e6b155147 feat(billing): trial-aware renewal sentence, refresh the card after a plan change
getRenewalDate now returns { renewsAt, trialing }: while the Stripe
subscription is trialing, renewsAt is its trial_end and the card says
the free trial ends and the first payment is charged on that date.
After an in-place plan change the renewal date and the credits are
revalidated together with the invoices, so the counters don't mix the
new plan's totals with the old plan's remaining credits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 15:34:18 +07:00
Gilad Resisi
6b6073a3db
Merge branch 'main' into fix/mention-dropdown-dark-mode 2026-10-14 15:11:58 +07:00
Gilad Resisi
f824cc0c9a
Merge branch 'main' into feat/public-api-mentions 2026-10-14 15:11:47 +07:00
Gilad Resisi
0b22d994bb fix(linkedin): refresh expired tokens in the mention lookup
mention() used the global fetch and read elements without checking the
status, so a 401 surfaced as a TypeError instead of RefreshToken. The
public integration-trigger endpoint and the MCP triggerTool refresh and
retry on RefreshToken, so use SocialAbstract.fetch like the provider's
other calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 15:11:10 +07:00
Gilad Resisi
53d796ec8e fix(editor): highlight the keyboard-selected mention row
The global .dropdown-menu button rule sets a transparent background with
higher specificity than a plain Tailwind bg class, so the selected row's
bg-boxHover never showed and keyboard navigation had no visible cursor.
Use the dropdown's own hover color with the important modifier for the
selected row, and drop the hover class that the global rule overrode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 15:10:47 +07:00
Gilad Resisi
51795629ec feat(billing): show the renewal date and remaining AI credits on the billing page
Adds a Billing cycle card between the plans and the payment method card:
the next renewal date from the payment provider (new getRenewalDate on the
provider interface, null by default, Stripe reads current_period_end of the
live subscription) via GET /billing/renewal, and the remaining AI images,
AI videos and clipping minutes of the current month from the existing
/copilot/credits endpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 14:57:16 +07:00
Gilad Resisi
6e8ef482d5
Merge pull request #2247 from gitroomhq/fix/public-delete-post-response
fix(posts): return the deleted post id from public API deletes
2026-10-14 07:02:41 +00:00
Gilad Resisi
8c75711800
Merge pull request #2242 from gitroomhq/fix/vk-upload-api-errors
fix(vk): surface VK API errors from the media upload calls
2026-10-14 07:02:18 +00:00
Gilad Resisi
b664f5f97f
Merge pull request #2241 from gitroomhq/fix/default-org-prefer-subscribed-main
fix(auth): prefer an org with a subscription as the default active org
2026-10-14 06:48:55 +00:00
Gilad Resisi
1004ca9232
Merge pull request #2240 from gitroomhq/fix/tiktok-business-image-size
fix(tiktok): pre-check image sizes on TikTok Business channels
2026-10-14 06:48:06 +00:00
Gilad Resisi
8b84937c19
Merge pull request #2239 from gitroomhq/fix/instagram-generic-container-error
fix(instagram): show the fallback message when the container status carries no detail
2026-10-14 06:46:02 +00:00
Gilad Resisi
26c4c3ba68
Merge pull request #2237 from gitroomhq/fix/downgrade-dialog-team-members
fix(billing): warn about team members only when they exist, and say they are disabled
2026-10-14 06:42:12 +00:00
Gilad Resisi
5356052965
Merge pull request #2236 from gitroomhq/fix/delete-account-cancel-and-remove-members
fix(account): cancel the subscription and remove team members on account deletion
2026-10-14 06:41:41 +00:00
Nevo David
6f4156afcb Merge remote-tracking branch 'origin/main' 2026-10-14 08:06:44 +03:00
Nevo David
a36eada0aa feat: cancel 2026-10-14 08:06:34 +03:00
Nevo David
b1a28b17eb feat: hubspot 2026-10-14 08:04:22 +03:00
Gilad Resisi
c0fee9eaa0 feat(linkedin): expose company mention lookup to the public API and MCP
Mark LinkedinProvider.mention() as a @Tool so the existing company page
lookup (exact vanity name) is listed in integration settings and callable
through the public integration-trigger endpoint, the CLI and the MCP
triggerTool. The returned id and label are used in a data-mention span,
which the existing publish path already converts to a LinkedIn
organization mention.

Tell agents about it: integrationSchema says its tools can include a
mention lookup, and the post content description allows the mention span.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 19:10:36 +07:00
Gilad Resisi
2775f59ae9 fix(editor): make the mention dropdown readable in dark mode
The @mention suggestion list used hardcoded light colors (bg-white,
text-gray-800, bg-blue-100). In dark mode bg-white resolves to the dark
background while the label stays near-black, so results were invisible
and the list looked empty. Use the theme tokens the other menus use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 18:57:04 +07:00
Gilad Resisi
b1d72df532 fix(posts): return the deleted post id from deletePost
PostsService.deletePost always returned { error: true }, even after
soft-deleting the post group, so both public API delete routes reported
an error on success. The success return was dropped when the method was
rewritten for Temporal workflow termination. Restore { id } on success;
{ error: true } stays for a group that matches no post.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 18:54:30 +07:00
Gilad Resisi
b757cdf007 fix(vk): surface VK API errors from the media upload calls
VK answers HTTP 200 with { error } instead of { response } on failures.
#2131 classified those bodies for wall.post and wall.createComment, but
uploadMedia still read all.response.upload_url and saved.response[0]
unchecked, so any VK error on photos.getWallUploadServer, video.save or
photos.saveWallPhoto became "Cannot read properties of undefined". That
unknown error exhausted the retries and ended in markUnconfirmed, telling
the user to check VK for a post that was never sent, with VK's actual
reason lost.

Run the existing checkApiError on both upload responses, so code 5 goes
through the token refresh, 6/9/29 retry, and anything else is a BadBody
carrying VK's error_msg. The success path is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 09:46:09 +07:00
Gilad Resisi
5f6008bba0 fix(auth): prefer an org with a subscription as the default active org
When no showorg cookie is set (or it no longer matches), the auth
middleware fell back to the first org of an unordered query. Invited
team members who also own an empty personal org could land behind the
paywall instead of in the paid team org they joined. Prefer an org that
has a subscription before falling back to the first one. An explicit
showorg cookie still wins.
2026-10-13 08:52:40 +07:00
Gilad Resisi
a15f6ea302 fix(tiktok): pre-check image sizes on TikTok Business channels
A customer sent the same carousel of 2172x2896 images (Inbox UPLOAD) to
four TikTok channels on 2026-10-12. The three regular TikTok channels
rejected it at creation with the 1080px shorter-side check added in
96e46cfe, while the TikTok Business channel accepted it and then failed
at publish with picture_size_check_failed. The same images resized to
1080x1440 published on all four.

The limit is TikTok's and applies to both providers; only the regular
provider checked it up front. TiktokBusinessProvider.checkValidity now
runs the same measurement, and its picture_size_check_failed mapping uses
the corrected message from 96e46cfe instead of "Picture must not exceed
1080x1920".

Posts already scheduled on Business channels are not re-validated, since
checkValidity only runs on create/update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 08:21:00 +07:00
Gilad Resisi
38918c2f98 fix(instagram): show the fallback message when the container status carries no detail
When a media container ends in status_code ERROR, Meta can return the same
literal ("ERROR") in the status field and no error code. The provider used
status as the message ahead of the fallback, so the post showed only "ERROR".

Treat a status identical to status_code as empty so the existing fallback,
"Instagram could not process the media", is used. Real status details still
go through handleErrors and are used as before.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-13 07:55:10 +07:00
Gilad Resisi
bc7b7d4707 fix(billing): keep the downgrade warning when the team list cannot be loaded
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 23:24:11 +07:00
Gilad Resisi
100a105d1a
Merge branch 'main' into mastra-protocol-update 2026-10-12 20:04:22 +07:00
Gilad Resisi
41f23e9d52 fix(account): cancel the subscription and remove team members on account deletion
Deleting an account was blocked with "Please remove your team members
before deleting your account" whenever the org had any other member. When a
plan loses team members the subscription flow only disables them, it does not
remove them, so an owner of a cancelled org who could not reach the team
settings (billing paywall) was stuck and could never delete the account.

The owner's explicit confirmation now covers both effects instead:
- GET /user/delete-account-info returns hasSubscription / hasAdditionalMembers
  across the orgs the user owns, and the confirmation dialog states that the
  subscription will be cancelled and/or the additional team members removed
  from the organization (four text variants).
- deleteAccount removes every other member of each deleted org, whether the
  subscription is still active or already cancelled (members disabled).
- An org with another SUPERADMIN is not treated as owned: deleting the
  account only removes the user from it and the org is left untouched.

Subscription cancellation itself is unchanged (cancelAllSubscriptions in the
controller, before deleteAccount).

Verified end to end in Stripe test mode with stripe listen: an org with an
active subscription and an enabled member, and an org whose subscription was
already cancelled with a disabled member, were both deleted; the Stripe
subscription ended up canceled, the Subscription row was removed and the
members kept their own orgs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 19:56:44 +07:00
Gilad Resisi
97d14d0138 fix(billing): warn about team members only when they exist, and say they are disabled
The downgrade and cancel confirmations always said "Your team members will
be removed from your organization" when moving from a plan with team members
to one without, even for an org with no members. They are not removed: the
subscription flow only sets userOrganization.disabled, and a later upgrade to
a team plan re-enables them.

moveToCheckout now loads /settings/team and adds the message only when the
org has a member other than the current user (or the list cannot be read),
and the text says the members are disabled until the org is on a plan that
includes team members again.

Verified end to end in Stripe test mode with stripe listen: a TEAM org with
a member downgraded to STANDARD (webhook disabled the member) and upgraded
back to TEAM (webhook re-enabled it).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 19:56:44 +07:00
Gilad Resisi
5ead635170 fix(mcp): serve the streamable endpoints in Mastra's dual-era mode
Set protocolVersion '2026-07-28' on the five streamable-HTTP MCPServer
instances (the legacy /sse/:id server keeps its config) and drop the
enableJsonResponse option the mode does not accept. Mastra then serves
2026-07-28 clients natively and 2025-era clients through the SDK's
stateless fallback, which answers GET/DELETE with 405 and runs on the
SDK's Node adapter instead of the @hono/node-server pump that held dead
SSE streams forever.

2026-07-28 clients open a subscriptions/listen stream for the whole
session; the tool lists never change, so endListenStream ends those
responses after 10 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 19:25:44 +07:00
Gilad Resisi
3a7d28b7ad
Merge pull request #2234 from gitroomhq/fix/instagram-2207053-video-limits
fix(instagram): point error 2207053 at Instagram's video limits
2026-10-12 06:11:11 +00:00
Gilad Resisi
93b1a2a642 fix(instagram): point error 2207053 at Instagram's video limits
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 08:32:09 +07:00
Gilad Resisi
91c91f633a
Merge pull request #1884 from gitroomhq/fix/google-workspace-session-observability
fix(integrations): reconnecting a channel wiped its stored refresh token
2026-10-09 08:22:39 +00:00
Gilad Resisi
7db798f0a1
Merge branch 'main' into fix/google-workspace-session-observability 2026-10-09 14:53:05 +07:00
Gilad Resisi
6c50457015
Merge pull request #2226 from gitroomhq/fix/delete-account-ignore-disabled-members
fix(account): ignore disabled team members when deleting an account
2026-10-09 03:10:22 +00:00
Gilad Resisi
d6f881a89a fix(account): ignore disabled members when checking account deletion
Cancelling a subscription that includes team members disables the
non-owner members (userOrganization.disabled = true) without removing
them. The delete-account guard counted those disabled rows too, so an
owner with a cancelled plan (stuck on the billing page, unable to reach
the team settings to remove anyone) could never delete their account.

getTeam now selects the member's disabled flag and the guard only
blocks on active members other than the owner.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 09:49:05 +07:00
Gilad Resisi
0d486f75e8 Merge origin/main into fix/google-workspace-session-observability
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 09:33:10 +07:00
Gilad Resisi
bc61335b05
Merge pull request #2225 from gitroomhq/fix/log-social-connect-auth-failure
fix(integrations): log the error behind "Authentication failed" on social connect
2026-10-09 02:16:52 +00:00
Gilad Resisi
2e2d8ed00b fix(integrations): log the error behind "Authentication failed" on social connect
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 09:09:28 +07:00
Enno Gelhaus
4c5d42a92f
feat: superadmin public api endpoint to reset an org's ai credits 2026-10-08 22:41:53 +02:00
Nevo David
8f3c38ab15 feat: fix invoices 2026-10-08 19:03:07 +07:00
Nevo David
3bd88cee91 feat: professional billing 2026-10-08 18:27:50 +07:00
Nevo David
5ac6e10f5e feat: fix icon 2026-10-08 17:00:50 +07:00
Nevo David
0969ce7a3c Merge remote-tracking branch 'origin/main' 2026-10-08 16:47:52 +07:00
Nevo David
7b29d401dc feat: move menu items 2026-10-08 16:47:20 +07:00
Gilad Resisi
2361947867
Merge pull request #2221 from gitroomhq/fix/calendar-icon-order
fix(calendar): put Delete right-most in the post hover bar, after Preview and Duplicate
2026-10-08 08:53:29 +00:00
Gilad Resisi
adf1a8f500 fix(calendar): put Delete right-most in the post hover bar, after Preview and Duplicate
Complements #2204: the hover icons now end with Preview, Duplicate, Delete,
so Duplicate sits between Preview and Delete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 15:45:43 +07:00
Nevo David
003a77eb2e feat: fix settings 2026-10-08 15:43:17 +07:00
Nevo David
3f848ccb62 fix: remove data loss 2026-10-08 13:51:58 +07:00
Nevo David
a9cdda5deb Merge remote-tracking branch 'origin/fix/scope-sensitive-responses' 2026-10-08 12:03:10 +07:00
Nevo David
47175b5af1 feat: calendar line 2026-10-08 12:01:54 +07:00
Nevo David
e756fa5743 fix: responsive 2026-10-07 23:31:48 +07:00
Nevo David
a194e3f487 feat: group schedules 2026-10-07 21:30:14 +07:00
Gilad Resisi
3128e870e6
Merge pull request #2212 from gitroomhq/feat/tiktok-upload-draft-resolve
feat(tiktok): connect UPLOAD drafts to the published post from the open-post icon
2026-10-07 06:10:39 +00:00
Gilad Resisi
00ff699159
Merge pull request #2211 from gitroomhq/fix/open-post-pending-and-photo-url
fix(calendar): open-post icon handles TikTok photo posts and links that are not ready
2026-10-07 05:57:59 +00:00
Gilad Resisi
24b77c246e
Merge pull request #2217 from gitroomhq/fix/date-picker-time-format-main
fix(frontend): honor the AM/PM date metric in the post date picker time input
2026-10-07 04:06:14 +00:00
Gilad Resisi
80d527b489 fix(frontend): honor the AM/PM date metric in the post date picker time input
The TimeInput inside the editor's date picker popup always rendered 24h,
ignoring the Date Metrics setting that the rest of the UI respects.
2026-10-07 10:59:52 +07:00
Gilad Resisi
07745d1a84
Merge pull request #1926 from gitroomhq/feat/media-list
feat: list media via public API and MCP mediaListTool
2026-10-07 03:40:40 +00:00
Gilad Resisi
fd0480f747
Merge branch 'main' into feat/media-list 2026-10-07 10:35:35 +07:00
Gilad Resisi
dda966e44f fix: validate page input on mediaListTool
A negative page passed the zod schema, survived the `|| 1` fallback and
reached Prisma as a negative skip, which throws. The tool now requires an
integer >= 1, like GetMediaDto does for the REST route.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-07 10:33:42 +07:00
Gilad Resisi
4be38e1a97 fix: return only media-owned fields from the media list API and tool
alt, thumbnail and thumbnailTimestamp are the values last saved from some
post's media settings dialog (the post keeps its own copy), so they do not
describe the file. The public route and mediaListTool now return only id,
name, originalName, path and createdAt.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-07 10:24:03 +07:00
Gilad Resisi
e7b8126b87 fix: drop type and fileSize from the media list response
Both columns are never written on upload (every row keeps the schema
defaults 'image' and 0, so videos report 'image' and fileSize is 0 for
almost every row), which would mislead API and MCP callers. getMedia now
only adds createdAt on top of the existing select.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-07 09:46:12 +07:00
Gilad Resisi
1396b215f2
Merge pull request #2216 from gitroomhq/feat/upload-tool-hints
feat: point MCP upload tools to the CLI and public API for private files
2026-10-07 02:37:31 +00:00
Gilad Resisi
0992c46058 feat: point MCP upload tools to the CLI and public API for private files
uploadFromUrlTool only accepts a public http(s) URL, and its description,
its fetch error and uploadWidgetTool's fallback line never mentioned another
route, so a private local file hit a dead end. The descriptions and the
fetch error now point to the Postiz CLI (postiz upload) and POST
/public/v1/upload, and uploadWidgetStatusTool says it lists only the files
of one widget session. Strings only, no behavior or schema change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-07 09:32:16 +07:00
Gilad Resisi
c45ce4a7d3
Merge pull request #2215 from gitroomhq/fix/instagram-trial-reel-limit-mapping
fix(instagram): map the Trial Reel publish limit error to a readable message
2026-10-07 02:10:58 +00:00
Gilad Resisi
05c9690589 Merge remote-tracking branch 'origin/main' into feat/media-list
# Conflicts:
#	apps/backend/src/public-api/routes/v1/public.integrations.controller.ts
#	libraries/nestjs-libraries/src/chat/tools/tool.list.ts
2026-10-07 08:59:41 +07:00
Gilad Resisi
66d210186d fix(instagram): map the Trial Reel publish limit error to a readable message
Meta rejects Trial Reels with code 9 / subcode 2207078 once the account
exceeds the Content Publishing API trial reel limit. The error had no
mapping, so the calendar showed "Unknown Error". Map it to a curated
non-retryable message.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-07 08:41:49 +07:00
Gilad Resisi
541c7a454c fix(tiktok-business): store the post URL when a post is connected by hand
TiktokBusinessProvider had no releaseUrl, so a Business post connected
through Connect Post kept the TikTok messages page as its link.

It now returns https://www.tiktok.com/@<profile>/video/<id>, the same form
the provider builds when a post publishes. No API call is made. TikTok
redirects that URL to /photo/<id> for photo posts.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-06 19:32:14 +07:00
Gilad Resisi
6eed47e0af feat(tiktok): connect UPLOAD drafts to the published post from the open-post icon
A TikTok UPLOAD post is a draft in the user's inbox, stored with releaseId
"missing" and the TikTok messages page as its link. Linking it to the post
the user later publishes was only possible through the manual Connect Post
picker, and a connected post kept the messages page as its URL.

- checkPostStatus (both TikTok providers) keeps "missing" and appends the
  publish id to the stored messages URL as a fragment. "missing" is a
  documented contract for API, CLI and agent clients, so it must not change;
  a fragment is never sent to TikTok and the link still opens the inbox.
- resolveReleaseId now also receives the stored releaseURL, reads the
  publish id from the fragment and returns the real post id and URL once
  TikTok reports them. While TikTok reports no public post for the draft it
  returns nothing, so the icon keeps opening the inbox. Posts without a
  fragment (stored before this change) return before any request.
- Connecting by hand also stores the post URL: updateReleaseId asks the
  provider's new optional releaseUrl (TikTok video/query share_url, query
  string stripped) and writes it with the id. A failed lookup never fails
  the connect.

Connect Post, the missing-content and release-id endpoints, the "missing"
guard and checkPostAnalytics behave as before.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-06 19:19:03 +07:00
Enno Gelhaus
22c0341880
Merge pull request #2210 from gitroomhq/egelhaus-patch-1
feat(sponsors): re-add chatbotx to readme
2026-10-06 13:03:05 +02:00
Enno Gelhaus
bf89e2ed8b
feat(sponsors): re-add chatbotx to readme 2026-10-06 13:02:06 +02:00
Gilad Resisi
506d9a03db chore(i18n): translations for the open-post link toasts
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-06 17:47:25 +07:00
Gilad Resisi
6f79545d4a fix(calendar): open-post icon no longer lands on a wrong or missing TikTok link
The open-post icon could send the user to their TikTok profile, or to a
page TikTok rejects, when the post link was not usable yet.

- Photo posts: both TikTok providers now build /photo/<id> for photo posts
  (publish ids starting with p_pub_) instead of /video/<id>, in
  checkPostStatus and resolveReleaseId. TikTok answered 403 for the /video/
  path of a freshly published photo post.
- Link not released yet: resolveReleaseId returns { pending: true } while
  TikTok has no public id, and the icon shows a "try again in a minute"
  toast instead of opening the profile. The same toast covers a request
  that fails or takes longer than 5 seconds.
- No public link: only-me and friends-only posts never get a public id, so
  the resolver (which now receives the post settings) returns
  { unavailable: true } without calling TikTok and the icon shows
  "This post has no public link".
- Token handling: getReleaseURL no longer refreshes an expired token up
  front. It refreshes only after the platform rejects the token and retries
  once, so a post whose link is already resolved never touches the platform
  or the channel. When that refresh fails the icon shows a "reconnect this
  channel" toast.

The tab is still opened in the click and closed again when there is nothing
to open, so popup blockers keep allowing it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-06 17:47:25 +07:00
Gilad Resisi
afa30c6534
Merge pull request #2209 from gitroomhq/rtl-auto-direction-main
feat: auto text direction (RTL) in composer editor and previews
2026-10-06 08:12:21 +00:00
Nevo David
c3743d9e79 feat: creation modal 2026-10-06 15:03:41 +07:00
Nevo David
48aa7e2cce feat: new creation modal 2026-10-06 15:01:54 +07:00
Gilad Resisi
109e8d4caf
Merge pull request #2208 from gitroomhq/fix/refresh-channel-limit
fix(permissions): look up the refreshed channel by internalId in the channel limit check
2026-10-06 07:55:38 +00:00
Gilad Resisi
326719b338 fix(permissions): look up the refreshed channel by internalId in the channel limit check
The refresh bypass in the channel limit check looked the channel up by its DB id, but the frontend sends the provider-side internalId in ?refresh=. The lookup never matched, so refreshing a channel on an org at its exact channel cap was rejected as if it were a new channel.

Use an org-scoped internalId lookup (existing repository method) for the bypass; getIntegrationById and its other callers are unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-06 14:45:14 +07:00
Gilad Resisi
080783772f fix: markdown conversion regexes tolerate paragraph and heading attributes 2026-10-06 14:24:26 +07:00
Gilad Resisi
ec01d3310e fix: match paragraph tag shape when detecting HTML content 2026-10-06 14:24:26 +07:00
Gilad Resisi
53ea9c8f89 fix: handle p tags with attributes and isolate IG caption direction 2026-10-06 14:24:26 +07:00
Gilad Resisi
75cb2f8356 fix: allow dir attribute through post content sanitizer 2026-10-06 14:24:26 +07:00
Gilad Resisi
1d4b75faa2 feat: auto text direction (RTL) in composer editor and previews 2026-10-06 14:24:26 +07:00
Gilad Resisi
5cfdcccbc0
Merge pull request #2206 from gitroomhq/feat/calendar-published-post-frame
feat(calendar): frame published posts in green with a checkmark
2026-10-06 07:07:26 +00:00
Gilad Resisi
fffe4faf67 fix(calendar): anchor the post state badges with start instead of left so they follow RTL
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-06 13:59:06 +07:00
Gilad Resisi
86ba0f47b6
Merge pull request #2205 from gitroomhq/feat/calendar-channel-filter
feat(calendar): channel multi-select filter above the calendar
2026-10-06 06:56:08 +00:00
Gilad Resisi
f05a0498b5
Merge pull request #2204 from gitroomhq/fix/calendar-delete-red
fix(calendar): make the post delete icon and confirmation red, swap Delete and Preview
2026-10-06 06:55:54 +00:00
Gilad Resisi
5007164ffb
Merge pull request #2203 from gitroomhq/feat/settings-authentication
feat: show login method in Global Settings
2026-10-06 06:55:41 +00:00
Gilad Resisi
1e57cd33cc
Merge pull request #2207 from gitroomhq/fix/find-slot-all-disabled-main
fix(posts): find-slot never responds when all channels are disabled
2026-10-06 06:55:21 +00:00
Gilad Resisi
4990043069 fix(posts): find-slot never responds when all channels are disabled
When an organization has integrations but every one of them is disabled
(e.g. after a trial expired), getPostingTimes returns no rows, so
findFreeDateTimeRecursive receives an empty times list, gets an empty
result for every day, and recurses forever - GET /posts/find-slot never
responds and the Create Post button silently does nothing.

Fall back to the schema-default posting times [120, 400, 700] when no
enabled integration contributes times, and cap the recursive search at
365 days as a safety net so no empty/exhausted times list can ever loop
forever.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYTuLLhYQsLCdgxBFEXpG9
2026-10-06 13:37:37 +07:00
Gilad Resisi
2a2c85c496 fix(calendar): filter list view by channel on the server
The list view paginates server-side, so filtering the 100-post page on the
client left the total page count wrong. /posts/list now accepts an optional
integrations param (comma-separated channel ids) and the repository filters
and counts by it. The calendar grid still filters on the client.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-06 13:35:17 +07:00
Gilad Resisi
f0113c7424 chore(i18n): translations for the channel filter keys
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-06 12:43:43 +07:00
Gilad Resisi
9bf96ebcaf feat(calendar): add channel multi-select filter above the calendar
Customers kept requesting a way to show only some channels' posts in the
calendar. Adds a filter icon button next to the customer selector that opens
a scrollable multi-select list with a select/deselect-all row. The filter is
client-side, applies to the calendar and list views, resets when the customer
changes, and only lists the selected customer's channels.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-06 12:43:43 +07:00
Gilad Resisi
743b996924 fix: show Apple login in Authentication settings
The provider lookup had no APPLE entry, so the Authentication section
rendered nothing for users who sign in with Apple. Adds the entry (label
and email) and the auth_method_apple translation for all locales.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-06 10:56:10 +07:00
Gilad Resisi
169c66aaeb fix(calendar): make the post delete icon and confirmation red, swap Delete and Preview
The calendar's delete icon sits right next to Preview and its confirmation
looks like any other dialog, so a mis-click is easy to confirm unnoticed.

The delete icon is now red, the Delete and Preview icons swap places so they
are no longer adjacent, and the confirmation opens with a red frame and a red
approve button. The red styling is opt-in through a new destructive flag on
deleteDialog / areYouSure / the modal shell, passed only by the calendar post
delete, so every other confirmation keeps its current look.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-06 10:31:51 +07:00
Gilad Resisi
b08bad8433 feat(calendar): frame published posts in green with a checkmark
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-05 17:52:54 +07:00
Gilad Resisi
b95168ff1a feat: show login method in Global Settings
Adds an Authentication section at the top of Global Settings that shows
how the user logs in, read from the existing User columns (providerName,
email). Password and GitHub/Google logins show the email; Farcaster,
Wallet and generic SSO show the label only. Translations added for all
locales.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-05 17:25:20 +07:00
Gilad Resisi
86b3c3dd55
Merge pull request #2061 from gitroomhq/fix/duplicate-subscriptions
fix: guard against duplicate Stripe subscriptions per customer
2026-10-05 09:11:45 +00:00
Gilad Resisi
ac65e200a7 fix: never treat incomplete Stripe subscriptions as live 2026-10-05 15:51:48 +07:00
Gilad Resisi
78558e933f
Merge pull request #2160 from gitroomhq/fix/enable-channels-on-upgrade-main
feat(subscription): re-enable disabled channels when the new plan can hold all of them
2026-10-05 08:49:18 +00:00
Gilad Resisi
4913031d9b fix: skip cancelling an already-cancelled duplicate on webhook retry 2026-10-05 12:52:41 +07:00
Gilad Resisi
8ad0df3df0 fix(api): return only the needed fields from channel delete and the organizations list
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-05 12:52:22 +07:00
Gilad Resisi
2b4fcbed7c fix(subscription): log webhook-path failures instead of swallowing them
The catches around modifySubscription / modifySubscriptionByOrg in
createOrUpdateSubscription(ByOrg) returned {} without logging, so a failure
there silently skipped writing the subscription row. They now log the error.
The channel re-enable calls are wrapped so a failure is logged and the rest
of the subscription update still runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 12:49:32 +07:00
Gilad Resisi
5d8ce5aa42
Merge pull request #2202 from gitroomhq/docs/webhook-no-throw-rule
docs(claude): code invoked by external webhooks must not throw
2026-10-05 05:46:02 +00:00
Gilad Resisi
2917384a9b Merge remote-tracking branch 'origin/main' into fix/enable-channels-on-upgrade-main
# Conflicts:
#	i18n.lock
#	libraries/react-shared-libraries/src/translation/locales/ar/translation.json
#	libraries/react-shared-libraries/src/translation/locales/bn/translation.json
#	libraries/react-shared-libraries/src/translation/locales/de/translation.json
#	libraries/react-shared-libraries/src/translation/locales/en/translation.json
#	libraries/react-shared-libraries/src/translation/locales/es/translation.json
#	libraries/react-shared-libraries/src/translation/locales/fr/translation.json
#	libraries/react-shared-libraries/src/translation/locales/he/translation.json
#	libraries/react-shared-libraries/src/translation/locales/it/translation.json
#	libraries/react-shared-libraries/src/translation/locales/ja/translation.json
#	libraries/react-shared-libraries/src/translation/locales/ko/translation.json
#	libraries/react-shared-libraries/src/translation/locales/pt/translation.json
#	libraries/react-shared-libraries/src/translation/locales/ru/translation.json
#	libraries/react-shared-libraries/src/translation/locales/tr/translation.json
#	libraries/react-shared-libraries/src/translation/locales/vi/translation.json
#	libraries/react-shared-libraries/src/translation/locales/zh/translation.json
2026-10-05 12:45:31 +07:00
Gilad Resisi
256f2b468f docs(claude): code invoked by external webhooks must not throw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 12:41:26 +07:00
Gilad Resisi
8809e456e8 Merge remote-tracking branch 'origin/main' into fix/duplicate-subscriptions
# Conflicts:
#	libraries/nestjs-libraries/src/services/stripe.service.ts
2026-10-05 12:27:36 +07:00
Nevo David
1af2885b10
Merge pull request #2190 from gitroomhq/feat/rename-channel
feat(channels): rename a channel in Postiz while keeping its original name
2026-10-05 05:26:21 +00:00
Nevo David
b3b074a500
Merge pull request #2165 from gitroomhq/fix/sentry-third-party-tag
fix(frontend): skip the Sentry report dialog for errors from browser extensions
2026-10-05 05:11:59 +00:00
Nevo David
e55121d87b
Merge pull request #2112 from gitroomhq/fix/cancel-toggle
fix(billing): persist cancelAt on cancel/reactivate instead of waiting for the webhook
2026-10-05 05:10:42 +00:00
Gilad Resisi
78182eddef
Merge pull request #2119 from gitroomhq/fix/calendar-mapped-error-tooltip-main
fix(calendar): surface curated provider errors in the calendar, public API and MCP
2026-10-05 03:50:03 +00:00
Gilad Resisi
9e6b99c66a
Merge pull request #2194 from gitroomhq/feat/calendar-open-post-link-main
feat(calendar): open-post link icon that resolves the release URL on click
2026-10-05 02:57:45 +00:00
Gilad Resisi
fc7f764587
Merge pull request #1829 from gitroomhq/fix/tag-label-contrast
fix(tags): readable calendar tag labels on any tag color
2026-10-05 02:57:15 +00:00
Gilad Resisi
8630c48750
Merge pull request #1828 from gitroomhq/feat/tag-edit-rewire
feat(tags): expose tag editing in the tags dropdown
2026-10-05 02:55:30 +00:00
Gilad Resisi
94a8891945
Merge pull request #2200 from gitroomhq/fix/teams-tab-user-role
fix(settings): hide the Teams tab from the User role
2026-10-05 02:31:18 +00:00
Gilad Resisi
8c5f356562 fix(settings): show a warning toast when the invite request fails
The early return on a failed invite left the modal open with no
feedback for non-402 failures. Show the server's message, or a generic
fallback, as a warning toast, matching the other failed-request
handlers in the frontend. Adds the could_not_send_invitation key and
its translations.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-05 09:13:04 +07:00
Enno Gelhaus
ac27b00373
feat(sponsors): remove rapidproxy from readme 2026-10-04 16:49:32 +02:00
Nevo David
4e55a95939 feat: provider increase 2026-10-04 17:10:26 +07:00
Nevo David
96b7847681 fixes: analytics 2026-10-04 14:11:30 +07:00
Nevo David
d883bfa159 feat: fix auto post 2026-10-04 13:21:58 +07:00
Nevo David
f28c252219 feat: make ugc 2026-10-04 13:15:33 +07:00
Nevo David
c9138d355e feat: fix agent media sso 2026-10-04 13:02:48 +07:00
Nevo David
273c7b504c feat: streak load 2026-10-04 12:35:35 +07:00
Nevo David
36834cda23 fix: typo in password reset email
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 12:14:20 +07:00
Nevo David
f65de34e2e feat: redeploy backend and mcp
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 12:12:39 +07:00
Nevo David
1f5f24e5fd feat: workflow changes 2026-10-04 12:05:10 +07:00
Nevo David
185044d500 feat: fix workflows without continue as new 2026-10-04 10:44:35 +07:00
Gilad Resisi
a4bebecc97 fix(settings): hide the Teams tab from the User role
Members with the User role could open Settings > Teams, see the member
list and submit the invite form. The server already rejects the invite
for that role with a 402, which opens the billing dialog, but the form
then showed "Invitation link sent" anyway, so it looked like a User had
invited someone.

The Teams tab is now listed and rendered only for Admin and Super Admin,
matching the role filter the top menu already applies. The invite form
also returns early on a failed response instead of showing the success
toast and copying an undefined link.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-03 23:58:04 +07:00
Nevo David
ce9cb27a6a Merge remote-tracking branch 'origin/main' 2026-10-03 15:50:03 +07:00
Nevo David
28701a9892 feat: mcp and skill description 2026-10-03 15:49:07 +07:00
Nevo David
2aae02fe03 feat: inline picture 2026-10-03 15:40:20 +07:00
Enno Gelhaus
3964536425
Merge pull request #2195 from gitroomhq/security-contact-role-address
docs(security): a role address for time-critical reports instead of a personal one
2026-10-02 21:52:33 +02:00
Enno Gelhaus
e25dd934d6
feat(security): clarify new email entry 2026-10-02 20:36:16 +02:00
Enno Gelhaus
f66844f7f9
docs(security): a role address for time-critical reports instead of a personal one 2026-10-02 20:31:30 +02:00
Nevo David
6b102afb7e feat: destructiveHint 2026-10-02 20:46:19 +07:00
Nevo David
4583ac5d62 feat: fix some tools 2026-10-02 19:13:46 +07:00
Nevo David
8e42f09cb4 Merge remote-tracking branch 'origin/main' 2026-10-02 18:17:50 +07:00
Nevo David
876ab9e6d9 feat: self hosting connector 2026-10-02 18:17:21 +07:00
Gilad Resisi
fc5b4ca29f fix(calendar): open the post tab before the release URL request
The open-post icon opened its tab only after awaiting the release URL
request, so a browser could treat it as an unprompted popup and block it,
most likely in Safari or when the request is slow (token refresh).

The tab is now opened synchronously in the click and navigated once the
request returns. The opener is cleared on the new tab, and a failed or empty
response falls back to the URL loaded with the calendar.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-02 17:21:52 +07:00
Gilad Resisi
f10296a741 feat(calendar): resolve the release URL on click before opening the post
The open-post icon now asks the backend for the post's current release URL
on every click instead of opening the URL loaded with the calendar.

New GET /posts/:id/release-url calls PostsService.getReleaseURL, which runs
the provider's optional resolveReleaseId through resolveRelease (the same
generic step checkPostAnalytics uses), persists a newly resolved id and URL,
and returns the URL. Providers without a resolver return the stored URL with
no platform call.

This covers platforms that only expose the public post URL some time after
the publish completes (TikTok stores the profile URL until then): the icon
opens the real post as soon as the platform has it, and the stored URL is
corrected at the same time.

Also tightens the icon gap in the calendar item header from 10px to 6px so
the extra icon fits narrow week-view items.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-02 17:00:01 +07:00
Gilad Resisi
9af1eb883d fix(calendar): open the first URL of a multi-target post and sever the opener
Reddit, Lemmy and Farcaster join several release URLs with commas, so the open-post icon opened one mangled URL; open the first target instead. Also pass noopener,noreferrer so the cross-origin page cannot reach the dashboard tab.
2026-10-02 16:21:54 +07:00
Gilad Resisi
163cfbfb21 feat(calendar): show the open-post link on failed posts that still have a URL
A post can end in ERROR after the platform accepted it (a thread comment failed after the parent was published, a follow-up mutation was rejected): its releaseURL is kept, so let the user reach the live post instead of re-publishing it.
2026-10-02 16:21:54 +07:00
Gilad Resisi
e70110fe1e feat(calendar): add an open-post link icon for published posts
Adds a hover-only globe icon to calendar items that opens the post's
releaseURL in a new tab. Shown only for non-recurring PUBLISHED posts
with a valid http URL, so rescheduled/re-drafted and failed posts hide it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-02 16:21:54 +07:00
Gilad Resisi
56f42d0936
Merge pull request #2186 from gitroomhq/fix/tiktok-persist-post-id-main
fix(tiktok): resolve and persist the public post id for analytics
2026-10-02 09:09:11 +00:00
Gilad Resisi
9c697e79a3
Merge branch 'main' into fix/tiktok-persist-post-id-main 2026-10-02 15:53:58 +07:00
Gilad Resisi
ca07a518b8 refactor(posts): extract release resolution into resolveRelease
Returns the current releaseId and releaseURL so other callers can reuse it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-02 15:50:01 +07:00
Gilad Resisi
11d24f3f6c
Merge pull request #2193 from gitroomhq/fix/media-read-timeout
fix(media): bound media reads that stall after their headers
2026-10-02 08:35:08 +00:00
Gilad Resisi
f5564d9f0b fix(media): give a media read two minutes before calling it stalled
The slowest healthy read measured was about eleven seconds, so a minute
was already generous, but a stalled post fails on this timeout and there
is no cost to being certain.
2026-10-02 15:20:23 +07:00
Gilad Resisi
9554e9f606 fix(media): fail a stalled media read instead of repeating the publish
A stall does not clear within the workflow's retry window, so repeating
the publish only re-reads the same media and re-uploads what was already
sent while holding the provider's queue slot. Throw BadBody once the
read's own retry is spent, which drops the need for a new workflow
version.
2026-10-02 12:26:50 +07:00
Nevo David
9fedac402f feat: responsive 2026-10-02 11:23:04 +07:00
Gilad Resisi
a2794ab655 fix(media): read media through the SSRF-safe axios client
readOrFetch took a user-influenced path on plain axios, unlike every
other media read in the class.
2026-10-02 06:51:46 +07:00
Gilad Resisi
b6ead58bf8 fix(media): bound media reads that stall after their headers
A stalled read never settles, so the activity holds its worker slot long
past startToCloseTimeout. Time both buffered reads out, retry once, and
let the workflow repeat the publish via post.workflow.v1.1.3.
2026-10-01 23:56:03 +07:00
Gilad Resisi
e0a08a7d95
Merge pull request #2191 from gitroomhq/docs/claude-md-no-credential-rows
docs(claude): add a rule on credentials and sensitive fields in responses
2026-10-01 04:40:47 +00:00
Gilad Resisi
2407718ec5 docs(claude): add a rule on credentials and sensitive fields in responses
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0153xf1m3VSQnd9QrMLhDikq
2026-10-01 11:36:56 +07:00
Gilad Resisi
bb2e01760d fix(channels): return only the id from the custom name update
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0153xf1m3VSQnd9QrMLhDikq
2026-10-01 11:29:40 +07:00
Gilad Resisi
9aa7c88acc Merge remote-tracking branch 'origin/main' into feat/rename-channel
# Conflicts:
#	apps/backend/src/api/routes/integrations.controller.ts
2026-10-01 10:15:49 +07:00
Gilad Resisi
4637a5190b fix(tiktok): resolve photo publish ids too
Legacy photo posts store p_pub_url~ ids, which the v_pub_ check skipped.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VcaeTzorDM71yKNf9h3Fo4
2026-09-30 15:33:45 +07:00
Gilad Resisi
bcbc1195a7 fix(tiktok): resolve and persist the public post id for analytics
TikTok only exposes the public post id after moderation, so posts kept
the publish id as releaseId and the profile URL as releaseURL, and
per-post analytics returned []. Add an optional resolveReleaseId provider
hook that checkPostAnalytics calls before postAnalytics, persisting the
resolved id + permalink. Both TikTok providers implement it, match any
publish id prefix, and read the int64 id from the raw body so it is not
rounded by JSON.parse.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VcaeTzorDM71yKNf9h3Fo4
2026-09-30 15:33:45 +07:00
Gilad Resisi
fa4722990e fix(frontend): classify third-party errors only in the browser
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 15:32:54 +07:00
Gilad Resisi
2a46d88cf3
Merge pull request #2184 from gitroomhq/chore/claude-md-shared-data-rules-main
docs(claude): add shared-query and persisted-data change rules
2026-09-30 08:17:33 +00:00
Gilad Resisi
cc0fdf9092 docs(claude): add shared-query and persisted-data change rules 2026-09-30 15:01:34 +07:00
Gilad Resisi
ff561b2c2e
Merge pull request #1678 from gitroomhq/fix/duplicate-refresh-error-email
fix(integrations): send a single notification when a token refresh fails
2026-09-30 07:51:05 +00:00
Gilad Resisi
5a1e92b4c0 feat(channels): rename a channel in Postiz while keeping its original name
Adds a nullable customName column on Integration, PUT /integrations/:id/custom-name, and Rename channel / Reset to original name options in the channel menu. Channel lists (app, public API, agent) return the custom name when set.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0153xf1m3VSQnd9QrMLhDikq
2026-09-30 14:33:05 +07:00
Gilad Resisi
496c3804c4
Merge pull request #2183 from gitroomhq/feat/edit-group-name-main
feat(groups): rename a channel group from the channel menu
2026-09-30 07:27:30 +00:00
Gilad Resisi
9cc6bf2136
Merge branch 'main' into feat/edit-group-name-main 2026-09-30 14:19:23 +07:00
Gilad Resisi
c43916dd19 fix(groups): settle the rename promise when the modal is dismissed
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0153xf1m3VSQnd9QrMLhDikq
2026-09-30 13:44:06 +07:00
Gilad Resisi
80dacd71e0 feat(groups): rename a channel group from the channel menu
Hover pencil on the group header opens a small rename modal backed by a new PUT /integrations/customers/:id (org-scoped, duplicate name rejected).
2026-09-30 12:28:22 +07:00
Gilad Resisi
33d33d1022
Merge pull request #2182 from gitroomhq/fix/tiktok-post-id-precision
fix(tiktok): keep the full public post id instead of the JSON.parse-rounded value
2026-09-30 05:22:46 +00:00
Gilad Resisi
634c6da17a fix(tiktok): keep the full public post id instead of the JSON.parse-rounded value
TikTok returns publicaly_available_post_id as an int64. Parsing the status
response with .json() rounds it past 2^53, so every stored release id and
video URL lost its last digits, and the analytics video query asked for a
video that does not exist. Extract the digits from the raw body before
parsing, in both checkPostStatus and postAnalytics, and send the id to the
video query as a string.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-30 11:59:06 +07:00
Gilad Resisi
3f8330683c
Merge pull request #2180 from gitroomhq/fix/tiktok-analytics-file-publish-id
fix(tiktok): resolve the public post id for FILE_UPLOAD publish ids in post analytics
2026-09-30 04:40:32 +00:00
Gilad Resisi
da7f7a1878 fix(tiktok): resolve the public post id for FILE_UPLOAD publish ids in post analytics
The analytics resolution step only matched v_pub_url publish ids, which
was every id when it was written (videos were PULL_FROM_URL). Since videos
moved to FILE_UPLOAD the ids are v_pub_file~..., so the video query was
sent with the publish id and returned nothing. Match any _pub_ publish id,
like the business provider already does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-30 11:19:37 +07:00
Gilad Resisi
b5ba8c89de
Merge pull request #2179 from gitroomhq/fix/pinterest-not-permitted-mapping
fix(pinterest): map the "not permitted to access that resource" pin error
2026-09-30 04:06:51 +00:00
Nevo David
852ac517a7 feat: more info 2026-09-30 11:08:46 +07:00
Gilad Resisi
538f3e6fd8 fix(pinterest): map the "not permitted to access that resource" pin error
Pinterest answers the pin create call with code 29 "You are not permitted
to access that resource." when the connected account cannot write to the
requested board (a board it does not own, a secret or group board without
access). The message had no mapping, so the post failed as "Unknown Error".
Map it to a bad-body error that names the board as the cause.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-30 11:01:22 +07:00
Nevo David
34509af462 Merge remote-tracking branch 'origin/main' 2026-09-30 10:19:30 +07:00
Nevo David
2800807930 redeploy 2026-09-30 10:18:56 +07:00
Nevo David
9c4524e18c
Merge pull request #2101 from gitroomhq/chore/sentry-sdk-10.56.0
chore(deps): pin the Sentry SDK to 10.56.0 to fix the span/scope memory leak
2026-09-30 02:38:05 +00:00
Gilad Resisi
9efa1f553c
Merge pull request #2178 from gitroomhq/fix/edit-modal-missing-channel
fix(frontend): close the edit modal instead of crashing when the post's channel is not loaded
2026-09-29 15:38:49 +00:00
Gilad Resisi
6eceb7e868
Merge pull request #2177 from gitroomhq/fix/uploader-failed-completion
fix(media): fail the upload step when the backend returns an error
2026-09-29 15:31:17 +00:00
Gilad Resisi
22f266aa24 fix(media): fail the upload step when the backend returns an error
fetchUploadApiEndpoint returned res.json() for every response. The app's
fetch wrapper never throws on HTTP errors, and @uppy/aws-s3 treats
whatever the completeMultipartUpload callback returns as a successful
upload (it emits upload-success with status 200). So when
/media/complete-multipart-upload answered 400 or 500, the error body
became a "successful" file without `saved`, the uploader handed
`undefined` to the editor, and the post preview crashed reading `.path`
of it (seen in production on 2026-09-29 as "Cannot read properties of
undefined (reading 'path')" and "(reading 'id')" in the post editor).

The helper now throws on a non-OK response, as impersonate.tsx already
does for the same reason. Uppy then marks the file as failed and aborts
its multipart upload, the uploader's complete handler drops it and shows
the "Some files failed to upload" warning, and the other files of the
batch are still attached. This applies to all five multipart callbacks;
none of them relied on reading an error body.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-29 19:58:59 +07:00
Gilad Resisi
2ebd93e721 fix(frontend): close the edit modal instead of crashing when the post's channel is not loaded
Opening an existing post looks its channel up in the channel list the
modal was given. When the channel is missing from that list, the modal
still called addOrRemoveSelectedIntegration(undefined, ...), the store
appended { integration: undefined }, and the next lookup in
addInternalValue read `.id` of undefined. React unmounted the page and
the user got "Application error" (seen in production on 2026-09-29 as
"Cannot read properties of undefined (reading 'id')" from the calendar).

When the existing post's channel is not found, the modal now shows a
warning toast with the existing "try to refresh the page" message and
closes itself. Guarding only the lookup is not enough: the modal renders
nothing without a selected channel, which left an empty overlay that
Escape and outside clicks cannot close. The same missing check is added
to the set branch, as the selected-channels branch already had it.

This covers every caller of the modal (calendar and agent chat). Why the
channel was missing from the list in the production case is not known;
the channel itself was active and in the user's only organization.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-29 19:58:43 +07:00
Enno Gelhaus
2e1b6ebd62
feat(sponsors): add rapidproxy to readme 2026-09-29 14:44:55 +02:00
Gilad Resisi
b2220ae1cc
Merge pull request #1855 from gitroomhq/feat/ig-reel-cover-image
feat(instagram): use custom thumbnail as reel cover via cover_url
2026-09-29 09:18:11 +00:00
Gilad Resisi
de396df4d6
Merge pull request #1880 from gitroomhq/fix/wire-settings-dtos
fix(providers): wire the Moltbook settings DTO without making submolt required
2026-09-29 08:57:50 +00:00
Gilad Resisi
3cccf2ff36
Merge pull request #2167 from gitroomhq/fix/facebook-368-rate-limit-retry-main
fix(facebook): retry the temporary posting-rate block (368 / 1390008) before failing
2026-09-29 08:52:32 +00:00
Gilad Resisi
235e7daf99
Merge pull request #2166 from gitroomhq/fix/telegram-drop-post-text-log-main
fix(telegram): stop logging the post text on publish
2026-09-29 08:45:36 +00:00
Gilad Resisi
5f2f39dd9d
Merge branch 'main' into fix/wire-settings-dtos 2026-09-29 15:24:47 +07:00
Gilad Resisi
8e09aeb4a5 fix(moltbook): keep submolt optional in the settings DTO
Wiring MoltbookDto made submolt required at validation, which would
reject the API/MCP callers that omit it today; the provider already
falls back to 'general' for a missing or empty submolt. Keep it optional
and only reject values that are not strings.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-29 15:19:08 +07:00
Gilad Resisi
502a6f85d9 Merge remote-tracking branch 'origin/main' into fix/wire-settings-dtos 2026-09-29 14:37:30 +07:00
Gilad Resisi
d739d084dc
Merge pull request #2102 from gitroomhq/fix/global-error-sentry-report
fix(frontend): report React render crashes to Sentry from the crash screen
2026-09-29 07:35:06 +00:00
Gilad Resisi
3205ce10e7 Revert "feat(mcp): accept { path, thumbnail } attachments for video covers"
This reverts commit e5f6fff3384386a6e53eb75ae5ecbbf6afb231db.
2026-09-29 14:31:08 +07:00
Gilad Resisi
72d6015b1a
Merge pull request #2174 from gitroomhq/feat/tiktok-video-cover-main
fix(tiktok): restore video cover frame selection on Direct Post
2026-09-29 07:16:58 +00:00
Gilad Resisi
716544fda3
Merge branch 'main' into feat/ig-reel-cover-image 2026-09-29 14:16:29 +07:00
Gilad Resisi
148cc961ca fix(tiktok): send a 0ms cover timestamp explicitly 2026-09-29 14:12:40 +07:00
Gilad Resisi
881ac768f0 fix(tiktok): send video_cover_timestamp_ms on Direct Post video init
Restores the cover-frame control lost when TikTok moved from PULL_FROM_URL
to FILE_UPLOAD; the field now goes in post_info per TikTok's current schema.
2026-09-29 13:41:32 +07:00
Gilad Resisi
7abbdde4f8
Merge pull request #2155 from gitroomhq/feat/facebook-video-title
feat(facebook): optional title for feed video posts
2026-09-29 06:09:00 +00:00
Gilad Resisi
371d8ec7d1
Merge pull request #2172 from gitroomhq/fix/wordpress-user-agent
fix(wordpress): send a Postiz User-Agent on requests to the WordPress site
2026-09-29 06:07:00 +00:00
Gilad Resisi
b0103f73f4 fix(wordpress): send a Postiz User-Agent on requests to the WordPress site
The connect check, post type/category/tag lookups, media upload and post
create went out with Node's default "node" User-Agent, which host firewalls
can treat as unidentified bot traffic. Send the same
"Postiz/1.0 (+https://postiz.com)" User-Agent the Tumblr provider uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 13:00:59 +07:00
Gilad Resisi
852acdeaa5
Merge pull request #2171 from gitroomhq/fix/editor-uploader-keep-inflight
fix(editor): stop wiping in-flight uploads when an earlier upload finishes
2026-09-29 04:54:30 +00:00
Gilad Resisi
480ee7ee47 fix(editor): stop wiping in-flight uploads when an earlier upload finishes
The post editor's onUploadSuccess called uppy.clear() after appending the
media. By then the uploader hook's complete handler has already removed the
finished batch's files, so clear() could only hit files of another batch that
was still uploading. clear() empties Uppy state without emitting file-removed,
so the aws-s3 plugin never aborts that upload: every progress event of its
parts throws reading .progress of the missing file (Sentry CLOUD-20X, and
CLOUD-211 on Safari) and the upload never completes, so the file is silently
dropped from the post.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 10:57:15 +07:00
Gilad Resisi
277d3620ac fix(frontend): record the Sentry wrapper location synchronously at init
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 17:10:27 +07:00
Gilad Resisi
d934731cb4 fix(facebook): retry the temporary posting-rate block (368 / 1390008) before failing 2026-09-28 16:42:36 +07:00
Gilad Resisi
3f21703450 fix(telegram): stop logging the post text on publish 2026-09-28 16:34:39 +07:00
Gilad Resisi
0cf459623f fix(frontend): skip the Sentry report dialog for errors from browser extensions
Tag events whose throwing callback has no frame from our /_next/ bundle as
third_party_code and do not open the report dialog for them. Frames of Sentry's
own callback wrapper are skipped, and frameless "Could not establish connection"
rejections are treated as extension noise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:34:14 +07:00
Gilad Resisi
528f6ea37c
Merge pull request #2164 from gitroomhq/fix/vk-duplicate-use-client
fix(frontend): remove duplicate 'use client' directive in VK provider
2026-09-28 08:55:35 +00:00
Gilad Resisi
a4314ea162 fix(frontend): remove duplicate 'use client' directive in VK provider
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 15:49:27 +07:00
Gilad Resisi
4db23eba21
Merge pull request #2163 from gitroomhq/fix/uploader-keep-batch-on-file-error
fix(media): keep the rest of the upload batch when one file fails
2026-09-28 08:29:12 +00:00
Gilad Resisi
3b36d5ed24 chore(i18n): translate the partial upload failure toast
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 15:15:53 +07:00
Gilad Resisi
29478ed6de fix(media): keep the rest of the upload batch when one file fails
The uploader's Uppy `error` handler called `cancelAll()` for every error.
Uppy core also emits `error` when a single file fails (from its
`upload-error` handler), so one failed file, e.g. a transient 5xx on
`/media/create-multipart-upload`, dropped every other file of the batch:
finished files were saved to the media library but never attached, the
rest were cancelled, and the user got no message. Cancelling the other
in-flight files is also what makes @uppy/aws-s3's progress callback throw
on a removed file (Sentry CLOUD-20X).

The handler now returns early while the upload is still in
`currentUploads` (a single file failed); core removes the upload before
emitting `error` when the whole upload fails, so that path still resets
the uploader. `complete` already fires with `successful` and `failed`: it
now also removes the failed files, so the next upload does not silently
retry them, and shows a warning toast when any file failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 15:15:20 +07:00
Gilad Resisi
935e069416
Merge pull request #2162 from gitroomhq/fix/sentry-ignore-uppy-progress-chrome
fix(frontend): stop the Sentry report dialog on the Chrome wording of the uppy progress error
2026-09-28 07:44:33 +00:00
Gilad Resisi
23181536f5
Merge pull request #2095 from gitroomhq/fix/local-uploads-range-main
fix(uploads): honor HTTP Range requests so local-storage video uploads work again
2026-09-28 07:44:20 +00:00
Gilad Resisi
6562791eac fix(uploads): clamp an over-long Range end instead of answering 416
Per RFC 7233 section 2.1, a last-byte-pos at or past the file length
means the rest of the file. Clamp it and serve 206; keep 416 only for
a start at or past the file size, or a start after the end.

Tested on local storage against a 22MB video: before this change,
bytes=16777216-25165823 (final 8MB chunk overshooting the file),
bytes=22041989-99999999 and bytes=0-22041990 all returned 416. After
it, all three return 206 with Content-Range clamped to the last byte
and bodies byte-identical to the file on disk. In-bounds ranges still
return the same 206, a start past the file still returns 416, and a
plain GET still returns 200 with the full file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:23:04 +07:00
Gilad Resisi
aaa4343d9b
Merge branch 'main' into fix/sentry-ignore-uppy-progress-chrome 2026-09-28 14:11:16 +07:00
Gilad Resisi
f0f23f433e
Merge pull request #2161 from gitroomhq/fix/post-save-no-success-on-error
fix(frontend): don't report a failed post save as successful
2026-09-28 07:08:01 +00:00
Gilad Resisi
cab42b13f5 fix(frontend): stop the Sentry report dialog on the Chrome wording of the uppy progress error
#2147 ignored the Safari wording of the @uppy/aws-s3 4.3.2 progress
callback crash ("undefined is not an object (evaluating 'r.progress')"),
but Chrome and Edge report the same throw as "Cannot read properties of
undefined (reading 'progress')", which the pattern does not match, so
those users still get the "Something broke" report dialog.

The throw is in the plugin's own onProgress (getFile(id).progress on a
file that is no longer in state), fired from the part request's load
handler after our error handler cancels the remaining files. #2145
guarded our upload-success handler, not this plugin line.

Sentry CLOUD-20X, 1054 events / 33 users since 2026-09-16.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:03:10 +07:00
Gilad Resisi
9dbebc2ef4 fix(frontend): don't report a failed post save as successful
Check the POST /posts response; on failure keep the editor open and show the server message (402 stays silent, the payment dialog already explained it).
2026-09-28 13:57:34 +07:00
Gilad Resisi
73a0dea976
Merge pull request #2159 from gitroomhq/fix/after-request-402-body-read-main
fix(frontend): keep the 402 response readable and stay on Add Channel after cancel
2026-09-28 06:43:19 +00:00
Gilad Resisi
f67d2fd266
Merge branch 'main' into fix/after-request-402-body-read-main 2026-09-28 13:36:35 +07:00
Gilad Resisi
b7e3df35a0 fix(frontend): stop the web3, custom-fields and extension connect flows on a 402
Same early return as the regular flow, so none of them use the billing url from the 402 body.
2026-09-28 13:29:19 +07:00
Gilad Resisi
5848ef2d43 refactor(integrations): enable all channels with a single updateMany
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:23:57 +07:00
Gilad Resisi
70911f8698 chore(i18n): translate the post-checkout channel notices
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:10:55 +07:00
Gilad Resisi
c145f0c3b6 feat(subscription): only re-enable channels when the limit grows, tell the user after checkout
Re-enabling all channels on any subscription create/update also undid
channels the user disabled on purpose whenever a same-plan update arrived
(renewal, cancel toggle, store re-sync). The enable-all now also requires
the new channel limit to be larger than the current subscription's, which
still covers trial end, resubscribing (no subscription row, limit 0) and
upgrades.

After returning from checkout, a notice on the calendar tells the user
whether all their channels were enabled again or stay disabled because the
plan does not cover them. It opens after the onboarding modal so it is shown
on top of it and is not removed by the onboarding close.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:10:55 +07:00
Gilad Resisi
c033aff59f fix(frontend): stay on Add Channel when the 402 dialog is cancelled
Return early on a 402 instead of following the billing url in its body.
2026-09-28 12:54:44 +07:00
Nevo David
1752382c17 feat: force token 200 2026-09-28 12:34:12 +07:00
Nevo David
7229c338c9 feat: schema fix 2026-09-28 12:20:08 +07:00
Gilad Resisi
4a6ba07f88 feat(subscription): re-enable disabled channels when the new plan can hold all of them
When a subscription lapses (trial ends or is cancelled), the FREE
downgrade disables every channel. Subscribing again never re-enabled
them, so a paying customer landed on a plan with all channels still
disabled and the app looking broken.

On a paid subscription change, if some non-deleted channels are disabled
and the plan's totalChannels can hold all of them, enable everything
back. When they don't all fit, nothing is enabled, since there is no way
to tell auto-disabled channels from ones the user disabled on purpose.
Idempotent: once everything is enabled the branch is a no-op.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYTuLLhYQsLCdgxBFEXpG9
2026-09-28 12:09:03 +07:00
Nevo David
c17f0c23c3 Merge remote-tracking branch 'origin/main' 2026-09-28 11:43:03 +07:00
Nevo David
cd48401e8c feat: canva intent 2026-09-28 11:37:44 +07:00
Gilad Resisi
4b933cd791 feat(facebook): optional title for feed video posts
Facebook Page videos were uploaded with the post text as description only,
so they always published without a title, and the MCP/public API settings
schema for Facebook offered no way to set one.

FacebookDto gets an optional title string. The provider adds it to the
POST /{page-id}/videos body only when it is non-empty and the post is a
feed post whose first attachment is an mp4. Stories, photo posts, text
posts and background presets are untouched, and posts without a title
send exactly the same request as before. The editor's Facebook settings
show a title input for posts and hide it for stories.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 13:01:42 +07:00
Gilad Resisi
971aa369f3 fix(frontend): tolerate a non-JSON 402 body in the payment dialog
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017g3KqiuR5TT68XdqpTRbZh
2026-09-25 17:43:33 +07:00
Gilad Resisi
d727ac0b64 fix(frontend): keep the 402 response readable after the payment dialog
afterRequest consumed the body to show the dialog message, so callers threw 'body stream already read' on dismiss (154 events/30d on /launches in prod).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017g3KqiuR5TT68XdqpTRbZh
2026-09-25 17:43:33 +07:00
Gilad Resisi
374fb20233
Merge pull request #2153 from gitroomhq/fix/activate-skip-body-on-redirect
fix(auth): don't read the activate response body once the onboarding redirect started
2026-09-25 10:37:13 +00:00
Gilad Resisi
fbd089f6f0
Merge pull request #2151 from gitroomhq/fix/billing-stripe-load-failure
fix(billing): show a message when Stripe.js fails to load instead of crashing
2026-09-25 10:34:07 +00:00
Gilad Resisi
9e8e749ded
Merge pull request #2152 from gitroomhq/ig-container-error-mapping-main
fix(instagram): map container error 2207085 to a curated video-format message
2026-09-25 10:29:19 +00:00
Gilad Resisi
85d663f1d3 fix(auth): don't read the activate response body once the onboarding redirect started
On a successful activation the backend answers with the onboarding
header. The shared afterRequest handler sees it, sets window.location to
the onboarding page and hands the response back; the activation page
then called .json() on it while the page was already navigating away.
Firefox rejects that body read with "AbortError: The operation was
aborted.", which is unhandled and pops the Sentry report dialog.

The page now returns early when the response carries the onboarding
header and only reads the body otherwise, so the "already activated"
path is unchanged. afterRequest itself is left alone because the
register flow relies on getting the onboarding response back to fire its
conversion events.

Sentry CLOUD-11: 65 events / 65 users in the last 30 days, 311 / 132
lifetime, all Firefox on /auth/activate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 17:26:47 +07:00
Gilad Resisi
4899709173 fix(instagram): map container error 2207085 to a curated video-format message 2026-09-25 17:14:32 +07:00
Gilad Resisi
60431b082c
Merge pull request #2150 from gitroomhq/threads-container-error-main
fix: friendly message when Threads reports an UNKNOWN container error
2026-09-25 05:56:04 +00:00
Gilad Resisi
85a9f3cf5d
Merge pull request #2149 from gitroomhq/fix/uploader-cancel-on-error
fix(media): cancel in-flight uploads on error instead of clearing Uppy state
2026-09-25 05:47:21 +00:00
Gilad Resisi
38443af99c
Merge pull request #2148 from gitroomhq/fix/extension-chrome-undefined-guard
fix(frontend): guard the chrome global before the extension connect check
2026-09-25 05:45:57 +00:00
Gilad Resisi
e6251b25ea fix: friendly message when Threads reports an UNKNOWN container error 2026-09-25 12:28:03 +07:00
Gilad Resisi
cdaf61d638 fix(billing): show a message when Stripe.js fails to load instead of crashing
loadStripe() rejects when js.stripe.com is blocked (ad blockers, privacy
extensions, corporate proxies). The promise was stored in state with no
handler, so the rejection surfaced as an unhandled
"Error: Failed to load Stripe.js", popped the Sentry report dialog, and
the billing page stayed on the loading spinner forever.

The promise now has a catch that flips a stripeFailed state, and the page
renders an explanation in the same bordered box used for the
"another account already subscribed" case. New translation key
billing_stripe_load_failed added to all locales via lingo.dev.

Sentry CLOUD-SJ: 185 events / 27 users in the last 30 days, 338 / 75
lifetime.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-25 12:23:38 +07:00
Gilad Resisi
66d9ef75f4 fix(media): cancel in-flight uploads on error instead of clearing Uppy state
The Uppy error handler called uppy.clear() while the failed upload was
still registered in currentUploads. Uppy core throws
"The installed uploader plugin does not allow removing files during an
upload." from clear() in that state, so every Transloadit assembly_error
produced a second, unhandled exception on top of the real failure and
popped the Sentry report dialog.

cancelAll() removes every file first, which drops the upload record
before that check, then resets the upload state; the rest of the handler
is unchanged.

Sentry CLOUD-S1: 53 events / 29 users in the last 30 days, 264 / 75
lifetime.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-25 12:19:54 +07:00
Gilad Resisi
464d04e97b fix(frontend): guard the chrome global before the extension connect check
add.provider.component.tsx tested chrome?.runtime?.sendMessage without
first checking typeof chrome, so on Safari and iOS Chrome, where the
chrome global does not exist, the bare identifier threw
"ReferenceError: Can't find variable: chrome" instead of showing the
existing "Extension Not Found" modal. The other two extension call sites
already guard with typeof chrome !== 'undefined'.

Sentry CLOUD-14W: 8 events / 6 users in the last 30 days, 22 / 11
lifetime, mostly on the LinkedIn connect flow.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-25 12:19:54 +07:00
Gilad Resisi
b3535360ca
Merge pull request #2146 from gitroomhq/fix/calendar-deleted-group-guard
fix(calendar): handle a deleted post group when opening a calendar tile
2026-09-25 04:39:05 +00:00
Gilad Resisi
055dbb89c6
Merge pull request #2145 from gitroomhq/fix/uploader-removed-file-progress
fix(media): skip the upload-success state update for an already removed file
2026-09-25 04:36:59 +00:00
Gilad Resisi
6e2f50e054
Merge pull request #2147 from gitroomhq/fix/sentry-ignore-uppy-progress
fix(frontend): stop the Sentry report dialog on the uppy aws-s3 progress error
2026-09-25 04:34:53 +00:00
Gilad Resisi
f0f3df652e fix(frontend): stop the Sentry report dialog on the uppy aws-s3 progress error
The @uppy/aws-s3 4.3.2 progress callback reads uppy.getFile(id).progress
from the S3 part PUT load handler without a null check, so when the file
has already left uppy's state it throws "undefined is not an object
(evaluating 'r.progress')" (Sentry CLOUD-211). beforeSend shows the report
dialog for every captured exception, so the throw surfaced as a
"Something broke" popup for users on Safari. The upload itself is done or
cancelled by the time this fires, so the error is ignored like the
posthog recorder one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-25 11:23:20 +07:00
Gilad Resisi
c1d553678b fix(calendar): handle a deleted post group when opening a calendar tile
getPostsByGroup crashed on posts[0].integrationId when the group had no
posts left (deleted from another tab, by a teammate, or on sub cancel),
so the API returned a 500 body. The calendar's editPost then indexed
data.posts[0] on that error body and threw an unhandled TypeError, which
also pops the Sentry report dialog.

The service now throws NotFoundException like the other post lookups,
and editPost returns early with the existing "Post not found" toast and
a calendar mutate so the stale tile disappears.

Sentry CLOUD-QF (Chrome) + CLOUD-QK (Safari): 833 events / 309 users in
the last 30 days, 2807 / 635 lifetime.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-25 11:19:52 +07:00
Gilad Resisi
c2d35f9492 fix(media): skip the upload-success state update for an already removed file
The Uppy upload-success handler read getState().files[file.id].progress
unconditionally. When the file had already been removed from Uppy's
state (validation or error paths call removeFile) the lookup is
undefined and the handler threw "Cannot read properties of undefined
(reading 'progress')", which also pops the Sentry report dialog.

Read the file state once and return when it is gone; setFileState is
otherwise unchanged.

Sentry CLOUD-20X + CLOUD-211 (Safari) + CLOUD-20Y: 1375 events / 62
users in the last 30 days, first seen 2026-09-16.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-25 11:19:52 +07:00
Gilad Resisi
767731a26e
Merge pull request #2144 from gitroomhq/fix/facebook-reconnect-page-token
fix(facebook): fail reconnect cleanly when the page has no page token
2026-09-25 04:10:21 +00:00
Gilad Resisi
a59aa389c1
Merge pull request #2143 from gitroomhq/fix/extension-unchecked-last-error
fix(frontend): silence Unchecked runtime.lastError from extension messaging callbacks
2026-09-25 04:09:28 +00:00
Gilad Resisi
3023eecaab
Merge branch 'main' into fix/facebook-reconnect-page-token 2026-09-25 11:03:00 +07:00
Gilad Resisi
b1725798b8
Merge pull request #2141 from gitroomhq/fix/nostr-secret-key-main
fix(nostr): convert the hex private key to bytes before signing posts
2026-09-25 04:01:42 +00:00
Gilad Resisi
cc8ca9855b fix(facebook): fail reconnect cleanly when the page has no page token
A page listed without an access_token made reConnect return an undefined token, and the integration upsert then threw a 500.
2026-09-25 10:27:53 +07:00
Gilad Resisi
f7ae41bc64
Merge pull request #2142 from gitroomhq/fix/sentry-ignore-metamask
fix(frontend): stop the Sentry report dialog on MetaMask injected-script errors
2026-09-25 02:45:51 +00:00
Gilad Resisi
723f2308a3
Merge pull request #2140 from gitroomhq/fix/telegram-bad-body-main
fix(telegram): map Telegram 400 rejections to non-retryable BadBody errors
2026-09-25 02:19:11 +00:00
Gilad Resisi
0f59347cc0 fix(frontend): stop the Sentry report dialog on MetaMask injected-script errors
MetaMask's injected inpage.js throws "Failed to connect to MetaMask"
(linked: "MetaMask extension not found") as Error instances, so the
existing plain-object wallet filter does not catch them and beforeSend
opens the user-report dialog. Both messages are added to ignorePatterns.
Sentry CLOUD-C: 860 events / 166 users in the last 30 days, 2270 events
/ 305 users lifetime, no Postiz frames in the stack.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-25 09:16:30 +07:00
Gilad Resisi
f9e0d0104b fix(nostr): convert the hex private key to bytes before signing posts
finalizeEvent requires the secret key as a Uint8Array, but post/comment
passed the stored hex string, so every Nostr publish crashed with
"expected Uint8Array, got type=string". Reuse the same conversion
authenticate already does via a shared helper.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PyDRJpL27E7WCK5UGsUope
2026-09-25 09:13:32 +07:00
Gilad Resisi
225aebcaeb fix(telegram): map Telegram 400 rejections to non-retryable BadBody errors
A Telegram 400 (caption too long, media Telegram could not download) is a
permanent rejection, but it surfaced as a plain error the workflow retried
3 times and then reported as "Could not publish after several attempts"
with a misleading couldn't-confirm email. Map it to BadBody so it fails
once with the real reason.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PyDRJpL27E7WCK5UGsUope
2026-09-25 09:07:09 +07:00
Gilad Resisi
709e05bc5e fix(frontend): read chrome.runtime.lastError in extension messaging callbacks
The STORE_REFRESH_TOKEN and REMOVE_REFRESH_TOKEN calls to the Postiz
browser extension passed a no-op callback. When the extension is not
installed, disabled, or the origin is not allowed, Chrome logs
"Unchecked runtime.lastError: Could not establish connection. Receiving
end does not exist." to the user's console because nothing read
lastError. Reading it in the callback, as add.provider.component.tsx
already does, marks the error as checked and silences the log. The
calls stay fire-and-forget with no behavior change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-25 09:06:13 +07:00
Gilad Resisi
1024d675e7
Merge pull request #2137 from gitroomhq/fix/ig-silent-video-audio-tooltip-main
fix(instagram): curate container processing errors, map 2207082 to the silent-video audio hint
2026-09-25 01:45:41 +00:00
Gilad Resisi
c693a97eb5 fix(instagram): disconnect the channel when a container status maps to a disconnect error 2026-09-25 08:36:55 +07:00
Gilad Resisi
94751bb0d3 fix(instagram): reuse the existing 2207082 retry mapping instead of shadowing it 2026-09-25 08:20:41 +07:00
Gilad Resisi
f4bd43f276 fix(instagram): curate container processing errors, map 2207082 to the silent-video audio hint
The container status poll is HTTP 200 with the failure in the body, so it never went through handleErrors and Meta's raw status text reached the tooltip.
2026-09-25 08:20:41 +07:00
Nevo David
bb5099a84a feat: connected clients 2026-09-24 13:43:40 +07:00
Nevo David
90cfaadb66 Merge remote-tracking branch 'origin/main' 2026-09-24 12:21:35 +07:00
Nevo David
8c63e6863d feat: schedule post preview url 2026-09-24 12:21:12 +07:00
Nevo David
33e126a9e2
Merge pull request #2079 from gitroomhq/feat/preview-inline-comments
feat(preview): inline comments, replies, resolve and anonymous commenting
2026-09-24 03:40:52 +00:00
Nevo David
32ca6ff5b7 feat: cursor 2026-09-24 10:31:28 +07:00
Nevo David
54fad3b7c7 Merge remote-tracking branch 'origin/main' into feat/preview-inline-comments 2026-09-24 10:20:45 +07:00
Gilad Resisi
4c33d525a6
Merge pull request #2134 from gitroomhq/fix/dribbble-badbody-mapping-main
fix(dribbble): map 4xx shot rejections to non-retryable BadBody errors
2026-09-23 08:58:34 +00:00
Gilad Resisi
3540edc469
Merge pull request #2133 from gitroomhq/fix/x-error-mappings-main
fix(x): map remaining known error responses to readable messages
2026-09-23 08:54:54 +00:00
Gilad Resisi
ce3bea1a2a
Merge branch 'main' into fix/dribbble-badbody-mapping-main 2026-09-23 15:54:24 +07:00
Gilad Resisi
4e538ec4a3 Merge remote-tracking branch 'origin/main' into fix/x-error-mappings-main
# Conflicts:
#	libraries/nestjs-libraries/src/integrations/social/x.provider.ts
2026-09-23 15:51:01 +07:00
Gilad Resisi
fd1482b3a0
Merge branch 'main' into fix/x-error-mappings-main 2026-09-23 15:39:23 +07:00
Gilad Resisi
135b1cc6f4
Merge pull request #2132 from gitroomhq/fix/x-unauthorized-refresh-token-main
fix(x): mark the channel for reconnect on Unauthorized media upload errors
2026-09-23 08:34:31 +00:00
Gilad Resisi
53fd19f1d6
Merge pull request #2128 from gitroomhq/fix/lemmy-error-handling-main
fix(lemmy): surface Lemmy API errors instead of crashing on post_view
2026-09-23 08:33:58 +00:00
Gilad Resisi
a63b28bf37 fix(dribbble): map 4xx shot rejections to non-retryable BadBody
Dribbble 4xx responses on shot creation were plain AxiosErrors: the
workflow retried them to exhaustion and recorded "Could not publish
after several attempts", and the response body with Dribbble's actual
rejection reason was discarded. Map 4xx (except 429) to BadBody with
the response body persisted in the failure details.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0188yxtbWi6wtfJg7ydjUpfG
2026-09-23 15:33:39 +07:00
Gilad Resisi
f477777ee0 fix(x): map remaining known error responses to readable messages
Locked account, crypto addresses, invalid media ids, 10-minute video,
Premium-only articles and empty tweet now map to bad-body with a
message instead of Unknown Error.
2026-09-23 15:31:58 +07:00
Gilad Resisi
a722357e5a
Merge pull request #2131 from gitroomhq/fix/vk-surface-api-errors-main
fix(vk): surface VK API errors instead of marking posts completed
2026-09-23 08:29:37 +00:00
Gilad Resisi
41d24f2838
Merge pull request #2130 from gitroomhq/fix/x-rate-limit-retry-message-main
fix(x): readable message when Too Many Requests retries are exhausted
2026-09-23 08:28:26 +00:00
Gilad Resisi
e475160bc3 fix(lemmy): route community search through this.fetch
A non-2xx from /api/v3/search threw a TypeError on communities.map; it now fails through the same handleErrors mapping as post and comment.
2026-09-23 15:27:16 +07:00
Gilad Resisi
935c80a8e1 fix(x): mark the channel for reconnect on Unauthorized media upload errors
twitter-api-v2 401s reach handleErrors via runInConcurrent with status
200, so the generic 401 rule never fired and the post failed as Unknown
Error without flagging the channel.
2026-09-23 15:25:55 +07:00
Gilad Resisi
20d7c98c6f
Merge pull request #2129 from gitroomhq/fix/pinterest-board-id-main
fix(pinterest): validate board as a numeric id and map the board-name rejection
2026-09-23 08:23:56 +00:00
Gilad Resisi
96bca72551 fix(vk): surface VK API errors instead of marking posts completed
VK answers HTTP 200 with { error } on failures, so wall.post/wall.createComment rejections were stored as completed with postId undefined. Map code 5 to RefreshToken, 6/9/29 to a retryable error, everything else to BadBody with VK's error_msg.
2026-09-23 15:16:54 +07:00
Gilad Resisi
1ae4a3b78e fix(x): readable message when Too Many Requests retries are exhausted 2026-09-23 15:14:53 +07:00
Gilad Resisi
0a2fc96072 fix(lemmy): surface Lemmy API errors instead of crashing on post_view
Route post, comment and login through this.fetch with a handleErrors mapping so Lemmy rejections fail once with a readable message (rate limits retry, bad credentials flag the channel); the login failure is rebuilt without the request body so the stored password is never persisted.
2026-09-23 15:08:51 +07:00
Gilad Resisi
5f8639b506
Merge pull request #2127 from gitroomhq/fix/facebook-error-mappings-main
fix(facebook): map five recurring Graph API rejections instead of "Unknown Error"
2026-09-23 08:05:29 +00:00
Gilad Resisi
35f174b7f2
Merge pull request #2126 from gitroomhq/fix/reddit-ratelimit-retry
fix(reddit): retry the submit after a RATELIMIT rejection instead of failing
2026-09-23 07:56:37 +00:00
Gilad Resisi
cd899eaad6 fix(pinterest): validate board as a numeric id and map the board-name rejection
Reject a board name in the settings DTO at scheduling time and fix the over-escaped handleErrors match so Pinterest's board-id rejection is curated instead of surfacing as Unknown Error.
2026-09-23 14:56:24 +07:00
Gilad Resisi
9fbaf55063 fix(reddit): only retry when RATELIMIT is the sole submit error
Reddit can return several error entries at once. A terminal error next
to RATELIMIT would reject every resubmit, so retrying burns the whole
pending budget before the user sees the real reason. Retry only when
every entry is RATELIMIT.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-23 14:52:24 +07:00
Gilad Resisi
8b5999b8d1 fix(facebook): match error subcodes on a word boundary
"error_subcode":33 as a substring also matched 330 and 331; the same held for
459 and 492. Test the three subcodes with a trailing word boundary instead.
2026-09-23 14:43:50 +07:00
Gilad Resisi
70499563d2 fix(facebook): map five recurring Graph API rejections instead of "Unknown Error"
Adds handleErrors branches for 190/459 (checkpoint), 190/492 (no Page role),
the 190 missing pages_* permissions body, 100/33 object does not exist, and
Facebook's HTML outage page, so users see the reason and the right outcome
(fail, reconnect, or retry) instead of "Unknown Error".
2026-09-23 14:43:50 +07:00
Gilad Resisi
6fb5df417e fix(reddit): retry the submit after a RATELIMIT rejection instead of failing
Reddit answers a rate-limited /api/submit with HTTP 200 and an errors
array. finalizePost treated every entry as a terminal BadBody, so a
temporary rate limit failed the whole post.

A RATELIMIT entry means nothing was submitted, so finalizePost now
clears the armed marker and returns pending: the next status check
re-arms the same subreddit and submits it again once the window has
passed. Every other rejection still throws the non-retryable BadBody.

Verified against real Reddit: with the rate-limit payload injected into
the first submit only, the following check re-armed and the resubmit
published; a non-RATELIMIT rejection still throws BadBody.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-23 14:41:10 +07:00
Gilad Resisi
4c81af957e
Merge pull request #2125 from gitroomhq/fix/pinterest-board-id-mapping-main
fix(pinterest): make the numeric board id mapping actually match
2026-09-23 07:25:26 +00:00
Gilad Resisi
6154538737
Merge pull request #2124 from gitroomhq/fix/threads-media-not-found-retry-main
fix(threads): retry publish when Threads has not found the container yet (4279009)
2026-09-23 07:16:24 +00:00
Gilad Resisi
c444224577
Merge pull request #2123 from gitroomhq/fix/instagram-190-login-disconnect-main
fix(instagram): disconnect the channel on Meta checkpoint errors instead of failing every post
2026-09-23 07:16:00 +00:00
Gilad Resisi
002a341bcc fix(pinterest): make the numeric board id mapping actually match
The match string carried 8 literal backslashes while Pinterest's response
carries 4, so the mapping never fired and posts failed with "Unknown Error".
Match on backslash-free fragments of the message instead.
2026-09-23 14:12:05 +07:00
Gilad Resisi
5536d8a73a fix(threads): retry publish when Threads has not found the container yet (4279009)
Threads sometimes answers threads_publish with "Media Not Found" seconds after
the container was created. Map subcode 4279009 to retry so the publish call
gets a few more attempts instead of failing the post with "Unknown Error".
2026-09-23 14:06:10 +07:00
Gilad Resisi
ba1f85b50b
Merge pull request #2122 from gitroomhq/fix/ignore-posthog-recorder-error
fix(frontend): stop the Sentry report dialog on the posthog-js recorder error
2026-09-23 07:00:55 +00:00
Gilad Resisi
28730a0c1b fix(instagram): disconnect the channel on Meta checkpoint errors instead of failing every post
Code-190 bodies "You cannot access the app till you log in to www.instagram.com" and "Session key is malformed" now map to disconnect, so the channel is flagged for reconnect once instead of every scheduled post failing with a misleading permissions message.
2026-09-23 14:00:23 +07:00
Gilad Resisi
fa93effac5 fix(frontend): stop the Sentry report dialog on the posthog-js recorder error
posthog-js throws "Called on script loaded before session recording is
available" when its session-recording script's load event fires before the
recorder extension is registered. The frontend beforeSend hook shows the
Sentry user-report dialog for every captured exception, so users hit the
"Something broke!" form on ordinary page loads (login, launches, channel
connect) with nothing actually wrong. Sentry issue CLOUD-QP: 656 events,
91 users since March 2026; three user-feedback reports in one week.

Add the message to ignorePatterns so the event is dropped before the
dialog branch, matching the existing network-error entries.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-23 11:12:25 +07:00
Nevo David
b90fc691c1
Revise README for clarity on Postiz offerings
Updated the README to clarify the differences between Postiz Cloud and the self-hosted version, emphasizing the managed experience and deployment options.
2026-09-23 10:20:20 +07:00
Nevo David
38cb6a41c7
Update Postiz compliance information in README
Clarify the description of the Postiz project and its compliance.
2026-09-23 10:14:08 +07:00
Nevo David
305f7c0d13
Enhance README with Postiz Cloud vs Open-source section
Added a comparison between Postiz Cloud and Open-source versions, detailing features, costs, and setup differences.
2026-09-23 10:10:13 +07:00
Gilad Resisi
ae1b80f340
Merge pull request #1827 from gitroomhq/fix/tag-deletion-cleanup
fix(tags): clean up post assignments on tag deletion and stop matching soft-deleted tags
2026-09-23 01:38:12 +00:00
Nevo David
5ff9e0b2f6 feat: update readme 2026-09-23 00:01:18 +07:00
Nevo David
c33f2188f8 feat: update readme 2026-09-23 00:00:12 +07:00
Nevo David
87ac77c699 feat: update readme 2026-09-22 23:56:44 +07:00
Nevo David
8b84b0dc27 feat: onboarding 2026-09-22 20:46:21 +07:00
Nevo David
b2548780b6 Merge remote-tracking branch 'origin/main' 2026-09-22 17:59:40 +07:00
Nevo David
dcb5b09e0e fix: allow mov 2026-09-22 17:58:20 +07:00
Gilad Resisi
6577ad8733
Merge pull request #2118 from gitroomhq/fix/slack-reject-video
fix(slack): reject video attachments at save time
2026-09-22 10:35:22 +00:00
Gilad Resisi
c762ace600 Merge origin/main into fix/slack-reject-video 2026-09-22 17:14:32 +07:00
Gilad Resisi
04e60c8bfc
Merge pull request #2117 from gitroomhq/fix/slack-surface-post-errors
fix(slack): surface chat.postMessage failures instead of marking the post published
2026-09-22 07:11:13 +00:00
Gilad Resisi
b7e5037b96 Merge origin/main into fix/slack-reject-video 2026-09-22 13:58:54 +07:00
Gilad Resisi
89121c06a9 Merge origin/main into fix/slack-surface-post-errors 2026-09-22 13:58:34 +07:00
Gilad Resisi
e62ef360e0
Merge pull request #2116 from gitroomhq/feat/reddit-search-by-name
feat(reddit): resolve a pasted r/name or subreddit URL in the subreddit search
2026-09-22 06:55:39 +00:00
Gilad Resisi
8202a150a1 feat(mcp): expose the curated post error in the posts list tool
The repository now returns a curated error message (or null) for every post,
so the MCP List Posts tool passes it through as an "error" field and declares
it in the output schema, matching the public GET /posts response.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XvHgEEangtx46CmTGCrnL1
2026-09-22 13:49:51 +07:00
Gilad Resisi
c8bf9d8f42 fix(calendar): curate post errors at read time instead of write time
Post.error keeps persisting the raw serialized failure; curation moved
to getPosts so the calendar and public API both get the curated
message or null, retroactively for existing rows.
2026-09-22 13:49:51 +07:00
Gilad Resisi
e333f75bd4 fix(calendar): clear the stored error when a post fails again uncuratedly
changeState only wrote the error column when it had a curated message to
store, so a post that first failed with a curated bad_body message and then
failed again for an uncurated reason (a token refresh failure, an unexpected
exception) kept the old value. The calendar tooltip then showed the earlier,
unrelated error - exactly the misleading-message problem this branch set out
to fix.

Overwrite the column on every failure instead: curated messages and internal
strings are stored as before, and anything uncurated clears it so the tooltip
falls back to the generic text. The full failure is still recorded in the
Errors table, so nothing is lost for debugging.

Reported by Sentry's PR review bot.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-22 13:49:51 +07:00
Gilad Resisi
291b07b4b7 fix(calendar): surface curated provider errors in the calendar tooltip
The calendar error tooltip always showed the generic 'An error
occurred while publishing this post' because getPosts never selected
the error column. Select it, but surface ONLY curated provider
messages: bad_body failures whose message came from a provider
handleErrors mapping or a hand-written provider throw. Unmapped API
responses carry the 'Unknown Error' placeholder at the point of
throwing, so anything else - raw API bodies, unexpected exceptions,
internal workflow strings like 'Refresh channel needed' - keeps the
generic tooltip exactly as today.

Curated messages are stored in post.error as {"message":"..."} so
the frontend can distinguish them from everything the column held
until now (internal strings, serialized ActivityFailure dumps), which
all render generic. Internal strings are still stored for debugging
and the raw failure still goes to the Errors table. The
checkPostStatus/finalizePost developer-guard throws are demoted to the
unmapped placeholder (detail moved to the json field) so they can
never surface either. The tooltip is capped at 400px with wrapping.

Verified e2e through real Temporal v1.0.6 workflows on a local run:
a real Pinterest 'Board not found' response surfaced its handleErrors
mapping; an unmapped bad_body, an unexpected exception, a
refreshNeeded early-exit string, and a seeded legacy serialized-blob
row all rendered the generic tooltip (checked in the rendered
calendar DOM).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-22 13:49:51 +07:00
Gilad Resisi
df0dd91a9d feat(reddit): only offer public subreddits from the exact r/name lookup
Mirror the subreddit_type === 'public' filter of the search path so a
pasted r/name that points at a private, restricted or archived
subreddit is not offered as a destination the post would fail on.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-22 13:48:07 +07:00
Gilad Resisi
678acd4adc fix(slack): reject video attachments at save time
The Slack provider sends every attachment as a Block Kit image block,
which Slack only accepts for png / jpg / gif. An mp4 made
chat.postMessage reject the whole message, and the post was still
shown as published.

Add a checkValidity override so a Slack post or comment with an mp4
attachment fails validation with "No video support for Slack, only
images" in the composer, the public API and the MCP schedule tool.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-22 13:36:58 +07:00
Gilad Resisi
4e83569e56 fix(slack): surface chat.postMessage failures instead of marking the post published
Slack answers HTTP 200 with { ok: false, error } when it rejects a
message. post() and comment() destructured ts off that body and returned
status 'posted' regardless, so a rejected post (e.g. invalid_blocks for
an mp4 in an image block) was marked PUBLISHED with an empty release
URL and nothing in the channel.

Check the response after both chat.postMessage calls: auth errors throw
RefreshToken, ratelimited is retried, everything else throws BadBody
with Slack's error code and detail lines as the message.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-22 13:36:40 +07:00
Gilad Resisi
398b41e8a4 feat(reddit): resolve a pasted r/name or subreddit URL in the subreddit search
The composer's "Search Subreddit" box sent the typed text verbatim to
Reddit's subreddit search. A pasted reddit.com/r/<name> URL matched
nothing, so there was no result to pick and the subreddit setting was
saved empty, which then failed validation with "value should not be
null or undefined".

When the text contains r/<name>, search by the name alone and put the
exact subreddit first in the results if it exists. Plain text still
sends the same search request as before, and the exact lookup only
swallows a not-found response so token refresh keeps working.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-22 13:36:21 +07:00
Nevo David
4c835138aa fix: CVE-2026-94456 2026-09-22 11:52:20 +07:00
Nevo David
ab6e4e8e53 Merge remote-tracking branch 'origin/main' 2026-09-22 11:32:32 +07:00
Nevo David
9259cf2429 fix: CVE-2026-94455 2026-09-22 11:32:19 +07:00
Gilad Resisi
4fa33d5216
Merge pull request #2115 from gitroomhq/fix/facebook-reel-insights
fix(facebook): request the reels metrics in video post analytics
2026-09-22 03:47:45 +00:00
Gilad Resisi
9948b072e7 fix(facebook): request the reels metrics in video post analytics
A customer reported that their Facebook posts show no statistics at all;
every one of their Facebook posts is a reel. The video_insights edge
answers a reel with an empty data array for total_video_impressions,
total_video_views and total_video_reactions_by_type_total, so
videoPostAnalytics returned [] and the statistics modal stayed empty.

Verified against a real reel: the same request with fb_reels_total_plays,
post_video_likes_by_reaction_type and post_video_social_actions returns
values, and Graph simply omits whichever metrics do not apply to the
node, so both sets are now requested in one call. Regular videos keep
their existing cases; the new ones map to Plays, Reactions and
Engagement.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wvGQeFVP1UKfi9VAYYBYK
2026-09-22 10:36:56 +07:00
Gilad Resisi
9c594d2814
Merge pull request #2098 from gitroomhq/fix/facebook-analytics-swallowed-errors
fix(facebook): surface Graph API errors in page analytics instead of caching an empty result
2026-09-22 03:05:37 +00:00
Nevo David
c023843702 feat: update chatgpt submission 2026-09-22 09:57:35 +07:00
Nevo David
6af357dd60 feat: update chatgpt submission 2026-09-22 09:12:22 +07:00
Nevo David
3d3e9eee7a feat: update chatgpt submission 2026-09-22 09:11:31 +07:00
Gilad Resisi
8edbc60b60
Merge branch 'main' into fix/duplicate-subscriptions 2026-09-21 17:47:39 +07:00
Gilad Resisi
328b34c594 fix(billing): persist cancelAt on cancel/reactivate instead of waiting for the webhook
POST /billing/cancel toggles Stripe's cancel_at_period_end, but only the
customer.subscription.updated webhook wrote cancelAt to the Subscription
row. When that webhook was lost, delayed or dropped by the handler, the
billing page showed "Cancel subscription" again after a reload, and the
next click toggled the subscription back to active, so the customer was
billed at renewal after cancelling.

- setToCancel writes cancelAt right after the Stripe update succeeds
  (the cancel date on cancel, null on reactivate) through a new
  updateCancelAt service/repository method. The webhook still runs and
  writes the same value.
- The "Subscription Cancelled" email is sent after the call and only when
  the result carries a cancel date, so reactivations no longer send it.
- Both billing page toasts are chosen from the response. When the click
  did the opposite of the button, the toast says so and tells the user to
  click again.

The endpoint stays a toggle and the failed-payment immediate cancel is
unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 17:44:26 +07:00
Nevo David
901f84ff7e
Merge pull request #2111 from gitroomhq/feat/clipping-public-api
feat(public-api): clipping endpoints
2026-09-21 07:56:57 +00:00
Nevo David
dac36eda7b feat(public-api): clipping endpoints
Add POST /public/v1/clipping, GET /public/v1/clipping and GET /public/v1/clipping/:id to the public API, calling the existing ClippingService.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 14:52:45 +07:00
Gilad Resisi
c0bd447d9a fix(frontend): report React render crashes to Sentry from the crash screen
global-error.tsx only reported the error when `useVariables()` returned a
Sentry DSN. This component replaces the root layout, so the variables
context provider is never mounted around it and the context default
(an empty DSN) is what it always got. The effect returned early every
time: in a production build a React render crash showed "Application
error", sent no Sentry event and opened no report dialog.

It went unnoticed because development builds behave differently: there
React re-throws boundary-caught errors to the global error handler, so
the SDK's own handler reported them and the dialog appeared. Production
React does not re-throw, so this component is the only place such an
error can be reported from. Errors outside rendering (timers, promises,
event handlers) were never affected.

The DSN guard is removed rather than rewired. Without an initialised
client `captureException` is a no-op, so self-hosted installs without a
DSN behave as before. The explicit `showReportDialog` call is removed
too: it never ran, and the shared `beforeSend` already opens the report
dialog for every captured exception, so keeping it would request the
dialog twice.

Testing (production build, `next start`, headless Chrome, a temporary
client component that throws during render 3 seconds after load, Sentry
pointed at a local capture server):
- before: no event and no dialog request reach Sentry; the session
  replay is the only trace of the crash
- after, with a DSN: exactly one event (the render error, linked to its
  replay) and exactly one report dialog request
- after, without a DSN: nothing is sent, no dialog request, no extra
  JavaScript errors
- the before state was observed on SDK 10.56.0 and the fix verified on
  10.45.0 (this branch); the cause is in our component, not the SDK

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-18 16:51:02 +07:00
Gilad Resisi
c38f8edbdb chore(deps): pin the Sentry SDK to 10.56.0 to pick up the span/scope leak fix
The installed SDK (10.45.0) has a memory leak in @sentry/core: spans and
scopes reference each other circularly and cannot be garbage collected,
and the span exporter keeps sent spans in an unbounded map. Upstream
tracked it as "Memory leak with high tracesSampleRate"
(getsentry/sentry-javascript#18339) and fixed it in 10.56.0
(getsentry/sentry-javascript#21242). 10.56.0 also carries the 10.49.0
fix for contexts retained through scopes on pooled connections
(getsentry/sentry-javascript#20328).

This matches what we saw in production: the MCP service climbed to the
V8 heap limit about once a day while trace sampling was 100%, and the
climb stopped when #2082 cut sampling to 20%. Sampling less only slows
the leak; this fixes it at the source, for the backend, the orchestrator
and the frontend server alike.

Pinned exactly, not with a caret, on purpose. 10.56.0 is the first
release with the fix, and later minors change behaviour we have not
evaluated: 10.61.0 streams gen_ai spans by default and stops truncating
AI message data, 10.71.0 enables logs by default, 10.72.0 stops
reporting AI errors that propagate to the caller. The lockfile was
regenerated from the committed one with only these four specifiers
changed; the rest of the diff is Sentry's own dependency tree (several
OpenTelemetry instrumentations are now vendored and drop out).
@sentry/webpack-plugin keeps its own build-time @sentry/core copy.

Behaviour changes that do ride along (10.46.0 to 10.56.0): OpenAI span
attributes are renamed from openai.* to gen_ai.* (10.48.0), the NestJS
instrumentation is vendored inside the SDK (10.54.0), array attribute
values are sent as arrays (10.54.0). sendDefaultPii, which the frontend
init uses, is deprecated in 10.57.0 and is untouched here.

Testing on 10.56.0, against a Sentry development environment unless
noted:
- backend, orchestrator and frontend type-check; backend and
  orchestrator boot; production `next build` passes, also when the
  source-map upload fails (the next.config error handler absorbs it)
- backend: HTTP transactions, console logs, an unhandled controller 500
  through the Nest global filter with the organization tag, a process
  level crash, Sentry.metrics counters and profiler ids on spans
- frontend: client init with every configured integration, user and
  organization tag, an uncaught browser error linked to its session
  replay, the crash report dialog, the feedback form, pageload spans
  with browser profiles
- OpenAI integration against a local stub: the wrapped client works for
  chat.completions.create and .parse; create emits a gen_ai.chat span;
  .parse and images.generate are not instrumented on 10.45.0 either
- MCP flows (initialize, tools/list, tools/call) unchanged

Not tested: a successful source-map upload to the real project.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-18 16:47:29 +07:00
Gilad Resisi
74ac26b8ec fix(facebook): surface Graph API errors in page analytics instead of caching an empty result
analytics() destructured only `data` from the page insights response, so any
Graph error body (rate limit, permission, invalid metric) silently became []
and checkAnalytics cached that empty result for an hour. Log the error and
throw, so checkAnalytics skips the cache write and the next call retries.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-18 14:02:33 +07:00
Gilad Resisi
78515f71cf fix(uploads): honor HTTP Range requests so local-storage video uploads work again
The local uploads route ignored the Range header and answered every request
with 200 and the whole file. TikTok, YouTube, LinkedIn and X now read video
chunks with ranged GETs and reject anything but 206, so every video upload
on STORAGE_PROVIDER=local failed with "did not return the requested byte
range". Serve 206 + Content-Range from a ranged createReadStream, advertise
Accept-Ranges, and return 416 for out-of-bounds ranges. Plain GETs are
unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 21:45:49 +07:00
Enno Gelhaus
22bf9904f1
Merge remote-tracking branch 'origin/main' into feat/preview-inline-comments
# Conflicts:
#	apps/frontend/src/app/(app)/layout.tsx
#	libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts
2026-09-16 15:08:29 +02:00
Gilad Resisi
959feac5f8 chore(i18n): translate preview comment keys 2026-09-14 23:03:08 +07:00
Gilad Resisi
6fae13c7bc feat(preview): inline comments, replies, resolve and anonymous commenting
Anchored text comments with highlights, one-level replies, org-scoped
resolve/reopen, named anonymous comments behind optional invisible
reCAPTCHA v2 and the IP throttler, and a dashboard restyle of /p/:id.
2026-09-14 22:57:16 +07:00
Gilad Resisi
5fb2f5368e chore: drop unused Injectable import from stripe.service 2026-09-10 14:26:26 +07:00
Gilad Resisi
76d6616e04 fix: reject in-app cancel when the org has no live Stripe subscription 2026-09-10 14:17:04 +07:00
Gilad Resisi
c3f39b97fe fix: use console.log for the new stripe guard log lines 2026-09-10 14:09:43 +07:00
Gilad Resisi
28e71678b0 fix: guard against duplicate Stripe subscriptions per customer
Onboarding checkout now refuses to mint a new subscription when the org's
Stripe customer already has a live one, the created webhook cancels a
duplicate, the deleted webhook keeps the org on a surviving subscription,
and in-app cancel acts on all live subscriptions.
2026-09-10 13:59:43 +07:00
Gilad Resisi
063ee50954 fix: validate page query on GET /public/v1/media
A negative page produced a negative Prisma skip and a 500. GetMediaDto
(same shape as GetNotificationsDto) now rejects non-numeric or < 1 values
with 400 and defaults to 1.

Tested: page=abc / 0 / -3 return 400 with validation messages, page=1.5
parses to 1, no page / page=2 / search unchanged, unauthenticated still 401.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 22:43:57 +07:00
Gilad Resisi
5cd4de2f4d feat: list media via public API and MCP mediaListTool
Adds GET /public/v1/media?page=&search= and a read-only mediaListTool so
agents can reuse already-uploaded media paths as attachments instead of
re-uploading. getMedia select now also returns type, fileSize, createdAt.

Tested: unauthenticated request returns 401; with an API key pagination
(pages count, page 2), filename search and the new fields verified;
mediaListTool appears in the MCP tools list, returns the same rows, and a
draft scheduled through the MCP with a listed path stores that path as the
post image.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 18:34:29 +07:00
Gilad Resisi
e5f6fff338 feat(mcp): accept { path, thumbnail } attachments for video covers
integrationSchedulePostTool attachments now accept either a plain URL
string or { path, thumbnail }, with thumbnail forwarded as the media
thumbnail (e.g. Instagram Reel cover_url). The public API already
accepted image[].thumbnail; this brings MCP to parity.

E2e-verified: MCP call with { path, thumbnail } and the equivalent
public-API request both published Reels with the custom cover.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 17:21:22 +07:00
Gilad Resisi
49aa92ac27 fix(integrations): keep the new refresh token when reconnecting a channel
Reconnecting a channel resolved the auth result with refreshToken:
body.refresh - a field that is empty on the OAuth callback - so every
reconnect overwrote the stored refresh token with an empty string and
set a ~31 year token expiration. From that moment the channel worked
only while the fresh access token lived (~1 hour for YouTube/GMB):
the next refresh attempt failed before even reaching the provider,
the channel was flagged for reconnection, and the next reconnect
wiped the token again - a permanent loop that no amount of
re-authorizing could escape.

- store auth.refreshToken / auth.expiresIn from the new authentication
  in the reconnect branch (reConnect stays identity-verification only)
- guard the repository update so an empty refresh token can never
  overwrite a stored one
- log the real error when a refresh or post-refresh reConnect fails
  instead of swallowing it, and pass it into the user notification
- add an optional refreshErrorMessage provider hook; YouTube maps
  Google's invalid_rapt (Workspace session policy) to a dedicated
  message telling the user how to exempt Postiz
- YouTube reConnect no longer goes through pages(), which swallowed
  the real Google error and reported any failure as 'Channel not found'
- drop the duplicated disconnect notification (refreshProcess notified
  once directly and again via disconnectChannel)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-12 19:12:50 +07:00
Gilad Resisi
4f469c7cc8 fix(providers): wire the LinkedIn and Moltbook settings DTOs
validatePosts runs settings-DTO validation only when the provider
declares `dto`. LinkedinProvider and MoltbookProvider never did, so for
linkedin, linkedin-page (inherits from LinkedinProvider) and moltbook
that validation layer silently did not run: LinkedinDto and MoltbookDto
existed but were unwired, and any malformed or missing settings value
was accepted and stored.

The dashboard never hits this (its form validates client-side with the
same DTO classes), but the public API (POST /public/v1/posts,
PUT /public/v1/posts/:id/settings) and the agent/MCP tools share
validatePosts and were unprotected - an API caller's typo or an
LLM-guessed settings value was accepted with a 200. The cost surfaced
later instead: a moltbook post without submolt silently publishes to
the "general" community (provider falls back to it), and a truthy
non-boolean carousel value on LinkedIn fails at publish time on a post
the user was told was valid.

Declare `dto = LinkedinDto` on LinkedinProvider (LinkedinPageProvider
inherits it) and `dto = MoltbookDto` on MoltbookProvider, so bad values
are rejected at save time with a specific message (400 / {errors}).
Audited all providers: these were the only unwired settings DTOs.
2026-08-12 13:52:55 +07:00
Gilad Resisi
2e807934c5 feat(instagram): use custom thumbnail as reel cover via cover_url
When a single-video reel's media has a thumbnail set, send it as
cover_url on the media container so Instagram uses it as the reel
cover; media without a thumbnail keep publishing via thumb_offset
exactly as before. Stories, carousel items and images are untouched.

E2e-tested on a Facebook-Login Instagram channel: reels published with
both JPEG and PNG covers, cover confirmed on the profile reels grid
(PNG accepted despite Meta docs listing JPEG only). Standalone
Instagram-Login shares this postPending, not separately e2e-tested.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 10:16:35 +07:00
Gilad Resisi
1f7e1b6b40 fix(tags): always restore dropdown closability after edit/delete modals
Wrap the async bodies of editTag and deleteTag in try/finally so
setAllowClose(true) runs even if mutate or the delete request rejects;
otherwise a failed request left the dropdown's click-outside close
permanently disabled until a page reload.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-04 09:16:16 +07:00
Gilad Resisi
d9bae16b28 fix(tags): readable calendar tag labels on any tag color
Replaces the mix-blend-difference treatment on the calendar tag bar
(label and hover action icons) with the white-text + text-shadow-tags
outline already used in the tags dropdown, so the bar stays readable for
light, gray, and saturated tag colors alike. Posts without a tag color
keep the bg-btnPrimary fallback unchanged.

Tested e2e on a local run: reproduced the unreadable label on main with a
mid-gray tag (white-on-gray difference blend is near-invisible for the
label and the hover icons), then verified on this branch that the label
and all hover action icons are crisply readable on mid-gray, pastel,
saturated red, and purple tags, with before/after screenshots of the same
post and color.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-03 15:31:31 +07:00
Gilad Resisi
751ce66c46 feat(tags): expose tag editing in the tags dropdown
Adds a pencil edit affordance on every row of the tags dropdown in the
creation modal (spaced away from the delete x to avoid mis-clicks), wired
to the existing ShowModal edit mode (PUT /posts/tags/:id). After saving,
the tag list revalidates and any selected instance of the edited tag is
remapped so chips and the post value reflect the new name/color without a
reload. Uses onClose to resolve the modal promise so dismissing without
saving restores the click-outside behavior. Adds a PencilIcon to the
shared ui/icons (none existed) and the edit_tag translation key with
lingo.dev translations for all locales.

Tested e2e on a local run: edited a selected tag's name and color from
the dropdown - the PUT persisted, the dropdown row and the selected
footer chip updated immediately without a reload, re-saving the post kept
it attached to the renamed tag, and dismissing the modal without saving
restored the dropdown's click-outside close.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-03 15:31:08 +07:00
Gilad Resisi
8d81cacdc6 fix(tags): clean up post assignments on tag deletion and stop matching soft-deleted tags
Deleting a tag now hard-deletes its TagsPosts rows (org-scoped soft-delete
runs first), the save-path tag matching filters deletedAt so a recreated
same-name tag can no longer attach the old dead tag alongside it, and the
post read queries filter soft-deleted tags out of the tags include so
already-orphaned assignments stop rendering immediately and self-heal on
the next save.

Tested e2e on a local run: reproduced the stuck remnant and the doubled
label on main (delete tag assigned to 2 posts -> assignments and calendar
label survive; recreate same name -> both dead and live tag attach), then
verified on this branch that orphaned assignments stop rendering
immediately, re-saving a post drops the orphan row, deleting a live tag
removes its assignments, and a recreated same-name tag attaches exactly
once - all confirmed in both the calendar UI and the DB.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-03 15:30:53 +07:00
Gilad Resisi
178619d43b fix(integrations): send a single notification when a token refresh fails
When a token refresh fails, refreshProcess sent the refresh-error
notification (with the failure cause) and then called disconnectChannel,
which sends the same notification again without the cause. Every failed
refresh therefore emailed the user twice: once titled "Could not refresh
your <provider> channel <cause>" and once "Could not refresh your
<provider> channel".

Drop the disconnectChannel call from the failure branch: the
refreshNeeded call two lines earlier already sets the same flag
disconnectChannel would, so the only thing it added was the duplicate
email. disconnectChannel itself is unchanged for its other callers.

Reproduced by triggering a post on an Instagram channel holding an
invalid token (refresh fails since the provider cannot refresh) — two
emails arrived for the single failure. After the fix, the same scenario
produces exactly one email (the one including the failure cause), and
the channel is still flagged as needing reconnection.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 19:01:21 +07:00
356 changed files with 24063 additions and 4510 deletions

View File

@ -51,6 +51,10 @@ STORAGE_PROVIDER="local"
# Your upload directory path if you host your files locally, otherwise Cloudflare will be used.
#NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY=""
# Only needed if you run your own Postiz Canva app: its origin from the Canva
# Developer Portal (Security -> Credentials), allowed by CORS on the backend.
#CANVA_APP_ORIGIN="https://app-xxxxxxxxxxx.canva-apps.com"
# Sign in with Apple (login provider)
# APPLE_BUNDLE_ID: iOS app bundle id (native mobile sign-in)
# APPLE_SERVICE_ID / TEAM_ID / KEY_ID / PRIVATE_KEY: web sign-in (Services ID + .p8 key)
@ -121,6 +125,17 @@ OPENAI_API_KEY=""
# OAuth client configured for the ChatGPT app. Only this client can receive
# verified user email claims for ChatGPT Enterprise domain restrictions.
OPENAI_OAUTH_CLIENT_ID=""
# Client id of the OAuth app (Settings > Developers) that HubSpot agents
# connect with. HubSpot sends no client secret, so this one app uses PKCE
# instead, gets a refresh token, and the MCP backend answers OAuth discovery
# at its domain root. Set it on both the API and the MCP backend.
# HUBSPOT_OAUTH_CLIENT_ID=""
# Client id and secret of the HubSpot app itself (HubSpot project > app >
# Auth tab), not of the Postiz app above. Its redirect URL is
# <NEXT_PUBLIC_BACKEND_URL>/oauth/hubspot/callback, which finishes the install
# (HubSpot only counts it once the code is exchanged). Set them on the API.
# HUBSPOT_APP_CLIENT_ID=""
# HUBSPOT_APP_CLIENT_SECRET=""
# MCP OAuth Dynamic Client Registration (RFC 7591) redirect-domain allowlist.
# When set (comma separated), POST /oauth/register only accepts redirect_uris
# whose host matches a listed domain or one of its subdomains; unset or empty
@ -130,6 +145,11 @@ OPENAI_OAUTH_CLIENT_ID=""
# and are always accepted. Example locks web callbacks to the claude.ai
# connector; add cursor.com for Cursor.
# DCR_VERIFIED_DOMAINS="claude.ai,claude.com"
# Postiz Cloud only: lets people connect a self-hosted Postiz on the MCP
# consent screen ("Use self-hosted"). The MCP tool calls of that connection
# are relayed to the instance with its API key. Leave unset on self-hosted
# installs; set it on both the API and the MCP backend.
# MCP_SELF_HOSTED_RELAY=true
# EVOLINK_API_KEY="" # EvoLink API key for Seedance AI video generation (https://evolink.ai)
NEXT_PUBLIC_DISCORD_SUPPORT=""
NEXT_PUBLIC_POLOTNO=""
@ -184,6 +204,10 @@ POSTIZ_OAUTH_CLIENT_SECRET=""
# LINK_DRIP_API_ENDPOINT="https://api.linkdrip.com/v1/" # Your self-hosted LinkDrip API endpoint
# LINK_DRIP_SHORT_LINK_DOMAIN="dripl.ink" # Your self-hosted LinkDrip domain
# reCAPTCHA Settings (invisible v2 on anonymous preview comments, optional; unset = no captcha)
# RECAPTCHA_SITE_KEY="" # Your reCAPTCHA v2 invisible site key
# RECAPTCHA_SECRET_KEY="" # Your reCAPTCHA v2 invisible secret key
# Provider visibility / migration
# HIDDEN_PROVIDERS="tiktok" # comma-separated identifiers hidden from the add-channel screen
# MIGRATE_PROVIDERS="tiktok:tiktok-business" # comma-separated "old:new" pairs, a reconnect of "old" goes through "new" and the channel is migrated in place

1
.github/agents/ai-agents-cli.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><path d="M22 35L28 29L22 23M30 37H38" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></path></svg>

After

Width:  |  Height:  |  Size: 285 B

1
.github/agents/chatgpt.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><path d="M43.7123 27.0973C44.4383 24.9182 44.1883 22.5312 43.0273 20.5491C41.2813 17.5091 37.7712 15.9451 34.3431 16.6811C32.8181 14.963 30.6271 13.986 28.33 14C24.826 13.992 21.7169 16.2481 20.6389 19.5821C18.3878 20.0431 16.4448 21.4522 15.3078 23.4492C13.5488 26.4813 13.9498 30.3033 16.2998 32.9034C15.5738 35.0824 15.8238 37.4694 16.9848 39.4515C18.7309 42.4915 22.2409 44.0556 25.669 43.3196C27.193 45.0376 29.385 46.0146 31.6821 45.9996C35.1881 46.0086 38.2982 43.7506 39.3762 40.4135C41.6273 39.9525 43.5703 38.5435 44.7073 36.5464C46.4643 33.5144 46.0623 29.6953 43.7133 27.0953L43.7123 27.0973ZM31.6841 43.9086C30.2811 43.9106 28.922 43.4196 27.845 42.5205C27.894 42.4945 27.979 42.4475 28.034 42.4135L34.4061 38.7335C34.7321 38.5485 34.9321 38.2015 34.9301 37.8265V28.8433L37.6232 30.3983C37.6522 30.4123 37.6712 30.4403 37.6752 30.4723V37.9115C37.6712 41.2195 34.9921 43.9016 31.6841 43.9086ZM18.7999 38.4055C18.0968 37.1914 17.8438 35.7684 18.0848 34.3874C18.1318 34.4154 18.2148 34.4664 18.2738 34.5004L24.646 38.1805C24.969 38.3695 25.369 38.3695 25.693 38.1805L33.4721 33.6884V36.7984C33.4741 36.8304 33.4591 36.8614 33.4341 36.8814L26.993 40.6005C24.1239 42.2525 20.4599 41.2705 18.8009 38.4055H18.7999ZM17.1228 24.4962C17.8228 23.2802 18.9279 22.3502 20.2439 21.8672C20.2439 21.9222 20.2409 22.0192 20.2409 22.0872V29.4483C20.2389 29.8223 20.4389 30.1693 20.7639 30.3543L28.543 34.8454L25.85 36.4004C25.823 36.4184 25.789 36.4214 25.759 36.4084L19.3169 32.6864C16.4538 31.0283 15.4718 27.3653 17.1218 24.4972L17.1228 24.4962ZM39.2492 29.6453L31.4701 25.1532L34.1631 23.5992C34.1901 23.5812 34.2241 23.5782 34.2541 23.5912L40.6962 27.3103C43.5643 28.9673 44.5473 32.6364 42.8903 35.5044C42.1893 36.7184 41.0853 37.6485 39.7702 38.1325V30.5513C39.7732 30.1773 39.5742 29.8313 39.2502 29.6453H39.2492ZM41.9293 25.6112C41.8823 25.5822 41.7993 25.5322 41.7403 25.4982L35.3681 21.8182C35.0451 21.6292 34.6451 21.6292 34.3211 21.8182L26.542 26.3102V23.2002C26.54 23.1682 26.555 23.1372 26.58 23.1172L33.0211 19.4011C35.8902 17.7461 39.5582 18.7311 41.2123 21.6012C41.9113 22.8132 42.1643 24.2322 41.9273 25.6112H41.9293ZM25.078 31.1543L22.3839 29.5993C22.3549 29.5853 22.3359 29.5573 22.3319 29.5253V22.0862C22.3339 18.7741 25.021 16.0901 28.333 16.0921C29.734 16.0921 31.0901 16.5841 32.1671 17.4801C32.1181 17.5061 32.0341 17.5531 31.9781 17.5871L25.606 21.2672C25.28 21.4522 25.08 21.7982 25.082 22.1732L25.078 31.1523V31.1543ZM26.541 28.0003L30.0061 25.9992L33.4711 27.9993V32.0004L30.0061 34.0004L26.541 32.0004V28.0003Z" fill="white"></path></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

1
.github/agents/claude-code.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><rect width="60" height="60" rx="30" fill="#D97757"></rect><path d="M29.1455 46.3636L28.3274 45.7418L27.8692 44.7273L28.3274 42.6982L28.851 40.08L29.2764 37.9854L29.6692 35.4L29.8983 34.5491L29.8655 34.4836L29.7019 34.5164L27.7383 37.2L24.7601 41.2254L22.4037 43.7127L21.8474 43.9418L20.8655 43.4509L20.9637 42.5345L21.5201 41.7491L24.7601 37.5927L26.7237 35.0073L28.0001 33.5345L27.9674 33.3382H27.9019L19.2619 38.9673L17.7237 39.1636L17.0364 38.5418L17.1346 37.5273L17.4619 37.2L20.0474 35.4L26.4946 31.8L26.5928 31.4727L26.4946 31.3091H26.1674L25.0874 31.2436L21.4219 31.1454L18.2474 31.0145L15.1383 30.8509L14.3528 30.6873L13.6328 29.7054L13.6983 29.2145L14.3528 28.7891L15.3019 28.8545L17.3637 29.0182L20.4728 29.2145L22.731 29.3454L26.0692 29.7054H26.5928L26.6583 29.4764L26.4946 29.3454L26.3637 29.2145L23.1237 27.0545L19.6546 24.7636L17.8219 23.4218L16.8401 22.7345L16.3492 22.1127L16.1528 20.7382L17.0364 19.7564L18.2474 19.8545L18.5419 19.92L19.7528 20.8691L22.3383 22.8654L25.7419 25.3854L26.2328 25.7782L26.4619 25.6473V25.5491L26.2328 25.1891L24.4001 21.8509L22.4364 18.4473L21.5528 17.04L21.3237 16.1891C21.2364 15.8945 21.1928 15.5673 21.1928 15.2073L22.2074 13.8327L22.7637 13.6364L24.1383 13.8327L24.6946 14.3236L25.5455 16.2545L26.8874 19.2982L29.0146 23.4218L29.6364 24.6654L29.9637 25.7782L30.0946 26.1382H30.3237V25.9418L30.4874 23.5854L30.8146 20.7382L31.1419 17.0727L31.2401 16.0254L31.7637 14.7818L32.7783 14.1273L33.5637 14.4873L34.2183 15.4364L34.1201 16.0254L33.7601 18.5454L32.9746 22.5054L32.4837 25.1891H32.7783L33.1055 24.8291L34.4474 23.0618L36.7055 20.2473L37.6874 19.1345L38.8655 17.8909L39.6183 17.3018H41.0255L42.0401 18.84L41.5819 20.4436L40.1419 22.2764L38.931 23.8145L37.1964 26.1382L36.1492 28.0036L36.2474 28.1345H36.4764L40.371 27.2836L42.4983 26.9236L44.9855 26.4982L46.131 27.0218L46.2619 27.5454L45.8037 28.6582L43.1201 29.3127L39.9783 29.9345L35.2983 31.0473L35.2328 31.08L35.2983 31.1782L37.3928 31.3745L38.3092 31.44H40.5346L44.6583 31.7345L45.7383 32.4545L46.3601 33.3054L46.2619 33.9927L44.5928 34.8109L42.3674 34.2873L37.131 33.0436L35.3637 32.6182H35.1019V32.7491L36.6074 34.2218L39.3237 36.6764L42.7601 39.8509L42.9237 40.6364L42.4983 41.2909L42.0401 41.2254L39.0292 38.9345L37.851 37.92L35.2328 35.7273H35.0692V35.9564L35.6583 36.84L38.8655 41.6509L39.0292 43.1236L38.8001 43.5818L37.9492 43.8764L37.0655 43.7127L35.1674 41.0945L33.2365 38.1164L31.6655 35.4654L31.5019 35.5964L30.5528 45.48L30.1274 45.9709L29.1455 46.3636Z" fill="white"></path></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

1
.github/agents/claude-cowork.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><path d="M29.1455 46.3636L28.3274 45.7418L27.8692 44.7273L28.3274 42.6982L28.851 40.08L29.2764 37.9854L29.6692 35.4L29.8983 34.5491L29.8655 34.4836L29.7019 34.5164L27.7383 37.2L24.7601 41.2254L22.4037 43.7127L21.8474 43.9418L20.8655 43.4509L20.9637 42.5345L21.5201 41.7491L24.7601 37.5927L26.7237 35.0073L28.0001 33.5345L27.9674 33.3382H27.9019L19.2619 38.9673L17.7237 39.1636L17.0364 38.5418L17.1346 37.5273L17.4619 37.2L20.0474 35.4L26.4946 31.8L26.5928 31.4727L26.4946 31.3091H26.1674L25.0874 31.2436L21.4219 31.1454L18.2474 31.0145L15.1383 30.8509L14.3528 30.6873L13.6328 29.7054L13.6983 29.2145L14.3528 28.7891L15.3019 28.8545L17.3637 29.0182L20.4728 29.2145L22.731 29.3454L26.0692 29.7054H26.5928L26.6583 29.4764L26.4946 29.3454L26.3637 29.2145L23.1237 27.0545L19.6546 24.7636L17.8219 23.4218L16.8401 22.7345L16.3492 22.1127L16.1528 20.7382L17.0364 19.7564L18.2474 19.8545L18.5419 19.92L19.7528 20.8691L22.3383 22.8654L25.7419 25.3854L26.2328 25.7782L26.4619 25.6473V25.5491L26.2328 25.1891L24.4001 21.8509L22.4364 18.4473L21.5528 17.04L21.3237 16.1891C21.2364 15.8945 21.1928 15.5673 21.1928 15.2073L22.2074 13.8327L22.7637 13.6364L24.1383 13.8327L24.6946 14.3236L25.5455 16.2545L26.8874 19.2982L29.0146 23.4218L29.6364 24.6654L29.9637 25.7782L30.0946 26.1382H30.3237V25.9418L30.4874 23.5854L30.8146 20.7382L31.1419 17.0727L31.2401 16.0254L31.7637 14.7818L32.7783 14.1273L33.5637 14.4873L34.2183 15.4364L34.1201 16.0254L33.7601 18.5454L32.9746 22.5054L32.4837 25.1891H32.7783L33.1055 24.8291L34.4474 23.0618L36.7055 20.2473L37.6874 19.1345L38.8655 17.8909L39.6183 17.3018H41.0255L42.0401 18.84L41.5819 20.4436L40.1419 22.2764L38.931 23.8145L37.1964 26.1382L36.1492 28.0036L36.2474 28.1345H36.4764L40.371 27.2836L42.4983 26.9236L44.9855 26.4982L46.131 27.0218L46.2619 27.5454L45.8037 28.6582L43.1201 29.3127L39.9783 29.9345L35.2983 31.0473L35.2328 31.08L35.2983 31.1782L37.3928 31.3745L38.3092 31.44H40.5346L44.6583 31.7345L45.7383 32.4545L46.3601 33.3054L46.2619 33.9927L44.5928 34.8109L42.3674 34.2873L37.131 33.0436L35.3637 32.6182H35.1019V32.7491L36.6074 34.2218L39.3237 36.6764L42.7601 39.8509L42.9237 40.6364L42.4983 41.2909L42.0401 41.2254L39.0292 38.9345L37.851 37.92L35.2328 35.7273H35.0692V35.9564L35.6583 36.84L38.8655 41.6509L39.0292 43.1236L38.8001 43.5818L37.9492 43.8764L37.0655 43.7127L35.1674 41.0945L33.2365 38.1164L31.6655 35.4654L31.5019 35.5964L30.5528 45.48L30.1274 45.9709L29.1455 46.3636Z" fill="#D97757"></path></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

1
.github/agents/claude.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><path d="M29.1455 46.3636L28.3274 45.7418L27.8692 44.7273L28.3274 42.6982L28.851 40.08L29.2764 37.9854L29.6692 35.4L29.8983 34.5491L29.8655 34.4836L29.7019 34.5164L27.7383 37.2L24.7601 41.2254L22.4037 43.7127L21.8474 43.9418L20.8655 43.4509L20.9637 42.5345L21.5201 41.7491L24.7601 37.5927L26.7237 35.0073L28.0001 33.5345L27.9674 33.3382H27.9019L19.2619 38.9673L17.7237 39.1636L17.0364 38.5418L17.1346 37.5273L17.4619 37.2L20.0474 35.4L26.4946 31.8L26.5928 31.4727L26.4946 31.3091H26.1674L25.0874 31.2436L21.4219 31.1454L18.2474 31.0145L15.1383 30.8509L14.3528 30.6873L13.6328 29.7054L13.6983 29.2145L14.3528 28.7891L15.3019 28.8545L17.3637 29.0182L20.4728 29.2145L22.731 29.3454L26.0692 29.7054H26.5928L26.6583 29.4764L26.4946 29.3454L26.3637 29.2145L23.1237 27.0545L19.6546 24.7636L17.8219 23.4218L16.8401 22.7345L16.3492 22.1127L16.1528 20.7382L17.0364 19.7564L18.2474 19.8545L18.5419 19.92L19.7528 20.8691L22.3383 22.8654L25.7419 25.3854L26.2328 25.7782L26.4619 25.6473V25.5491L26.2328 25.1891L24.4001 21.8509L22.4364 18.4473L21.5528 17.04L21.3237 16.1891C21.2364 15.8945 21.1928 15.5673 21.1928 15.2073L22.2074 13.8327L22.7637 13.6364L24.1383 13.8327L24.6946 14.3236L25.5455 16.2545L26.8874 19.2982L29.0146 23.4218L29.6364 24.6654L29.9637 25.7782L30.0946 26.1382H30.3237V25.9418L30.4874 23.5854L30.8146 20.7382L31.1419 17.0727L31.2401 16.0254L31.7637 14.7818L32.7783 14.1273L33.5637 14.4873L34.2183 15.4364L34.1201 16.0254L33.7601 18.5454L32.9746 22.5054L32.4837 25.1891H32.7783L33.1055 24.8291L34.4474 23.0618L36.7055 20.2473L37.6874 19.1345L38.8655 17.8909L39.6183 17.3018H41.0255L42.0401 18.84L41.5819 20.4436L40.1419 22.2764L38.931 23.8145L37.1964 26.1382L36.1492 28.0036L36.2474 28.1345H36.4764L40.371 27.2836L42.4983 26.9236L44.9855 26.4982L46.131 27.0218L46.2619 27.5454L45.8037 28.6582L43.1201 29.3127L39.9783 29.9345L35.2983 31.0473L35.2328 31.08L35.2983 31.1782L37.3928 31.3745L38.3092 31.44H40.5346L44.6583 31.7345L45.7383 32.4545L46.3601 33.3054L46.2619 33.9927L44.5928 34.8109L42.3674 34.2873L37.131 33.0436L35.3637 32.6182H35.1019V32.7491L36.6074 34.2218L39.3237 36.6764L42.7601 39.8509L42.9237 40.6364L42.4983 41.2909L42.0401 41.2254L39.0292 38.9345L37.851 37.92L35.2328 35.7273H35.0692V35.9564L35.6583 36.84L38.8655 41.6509L39.0292 43.1236L38.8001 43.5818L37.9492 43.8764L37.0655 43.7127L35.1674 41.0945L33.2365 38.1164L31.6655 35.4654L31.5019 35.5964L30.5528 45.48L30.1274 45.9709L29.1455 46.3636Z" fill="#D97757"></path></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

1
.github/agents/codex.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><g transform="translate(12 12) scale(1.5)"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z" fill="white"></path></g></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

1
.github/agents/cursor.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><g transform="translate(18 13)"><path d="M11.925 34l11.925-6.875L11.925 20.25 0 27.125 11.925 34z" fill="white" fill-opacity="0.95"></path><path d="M23.85 27.125V13.375L11.925 6.5v13.75l11.925 6.875z" fill="white" fill-opacity="0.5"></path><path d="M11.925 6.5L0 13.375v13.75l11.925-6.875V6.5z" fill="white" fill-opacity="0.75"></path></g></svg>

After

Width:  |  Height:  |  Size: 500 B

1
.github/agents/grok-bot.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><g transform="translate(12 12) scale(0.5143)"><path fill-rule="evenodd" clip-rule="evenodd" d="M69.7784 34.9999C69.7784 39.871 68.7523 44.7296 66.7851 49.1832C64.9333 53.3744 62.2559 57.1874 58.9467 60.3483C55.8445 63.3119 52.1983 65.6915 48.2409 67.3356C44.5469 68.8705 40.5934 69.7611 36.6016 69.9583C32.8943 70.1403 29.1612 69.7256 25.5837 68.7326C22.2821 67.8153 19.1179 66.4087 16.2238 64.5701C6.14513 58.167 0 46.9674 0 34.9999C0 30.1288 1.0261 25.2701 2.99334 20.8165C7.82793 9.87552 17.9696 2.13463 29.7702 0.378474C33.1587 -0.126158 36.6197 -0.126158 40.0082 0.378474C43.6802 0.925238 47.2606 2.06281 50.5756 3.73662C54.1464 5.5397 57.4013 7.96136 60.157 10.8656C63.1112 13.9777 65.4831 17.6355 67.122 21.6056C68.8707 25.8408 69.7784 30.416 69.7784 34.9999ZM45.0815 25.5794C45.4136 26.1492 45.6484 26.7544 45.7315 27.4122C46.0379 29.8319 44.3112 32.0065 41.8829 32.2163C41.3665 32.2613 40.8425 32.2134 40.3414 32.0803C39.3229 31.8093 38.4123 31.185 37.7852 30.3366C37.496 29.9449 37.2574 29.5121 36.9996 29.1013C35.8351 27.2465 34.6239 25.4224 33.361 23.6346C32.9707 23.0802 32.5745 22.5296 32.1727 21.9829C31.8825 21.5864 31.5647 21.2024 31.347 20.7581C30.8163 19.679 30.845 18.3997 31.4282 17.3473C32.7244 15.008 36.0136 14.5091 38.1575 15.9273C38.8008 16.3534 39.2408 16.9404 39.6904 17.5532C40.0417 18.031 40.3881 18.5117 40.7308 18.9953C41.7388 20.4163 42.7133 21.8603 43.6583 23.3234C44.1403 24.0694 44.6348 24.8124 45.0815 25.5794ZM60.3288 19.2126C60.6056 19.7766 60.8261 20.3636 60.933 20.9851C61.1697 22.3515 60.786 24.0856 59.1232 24.1718C58.8398 24.1862 58.5553 24.1469 58.2814 24.0732C57.8595 23.9583 57.4624 23.762 57.0968 23.5216C56.2464 22.9634 55.5515 22.1686 55.0418 21.2905C54.8432 20.9468 54.6724 20.5867 54.4853 20.2363C54.1951 19.6905 53.8925 19.1514 53.5795 18.618C52.2536 16.3677 50.7092 14.2956 49.0159 12.3134C48.2838 11.4564 47.2348 9.80561 48.1426 8.71974C48.5234 8.26395 49.1429 8.11553 49.7118 8.11457C50.8963 8.11361 52.0685 8.64601 53.0306 9.30194C54.2037 10.1034 55.0971 11.2448 55.9667 12.3537C57.6323 14.4775 59.1385 16.7843 60.3288 19.2126Z" fill="white"></path></g></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

1
.github/agents/grok-build.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><g transform="translate(12 12) scale(1.5)"><path fill-rule="evenodd" d="M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815" fill="white"></path></g></svg>

After

Width:  |  Height:  |  Size: 815 B

1
.github/agents/hermes-agent.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 20 KiB

1
.github/agents/mcp-server.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><g transform="translate(12 12) scale(1.5)"><path d="M13.85 0a4.16 4.16 0 0 0-2.95 1.217L1.456 10.66a.835.835 0 0 0 0 1.18.835.835 0 0 0 1.18 0l9.442-9.442a2.49 2.49 0 0 1 3.541 0 2.49 2.49 0 0 1 0 3.541L8.59 12.97l-.1.1a.835.835 0 0 0 0 1.18.835.835 0 0 0 1.18 0l.1-.098 7.03-7.034a2.49 2.49 0 0 1 3.542 0l.049.05a2.49 2.49 0 0 1 0 3.54l-8.54 8.54a1.96 1.96 0 0 0 0 2.755l1.753 1.753a.835.835 0 0 0 1.18 0 .835.835 0 0 0 0-1.18l-1.753-1.753a.266.266 0 0 1 0-.394l8.54-8.54a4.185 4.185 0 0 0 0-5.9l-.05-.05a4.16 4.16 0 0 0-2.95-1.218c-.2 0-.401.02-.6.048a4.17 4.17 0 0 0-1.17-3.552A4.16 4.16 0 0 0 13.85 0m0 3.333a.84.84 0 0 0-.59.245L6.275 10.56a4.186 4.186 0 0 0 0 5.902 4.186 4.186 0 0 0 5.902 0L19.16 9.48a.835.835 0 0 0 0-1.18.835.835 0 0 0-1.18 0l-6.985 6.984a2.49 2.49 0 0 1-3.54 0 2.49 2.49 0 0 1 0-3.54l6.983-6.985a.835.835 0 0 0 0-1.18.84.84 0 0 0-.59-.245" fill="white"></path></g></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

1
.github/agents/muse.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 25 KiB

1
.github/agents/nanoclaw.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><text x="30" y="30" text-anchor="middle" dominant-baseline="central" font-family="Inter, Arial, sans-serif" font-weight="700" font-size="30" fill="white">n</text></svg>

After

Width:  |  Height:  |  Size: 323 B

1
.github/agents/openclaw.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><path d="M29.9996 15.7987C20.4686 15.7987 15.7031 23.7412 15.7031 30.0952C15.7031 36.4492 20.4686 42.8032 25.2341 44.3902V47.5672H28.4111V44.3902C28.4111 44.3902 29.9996 45.0256 31.5881 44.3902V47.5672H34.7651V44.3902C39.5306 42.8017 44.2961 36.4492 44.2961 30.0952C44.2961 23.7412 39.5306 15.7987 29.9996 15.7987Z" fill="url(#openclaw-a)"></path><path d="M17.29 26.9175C12.526 25.329 10.936 28.506 12.526 31.683C14.1145 34.86 17.29 33.2715 18.88 30.0945C19.8316 27.8706 18.88 26.9175 17.29 26.9175Z" fill="url(#openclaw-b)"></path><path d="M42.704 26.9175C47.468 25.329 49.058 28.506 47.468 31.683C45.8795 34.86 42.704 33.2715 41.114 30.0945C40.1624 27.8706 41.114 26.9175 42.704 26.9175Z" fill="url(#openclaw-c)"></path><path d="M20.2193 14.7526C20.936 14.3235 21.7792 14.4018 22.6509 14.8083C23.5197 15.2149 24.4924 15.9737 25.5675 17.0488C25.6567 17.138 25.7069 17.2591 25.7069 17.3853C25.7069 17.5115 25.6567 17.6326 25.5675 17.7218C25.4782 17.8111 25.3572 17.8612 25.2309 17.8612C25.1047 17.8612 24.9837 17.8111 24.8944 17.7218C23.851 16.6784 22.9686 16.0083 22.2489 15.6726C21.5337 15.3383 21.0519 15.3639 20.7101 15.5687C20.6025 15.6237 20.478 15.6358 20.3617 15.6026C20.2455 15.5694 20.1462 15.4933 20.0839 15.3897C20.0216 15.2861 20.0009 15.1627 20.026 15.0445C20.0512 14.9262 20.1202 14.8219 20.2193 14.7526ZM37.3389 14.8098C38.2122 14.4033 39.0554 14.3235 39.7721 14.7526C39.8711 14.8219 39.9402 14.9262 39.9653 15.0445C39.9904 15.1627 39.9698 15.2861 39.9075 15.3897C39.8452 15.4933 39.7459 15.5694 39.6296 15.6026C39.5134 15.6358 39.3889 15.6237 39.2813 15.5687C38.9395 15.3639 38.4576 15.3383 37.7424 15.6726C37.0227 16.0083 36.1404 16.6784 35.0985 17.7218C35.0543 17.7661 35.0018 17.8013 34.944 17.8253C34.8862 17.8493 34.8243 17.8617 34.7617 17.8617C34.6991 17.8618 34.6372 17.8496 34.5793 17.8257C34.5215 17.8018 34.469 17.7668 34.4247 17.7226C34.3804 17.6784 34.3452 17.6259 34.3212 17.5681C34.2972 17.5103 34.2848 17.4484 34.2847 17.3858C34.2847 17.3233 34.2969 17.2613 34.3208 17.2035C34.3447 17.1456 34.3797 17.0931 34.4239 17.0488C35.499 15.9737 36.4716 15.2149 37.3389 14.8098Z" fill="#FF4D4D"></path><path d="M25.2265 25.6469C25.7321 25.6469 26.2169 25.446 26.5744 25.0886C26.9319 24.7311 27.1327 24.2462 27.1327 23.7407C27.1327 23.2351 26.9319 22.7503 26.5744 22.3928C26.2169 22.0353 25.7321 21.8345 25.2265 21.8345C24.721 21.8345 24.2361 22.0353 23.8786 22.3928C23.5211 22.7503 23.3203 23.2351 23.3203 23.7407C23.3203 24.2462 23.5211 24.7311 23.8786 25.0886C24.2361 25.446 24.721 25.6469 25.2265 25.6469ZM34.7575 25.6469C35.2631 25.6469 35.7479 25.446 36.1054 25.0886C36.4629 24.7311 36.6637 24.2462 36.6637 23.7407C36.6637 23.2351 36.4629 22.7503 36.1054 22.3928C35.7479 22.0353 35.2631 21.8345 34.7575 21.8345C34.252 21.8345 33.7671 22.0353 33.4096 22.3928C33.0521 22.7503 32.8513 23.2351 32.8513 23.7407C32.8513 24.2462 33.0521 24.7311 33.4096 25.0886C33.7671 25.446 34.252 25.6469 34.7575 25.6469Z" fill="#050810"></path><path d="M25.5521 24.2179C25.7629 24.2179 25.9651 24.1342 26.1142 23.9851C26.2633 23.836 26.3471 23.6338 26.3471 23.4229C26.3471 23.2121 26.2633 23.0099 26.1142 22.8608C25.9651 22.7117 25.7629 22.6279 25.5521 22.6279C25.3414 22.6279 25.1394 22.7116 24.9904 22.8606C24.8415 23.0095 24.7578 23.2115 24.7578 23.4222C24.7578 23.6328 24.8415 23.8348 24.9904 23.9838C25.1394 24.1327 25.3414 24.2179 25.5521 24.2179ZM35.0831 24.2179C35.2937 24.2179 35.4957 24.1343 35.6447 23.9853C35.7936 23.8364 35.8773 23.6343 35.8773 23.4237C35.8773 23.213 35.7936 23.011 35.6447 22.8621C35.4957 22.7131 35.2937 22.6294 35.0831 22.6294C34.8726 22.6294 34.6708 22.713 34.522 22.8618C34.3732 23.0107 34.2896 23.2125 34.2896 23.4229C34.2896 23.6334 34.3732 23.8352 34.522 23.984C34.6708 24.1328 34.8726 24.2179 35.0831 24.2179Z" fill="#00E5CC"></path><defs><linearGradient id="openclaw-a" x1="10.9391" y1="12.6217" x2="52.6195" y2="46.3446" gradientUnits="userSpaceOnUse"><stop stop-color="#FF4D4D"></stop><stop offset="1" stop-color="#991B1B"></stop></linearGradient><linearGradient id="openclaw-b" x1="11.9298" y1="26.4944" x2="18.4208" y2="34.4399" gradientUnits="userSpaceOnUse"><stop stop-color="#FF4D4D"></stop><stop offset="1" stop-color="#991B1B"></stop></linearGradient><linearGradient id="openclaw-c" x1="41.1155" y1="26.9175" x2="48.665" y2="33.7067" gradientUnits="userSpaceOnUse"><stop stop-color="#FF4D4D"></stop><stop offset="1" stop-color="#991B1B"></stop></linearGradient></defs></svg>

After

Width:  |  Height:  |  Size: 4.5 KiB

1
.github/agents/paperclip.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><path d="M40.5 27.5 29.2 38.8a6.5 6.5 0 0 1-9.2-9.2l13-13a4.2 4.2 0 0 1 6 6L26 35.6a2 2 0 0 1-2.8-2.8l11-11" stroke="white" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" fill="none"></path></svg>

After

Width:  |  Height:  |  Size: 370 B

View File

@ -0,0 +1 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#242323"></rect><g transform="translate(12 12) scale(1.5)"><path d="M22.3977 7.0896h-2.3106V.0676l-7.5094 6.3542V.1577h-1.1554v6.1966L4.4904 0v7.0896H1.6023v10.3976h2.8882V24l6.932-6.3591v6.2005h1.1554v-6.0469l6.9318 6.1807v-6.4879h2.8882V7.0896zm-3.4657-4.531v4.531h-5.355l5.355-4.531zm-13.2862.0676 4.8691 4.4634H5.6458V2.6262zM2.7576 16.332V8.245h7.8476l-6.1149 6.1147v1.9723H2.7576zm2.8882 5.0404v-3.8852h.0001v-2.6488l5.7763-5.7764v7.0111l-5.7764 5.2993zm12.7086.0248-5.7766-5.1509V9.0618l5.7766 5.7766v6.5588zm2.8882-5.0652h-1.733v-1.9723L13.3948 8.245h7.8478v8.087z" fill="#20B8CD"></path></g></svg>

After

Width:  |  Height:  |  Size: 745 B

138
ARCHITECTURE-2026-10-23.md Normal file
View File

@ -0,0 +1,138 @@
# Postiz Architecture — 2026-10-23
Scope note: this doc covers competitive-positioning-adjacent technical architecture, user-action data flow, risks, and a next-build list. Pages/APIs/feature backlog is covered by `PLAN-2026-10-23-DEEP.md` if/when that file exists — it did not exist at the time this was written, so nothing here duplicates it.
## 0. Ground truth on this repo (read, not assumed)
- Fork: `caelum0x/postiz-app` (origin), tracking `gitroomhq/postiz-app` (upstream). AGPL-3.0.
- Monorepo, pnpm workspaces, 5 apps + shared libraries:
- `apps/backend` — NestJS REST API (port 3000), also boots the Mastra MCP server and Temporal worker in-process (`apps/backend/src/main.ts`).
- `apps/orchestrator` — NestJS + Temporal worker: all background workflows/activities (posting, autopost, clipping, video, email, token refresh).
- `apps/frontend` — **Next.js 16** app (App Router), not Vite as `CLAUDE.md` currently states — confirmed by `next.config.js`, `instrumentation.ts`, `sentry.server.config.ts`, and root `package.json` (`"next": "16.3.1"`).
- `apps/sdk` — thin TypeScript client hard-coded to `https://api.postiz.com` (Postiz Cloud), used for the published npm SDK.
- `apps/commands` — CLI entry (`main.ts` + `tasks/`: `refresh.tokens`, `agent.run`, `configuration`).
- `apps/extension` — Chrome extension (manifest-style background script) that extracts auth cookies from logged-in social sites for providers that need cookie-based auth, allow-listed to `localhost` and `*.postiz.com` origins only.
- `libraries/nestjs-libraries` — shared backend code: Prisma database layer, 35+ `integrations/social/*.provider.ts` (one per channel), `chat/` (Mastra-based AI agent + MCP server + MCP OAuth relay), `deepgram/`, `videos/`, `short-linking/`, `services/payment/` (Stripe).
- Database: **PostgreSQL** via **Prisma** (schema at `libraries/nestjs-libraries/src/database/prisma/schema.prisma`, 91 models). Includes the app's own domain tables (Organization, User, Integration, Post, Media, Subscription, Webhooks, Clipping, ...) plus `mastra_*` tables — the AI agent/MCP framework (Mastra) persists its own state (threads, messages, MCP server/client registrations, workflows) directly in the same Postgres instance (`libraries/nestjs-libraries/src/chat/mastra.store.ts`).
- Queue/orchestration: **Temporal** (`@temporalio/*`, `nestjs-temporal-core`), with its own Postgres + Elasticsearch stack in `docker-compose.yaml` (`temporal-postgresql`, `temporal-elasticsearch`, `temporal`, `temporal-ui`). This replaced a simpler queue — there is no BullMQ in the current flow.
- Cache: **Redis** (`ioredis`), falls back to an in-memory `MockRedis` if `REDIS_URL` is unset (`libraries/nestjs-libraries/src/redis/redis.service.ts`). Used for rate-limiting (`ThrottlerBehindProxyGuard`) and caching, not as the job queue.
- Storage: pluggable — local disk, Cloudflare R2, or S3-compatible (`STORAGE_PROVIDER` env var; `@aws-sdk/client-s3` + `UPLOAD_DIRECTORY`).
- AI stack: LangGraph (`@langchain/langgraph`, `@langchain/openai`, `@langchain/tavily`) for the content-generation agent graph (`libraries/nestjs-libraries/src/agent`), and **Mastra** (`@mastra/core`, `@mastra/mcp`, `@mastra/pg`) for the chat/tool-calling layer that backs both the in-app chat UI and the external MCP server (`/mcp`, `/mcp/:id`, `/sse/:id` routes, started from `start.mcp.ts`).
- Payments: Stripe (`services/payment/`), webhook-driven subscription sync.
- Public API: `apps/backend/src/public-api` — `/public/v1/*` routes, API-key authenticated, rate-limited distinctly from session routes. This is what the published SDK and MCP server call into.
## 1. Deployment reality (do not assume Oracle hosting applies here)
- There is **no live Postiz deployment** on any of the three portfolio boxes right now (confirmed in this repo's own `NOTES.md`: not running on `railyard-box`, `box` 130.61.180.42 currently refuses SSH, `recoder-micro` rejects the shared deploy key). This product has zero live users today — it exists only as code + a `docker-compose.yaml` for local/self-hosted use.
- Self-hosting is the only supported open-source deployment path: `docker-compose.yaml` ships `postiz` (backend+frontend combined container, port 4007), `postiz-postgres`, `postiz-redis`, the full Temporal stack (`temporal`, `temporal-postgresql`, `temporal-elasticsearch`, `temporal-ui`), and optional `spotlight` (Sentry-compatible local error capture). `railway.toml` and the README's deploy table (Docker / Coolify / Railway / any VPS) confirm self-host, not a managed Cloudflare/Oracle target.
- **Postiz Cloud** (`postiz.com`, what `apps/sdk` talks to) is a separately-hosted commercial SaaS *not present in this repo* — it is the thing this OSS edition is positioned against/alongside, not something deployed from here.
- Net: the correct hosting target for this product, if the owner wants it live, is a self-hosted Docker Compose stack on one of the Oracle boxes (recommended: `box` once SSH is restored, given it's the general-purpose box) — not Cloudflare Workers/Pages (no edge-compatible target exists here; Temporal workers and a Postgres-backed Nest app don't fit the Workers runtime model).
## 2. System diagram (real components only)
```mermaid
flowchart TB
subgraph Clients
WebUI["Frontend\nNext.js 16 (App Router)"]
Ext["Chrome Extension\n(cookie capture for\ncookie-auth providers)"]
CLI["apps/commands CLI\n(agent.run, refresh.tokens)"]
MCPClient["External MCP client\n(Claude/ChatGPT/agent, via SDK or MCP)"]
end
subgraph Backend["apps/backend (NestJS, port 3000)"]
API["/api, /posts, /integrations\n(session-authed)"]
PublicAPI["/public/v1/*\n(API-key authed)"]
MCPServer["Mastra MCPServer\n/mcp, /mcp/:id, /sse/:id"]
Chat["Chat/Agent module\n(LangGraph + Mastra tools)"]
end
subgraph Orchestrator["apps/orchestrator (Temporal worker)"]
Workflows["Workflows:\npostWorkflowV1.x, autopost,\nclipping, generate.video,\nrefresh.token, digest.email"]
Activities["Activities:\npost.activity, clipping.activity,\nmedia.activity, integrations.activity"]
end
subgraph Data["Data & infra"]
PG[("PostgreSQL\n(Prisma: app tables +\nmastra_* AI-agent tables)")]
Redis[("Redis\n(cache + rate-limit;\nin-memory fallback)")]
Temporal[("Temporal server\n+ its own Postgres + ES")]
Storage[("Object storage\nlocal disk / S3 / R2")]
end
subgraph ThirdParty["Third-party services"]
Social["28+ social platform APIs\n(X, LinkedIn, Facebook,\nInstagram, TikTok, ...)"]
OpenAI["OpenAI (text + DALL-E)"]
Tavily["Tavily (web search)"]
Deepgram["Deepgram (transcription)"]
Stripe["Stripe (billing)"]
end
WebUI -->|session cookie| API
Ext -->|extracted cookies, postiz.com only| API
CLI --> API
MCPClient -->|API key / OAuth relay| MCPServer
MCPServer --> Chat
Chat --> OpenAI
Chat --> Tavily
Chat --> PG
API --> PG
API --> Redis
API -->|start workflow| Temporal
PublicAPI --> API
PublicAPI --> Temporal
Temporal --> Workflows
Workflows --> Activities
Activities --> PG
Activities --> Social
Activities --> Deepgram
Activities --> Storage
Activities --> OpenAI
API --> Stripe
Stripe -->|webhook| API
```
## 3. Data-flow for the 2-3 most important user actions
### A. Schedule and publish a post (core product loop)
1. User composes a post in the Next.js frontend; frontend calls `POST /posts` (or the public `/public/v1/posts` if driven via SDK/MCP/CLI) with content + target integrations + send time.
2. `PostsController.createPost` (DTO-validated) calls `PostsService.createPost`, which writes `Post` + per-channel settings rows via Prisma to Postgres (one write, no raw SQL per project convention).
3. `PostsService.startWorkflow` first lists/terminates any existing running Temporal workflow for that `postId` (idempotency guard), then starts `postWorkflowV1.1.3` (versioned — workflow code is never mutated in place; new behavior ships as a new version, see CLAUDE.md rule) on Temporal's `main` task queue, tagged with `postId`/`organizationId` search attributes.
4. Temporal dispatches the workflow to the `apps/orchestrator` worker process. The workflow sleeps until the scheduled time, re-checks post state (to catch a cancel/edit during the sleep), then calls `post.activity` → the relevant `integrations/social/*.provider.ts` implementation, which calls the real platform API (X, LinkedIn, etc.) using stored OAuth tokens.
5. Activity result (success/failure, remote post id) is written back to the `Post`/`Integration` rows in Postgres; failures retry per-activity with backoff (non-retryable reasons — e.g. revoked token — short-circuit).
6. Frontend polls/SWR-refetches post status from Postgres via the backend API.
### B. AI chat / MCP-driven content generation (agent surface)
1. A request arrives either via the in-app chat UI (session-authed, hits `Chat` module) or an external MCP client (Claude Desktop, ChatGPT app, or any MCP-compatible agent) calling the Mastra `MCPServer` at `/mcp` (or `/mcp/:id` for a specific self-hosted-instance relay, or `/sse/:id` for SSE transport), authenticated via an API key or the `/mcp-oauth*` OAuth relay (`mcp.relay.service.ts`, `oauth-middleware.ts`) for multi-tenant/self-hosted setups.
2. Mastra resolves the caller's org/auth context (`auth.context.ts`, `async.storage.ts`) and exposes a fixed toolset (`chat/tools/*.tool.ts`: list integrations, generate image, upload from URL, delete post, check video status, trigger integration, etc.) plus the LangGraph agent for free-text generation (web search via Tavily, image gen via OpenAI DALL-E).
3. Tool calls that mutate state (e.g. create/delete a post, trigger an integration) go through the same `PostsService`/`IntegrationService` Prisma-backed code path as the UI — no separate write path — landing in the same Postgres tables.
4. Mastra persists its own conversation/thread/tool-call state in the `mastra_*` Postgres tables (same database, separate tables) so a chat session survives a backend restart.
5. Any action that needs background work (video generation, clipping) hands off to Temporal exactly like path A, rather than blocking the MCP response.
### C. Long-video-to-clips pipeline (Deepgram clipping — the feature with no direct competitor equivalent per the strategy doc)
1. User submits a source video URL/upload; `ClippingService.submitAnalyse` creates a `Clipping` record and calls the `clipping.workflow` on Temporal.
2. Workflow step 1 (`submitClippingAnalyse`/`checkClippingAnalyse`): analysis job submitted to an external job runner and polled (bounded retries, each poll idempotent).
3. Workflow step 2 (`transcribeClipping`): Deepgram transcribes the audio (`deepgram.service.ts`).
4. Workflow step 3 (`pickClippingClips`): an AI call (OpenAI, via the same agent infra) scores the transcript and picks clip boundaries; result written to `ClippingClip` rows.
5. Workflow step 4, per clip: `submitClipFetch`/`checkClipFetch` then `submitClipRender`/`checkClipRender` — fetch the source segment and render the final clip (burned-in captions via `captionClip`), stored to the configured object storage backend.
6. `createClippingDrafts` turns finished clips into draft `Post` rows so the user schedules/publishes them through the normal path A loop — the clipping pipeline is a *producer* of posts, not a separate publishing path.
7. Failure handling is deliberately asymmetric: submission steps tolerate at-least-once (a duplicate job just costs a second render), AI/transcription steps are cheap to retry, and only the final terminal failure (`failClipping`) surfaces to the user.
## 4. Real architectural risks / bottlenecks at current scale (zero live users, zero budget)
- **Not deployed anywhere — the biggest risk is literally "it doesn't run."** All competitive positioning in `STRATEGY-2026-10-23.md` is moot until a live instance exists for a self-hoster to even evaluate, let alone for the growth moves (comparison pages, clipping landing page) to point at a working demo/signup.
- **Three stateful backing services for one app** (Postiz's own Postgres, Temporal's own Postgres, Temporal's own Elasticsearch) plus Redis — a fourth Postgres-class dependency (Elasticsearch) purely so Temporal UI can do visibility search. On a zero-budget single small VPS/Oracle box this is a meaningful memory/CPU footprint (ES alone typically wants 512MB+ heap, already reflected in the compose file's `ES_JAVA_OPTS=-Xms256m -Xmx256m` ceiling) for a product with no users yet. Worth evaluating whether Temporal's SQL-only visibility (no ES) is enough at this scale, dropping the ES container entirely.
- **Single shared Postgres for app data and AI-agent (Mastra) state.** Convenient operationally (one DB to back up), but couples chat/agent load (threads, tool-call logs, MCP registrations) to core posting-data performance and backup size as usage grows — no isolation today.
- **OAuth app setup is the activation cliff**, confirmed by the strategy doc's own top growth move: every self-hoster must register their own developer app per social platform (Meta/TikTok/YouTube approval can take weeks per the README's own comparison table). This is a product-structural bottleneck, not a hosting one — a feature gap, not infra.
- **Self-host-only in practice right now**: no managed hosting exists for this fork (Postiz Cloud at postiz.com is a different, separately-run codebase/infra this repo doesn't touch), so every prospective user must run Docker Compose with 7+ containers themselves — a steep floor for the "technical solo marketer" persona the strategy doc targets, some of whom are not comfortable operating Temporal/Elasticsearch.
- **Cookie-based extension auth is inherently fragile**: providers relying on the Chrome extension's cookie capture (vs. OAuth) break whenever the target platform changes its cookie names/session model, and only work for users running the extension on a logged-in browser — not something a CI/server environment can do.
- **Versioned-workflow discipline is a real but easy-to-violate constraint**: the `post.workflow.v1.x.ts` ladder (14 versions already) means every behavior change to the publish flow adds a new file rather than editing in place — correct for Temporal determinism, but it is pure accretion with no visible deprecation/cleanup path for old versions once no running executions reference them.
## 5. Prioritized next-build list (effort vs. impact)
1. **Get one instance live on an Oracle box (box, once SSH access is restored) — lowest effort, highest impact.** `docker-compose.yaml` already defines the full stack; this is an infra/ops task (bring up containers, point a subdomain at port 4007, set real env vars), not a code change. Nothing else on this list, or in the strategy doc's growth moves, matters while zero instances are reachable.
2. **Guided OAuth-app pre-registration wizard** (strategy doc's own #1 growth move, and this doc's #1 architectural risk). Medium effort: extend the existing `apps/commands` CLI/`configuration.ts` task with a step-by-step per-provider wizard (pre-filled redirect URIs, direct links to each platform's developer console, validation against `missing-env-vars.standalone.spec.ts`'s existing checks) rather than a hosted-credentials fallback, which would require Postiz to hold shared app secrets — a bigger trust/ops commitment for a zero-budget operation.
3. **Drop or make-optional the Elasticsearch dependency in `docker-compose.yaml`** for the self-host default path. Low effort (Temporal supports SQL-only visibility), direct reliability/resource win for the exact persona (small VPS, zero budget) this product targets — makes self-hosting materially lighter before pushing anyone to try it.
4. **Standalone landing page for the Deepgram clipping pipeline** (strategy doc's #3 growth move) — this is a content/marketing build, not an architecture change, but it depends on #1 (a live instance to demo/sign up through) and is the one feature with zero named-competitor equivalent, so it is the highest-leverage SEO/positioning asset once something is live.
5. **Add a lightweight cleanup/documentation pass over the `post-workflows` version ladder** — low urgency, but before adding a 15th version, worth confirming (via Temporal's visibility query) which old versions have zero running executions and can be safely archived, so the versioning discipline doesn't silently become unbounded technical debt.

130
BUILD-LOG-2026-10-23.md Normal file
View File

@ -0,0 +1,130 @@
# Build Log — 2026-10-23
## Round 1
### 1. Webhook delivery reliability (backlog item #6) — finished + fixed
Picked up an in-progress, uncommitted implementation and finished it to a working, verified state.
- `WebhookDelivery` Prisma model (additive migration): `webhookId`, `event`, `postId`, `url`, `requestBody`, `statusCode`, `success`, `attempts`, `error`, `durationMs`, indexed on `webhookId` and `(webhookId, createdAt)`.
- `Webhooks.secret` column (nullable, additive) — a per-webhook HMAC-SHA256 signing secret generated on create, exposed to the UI exactly once (at creation or regeneration), never again on list/read.
- `WebhooksService.sendWithRetry` — signs the payload (`X-Postiz-Signature: sha256=...`), retries up to 3 attempts with exponential backoff (500ms × 3^n) on 5xx/429/408, treats other 4xx as terminal, and always persists a `WebhookDelivery` row (success or failure) with status code, attempt count, error, and duration.
- `apps/orchestrator/src/activities/post.activity.ts`'s `sendWebhooks` now calls `sendWithRetry` instead of a raw unsigned `fetch` + silent catch.
- New endpoints on `webhooks.controller.ts`: `POST /webhooks/:id/secret` (regenerate), `GET /webhooks/:id/deliveries` (paginated log), `POST /webhooks/deliveries/:deliveryId/redeliver`. `/webhooks/send` (manual test-send) now also signs, dispatches through the existing SSRF-safe dispatcher, and returns a real status instead of swallowing errors.
- Frontend: `apps/frontend/src/components/webhooks/webhook.deliveries.tsx` (new) — paginated delivery log modal with status, attempts, error, and a redeliver action. `webhooks.tsx` wires a "Logs" column into the webhook list and a secret-reveal modal on create/regenerate.
- **Fix applied this round**: the "Regenerate secret" button existed as dead code (handler defined, never rendered) — wired it into the edit form, visible only when editing an existing webhook.
- Verified: `apps/backend`, `apps/orchestrator`, and `apps/frontend` all build clean (`nest build` / `next build`) with the new Prisma client generated.
### 2. Competitor comparison landing pages (backlog item #4) — built new, full depth
Built all 7 pages named in STRATEGY-2026-10-23.md section 5, as real statically-rendered routes with zero API/DB dependency, each sourced from the live `pricing.ts` config and the strategy doc's researched competitor numbers (not invented):
- `/compare/buffer`, `/compare/hootsuite`, `/compare/later`, `/compare/socialbee`, `/compare/metricool`, `/compare/publer`, `/compare/mixpost`
- New public, unauthenticated route group `apps/frontend/src/app/(app)/(compare)/` (mirrors the existing `(preview)` pattern — doesn't use the auth-gated `(site)` shell).
- `apps/frontend/src/components/compare/compare.data.ts` — per-competitor content: headline, pricing comparison rows, the 4-box structural-moat checklist from STRATEGY.md section 2, a feature checklist, a verdict paragraph, and FAQ entries (for SEO rich snippets).
- `apps/frontend/src/components/compare/compare.page.component.tsx` — shared presentational layout (hero, structural checklist table, pricing table, feature checklist, verdict, FAQ, CTA), using the app's existing `new*` color tokens, glyph check/cross icons (no emoji), and `/auth` as the signup CTA.
- 7 thin `page.tsx` files, each with per-page `<title>`/description/canonical metadata.
- **Critical fix applied this round**: `apps/frontend/src/proxy.ts` (the app's auth gatekeeper middleware) redirected every anonymous visitor to `/auth` by default — which would have made all 7 new pages return a 307 redirect for the exact audience (anonymous searchers) they exist to convert. Added `/compare/` to the existing public-path allowlist alongside `/p/`, `/provider/`, `/uploads/`.
- Verified live: built the frontend in production mode, ran `next start`, and curled all 7 routes — all return `200` with the correct per-competitor `<title>` and rendered content (confirmed before and after the proxy fix, showing the before-state 307 and after-state 200).
### 3. Pre-existing broken production build — fixed (not in the numbered backlog, but blocking everything)
`apps/backend` failed to compile on `HEAD` (commit `ba6d7f87`, already merged to main before this session) — `MastodonCustomProvider.generateAuthUrl` had a signature (`refresh?: string, external?: ClientInformation`) that didn't match the `IAuthenticator` interface (`clientInformation?: ClientInformation`) and called `generateUrlDynamic` with 5 arguments against a 4-argument signature. Fixed to match the interface and the only real call site (`integrations.controller.ts`'s `generateAuthUrl(getExternalUrl)`). Confirmed `apps/backend` now builds clean.
## Files changed this round
- `libraries/nestjs-libraries/src/database/prisma/schema.prisma` — `WebhookDelivery` model, `Webhooks.secret`
- `libraries/nestjs-libraries/src/database/prisma/webhooks/webhooks.repository.ts`, `webhooks.service.ts`
- `libraries/nestjs-libraries/src/dtos/webhooks/webhooks.dto.ts`
- `apps/backend/src/api/routes/webhooks.controller.ts`
- `apps/orchestrator/src/activities/post.activity.ts`
- `apps/frontend/src/components/webhooks/webhooks.tsx`, `webhook.deliveries.tsx` (new)
- `apps/frontend/src/proxy.ts`
- `apps/frontend/src/components/compare/compare.data.ts` (new), `compare.page.component.tsx` (new)
- `apps/frontend/src/app/(app)/(compare)/layout.tsx` (new) + 7 `compare/<slug>/page.tsx` (new)
- `libraries/nestjs-libraries/src/integrations/social/mastodon.custom.provider.ts` (build fix)
## Remaining backlog (not started this round)
2 (unified inbox), 3 (internal approval workflow), 5 (agency PDF/CSV reports), 7 (competitor tracking), 8 (auto first-comment), 9 (content recycling), 10 (local short-link provider — noted below), 11 (white-label preview domain), 12 (public API bulk + webhook event filters), 13 (comment @mentions/assignment), and item #1 (OAuth onboarding wizard).
Note on #10 (local short-link provider): `ShortLinkService` currently selects its provider via a module-load-time static singleton (`new Dub()` / `new Kutt()` / etc., no DI), so a DB-backed "local" provider needs that singleton refactored to an injectable service first — flagged for a later round rather than bolted on against the grain of the existing pattern.
## Owner-only blockers
None hit this round — no payment, 2FA, or console-only step was required for any of the above.
## Round 2
### 1. Public API bulk endpoints + webhook event filters (backlog item #12) — finished + verified
Picked up an in-progress, uncommitted implementation (schema, DTOs, controller, webhook send-path filtering, and the frontend event checkboxes already existed) and verified it end to end rather than re-building it:
- `POST /public/v1/posts/bulk` (up to 25 posts/call) and `DELETE /public/v1/posts/bulk` (up to 50 ids/call) on `public.integrations.controller.ts`, both sharing the exact single-post create/delete pipeline per item so a bad entry never aborts the batch.
- `Webhooks.events String[]` (additive, empty = every event, same backward-compatible default as the rest of this feature) — `post.activity.ts`'s `sendWebhooks`/the new `changeState` failure path only deliver to webhooks subscribed to that event (or subscribed to none, meaning all).
- No code changes needed; confirmed by building `apps/backend`/`apps/orchestrator`/`apps/frontend` clean.
### 2. Comment @mentions and assignment (backlog item #13) — finished, was previously just schema + DTOs with no wiring
The schema (`Comments.mentionedUserIds`/`assignedToId`, `Notifications.userId`) and some repository/DTO scaffolding already existed uncommitted, but nothing called any of it — `createPublicComment` silently dropped `mentions`/`assignedToId` even if a client sent them, and there was no team-member list or assignment endpoint anywhere.
- `PostsService.createPublicComment` now resolves `mentions`/`assignedToId` against `OrganizationService.getTeamMembersForMentions` and rejects anyone not on the team — but only when the comment is from an authenticated team member (`userId` set); the public no-auth preview link can never set either field, even if a crafted request body includes them (checked server-side, not just via DTO validation).
- New `PostsService.assignComment` (+ `PUT /posts/comments/:commentId/assign`) to change/clear a root comment's assignee after the fact, same org/root-only restrictions as the existing `resolveComment`.
- New `GET /posts/comments/team-members` (any authenticated org member, not gated behind the admin-only `/settings/team`) backs the mention/assign pickers.
- `NotificationService.notifyUser` (new, wraps the already-existing `createUserNotification` repository method) sends a best-effort, per-user in-app notification on a mention or a new assignment.
- **Data-exposure fix applied this round**: `PostsService.getComments` is shared by the fully public preview GET (`PublicController`) and now also a new authenticated GET (`PostsController`, `GET /posts/:id/comments`) — mentioned-user names/ids and the assignee's name are only included when the caller is verified as a logged-in member of the org that owns the post (`includeInternal` gate), so an external client on the public preview link never sees internal team members' names. The frontend (`preview.comments.context.tsx`) now fetches from the authenticated route when logged into the owning org, the public route otherwise — same branching `CommentComposer` already used for posting.
- Frontend: mention checkboxes + an "Assign to" select in the comment composer (root comments only for assignment), an assignee reassign `<select>` and a `cc:` line of mentioned names on each thread card, all in `apps/frontend/src/components/preview/comments.components.tsx` / `preview.comments.context.tsx`.
- Verified: `apps/backend`, `apps/orchestrator` (`nest build`) and `apps/frontend` (full production `next build`, including `/p/[id]`) all build clean.
### 3. Evergreen content recycling (backlog item #9) — built new, full depth
This was the biggest gap found this round: `/compare/socialbee` (shipped round 1) already **claims** "Postiz supports a recycle-after-days, category-based queue rotation for evergreen content" — but the feature didn't exist beyond an unused `EvergreenRecycle` Prisma model and a `RECYCLE` enum value some earlier session had added and never wired up. Built it for real so that comparison-page claim is true:
- `EvergreenRepository`/`EvergreenService` (new, mirrors the existing `PostEngagementRepository`/`Service` pattern) — create/list/pause/resume/remove a recycle schedule for an already-published post, plus a bounded (`BATCH_CAP = 25`) `runDueBatch()` that clones a due post's content/media/settings into a brand-new `Post` row (own id/group/Comments thread, `CreationMethod.RECYCLE`) through the exact same `validatePosts` → `mapTypeToPost` → `createPost` pipeline every other post-creation path uses — not a new, parallel content-writing path. A failed entry is pushed one interval out instead of retried immediately, and a recycle schedule whose original post was deleted deactivates itself instead of erroring forever.
- New daily Temporal workflow `evergreenRecycleWorkflow` (`apps/orchestrator/src/workflows/evergreen.recycle.workflow.ts` + `evergreen.activity.ts`), modeled on the existing `bestTimeToPostWorkflow` infinite-loop pattern, registered in `app.module.ts` / `workflows/index.ts` / `infinite.workflow.register.ts`.
- `POST|GET /posts/:id/evergreen` and `PUT|DELETE /posts/evergreen/:recycleId` on `posts.controller.ts`; only an already-`PUBLISHED` post can get a recycle schedule.
- Frontend: a new "Evergreen Recycling" calendar action (recycle-glyph icon, shown only on published posts) opening `evergreen.modal.tsx` — lists existing schedules with pause/resume/remove, and a form to add one (interval days + optional max recycles).
- Verified: `apps/backend`, `apps/orchestrator` (`nest build`) and `apps/frontend` (full production `next build`) all build clean with the already-generated Prisma client (schema/client were already in place from the earlier session; no schema change needed this round).
## Files changed this round (Round 2)
- `libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts`, `posts.repository.ts` — comment mentions/assignment wiring, `getComments` internal-field gate
- `apps/backend/src/api/routes/posts.controller.ts` — authenticated comments GET, comment-assign PUT, team-members GET, evergreen CRUD routes
- `libraries/nestjs-libraries/src/database/prisma/notifications/notification.service.ts` — `notifyUser`
- `libraries/nestjs-libraries/src/database/prisma/organizations/organization.repository.ts`, `organization.service.ts` — already had `getTeamMembersForMentions` from the earlier session, now actually called
- `apps/frontend/src/components/preview/comments.components.tsx`, `preview.comments.context.tsx` — mention/assign UI, authed-vs-public comments fetch
- `libraries/nestjs-libraries/src/database/prisma/evergreen/evergreen.repository.ts` (new), `evergreen.service.ts` (new)
- `libraries/nestjs-libraries/src/dtos/posts/evergreen.recycle.dto.ts` (new)
- `apps/orchestrator/src/activities/evergreen.activity.ts` (new), `workflows/evergreen.recycle.workflow.ts` (new), `workflows/index.ts`, `app.module.ts`
- `libraries/nestjs-libraries/src/temporal/infinite.workflow.register.ts`
- `libraries/nestjs-libraries/src/database/prisma/database.module.ts`
- `apps/frontend/src/components/launches/calendar.tsx`, `evergreen.modal.tsx` (new)
- `libraries/nestjs-libraries/src/database/prisma/schema.prisma`, `apps/backend/src/public-api/routes/v1/public.integrations.controller.ts`, `apps/frontend/src/components/webhooks/webhooks.tsx`, `apps/orchestrator/src/activities/post.activity.ts`, `libraries/nestjs-libraries/src/dtos/posts/bulk.posts.dto.ts`, `libraries/nestjs-libraries/src/dtos/webhooks/webhooks.dto.ts`, `libraries/nestjs-libraries/src/database/prisma/webhooks/webhooks.repository.ts` — pre-existing uncommitted work from an earlier session (backlog item #12), verified working this round, no changes needed
## Remaining backlog (not started)
2 (unified inbox), 3 (internal approval workflow — note: `Organization.requireApprovalForQueue`/`Post.pendingApproval` schema fields already exist uncommitted from an earlier session but are completely unwired, same as evergreen was; next target), 5 (agency PDF/CSV reports, note: `pdfkit` is already added to `package.json` from an earlier session but unused), 7 (competitor tracking), 8 (auto first-comment), 10 (local short-link provider), 11 (white-label preview domain), and item #1 (OAuth onboarding wizard).
## Owner-only blockers (Round 2)
None hit this round.
## Round 3
### 1. Internal approval workflow (backlog item #3) — built new, full depth
`Organization.requireApprovalForQueue` and `Post.pendingApproval` existed in the schema from an earlier session but had zero wiring (same shape of gap evergreen recycling and comment mentions were in before prior rounds). Wired it end to end:
- `Post.createdByUserId` (new, additive, nullable) + `User.createdPosts` back-relation — stamped on create from the WEB dashboard only, so an approver knows (and can be notified) who submitted a pending post. Every other creation path (API/MCP/autopost/bulk CSV/evergreen/clipping) never sets it, unaffected.
- `OrganizationRepository`/`OrganizationService`: `getApprovalForQueueSetting`/`updateApprovalForQueueSetting`/`requiresApprovalForQueue`. New `GET|POST /settings/approval-queue` (POST is ADMIN-gated), same shape as the existing shortlink-preference endpoints.
- `PostsService.createPost` now takes an optional `createdBy: { userId, role }` (WEB controller only). When the caller's role is `USER`, the save type is schedule/now, and the org has the setting on, the post is held as `DRAFT` with `pendingApproval: true` instead of going to `QUEUE` — `PostsRepository.createOrUpdatePost` grew the `createdByUserId`/`pendingApproval` params to do this at the DB layer. `PostsRepository.changeState` now always clears `pendingApproval`, since every path that calls it is an intentional final transition.
- `PostsService.approvePendingQueuePost`/`rejectPendingQueuePost` (+ `PUT /posts/:id/approve-queue`, `PUT /posts/:id/reject-queue`, ADMIN-gated) — approve reuses `changePostStatus` (the same path the internal "schedule" button and the public-preview `approvePublicPost` already use, so the real publish workflow actually starts); reject just clears the flag and leaves it a normal, editable draft. Both notify the original submitter via the existing `NotificationService.notifyUser`.
- `PostsService.getPendingApprovalPosts` + `GET /posts/pending-approval` (ADMIN-gated, declared before the generic `/:id` GET to avoid Nest route-matching ambiguity).
- Frontend: a yellow clock badge + inline Approve/Check and Reject/X glyph icons (no emoji) on the calendar card itself when `state === 'DRAFT' && post.pendingApproval`, visible only to ADMIN/SUPERADMIN viewers; a "Pending approval:" label replaces "Draft:" on the card. New `apps/frontend/src/components/settings/approval-queue-preference.component.tsx` (the toggle) and `pending-approvals.component.tsx` (the list with Approve/Reject buttons), both rendered in `teams.component.tsx` only for ADMIN+ roles. `manage.modal.tsx`'s save flow shows a distinct "Submitted for approval" toast instead of "Added/updated successfully" when the response indicates it.
- Verified: `apps/backend`, `apps/orchestrator` (`nest build`) and `apps/frontend` (full production `next build`, including route generation) all build clean with the newly generated Prisma client (`prisma validate` + `prisma generate` both clean).
## Files changed this round (Round 3)
- `libraries/nestjs-libraries/src/database/prisma/schema.prisma` — `Post.createdByUserId`, `User.createdPosts`
- `libraries/nestjs-libraries/src/database/prisma/organizations/organization.repository.ts`, `organization.service.ts` — approval-for-queue setting
- `libraries/nestjs-libraries/src/dtos/settings/approval-for-queue.dto.ts` (new)
- `apps/backend/src/api/routes/settings.controller.ts` — `GET|POST /settings/approval-queue`
- `libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts` — `createOrUpdatePost`/`changeState` pendingApproval wiring, `getPendingApprovalPosts`, select additions
- `libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts` — `createPost` gating, `approvePendingQueuePost`/`rejectPendingQueuePost`/`getPendingApprovalPosts`
- `apps/backend/src/api/routes/posts.controller.ts` — caller role on `createPost`, `GET /posts/pending-approval`, `PUT /posts/:id/approve-queue`, `PUT /posts/:id/reject-queue`
- `libraries/helpers/src/utils/posts.list.minify.ts` — `pendingApproval` key mapping
- `apps/frontend/src/components/launches/calendar.tsx` — badge, approve/reject actions and icons, pending-approval label
- `apps/frontend/src/components/new-launch/manage.modal.tsx` — "submitted for approval" toast
- `apps/frontend/src/components/settings/approval-queue-preference.component.tsx` (new), `pending-approvals.component.tsx` (new), `teams.component.tsx` — settings UI
## Remaining backlog (not started, Round 3)
2 (unified inbox), 5 (agency PDF/CSV reports — `pdfkit` still unused in `package.json`), 7 (competitor tracking), 8 (auto first-comment), 10 (local short-link provider), 11 (white-label preview domain), item #1 (OAuth onboarding wizard).
## Owner-only blockers (Round 3)
None hit this round. The pre-existing "no reachable live Postiz deployment" blocker (NOTES.md) was not re-checked this round since it wasn't this round's scope.

View File

@ -72,4 +72,9 @@ const useCommunity = () => {
- When you finished running, run another agents that matches the new code with the existing system code, to see that it looks similar and is not a weird pattern.
- Workflows files can never be changed if they are already in origin/main, because changing a workflow will fail all its activities, instead create a new workflow with the version, and everywhere the workflow being called, change it to the new workflow version.
- Workflows activities parameters cannot be changed, as it will break the workflow, if we need to change the parameters, if we need to change the parameters, we need to create a new activity with the new parameters, and then create a new workflow that uses the new activity.
- Code must always be generic, there can't be a way that a specific logic, let's say facebook or instagram, appear in a file that use a generic logic, instead, we need to edit the interface of the provider, add another function, and then generically call it from the generic code, and then implement the specific logic in the provider implementation. we can't have something like if(facebookProvider) {} inside a non facebook provider file.
- Code must always be generic, there can't be a way that a specific logic, let's say facebook or instagram, appear in a file that use a generic logic, instead, we need to edit the interface of the provider, add another function, and then generically call it from the generic code, and then implement the specific logic in the provider implementation. we can't have something like if(facebookProvider) {} inside a non facebook provider file.
- Before adding a field to a shared repository/service `select` or changing a shared method's return shape, grep for all its consumers (frontend, public API, MCP/agent tools, orchestrator, webhooks) and confirm the change is intended for each.
- Exposing a stored field to a new external surface (public API, MCP, webhooks) is a data-exposure decision — ask first, and check what existing production rows hold for that column before shipping it.
- Never silently change the meaning or format of a value persisted in an existing DB column; that affects every reader and all historical rows, so ask first.
- Never return a raw Prisma row from a model that holds credentials (`Integration`, `User` and similar) in a controller response. Repository writes on those models must use a `select` with only the fields the caller needs (like `setTimes` with `select: { id: true }`), or the controller returns nothing. This applies even where nearby code looks different.
- Be extra careful with code invoked by webhooks of external systems (Stripe, RevenueCat and other payment providers), including everything they call down the stack (e.g. `SubscriptionService.createOrUpdateSubscription`, `modifySubscription`, `deleteSubscription`). That code must not throw exceptions: never add a `throw`, and wrap any call that can fail (DB, provider API) so a failure is caught and logged instead of propagating. A webhook that throws leaves billing state half-applied for a paying customer.

3
NOTES.md Normal file
View File

@ -0,0 +1,3 @@
# Notes (owner-only blockers)
- No live Postiz deployment found on any reachable box (not running on `railyard-box`; `box` 130.61.180.42 refuses SSH on port 22 right now, `recoder-micro` 92.5.156.133 rejects the shared deploy key) — owner needs to either confirm there's no live Postiz instance yet, or restore access/point me at the right host to deploy `origin/main` (caelum0x/postiz-app) to.

117
PLAN-2026-10-23-DEEP.md Normal file
View File

@ -0,0 +1,117 @@
# Postiz — Deep Build Plan (2026-10-23)
Internal build spec. Terse. Ground truth only (verified against source at this commit). No stubs described as done.
## Conventions
- Auth: `session` = cookie session guard (`AuthService`/org context). `apikey` = `/public/v1/*` API-key guard. `none` = unauthenticated.
- UI controls: icon/glyph buttons only, no emoji, no bare-word action buttons (e.g. a send action = arrow glyph, a confirm = check glyph, a close = × glyph).
## 1. Pages (apps/frontend/src/app)
| Route | Purpose | Key UI elements |
|---|---|---|
| `(site)/launches` | Calendar + composer, main workspace | Month/week/list view toggle (icon group), per-day post chips, "+" new-post button (icon), platform picker (icon grid from `pick.platform.component.tsx`), composer modal (`manage.modal.tsx`) with per-channel tabs, char counter, media picker, tag selector, schedule date/time picker, bulk-schedule CSV upload |
| `(site)/analytics` | Per-channel metrics | Channel selector (icon tabs), date-range picker, line/bar charts, best-time-to-post heatmap |
| `(site)/media` | Media library | Grid of uploads, upload button (icon), drag-drop zone, delete (icon), AI-generate-image/video entry points |
| `(site)/plugs` | Automations list | Plug cards (toggle switch to enable/disable), create-plug modal, per-integration function picker |
| `(site)/settings` | Org/team/shortlink | Team member list + role badges, invite-link generator (copy icon), shortlink domain field, danger-zone delete-account |
| `(site)/billing`, `billing/lifetime` | Subscription mgmt | Plan cards, upgrade/downgrade buttons, Stripe portal link (external-link icon), coupon field, lifetime-deal claim form |
| `(site)/third-party` | App marketplace | App cards, install/connect button (icon), per-app function list |
| `(site)/agents`, `agents/[id]` | AI agents | Agent list, chat thread view, credits counter, new-thread button (icon) |
| `(site)/admin/errors`, `admin/stats` | Admin-only diagnostics | Error table (filter by platform dropdown), stats cards; gated by admin role check in loader |
| `(site)/err` | Generic error page | Error message, retry button (icon) |
| `(preview)/p/[id]` | Public post preview/approval | Post render, comment thread, approve/reject buttons (check/× icons), no auth |
| `auth`, `auth/login`, `auth/activate(+[code])`, `auth/forgot(+[token])`, `auth/login-required` | Auth flows | Email/password fields, OAuth provider buttons (icon + provider name), activation code input, reset-password form |
| `integrations/social/[provider]` | OAuth connect-callback landing | Spinner, success/fail state, auto-redirect to `/launches` |
| `oauth/authorize` | 3rd-party OAuth-app consent | App name/logo, scope list, allow/deny buttons (check/× icons) |
| `(extension)/modal/[style]/[platform]` | Chrome-extension popup | Minimal connect-status UI, close icon |
| `provider/[p]`, `provider/add` | Standalone provider connect (no main app shell) | Same picker/connect flow as in-app, used for embeds |
## 2. APIs (apps/backend/src/api/routes, no global prefix; apps/backend/src/public-api for `/public/v1`)
Format: `METHOD path — auth — req → resp`.
### auth.controller.ts
- `GET /auth/can-register` — none — → `{ register: boolean }`
- `POST /auth/register` — none — `{ email, password, company?, providerToken? }` → `{ id, jwt? }`
- `POST /auth/login` — none — `{ email, password }` → `{ jwt }` (cookie set)
- `POST /auth/forgot`, `POST /auth/forgot/return` — none — email → ack / token+password → ack
- `GET /auth/oauth/:provider`, `POST /auth/oauth/:provider/redirect`, `POST /auth/oauth/:provider/exists` — none — provider OAuth bootstrap
- `POST /auth/activate`, `POST /auth/resend-activation` — session/none — code → ack
- `POST|GET /auth/farcaster/signer` — none — Farcaster signer flow
### posts.controller.ts
- `GET /posts`, `GET /posts/:id`, `GET /posts/group/:group` — session — → `Post[]`/`Post`
- `POST /posts` — session — `{ type, date, tags, posts: [{ integration, content, settings }] }` → created post group
- `PUT /posts/:id/date` — session — `{ date }` → ack
- `DELETE /posts/:group` — session — → ack
- `GET /posts/:id/statistics`, `/missing` — session — → metrics / missing-channel list
- `GET|PUT /posts/:id/release-url`, `/release-id` — session — published-URL bookkeeping
- `GET|POST /posts/:id/comments`, `POST /posts/comments/:commentId/resolve` — session — approval-thread comments
- `GET|POST|PUT|DELETE /posts/tags` — session — tag CRUD
- `GET /posts/find-slot(/:id)` — session — → next free scheduling slot
- `POST /posts/bulk-schedule`, `GET /posts/bulk-schedule/supported-providers` — session — CSV rows → created posts
- `POST /posts/generator`, `/generator/draft` — session — `{ prompt, integrations }` → AI-generated caption(s)
- `GET /posts/separate-posts` — session — per-channel content split
### integrations.controller.ts / no.auth.integrations.controller.ts
- `GET /integrations` — none — → public provider list (name, identifier, toolTip, picture)
- Connect/settings/nickname/group/custom-name endpoints — session — per-integration config
- `GET /integrations/social/:integration` — none — OAuth callback landing
- `POST /integrations/social-connect/:integration` — none — external-URL-based connect (used by `mastodon-custom`, `lemmy`, `wordpress`, `listmonk`)
- `POST /integrations/public/provider/:id/connect` — apikey — connect via public API
- `GET|POST|PUT|DELETE /integrations/plug/list(+CRUD)` — session — automation CRUD
- `GET /integrations/mentions` — session — → mentionable handles
- `POST /integrations/function` — session — plugin function dispatch (allowlisted per `third-party.controller.ts` security fix already shipped)
- `GET /integrations/telegram/updates` — session — Telegram webhook polling
- `POST|GET /integrations/moltbook/register(+status)` — session
### billing.controller.ts
- Stripe/RevenueCat: `check/:id`, `check-discount`, `apply-discount`, `finish-trial`, `embedded`, `subscribe`, `sync`, `portal`, `invoices`, `renewal`, `cancel(-subscription)`, `prorate`, `charges+refund-charges`, `coupon-info/apply-coupon/cancel-coupon`, `chatbase-refund`, `add-subscription` — session — standard Stripe-shaped req/resp
### media / copilot / clipping
- `media.controller.ts`: `upload-server`, `upload-simple`, `save-media`, `generate-image(-with-prompt)`, `generate-video`, `video/function`, `video-options`, `media/:id/status` — session
- `copilot.controller.ts`: `POST /copilot/chat`, `/agent`, `GET /copilot/credits`, `/:thread/list`, `/list` — session — chat/agent assistant
- `clipping.controller.ts` + `.widget.controller.ts`: CRUD `/clipping`, `GET /clipping/:id`, `/clipping-widget/status` — session/none(widget)
### webhooks / sets / signature / autopost
- `webhooks.controller.ts`: CRUD `/webhooks` + `POST /webhooks/send` — session
- `sets.controller.ts`: CRUD `/sets` (reusable templates) — session
- `signature.controller.ts`: CRUD `/signatures` — session
- `autopost.controller.ts`: CRUD `/autopost` + `/:id/active` + `/send` — session
### third-party / oauth / oauth-app
- `third-party.controller.ts`: list, submit, function dispatch (allowlisted), import — session
- `oauth.controller.ts`: full OAuth2 provider — `register/authorize/token/userinfo` — mixed
- `oauth-app.controller.ts`: self-serve OAuth-app CRUD + secret rotation — session
### settings / users / analytics / enterprise / stripe / payment / admin
- `settings.controller.ts`: team CRUD, `team/add`, `team/:id` delete, `team/leave`, shortlink get/set — session
- `users.controller.ts`: `/user/self`, `/personal`, `impersonate`, switch-org, `/organizations`, `join-org`, `change-org`, `delete-account(-info)`, `logout`, `/subscription(+tiers)` — session
- `analytics.controller.ts`: `/:integration`, `/post/:postId`, `/best-time/:integration` — session
- `enterprise.controller.ts`: `create-user`, `url`, `delete-channel` — apikey (enterprise)
- `stripe.controller.ts` / `payment.controller.ts`: `POST /stripe`, `POST /payment/:provider` — none (webhook, signature-verified)
- `admin.controller.ts`: `/errors(+/platforms)`, `/stats` — session (admin role)
### Misc
- `notifications.controller.ts`, `announcements.controller.ts`, `approved-apps.controller.ts`, `monitor.controller.ts` (queue status) — session
- `public.controller.ts`: public post view/comments/approve, `GET /public/stream` (SSE) — none
- `root.controller.ts`: `GET /` — none — health
### Public API v1 (`apps/backend/src/public-api/routes/v1/public.integrations.controller.ts`, `@Controller('/public/v1')`)
- CRUD `/posts`, `/upload(+-from-url)`, `/integrations`, `/groups`, `/me`, `/analytics/*`, `/clipping`, `/notifications`, `/credits/reset`, `/debug/*` — apikey — backs `apps/sdk` (`@postiz/node`)
## 3. Features
| Feature | Data touched | Dependencies | Remaining |
|---|---|---|---|
| 34→35 social providers | `Integration` table | `integration.manager.ts` registry, per-provider class | Done this session: `mastodon-custom` enabled (was commented out, had no standalone `requiredEnvVars`, no composer mapping — all 3 fixed). Still open: audit per-provider `checkPostStatus`/`finalizePost` override coverage against `SocialAbstract` stubs |
| Chrome extension cookie-auth | none (client-side cookie read) | `provider.registry.ts`, `manifest.json` host_permissions | Only Skool implemented; needs one module per cookie-auth provider + manifest permission entries. Medium effort, not started |
| AI post generator + copilot agent | `Post`, `mastra_*` tables | LangGraph, Mastra, OpenAI key | Functional; no gaps found this audit |
| Video clipping | `Clipping`, `ClippingClip` | Temporal orchestrator, Deepgram | Functional |
| Best-time-to-post | `Post` stats | bounded daily batch job (already shipped) | Functional |
| OAuth2 dev platform + public API + SDK | `OAuthApp`, API keys | `oauth.controller.ts`, `apps/sdk` | Functional; SDK is hard-coded to `api.postiz.com`, self-hosted users must override base URL manually — not currently exposed as a documented env/config option in the SDK client. Not fixed this session (separate scope from provider gap) |
| Live deployment | n/a | Oracle boxes (SSH/deploy-key access) | OWNER BLOCKER — no box currently reachable with working SSH/deploy key. Self-host via existing `docker-compose.yaml` once access restored; code is deploy-ready as-is |
## 4. This session's commit
- `fix(mastodon): enable self-hosted Mastodon instances via the custom provider` — uncomments `MastodonCustomProvider` registration, makes it not inherit `MASTODON_CLIENT_ID`/`SECRET` requirement (it doesn't use them — it registers a per-instance app via `externalUrl()`), adds `toolTip`, and maps `mastodon-custom` to the existing generic `MastodonProvider` composer component so posts to custom instances render/compose correctly instead of falling back to `Empty`.

111
README.md
View File

@ -13,31 +13,12 @@
</a>
</p>
<h3 align="center"><strong><a href="https://github.com/gitroomhq/postiz-agent">NEW: check out Postiz agent CLI! perfect for OpenClaw and other agents</a></strong></h3>
<div align="center">
<strong>
<h2>Your ultimate AI social media scheduling tool</h2><br />
<a href="https://postiz.com">Postiz</a>: An alternative to: Buffer.com, Hypefury, Twitter Hunter, etc...<br /><br />
<a href="https://postiz.com">Postiz</a> is a social media management platform for scheduling, automating, and analyzing your content.
Use Postiz Cloud for a fully managed experience, or deploy the open-source edition on your own infrastructure.
</strong>
Postiz offers everything you need to manage your social media posts,<br />build an audience, capture leads, and grow your business.
</div>
<div class="flex" align="center">
<br />
<img alt="Instagram" src="https://postiz.com/svgs/socials/Instagram.svg" width="32">
<img alt="Youtube" src="https://postiz.com/svgs/socials/Youtube.svg" width="32">
<img alt="Dribbble" src="https://postiz.com/svgs/socials/Dribbble.svg" width="32">
<img alt="Linkedin" src="https://postiz.com/svgs/socials/Linkedin.svg" width="32">
<img alt="Reddit" src="https://postiz.com/svgs/socials/Reddit.svg" width="32">
<img alt="TikTok" src="https://postiz.com/svgs/socials/TikTok.svg" width="32">
<img alt="Facebook" src="https://postiz.com/svgs/socials/Facebook.svg" width="32">
<img alt="Pinterest" src="https://postiz.com/svgs/socials/Pinterest.svg" width="32">
<img alt="Threads" src="https://postiz.com/svgs/socials/Threads.svg" width="32">
<img alt="X" src="https://postiz.com/svgs/socials/X.svg" width="32">
<img alt="Slack" src="https://postiz.com/svgs/socials/Slack.svg" width="32">
<img alt="Discord" src="https://postiz.com/svgs/socials/Discord.svg" width="32">
<img alt="Mastodon" src="https://postiz.com/svgs/socials/Mastodon.svg" width="32">
<img alt="Bluesky" src="https://postiz.com/svgs/socials/Bluesky.svg" width="32">
</div>
<p align="center">
@ -65,7 +46,46 @@
<a href="https://apps.make.com/postiz">Make.com integration</a>
</p>
<br /><br />
<br />
<p align="center"><strong>Schedule posts to:</strong></p>
<div class="flex" align="center">
<img alt="Instagram" src="https://postiz.com/svgs/socials/Instagram.svg" width="32">
<img alt="Youtube" src="https://postiz.com/svgs/socials/Youtube.svg" width="32">
<img alt="Dribbble" src="https://postiz.com/svgs/socials/Dribbble.svg" width="32">
<img alt="Linkedin" src="https://postiz.com/svgs/socials/Linkedin.svg" width="32">
<img alt="Reddit" src="https://postiz.com/svgs/socials/Reddit.svg" width="32">
<img alt="TikTok" src="https://postiz.com/svgs/socials/TikTok.svg" width="32">
<img alt="Facebook" src="https://postiz.com/svgs/socials/Facebook.svg" width="32">
<img alt="Pinterest" src="https://postiz.com/svgs/socials/Pinterest.svg" width="32">
<img alt="Threads" src="https://postiz.com/svgs/socials/Threads.svg" width="32">
<img alt="X" src="https://postiz.com/svgs/socials/X.svg" width="32">
<img alt="Slack" src="https://postiz.com/svgs/socials/Slack.svg" width="32">
<img alt="Discord" src="https://postiz.com/svgs/socials/Discord.svg" width="32">
<img alt="Mastodon" src="https://postiz.com/svgs/socials/Mastodon.svg" width="32">
<img alt="Bluesky" src="https://postiz.com/svgs/socials/Bluesky.svg" width="32">
</div>
<p align="center"><strong>With your favorite AI agent:</strong></p>
<div class="flex" align="center">
<a href="https://postiz.com/chatgpt" title="ChatGPT"><img alt="ChatGPT" src=".github/agents/chatgpt.svg" width="32"></a>
<a href="https://postiz.com/claude" title="Claude"><img alt="Claude" src=".github/agents/claude.svg" width="32"></a>
<a href="https://postiz.com/claude-code" title="Claude Code"><img alt="Claude Code" src=".github/agents/claude-code.svg" width="32"></a>
<a href="https://postiz.com/codex" title="Codex"><img alt="Codex" src=".github/agents/codex.svg" width="32"></a>
<a href="https://postiz.com/cursor" title="Cursor"><img alt="Cursor" src=".github/agents/cursor.svg" width="32"></a>
<a href="https://postiz.com/openclaw" title="OpenClaw"><img alt="OpenClaw" src=".github/agents/openclaw.svg" width="32"></a>
<a href="https://postiz.com/hermes" title="Hermes Agent"><img alt="Hermes Agent" src=".github/agents/hermes-agent.svg" width="32"></a>
<a href="https://postiz.com/grok-bot" title="Grok Bot"><img alt="Grok Bot" src=".github/agents/grok-bot.svg" width="32"></a>
<a href="https://postiz.com/grok-build" title="Grok Build"><img alt="Grok Build" src=".github/agents/grok-build.svg" width="32"></a>
<a href="https://postiz.com/muse" title="Muse"><img alt="Muse" src=".github/agents/muse.svg" width="32"></a>
<a href="https://postiz.com/perplexity-computer" title="Perplexity Computer"><img alt="Perplexity Computer" src=".github/agents/perplexity-computer.svg" width="32"></a>
<a href="https://postiz.com/nanoclaw" title="nanoclaw"><img alt="nanoclaw" src=".github/agents/nanoclaw.svg" width="32"></a>
<a href="https://postiz.com/paperclip" title="Paperclip"><img alt="Paperclip" src=".github/agents/paperclip.svg" width="32"></a>
<a href="https://postiz.com/mcp" title="MCP Server"><img alt="MCP Server" src=".github/agents/mcp-server.svg" width="32"></a>
<a href="https://postiz.com/agent" title="AI Agents CLI"><img alt="AI Agents CLI" src=".github/agents/ai-agents-cli.svg" width="32"></a>
</div>
<br />
## 🔌 See the leading Postiz features
@ -88,8 +108,8 @@
| [Hostinger](https://www.hostinger.com/vps/docker/postiz?ref=postiz) | <img src=".github/sponsors/hostinger.png" alt="Hostinger" width="500"/> | Hostinger is on a mission to make online success possible for anyone – from developers to aspiring bloggers and business owners |
| [Virlo](https://dev.virlo.ai/?ref=postiz) | <img src="https://github.com/user-attachments/assets/25182598-5344-45fc-b9cd-e4cfa16aabfd" alt="Virlo" width="500"/> | Virlo is the #1 social media trend spotting and all-in-one GTM tool for teams leveraging short-form video |
| [ChatbotX](https://chatbotx.io/?ref=postiz) | <img src="https://github.com/user-attachments/assets/0aa6b058-9a64-46d3-bc26-337abc51737d" alt="ChatbotX" width="500"/> | The ManyChat alternative that you can self-host, white-label, and resell to your clients. Bring your own OpenClaw, Hermes, or Claude agents! |
| [RapidProxy](https://www.rapidproxy.io/?ref=postiz) | <img width="700" height="412" alt="WP-PROXY-THUMBNAIL-41" src="https://github.com/user-attachments/assets/6cf5b2c9-2687-4181-8964-2e7b90eace4f" /> | RapidProxy provides 90M+ residential IPs for social media, browser automation, and AI workflows, with smart rotation and stable sessions. From $0.55/GB; use RAPID10 for 10% off.
![Bronze Tier](https://opencollective.com/postiz/tiers/main-repository-bronze-tier.svg?avatarHeight=36&width=600&button=false)
# Intro
@ -97,7 +117,6 @@
- Measure your work with analytics.
- Collaborate with other team members to exchange or buy posts.
- Invite your team members to collaborate, comment, and schedule posts.
- At the moment, there is no difference between the hosted version and the self-hosted version
- Perfect for automation (API) with platforms like N8N, Make.com, Zapier, etc.
## Tech Stack
@ -115,15 +134,53 @@ To have the project up and running, please follow the [Quick Start Guide](https:
## Sponsor Postiz
We now give a few options to Sponsor Postiz:
We now offer a few options to sponsor Postiz:
- Just a donation: You like what we are building, and want to buy us some coffee so we can build faster.
- Main repository: Get your logo with a backlink from the main Postiz repository. Postiz has over 7M downloads and 20k views per month.
Link: https://opencollective.com/postiz
<br />
<br />
## Postiz Cloud vs. Open-source
Choose [Postiz Cloud](https://postiz.com/) for a fully managed experience, or deploy Postiz Open-source on your own infrastructure. Both provide the same core Postiz product and features.
We do not "gate" features or limit the license.
The main difference is the infrastructure you need to own, approval from social media providers, and deployment that might be hard at times (let your LLM deploy it)
| Area | Postiz Cloud | Postiz Open-source (self-hosted) |
|---|---|---|
| **Cost** | Subscription per plan, 7-day free trial | Free forever (AGPL-3.0); you pay only for your own infra |
| **Setup time** | Sign up and connect channels in minutes | Deploy with Docker / Coolify / Railway / any VPS; you configure Postgres, Redis, storage and env vars |
| **Hosting & data** | Hosted by Postiz; data stored in our infrastructure | Runs on your own server; data never leaves your environment |
| **Social platform apps** | Pre-approved apps for every channel, ready to use | You create your own developer apps on each platform and go through their approval (Meta, YouTube, TikTok can take weeks) |
| **Channels** | Limited by plan tier | Unlimited, every supported provider |
| **Posts per month** | Limited by plan tier | Unlimited |
| **Team members** | Limited by plan tier | Unlimited |
| **Scheduling, calendar views, cross-posting, repeated posts, post comments & delays, sets, signatures** | Included | Included |
| **Internal & Global Plugs, RSS auto-post, customer groups** | Included per plan | Included |
| **Analytics** | Included per plan | Included (requires your own app credentials with analytics scopes) |
| **AI Copilot, AI images, AI videos** | Included with monthly quotas per plan; keys managed by Postiz | Available if you bring your own OpenAI (and other provider) API keys; no quota, you pay the provider |
| **AI video clipping** | Included with monthly clipping minutes per plan | Requires your own provider keys and extra configuration |
| **Smart Agent** | Included per plan | Available with your own LLM key |
| **Public API & webhooks** | Included per plan | Included |
| **Agentic surfaces (MCP, CLI, Claude / ChatGPT / Codex / OpenClaw / Cursor connectors)** | Included, hosted MCP endpoint | Included, you point the MCP / CLI at your own instance |
| **Custom integrations** | Included per plan | Included; you can also modify the code and add providers |
| **Updates & maintenance** | Automatic, zero downtime for you | You pull new images and run migrations yourself |
| **Uptime, backups, security patches** | Managed by Postiz | Your responsibility |
| **Support** | Priority support via Discord / email per plan | Community support on Discord and GitHub |
| **Source access & customization** | No (SaaS) | Full source code, fork and modify freely under AGPL |
| **Compliance / data residency** | Postiz-controlled regions | Any region or air-gapped environment you choose |
<br />
<br />
## Postiz Compliance
- Postiz is an open-source, self-hosted social media scheduling tool that supports platforms like X (formerly Twitter), Bluesky, Mastodon, Discord, and others.
- This GitHub repository contains the open-source, self-hosted edition of Postiz. Postiz is also available as Postiz Cloud, a fully managed service at postiz.com.
- Postiz hosted service uses official, platform-approved OAuth flows.
- Postiz does not automate or scrape content from social media platforms.
- Postiz does not collect, store, or proxy API keys or access tokens from users.

View File

@ -66,7 +66,7 @@ If you discover a security vulnerability in the Postiz app, report it through [G
Email the maintainers only when the report requires immediate, time-critical attention. Email does not replace submitting the report through GAdvisory.
- @egelhaus ([E-Mail](mailto:egelhaus@ennogelhaus.de))
- Gelhaus Solutions (@egelhaus): [contact@gplatform.org](mailto:contact@gplatform.org)
### AI Reports

89
STRATEGY-2026-10-23.md Normal file
View File

@ -0,0 +1,89 @@
# Postiz Strategy — 2026-10-23
Scope note: this document covers competitive positioning, differentiation, user
research (persona + journey map), and growth moves. It deliberately does not
cover page/API/feature build-out — see `PLAN-2026-10-23-DEEP.md` if present for
that (not found in the repo at time of writing, 2026-10-23).
Grounded in the actual repo state at `/Users/arhansubasi/products/postiz-app`
(fork `caelum0x/postiz-app`, upstream `gitroomhq/postiz-app`, AGPL-3.0):
- 36 real social/channel providers under `libraries/nestjs-libraries/src/integrations/social/*.provider.ts` (Instagram, X, LinkedIn page+personal, TikTok + TikTok Business, Facebook, YouTube, Pinterest, Reddit, Threads, Bluesky, Mastodon, Discord, Slack, Telegram, Dev.to, Hashnode, Medium, WordPress, Tumblr, Twitch, VK, Dribbble, GMB, Farcaster, Nostr, Lemmy, Beehiiv, HubSpot, Skool, Whop, Listmonk, Kick, Mewe, Moltbook, etc.) plus Resend/node-mailer for email channels.
- Real AI stack: `libraries/nestjs-libraries/src/agent/agent.graph.service.ts` (LangGraph + GPT-4.1 + Tavily web search + DALL-E image gen), `libraries/nestjs-libraries/src/openai/openai.service.ts`, `chat/start.mcp.ts` + `chat/mcp.relay.service.ts` (Postiz runs its own MCP server), `chat/load.tools.service.ts` and `chat/tools/generate.image.tool.ts` / `generate.video.tool.ts`.
- Real video-clipping pipeline: `libraries/nestjs-libraries/src/database/prisma/clipping/clipping.service.ts` — Temporal-orchestrated long-video-to-clips with Deepgram transcription, i.e. an OpusClip-style feature bundled into a scheduler.
- Real public API + SDK + CLI + browser extension: `apps/sdk` (`@postiz/node` on npm), `apps/commands` (CLI), `apps/extension`, plus listed n8n node and Make.com integration in the README.
- Production pricing config confirmed in code at `libraries/nestjs-libraries/src/database/prisma/subscriptions/pricing.ts`:
FREE $0 (0 channels), STANDARD $29/mo ($278/yr, 5 channels, AI on, public API, 60 clipping min, 3 video gens, 20 image gens), TEAM $39/mo (10 channels, team members, autopost), PRO $49/mo (30 channels, 300 clipping min), ULTIMATE $99/mo (100 channels, 600 clipping min, 10k webhooks).
- Open-core model confirmed in README: "We do not gate features or limit the license" between self-hosted and Postiz Cloud — same product either way.
## 1. Direct competitors
- **Buffer** (buffer.com)
- Pricing: Free (3 channels, 10 scheduled posts/channel); Essentials $5/mo per channel; Team $10/mo per channel (unlimited seats).
- Strongest feature: simplest onboarding in the category, cleanest UI, cheapest true per-channel entry price.
- Weakest point: no self-hosting, no public API/MCP for agent workflows, no video-clipping or AI web-research-backed caption generation, per-channel pricing gets expensive fast past ~6 channels.
- **Hootsuite** (hootsuite.com)
- Pricing: Standard $99/mo billed annually (10 accounts), Professional $199/mo, Advanced $399/mo. No free plan.
- Strongest feature: deepest enterprise feature set (approval workflows, social listening, large team permissions).
- Weakest point: priced for enterprise only — same 10-channel ceiling costs $1,197/mo once 3 users + approvals are added vs. Postiz TEAM at $39/mo flat; no self-host option, no AGPL/open-source trust story.
- **Later** (later.com)
- Pricing: Starter $18.75/mo (annual), Growth $37.50/mo, Scale $82.50/mo. No free plan.
- Strongest feature: best visual/Instagram-grid planning UX for creators.
- Weakest point: no X/Twitter support at all; no self-hosting; no AI agent/MCP surface; no video clipping.
- **SocialBee** (socialbee.com)
- Pricing: Bootstrap $29/mo (5 profiles), Accelerate $49/mo (10 profiles), Pro $99/mo (25 profiles, 3 users).
- Strongest feature: evergreen content recycling / category-based queue rotation.
- Weakest point: flat per-tier profile caps with no team seats below Pro ($99/mo); no open-source/self-host option; no public API or MCP server.
- **Metricool** (metricool.com)
- Pricing: Free (1 brand, 20 posts/mo, X and LinkedIn excluded); paid plans priced per brand starting ~$20/mo, Advanced ~$53/mo for 10 profiles/3 users/approvals.
- Strongest feature: best-in-class analytics and competitor tracking.
- Weakest point: X and LinkedIn gated behind paid tiers even on "included" lists; no AI content agent, no video clipping, closed source.
- **Publer** (publer.io)
- Pricing: Free tier (3 accounts, no X, 10 scheduled posts each); paid from $5/mo for one account + $4/extra account on Professional; ~$32/mo for 10 channels/3 users with approvals.
- Strongest feature: cheapest true cost-at-scale among SaaS competitors.
- Weakest point: no self-hosting, no public API/MCP/SDK/CLI, no video clipping, no bundled AI web-research agent.
- **Mixpost** (mixpost.app) — the direct self-hosted/open-source competitor
- Pricing: Lite free (Facebook Pages, X, Mastodon only); Pro $299 one-time (all platforms, API, MCP, basic white-label, 1 year of updates included, renew for updates after); Enterprise $1,199 one-time (white-label + resale billing). Hosting is extra ($5-20/mo VPS).
- Strongest feature: true perpetual-license, zero-recurring-fee model; Laravel/PHP stack is familiar to a large existing dev audience.
- Weakest point: Lite (the free tier) only supports 3 channels; Laravel stack has a smaller AI/LangChain ecosystem than Node — no bundled video-clipping/transcription pipeline, no bundled web-research agent comparable to Postiz's LangGraph+Tavily+DALL-E graph; a lapsed license freezes you on an old version with no update path short of repaying.
## 2. Exact differentiation plan (per competitor, specific axis)
- **vs. Buffer**: undercut on per-channel economics at scale — Postiz STANDARD is $29/mo flat for 5 channels ($5.80/channel) vs Buffer Essentials at $5/channel but with zero AI, zero public API, and zero self-host option; message this as "Buffer's price, plus a public API, MCP server, and AI agent Buffer doesn't have at any price."
- **vs. Hootsuite**: undercut on the exact workflow Hootsuite overcharges for — team seats + approval at 10 channels. Postiz TEAM is $39/mo flat (10 channels, team members, autopost) vs Hootsuite's $1,197/mo for the equivalent (Advanced + 3 seats). Put this side-by-side number on the pricing page, not a vague "cheaper" claim.
- **vs. Later**: ship/keep full X (Twitter) support — Later has none — and lead marketing copy for Instagram-grid-style creators with "every channel Later has, plus X, Threads, Bluesky, and 20+ more."
- **vs. SocialBee**: give team seats at the $29 tier (SocialBee requires $99 Pro for any team member); this is already true in Postiz's own pricing.ts (STANDARD lacks team_members=false actually — check: STANDARD has team_members:false too). Correction built into point below — see Note.
- **vs. Metricool**: never gate X or LinkedIn behind a higher tier — confirm (from pricing.ts) that channel count is the only paid gate, not platform identity; make that an explicit comparison-page claim ("every channel, every tier, no platform tax").
- **vs. Publer**: win on what Publer structurally cannot ship — self-host AGPL deployment, the `@postiz/node` SDK, the CLI (`apps/commands`), the browser extension (`apps/extension`), and the native MCP server (`start.mcp.ts`) that lets Claude/ChatGPT/Codex agents schedule posts directly. Publer has none of these; put "runs your own MCP server" on the comparison page as a literal checklist row.
- **vs. Mixpost (the real fight, since it's the other self-hosted option)**: win on the recurring-feature-velocity axis Mixpost's perpetual-license model can't match — Postiz's LangGraph agent (`agent.graph.service.ts`) does live web research via Tavily before drafting a post, and generates images via DALL-E inline; Mixpost's Pro tier has an MCP integration but no bundled LLM agent graph or video-clipping pipeline. Lead with the clipping feature (`clipping.service.ts` + Deepgram transcription) as a feature SocialBee/Buffer/Later/Mixpost all lack entirely — "turn one long video into scheduled clips across every channel" is not offered by any competitor above, open-source or SaaS.
- **Cross-cutting structural moat**: Postiz is the only product in this list that is simultaneously (a) open-source/self-hostable, (b) has a managed cloud option at Buffer-adjacent pricing, (c) ships a public API + npm SDK + CLI + browser extension + native MCP server, and (d) bundles an LLM agent with live web search and video generation. No single named competitor above checks more than 2 of those 4 boxes. Make that 4-box checklist the hero comparison-table structure on the Postiz Cloud vs. [X] landing pages instead of a generic feature list.
Note on the SocialBee bullet above: Postiz's own STANDARD tier in `pricing.ts` has `team_members: false`; team seats start at TEAM ($39/mo). The accurate claim is therefore "Postiz gives team seats one tier up at $39/mo vs SocialBee's $99/mo Pro" — a $60/mo gap, not "team seats at $29." Use the corrected $39-vs-$99 number on any comparison page.
## 3. Primary user persona / ICP
- **Primary persona: the technical/solo marketer at a small SaaS or dev-tool company (1-10 person team) who already pays for Supabase/Neon/Resend-style infra and is comfortable self-hosting.**
- Job to be done: get consistent multi-platform posting (especially X, LinkedIn, Reddit, Discord/Slack for community) live without hiring a social media person, and automate it from existing dev workflows (n8n/Make/Zapier, or directly from an AI agent via MCP) rather than hand-typing into five separate native composer UIs.
- Why this persona, grounded in the repo: Postiz's own README leads with the dev-tool ecosystem (n8n node, Make.com integration, Postiz Node SDK, AI-agent integrations for ChatGPT/Claude/Codex/Cursor/Grok listed in the README's agent-icon row) — the product is built for people who want posting as a callable primitive, not a composer UI.
- Secondary persona: a small agency or community team (the TEAM/PRO tier shape — 10-30 channels, multiple members, autopost) managing several client/brand accounts who wants self-host cost control instead of Hootsuite's per-seat tax.
## 4. User journey map (discovery -> paying/retained user)
1. **Discovery** — finds Postiz via: GitHub (AGPL repo, currently ~37.5k+ stars per competitor research), a "Buffer alternative" / "open source Buffer alternative" search or blog post, or an AI-agent tooling list (MCP server directories, n8n/Make marketplace listings).
2. **Evaluation** — compares self-host (free, own infra) vs. Postiz Cloud (`platform.postiz.com`) pricing against Buffer/Mixpost; reads the open-core claim ("we do not gate features") to confirm no rug-pull risk.
3. **First setup** — either (a) self-hosts via Docker Compose (`docker-compose.yaml`/`docker-compose.dev.yaml`) and needs Postgres+Redis+env vars configured correctly, or (b) signs up on Postiz Cloud directly. **This is the single biggest drop-off risk step**: self-hosting Postiz requires correctly provisioning OAuth app credentials for every platform the user wants (each provider needs its own developer-app registration — e.g. Meta app review for Instagram/Facebook, X API tier, TikTok app approval) before a single post can be scheduled; this setup friction is categorically worse than any SaaS competitor's "click to connect" OAuth, and is where a self-host-curious technical user is most likely to abandon before ever publishing a post.
4. **Activation** — connects first channel(s), schedules/publishes first post; for the AI-agent persona, activation instead means wiring the MCP server or Node SDK into an existing agent/workflow and getting the first automated post out.
5. **Habit formation** — returns weekly/daily via the calendar view, analytics, or an automated pipeline (n8n/Make/agent) that keeps posting without manual re-entry.
6. **Monetization trigger** — hits a FREE-tier wall (FREE has 0 channels in `pricing.ts`, i.e. it is effectively a trial/demo tier, not a usable free plan) and must upgrade to STANDARD ($29/mo) to connect even one channel, or needs a 6th+ channel / team member / clipping minutes beyond STANDARD's caps.
7. **Retention / expansion** — adds team members (TEAM), add more channels/clipping minutes/webhooks (PRO/ULTIMATE), or becomes a public-API/MCP power user embedding Postiz into their own product or internal tooling, which raises switching cost substantially versus a SaaS-only competitor.
## 5. Three concrete growth moves specific to this product
- **Ship a one-click "OAuth app pre-registration" path or a hosted-credentials fallback for self-hosters.** Since step 3 above (per-platform OAuth app setup) is the confirmed biggest activation blocker for the exact self-host-first ICP this product targets, offer self-hosters an opt-in "use Postiz Cloud's shared OAuth apps for your first N posts, bring your own after" mode, or a guided CLI wizard (building on the existing `apps/commands` CLI) that walks through each provider's app-creation steps inline. This directly targets the step with the highest measured drop-off risk in the journey map above, not a generic onboarding tweak.
- **Publish head-to-head comparison pages for each competitor above, using the exact numbers in this doc** (Buffer $5/channel vs. Postiz $29 flat/5 channels + API+MCP; Hootsuite $1,197/mo vs. Postiz TEAM $39/mo for the same 10-channel/3-seat/approval shape; Mixpost's $299 one-time but no agent-graph/clipping vs. Postiz Cloud's bundled AI+clipping). These are the kind of bottom-of-funnel, high-intent "X vs Postiz" pages that convert searchers already comparing tools — and every number here is pulled from the live `pricing.ts` and competitor pricing pages found above, not invented.
- **Package the video-clipping pipeline (`clipping.service.ts` + Deepgram) as its own standalone landing page/feature — "turn one long-form video into scheduled social clips" — since no competitor named above (Buffer, Hootsuite, Later, SocialBee, Metricool, Publer, Mixpost) offers this at all.** This is a real, already-built, differentiated feature with zero direct competitive overlap in this specific product category; a dedicated page targeting "repurpose long video to short clips scheduler" search intent captures a search behavior none of the 7 named competitors can answer directly from their own feature set.

View File

@ -4,13 +4,15 @@ import { GetOrgFromRequest } from '@gitroom/nestjs-libraries/user/org.from.reque
import { ApiTags } from '@nestjs/swagger';
import { IntegrationService } from '@gitroom/nestjs-libraries/database/prisma/integrations/integration.service';
import { PostsService } from '@gitroom/nestjs-libraries/database/prisma/posts/posts.service';
import { PostEngagementService } from '@gitroom/nestjs-libraries/database/prisma/post-engagement/post-engagement.service';
@ApiTags('Analytics')
@Controller('/analytics')
export class AnalyticsController {
constructor(
private _integrationService: IntegrationService,
private _postsService: PostsService
private _postsService: PostsService,
private _postEngagementService: PostEngagementService
) {}
@Get('/:integration')
@ -30,4 +32,15 @@ export class AnalyticsController {
) {
return this._postsService.checkPostAnalytics(org.id, postId, +date);
}
// Reads only from the pre-aggregated PostEngagementSnapshot table (see
// PostEngagementService) - no live provider calls on this path, so it is
// safe to call on every composer/calendar render.
@Get('/best-time/:integration')
async getBestTimeToPost(
@GetOrgFromRequest() org: Organization,
@Param('integration') integration: string
) {
return this._postEngagementService.getBestTimes(org.id, integration);
}
}

View File

@ -25,7 +25,7 @@ import { EmailService } from '@gitroom/nestjs-libraries/services/email.service';
import { RealIP } from 'nestjs-real-ip';
import { UserAgent } from '@gitroom/nestjs-libraries/user/user.agent';
import { Provider } from '@prisma/client';
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
import { makeSecureId } from '@gitroom/nestjs-libraries/services/make.secure.id';
import * as Sentry from '@sentry/nestjs';
import { FarcasterProvider } from '@gitroom/nestjs-libraries/integrations/social/farcaster.provider';
@ -223,7 +223,7 @@ export class AuthController {
@Query() query: any,
@Res({ passthrough: true }) response: Response
) {
const state = `login-${makeId(16)}`;
const state = `login-${makeSecureId(16)}`;
response.cookie('oauth_state', state, {
domain: getCookieUrlFromDomain(process.env.FRONTEND_URL!),
...(!process.env.NOT_SECURED

View File

@ -20,6 +20,11 @@ import { AuthService } from '@gitroom/helpers/auth/auth.service';
import { UsersService } from '@gitroom/nestjs-libraries/database/prisma/users/users.service';
import { PaymentService } from '@gitroom/nestjs-libraries/services/payment/payment.service';
import { BillingSyncDto } from '@gitroom/nestjs-libraries/dtos/billing/billing.sync.dto';
import { CheckPolicies } from '@gitroom/backend/services/auth/permissions/permissions.ability';
import {
AuthorizationActions,
Sections,
} from '@gitroom/backend/services/auth/permissions/permission.exception.class';
@ApiTags('Billing')
@Controller('/billing')
@ -158,6 +163,17 @@ export class BillingController {
};
}
@Get('/invoices')
@CheckPolicies([AuthorizationActions.Create, Sections.ADMIN])
async getInvoices(@GetOrgFromRequest() org: Organization) {
return (await this.provider(org)).getInvoices(org.id);
}
@Get('/renewal')
async getRenewal(@GetOrgFromRequest() org: Organization) {
return (await this.provider(org)).getRenewalDate(org.id);
}
@Get('/')
getCurrentBilling(@GetOrgFromRequest() org: Organization) {
return this._paymentService.getSubscription(org.id);
@ -169,14 +185,18 @@ export class BillingController {
@GetUserFromRequest() user: User,
@Body() body: { feedback: string }
) {
await this._notificationService.sendEmail(
process.env.EMAIL_FROM_ADDRESS,
'Subscription Cancelled',
`Organization ${org.name} has cancelled their subscription because: ${body.feedback}`,
user.email
);
const result = await (await this.provider(org)).setToCancel(org.id);
return (await this.provider(org)).setToCancel(org.id);
if (result.cancel_at) {
await this._notificationService.sendEmail(
process.env.EMAIL_FROM_ADDRESS,
'Subscription Cancelled',
`Organization ${org.name} has cancelled their subscription because: ${body.feedback}`,
user.email
);
}
return result;
}
@Post('/prorate')

View File

@ -116,7 +116,8 @@ export class CopilotController {
@Get('/credits')
calculateCredits(
@GetOrgFromRequest() organization: Organization,
@Query('type') type: 'ai_images' | 'ai_videos'
@Query('type')
type: 'ai_images' | 'ai_videos' | 'clipping_minutes'
) {
return this._subscriptionService.checkCredits(
organization,

View File

@ -17,15 +17,33 @@ export class EnterpriseController {
private _postsService: PostsService
) {}
private verifyEnterpriseToken<T extends object>(params: string): T {
const payload = AuthService.verifyJWT(params) as any;
if (
!payload || typeof payload !== 'object' ||
'providerName' in payload || // login token (full User row)
'orgId' in payload || // team invite token
'expires' in payload // password reset token
) {
throw new Error('Invalid enterprise token');
}
return payload as T;
}
@Post('/create-user')
async createUser(@Body('params') params: string) {
try {
const { id, name, saasName, email } = AuthService.verifyJWT(params) as {
const { id, name, saasName, email } = this.verifyEnterpriseToken<{
id: string;
name: string;
email: string;
saasName: string;
};
}>(params);
if (!id || !saasName) {
return { success: false };
}
try {
return await this._organizationService.createMaxUser(
@ -45,15 +63,21 @@ export class EnterpriseController {
@Post('/url')
async redirectParams(@Body('params') params: string) {
try {
const load = AuthService.verifyJWT(params) as {
const load = this.verifyEnterpriseToken<{
redirectUrl: string;
apiKey: string;
refreshId?: string;
provider: string;
webhookUrl: string;
};
}>(params);
if (!load || !load.redirectUrl || !load.apiKey || !load.provider) {
if (
!load ||
!load.redirectUrl ||
!load.apiKey ||
typeof load.apiKey !== 'string' ||
!load.provider
) {
return;
}
@ -94,12 +118,18 @@ export class EnterpriseController {
@Post('/delete-channel')
async deleteChannel(@Body('params') params: string) {
try {
const load = AuthService.verifyJWT(params) as {
const load = this.verifyEnterpriseToken<{
apiKey: string;
id: string;
};
}>(params);
if (!load || !load.apiKey || !load.id) {
if (
!load ||
!load.apiKey ||
!load.id ||
typeof load.apiKey !== 'string' ||
typeof load.id !== 'string'
) {
return { success: false };
}

View File

@ -3,6 +3,7 @@ import {
Controller,
Delete,
Get,
Logger,
Param,
Post,
Put,
@ -20,6 +21,8 @@ import { ApiTags } from '@nestjs/swagger';
import { GetUserFromRequest } from '@gitroom/nestjs-libraries/user/user.from.request';
import { PostsService } from '@gitroom/nestjs-libraries/database/prisma/posts/posts.service';
import { IntegrationTimeDto } from '@gitroom/nestjs-libraries/dtos/integrations/integration.time.dto';
import { IntegrationNameDto } from '@gitroom/nestjs-libraries/dtos/integrations/integration.name.dto';
import { CustomerNameDto } from '@gitroom/nestjs-libraries/dtos/integrations/customer.name.dto';
import { PlugDto } from '@gitroom/nestjs-libraries/dtos/plugs/plug.dto';
import {
Disconnect,
@ -39,6 +42,8 @@ import { RefreshIntegrationService } from '@gitroom/nestjs-libraries/integration
@ApiTags('Integrations')
@Controller('/integrations')
export class IntegrationsController {
private readonly _logger = new Logger(IntegrationsController.name);
constructor(
private _integrationManager: IntegrationManager,
private _integrationService: IntegrationService,
@ -66,6 +71,15 @@ export class IntegrationsController {
return this._integrationService.customers(org.id);
}
@Put('/customers/:id')
async updateCustomerName(
@GetOrgFromRequest() org: Organization,
@Param('id') id: string,
@Body() body: CustomerNameDto
) {
return this._integrationService.updateCustomerName(org.id, id, body.name);
}
@Put('/:id/group')
async updateIntegrationGroup(
@GetOrgFromRequest() org: Organization,
@ -88,6 +102,15 @@ export class IntegrationsController {
return this._integrationService.updateOnCustomerName(org.id, id, body.name);
}
@Put('/:id/custom-name')
async updateCustomName(
@GetOrgFromRequest() org: Organization,
@Param('id') id: string,
@Body() body: IntegrationNameDto
) {
return this._integrationService.updateCustomName(org.id, id, body.name);
}
@Get('/list')
async getIntegrationList(@GetOrgFromRequest() org: Organization) {
return {
@ -99,7 +122,8 @@ export class IntegrationsController {
p.providerIdentifier
);
return {
name: p.name,
name: p.customName || p.name,
originalName: p.name,
id: p.id,
internalId: p.internalId,
disabled: p.disabled,
@ -226,6 +250,27 @@ export class IntegrationsController {
throw new Error('Missing external url');
}
// Building the auth URL with an unset client id/secret sends the user
// to the provider with an empty or literal "undefined" client id - the
// provider's error page gives no hint that a server env var is missing
// (#2238). Catch it generically here instead of per-provider.
const missingEnvVars = integrationProvider.missingEnvVars?.() ?? [];
if (missingEnvVars.length) {
this._logger.error(
`Cannot start ${integration} OAuth: missing env var(s) ${missingEnvVars.join(
', '
)}`
);
return {
err: true,
message: `${integrationProvider.name} is not configured on this server: missing ${missingEnvVars.join(
', '
)}. Ask the admin to set ${missingEnvVars.length > 1 ? 'these' : 'this'} environment variable${
missingEnvVars.length > 1 ? 's' : ''
}.`,
};
}
try {
const getExternalUrl = integrationProvider.externalUrl
? {
@ -259,7 +304,17 @@ export class IntegrationsController {
);
return { url };
} catch (err) {
} catch (err: any) {
// Previously swallowed entirely (HTTP 200 with just { err: true }), so
// a provider rejecting the request (for example X's request-token call
// failing) left no trace anywhere in the server logs (#2238). Log only
// the message, never the raw error object - some provider errors carry
// request config/headers that aren't guaranteed to be redacted here.
this._logger.error(
`Failed to generate auth URL for ${integration}: ${
err?.message || err
}`
);
return { err: true };
}
}

View File

@ -62,7 +62,11 @@ export class NoAuthIntegrationsController {
? 'none'
: await ioRedis.get(`login:${body.state}`);
if (!getCodeVerifier) {
throw new Error('Invalid state');
// The state expires after an hour and is deleted once used (page reload)
throw new HttpException(
'This connection link expired or was already used, please connect the channel again',
400
);
}
const organization = await ioRedis.get(`organization:${body.state}`);
@ -136,7 +140,14 @@ export class NoAuthIntegrationsController {
refresh,
auth.accessToken
);
return res({ ...newAuth, refreshToken: body.refresh });
// keep the fresh refresh token and expiration from the new
// authentication, otherwise the stored refresh token is wiped and
// the channel breaks again as soon as the access token expires
return res({
...newAuth,
refreshToken: auth.refreshToken,
expiresIn: auth.expiresIn,
});
} catch (err: any) {
return res({
error: err.message,
@ -164,6 +175,7 @@ export class NoAuthIntegrationsController {
});
}
console.log(`Authentication failed for ${integration}:`, err);
return res({
error: 'Authentication failed',
accessToken: '',
@ -365,7 +377,18 @@ export class NoAuthIntegrationsController {
}
const { integrationId, organizationId, internalId, provider } = payload;
if (!integrationId || !organizationId || !internalId || !provider) {
if (
!integrationId ||
typeof integrationId !== 'string' ||
!organizationId ||
typeof organizationId !== 'string' ||
!internalId ||
typeof internalId !== 'string' ||
!provider ||
typeof provider !== 'string' ||
'timeLimit' in payload || // team invite token
'expires' in payload // password reset token
) {
throw new HttpException('Invalid token payload', 400);
}
@ -373,7 +396,11 @@ export class NoAuthIntegrationsController {
organizationId,
integrationId
);
if (!integration || integration.internalId !== internalId) {
if (
!integration ||
integration.internalId !== internalId ||
integration.providerIdentifier !== provider
) {
throw new HttpException('Integration not found', 404);
}
@ -416,8 +443,10 @@ export class NoAuthIntegrationsController {
false,
undefined,
undefined,
AuthService.signJWT(
JSON.parse(Buffer.from(body.cookies, 'base64').toString())
// stored encrypted like connectSocialMedia does, never signed: the
// cookies JSON comes from the request
AuthService.fixedEncryption(
Buffer.from(body.cookies, 'base64').toString()
)
);

View File

@ -8,21 +8,35 @@ import {
HttpStatus,
Post,
Query,
Res,
UseGuards,
} from '@nestjs/common';
import { Response } from 'express';
import { ApiTags } from '@nestjs/swagger';
import { Throttle } from '@nestjs/throttler';
import { OAuthService } from '@gitroom/nestjs-libraries/database/prisma/oauth/oauth.service';
import { GetUserFromRequest } from '@gitroom/nestjs-libraries/user/user.from.request';
import { GetOrgFromRequest } from '@gitroom/nestjs-libraries/user/org.from.request';
import { User, Organization } from '@prisma/client';
import { AuthorizeOAuthQueryDto, ApproveOAuthDto } from '@gitroom/nestjs-libraries/dtos/oauth/authorize-oauth.dto';
import {
AuthorizeOAuthQueryDto,
ApproveOAuthDto,
AuthorizeSelfHostedDto,
} from '@gitroom/nestjs-libraries/dtos/oauth/authorize-oauth.dto';
import { TokenExchangeDto } from '@gitroom/nestjs-libraries/dtos/oauth/token-exchange.dto';
import { RegisterClientDto } from '@gitroom/nestjs-libraries/dtos/oauth/register-client.dto';
import { HubspotInstallQueryDto } from '@gitroom/nestjs-libraries/dtos/oauth/hubspot-install.dto';
import { extractBasicCredentials } from '@gitroom/nestjs-libraries/chat/oauth-types';
import { McpRelayService } from '@gitroom/nestjs-libraries/chat/mcp.relay.service';
import { ThrottlerRealIpGuard } from '@gitroom/nestjs-libraries/throttler/throttler.provider';
@ApiTags('OAuth')
@Controller('/oauth')
export class OAuthController {
constructor(private _oauthService: OAuthService) {}
constructor(
private _oauthService: OAuthService,
private _mcpRelayService: McpRelayService
) {}
// Dynamic Client Registration (RFC 7591), used by MCP clients like Claude
@Post('/register')
@ -42,6 +56,11 @@ export class OAuthController {
}
);
const selfHosted = this._oauthService.allowsSelfHosted(
app,
query.resource
);
return {
app: {
name: app.name,
@ -51,14 +70,80 @@ export class OAuthController {
redirectUrl: app.redirectUrl,
},
state: query.state,
selfHosted,
selfHostedEmail:
selfHosted && this._oauthService.selfHostedRequiresEmail(app),
};
}
// Public (the person may have no account here) and capped per client,
// since every attempt sends requests to the instance
@UseGuards(ThrottlerRealIpGuard)
@Throttle({ default: { limit: 30, ttl: 3600000 } })
@Post('/authorize/self-hosted')
async authorizeSelfHosted(@Body() body: AuthorizeSelfHostedDto) {
const app = await this._oauthService.validateAuthorizationRequest(
body.client_id,
{
redirectUri: body.redirect_uri,
codeChallenge: body.code_challenge,
codeChallengeMethod: body.code_challenge_method,
}
);
const email = body.email?.trim();
this._oauthService.validateSelfHostedRequest(app, {
resource: body.resource,
email,
});
const instance = await this._mcpRelayService.connect(
body.instance_url,
body.api_key
);
const code = await this._oauthService.createSelfHostedAuthorizationCode(
app.id,
{ ...instance, email },
this._oauthService.pkceBinding(app, {
codeChallenge: body.code_challenge,
codeChallengeMethod: body.code_challenge_method,
redirectUri: body.redirect_uri,
})
);
// Same redirect as an approved cloud authorization
const redirectUrl = new URL(
app.dynamic ? body.redirect_uri! : app.redirectUrl
);
redirectUrl.searchParams.set('code', code);
if (body.state) {
redirectUrl.searchParams.set('state', body.state);
}
return { redirect: redirectUrl.toString() };
}
@Post('/token')
// RFC 6749 §5.1: successful token responses are 200; strict clients (Canva) reject Nest's default 201
@HttpCode(200)
async token(
@Body() body: TokenExchangeDto,
@Headers('authorization') authorization?: string
) {
// client_secret_basic puts the credentials in the Authorization header,
// client_secret_post and public clients put them in the body
const basic = extractBasicCredentials(authorization);
const clientId = basic?.clientId || body.client_id;
// Only HubSpot gets refresh tokens, the service answers every other
// client with unsupported_grant_type, as before
if (body.grant_type === 'refresh_token') {
return this._oauthService.refreshAccessToken(
clientId,
body.refresh_token
);
}
if (body.grant_type !== 'authorization_code') {
throw new HttpException(
{ error: 'unsupported_grant_type' },
@ -66,10 +151,6 @@ export class OAuthController {
);
}
// client_secret_basic puts the credentials in the Authorization header,
// client_secret_post and public clients put them in the body
const basic = extractBasicCredentials(authorization);
const clientId = basic?.clientId || body.client_id;
if (!clientId) {
throw new HttpException(
{ error: 'invalid_client' },
@ -95,6 +176,26 @@ export class OAuthController {
async userinfoPost(@Headers('authorization') authorization?: string) {
return this._oauthService.getUserInfo(authorization);
}
// Public (HubSpot sends the person here after they install the HubSpot app)
// and capped per IP, since every attempt sends a request to HubSpot
@UseGuards(ThrottlerRealIpGuard)
@Throttle({ default: { limit: 30, ttl: 3600000 } })
@Get('/hubspot/callback')
async hubspotCallback(
@Query() query: HubspotInstallQueryDto,
@Res({ passthrough: false }) response: Response
) {
await this._oauthService.completeHubspotInstall(query.code);
// The calendar explains what just happened (HubspotInstalled); returnUrl
// brings someone who has to sign in first back to it
const installed = `${process.env.FRONTEND_URL}/launches?hubspot=installed`;
return response.redirect(
302,
`${installed}&returnUrl=${encodeURIComponent(installed)}`
);
}
}
@ApiTags('OAuth')
@ -134,13 +235,11 @@ export class OAuthAuthorizedController {
app.id,
user.id,
org.id,
app.dynamic
? {
codeChallenge: body.code_challenge,
codeChallengeMethod: body.code_challenge_method,
redirectUri: body.redirect_uri,
}
: undefined
this._oauthService.pkceBinding(app, {
codeChallenge: body.code_challenge,
codeChallengeMethod: body.code_challenge_method,
redirectUri: body.redirect_uri,
})
);
const redirectUrl = new URL(redirectTarget);

View File

@ -29,6 +29,20 @@ import {
Sections,
} from '@gitroom/backend/services/auth/permissions/permission.exception.class';
import { PostValidationException } from '@gitroom/backend/api/routes/posts.validation.exception';
import {
AssignCommentDto,
CreatePublicCommentDto,
ResolveCommentDto,
} from '@gitroom/nestjs-libraries/dtos/comments/add.comment.dto';
import { RealIP } from 'nestjs-real-ip';
import { BulkScheduleDto } from '@gitroom/nestjs-libraries/dtos/posts/bulk.schedule.dto';
import { simpleTextProviders } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/all.providers.settings';
import { OrganizationService } from '@gitroom/nestjs-libraries/database/prisma/organizations/organization.service';
import { EvergreenService } from '@gitroom/nestjs-libraries/database/prisma/evergreen/evergreen.service';
import {
CreateEvergreenRecycleDto,
UpdateEvergreenRecycleDto,
} from '@gitroom/nestjs-libraries/dtos/posts/evergreen.recycle.dto';
@ApiTags('Posts')
@Controller('/posts')
@ -36,7 +50,9 @@ export class PostsController {
constructor(
private _postsService: PostsService,
private _agentGraphService: AgentGraphService,
private _shortLinkService: ShortLinkService
private _shortLinkService: ShortLinkService,
private _organizationService: OrganizationService,
private _evergreenService: EvergreenService
) {}
@Get('/:id/statistics')
@ -55,6 +71,14 @@ export class PostsController {
return this._postsService.getMissingContent(org.id, id);
}
@Get('/:id/release-url')
async getReleaseURL(
@GetOrgFromRequest() org: Organization,
@Param('id') id: string
) {
return this._postsService.getReleaseURL(org.id, id);
}
@Put('/:id/release-id')
async updateReleaseId(
@GetOrgFromRequest() org: Organization,
@ -64,19 +88,102 @@ export class PostsController {
return this._postsService.updateReleaseId(org.id, id, releaseId);
}
// Evergreen content recycling (see Organization.EvergreenRecycle in the
// schema) - lists/creates/pauses/removes the recycle schedule for one
// already-published post. The actual republishing happens in the daily
// evergreenRecycleWorkflow batch, not from this controller.
@Get('/:id/evergreen')
async getEvergreenRecycles(
@GetOrgFromRequest() org: Organization,
@Param('id') id: string
) {
return this._evergreenService.listForPost(org.id, id);
}
@Post('/:id/evergreen')
async createEvergreenRecycle(
@GetOrgFromRequest() org: Organization,
@Param('id') id: string,
@Body() body: CreateEvergreenRecycleDto
) {
return this._evergreenService.createRecycle(org.id, id, body);
}
@Put('/evergreen/:recycleId')
async updateEvergreenRecycle(
@GetOrgFromRequest() org: Organization,
@Param('recycleId') recycleId: string,
@Body() body: UpdateEvergreenRecycleDto
) {
return this._evergreenService.setActive(org.id, recycleId, body.active);
}
@Delete('/evergreen/:recycleId')
async deleteEvergreenRecycle(
@GetOrgFromRequest() org: Organization,
@Param('recycleId') recycleId: string
) {
return this._evergreenService.remove(org.id, recycleId);
}
@Post('/should-shortlink')
async shouldShortlink(@Body() body: { messages: string[] }) {
return { ask: this._shortLinkService.askShortLinkedin(body.messages) };
}
// Authenticated counterpart to PublicController#getComments - same data,
// plus mention/assignment identities that are only safe to reveal once we
// know the caller is logged in as a member of the org that owns the post
// (see PostsService.getComments's includeInternal gate).
@Get('/:id/comments')
async getComments(
@GetOrgFromRequest() org: Organization,
@Param('id') id: string
) {
return { comments: await this._postsService.getComments(id, org.id) };
}
@Post('/:id/comments')
async createComment(
@GetOrgFromRequest() org: Organization,
@GetUserFromRequest() user: User,
@Param('id') id: string,
@Body() body: { comment: string }
@Body() body: CreatePublicCommentDto,
@RealIP() ip: string
) {
return this._postsService.createComment(org.id, user.id, id, body.comment);
return this._postsService.createPublicComment(id, body, user.id, ip);
}
@Put('/comments/:commentId/resolve')
async resolveComment(
@GetOrgFromRequest() org: Organization,
@Param('commentId') commentId: string,
@Body() body: ResolveCommentDto
) {
return this._postsService.resolveComment(org.id, commentId, body.resolved);
}
@Put('/comments/:commentId/assign')
async assignComment(
@GetOrgFromRequest() org: Organization,
@GetUserFromRequest() user: User,
@Param('commentId') commentId: string,
@Body() body: AssignCommentDto
) {
return this._postsService.assignComment(
org.id,
commentId,
body.assignedToId,
user.id
);
}
// Backs the comment @mention/assignment picker - every active member of
// the current organization, not gated behind the admin-only
// SettingsController team endpoint since any member composing a comment
// needs to see who they can mention/assign.
@Get('/comments/team-members')
async getCommentTeamMembers(@GetOrgFromRequest() org: Organization) {
return this._organizationService.getTeamMembersForMentions(org.id);
}
@Get('/tags')
@ -159,10 +266,21 @@ export class PostsController {
}
@Get('/group/:group')
getPostsByGroup(@GetOrgFromRequest() org: Organization, @Param('group') group: string) {
getPostsByGroup(
@GetOrgFromRequest() org: Organization,
@Param('group') group: string
) {
return this._postsService.getPostsByGroup(org.id, group);
}
// Declared before the generic '/:id' GET below so Nest doesn't try to
// resolve this literal path as an :id param.
@Get('/pending-approval')
@CheckPolicies([AuthorizationActions.Create, Sections.ADMIN])
async getPendingApprovalPosts(@GetOrgFromRequest() org: Organization) {
return this._postsService.getPendingApprovalPosts(org.id);
}
@Get('/:id')
getPost(@GetOrgFromRequest() org: Organization, @Param('id') id: string) {
return this._postsService.getPost(org.id, id);
@ -180,6 +298,7 @@ export class PostsController {
@CheckPolicies([AuthorizationActions.Create, Sections.POSTS_PER_MONTH])
async createPost(
@GetOrgFromRequest() org: Organization,
@GetUserFromRequest() user: User,
@Body() rawBody: any
) {
// Server-side validation — never trust the client to have validated.
@ -220,7 +339,34 @@ export class PostsController {
}
const body = await this._postsService.mapTypeToPost(rawBody, org.id);
return this._postsService.createPost(org.id, body, 'WEB');
// The auth middleware populates org.users with the caller's own
// membership row (see organization.service.ts for the same pattern) -
// this is the only place that reads it as a role, so the Organization
// type doesn't declare it.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const callerRole = org.users?.[0]?.role;
return this._postsService.createPost(org.id, body, 'WEB', false, {
userId: user.id,
role: callerRole,
});
}
@Get('/bulk-schedule/supported-providers')
bulkScheduleSupportedProviders() {
// Single source of truth for which providers bulk CSV import can
// target — same generic, data-driven list the backend enforces in
// bulkSchedule(), so the frontend channel picker never drifts from it.
return { providers: simpleTextProviders() };
}
@Post('/bulk-schedule')
@CheckPolicies([AuthorizationActions.Create, Sections.POSTS_PER_MONTH])
async bulkSchedule(
@GetOrgFromRequest() org: Organization,
@Body() body: BulkScheduleDto
) {
return this._postsService.bulkSchedule(org.id, body);
}
@Post('/generator/draft')
@ -281,6 +427,26 @@ export class PostsController {
return this._postsService.changeDate(org.id, id, date, action, republish);
}
// ADMIN/SUPERADMIN-only - approve/reject a USER-level member's post held
// back by Organization.requireApprovalForQueue (see PostsService#createPost).
@Put('/:id/approve-queue')
@CheckPolicies([AuthorizationActions.Create, Sections.ADMIN])
async approvePendingQueuePost(
@GetOrgFromRequest() org: Organization,
@Param('id') id: string
) {
return this._postsService.approvePendingQueuePost(org.id, id);
}
@Put('/:id/reject-queue')
@CheckPolicies([AuthorizationActions.Create, Sections.ADMIN])
async rejectPendingQueuePost(
@GetOrgFromRequest() org: Organization,
@Param('id') id: string
) {
return this._postsService.rejectPendingQueuePost(org.id, id);
}
@Post('/separate-posts')
async separatePosts(
@GetOrgFromRequest() org: Organization,

View File

@ -27,6 +27,10 @@ import { promisify } from 'util';
import { OnlyURL } from '@gitroom/nestjs-libraries/dtos/webhooks/webhooks.dto';
import { isSafePublicHttpsUrl } from '@gitroom/nestjs-libraries/dtos/webhooks/webhook.url.validator';
import { ssrfSafeDispatcher } from '@gitroom/nestjs-libraries/dtos/webhooks/ssrf.safe.dispatcher';
import {
ApprovePostDto,
CreatePublicCommentDto,
} from '@gitroom/nestjs-libraries/dtos/comments/add.comment.dto';
const pump = promisify(pipeline);
@ -53,8 +57,10 @@ export class PublicController {
@Get(`/posts/:id`)
async getPreview(@Param('id') id: string) {
// the batch only links the posts in the dashboard, it stays out of the
// public preview
return (await this._postsService.getPostsRecursively(id, true)).map(
({ childrenPost, ...p }) => ({
({ childrenPost, batchId, ...p }) => ({
...p,
...(p.integration
? {
@ -76,6 +82,24 @@ export class PublicController {
return { comments: await this._postsService.getComments(postId) };
}
@Post(`/posts/:id/comments`)
async createComment(
@Param('id') postId: string,
@Body() body: CreatePublicCommentDto,
@RealIP() ip: string
) {
return this._postsService.createPublicComment(postId, body, null, ip);
}
@Post(`/posts/:id/approve`)
async approvePost(
@Param('id') postId: string,
@Body() body: ApprovePostDto,
@RealIP() ip: string
) {
return this._postsService.approvePublicPost(postId, body, null, ip);
}
@Post('/t')
async trackEvent(
@Res() res: Response,
@ -136,7 +160,16 @@ export class PublicController {
billing: 'FREE' | 'STANDARD' | 'TEAM' | 'PRO' | 'ULTIMATE';
};
if (!load || !load.orgId || !load.billing || !pricing[load.billing]) {
if (
!load ||
!load.orgId ||
typeof load.orgId !== 'string' ||
!load.billing ||
!pricing[load.billing] ||
'timeLimit' in load || // team invite token
'providerName' in load || // login token (full User row)
'expires' in load // password reset token
) {
return { success: false };
}
@ -154,7 +187,6 @@ export class PublicController {
}
}
@Get('/stream')
async streamFile(
@Query() query: OnlyURL,

View File

@ -15,6 +15,7 @@ import { OrganizationService } from '@gitroom/nestjs-libraries/database/prisma/o
import { AddTeamMemberDto } from '@gitroom/nestjs-libraries/dtos/settings/add.team.member.dto';
import { AdminAddTeamMemberDto } from '@gitroom/nestjs-libraries/dtos/settings/admin.add.team.member.dto';
import { ShortlinkPreferenceDto } from '@gitroom/nestjs-libraries/dtos/settings/shortlink-preference.dto';
import { ApprovalForQueueDto } from '@gitroom/nestjs-libraries/dtos/settings/approval-for-queue.dto';
import { ApiTags } from '@nestjs/swagger';
import { AuthorizationActions, Sections } from '@gitroom/backend/services/auth/permissions/permission.exception.class';
@ -72,6 +73,18 @@ export class SettingsController {
return this._organizationService.deleteTeamMember(org, id);
}
// Self-service: a member leaving an organization they're currently
// switched into, as opposed to an admin removing someone else via
// deleteTeamMember() above. Not gated behind the TEAM_MEMBERS/ADMIN
// policy since any member - not just admins - can leave an org.
@Post('/team/leave')
leaveOrganization(
@GetUserFromRequest() user: User,
@GetOrgFromRequest() org: Organization
) {
return this._organizationService.leaveOrganization(user, org);
}
@Get('/shortlink')
async getShortlinkPreference(@GetOrgFromRequest() org: Organization) {
return this._organizationService.getShortlinkPreference(org.id);
@ -88,4 +101,21 @@ export class SettingsController {
body.shortlink
);
}
@Get('/approval-queue')
async getApprovalQueueSetting(@GetOrgFromRequest() org: Organization) {
return this._organizationService.getApprovalForQueueSetting(org.id);
}
@Post('/approval-queue')
@CheckPolicies([AuthorizationActions.Create, Sections.ADMIN])
async updateApprovalQueueSetting(
@GetOrgFromRequest() org: Organization,
@Body() body: ApprovalForQueueDto
) {
return this._organizationService.updateApprovalForQueueSetting(
org.id,
body.requireApprovalForQueue
);
}
}

View File

@ -116,7 +116,25 @@ export class ThirdPartyController {
throw new HttpException('Invalid identifier', 400);
}
return thirdPartyInstance?.instance?.[functionName](
// functionName comes straight from the URL - only call methods the
// provider explicitly opted in with @ExposeThirdPartyFunction, the same
// allowlist VideoManager enforces for its own name-dispatched functions.
// Without this, any authenticated org member could invoke ANY method
// found on the provider instance (checkConnection, sendData, or a future
// internal helper) just by naming it in the URL.
const functionToCall = thirdPartyInstance.instance?.[functionName];
if (
typeof functionToCall !== 'function' ||
this._thirdPartyManager.checkAvailableThirdPartyFunction(functionToCall)
) {
throw new HttpException(
`Function ${functionName} not found on third-party instance`,
400
);
}
return functionToCall.call(
thirdPartyInstance.instance,
AuthService.fixedDecryption(thirdParty.apiKey),
data
);

View File

@ -79,23 +79,6 @@ export class UsersController {
return { token };
}
@Get('/agent-media-sso')
async getAgentMediaSsoUrl(
@GetUserFromRequest() user: User,
@GetOrgFromRequest() organization: Organization
) {
if (!process.env.AGENT_MEDIA_SSO_KEY) {
throw new HttpException('Agent Media SSO is not configured', 400);
}
const token = sign(
{ id: organization.id, displayName: organization.name },
process.env.AGENT_MEDIA_SSO_KEY
);
return { url: `https://agent-media.ai/sso/${token}` };
}
@Get('/self')
async getSelf(
@GetUserFromRequest() user: User,
@ -298,9 +281,14 @@ export class UsersController {
@Get('/organizations')
async getOrgs(@GetUserFromRequest() user: User) {
return (await this._orgService.getOrgsByUserId(user.id)).filter(
(f) => !f.users[0].disabled
);
return (await this._orgService.getOrgsByUserId(user.id))
.filter((f) => !f.users[0].disabled)
.map((p) => ({
id: p.id,
name: p.name,
users: p.users,
subscription: p.subscription,
}));
}
@Post('/change-org')
@ -327,6 +315,11 @@ export class UsersController {
response.status(200).send();
}
@Get('/delete-account-info')
getDeleteAccountInfo(@GetUserFromRequest() user: User) {
return this._userService.getDeleteAccountInfo(user.id);
}
@Post('/delete-account')
async deleteAccount(
@GetUserFromRequest() user: User,

View File

@ -14,9 +14,10 @@ import { ApiTags } from '@nestjs/swagger';
import { WebhooksService } from '@gitroom/nestjs-libraries/database/prisma/webhooks/webhooks.service';
import { CheckPolicies } from '@gitroom/backend/services/auth/permissions/permissions.ability';
import {
OnlyURL, UpdateDto, WebhooksDto
DeliveriesPageDto, OnlyURL, UpdateDto, WebhooksDto
} from '@gitroom/nestjs-libraries/dtos/webhooks/webhooks.dto';
import { AuthorizationActions, Sections } from '@gitroom/backend/services/auth/permissions/permission.exception.class';
import { getSsrfSafeDispatcher } from '@gitroom/nestjs-libraries/dtos/webhooks/ssrf.safe.dispatcher';
@ApiTags('Webhooks')
@Controller('/webhooks')
@ -25,7 +26,7 @@ export class WebhookController {
@Get('/')
async getStatistics(@GetOrgFromRequest() org: Organization) {
return this._webhooksService.getWebhooks(org.id);
return this._webhooksService.getWebhooksForDisplay(org.id);
}
@Post('/')
@ -53,18 +54,58 @@ export class WebhookController {
return this._webhooksService.deleteWebhook(org.id, id);
}
@Post('/:id/secret')
async regenerateSecret(
@GetOrgFromRequest() org: Organization,
@Param('id') id: string
) {
return this._webhooksService.regenerateSecret(org.id, id);
}
@Get('/:id/deliveries')
async getDeliveries(
@GetOrgFromRequest() org: Organization,
@Param('id') id: string,
@Query() query: DeliveriesPageDto
) {
return this._webhooksService.getDeliveries(
org.id,
id,
Number(query.page) || 1
);
}
@Post('/deliveries/:deliveryId/redeliver')
async redeliver(
@GetOrgFromRequest() org: Organization,
@Param('deliveryId') deliveryId: string
) {
const result = await this._webhooksService.redeliver(org.id, deliveryId);
if (!result) {
return { success: false, error: 'Delivery not found' };
}
return result;
}
@Post('/send')
async sendWebhook(@Body() body: any, @Query() query: OnlyURL) {
try {
await fetch(query.url, {
const response = await fetch(query.url, {
method: 'POST',
body: JSON.stringify(body),
headers: { 'Content-Type': 'application/json' },
// @ts-ignore — undici dispatcher option, not in lib.dom fetch types
dispatcher: getSsrfSafeDispatcher(),
});
return {
send: response.status >= 200 && response.status < 300,
statusCode: response.status,
};
} catch (err) {
/** sent **/
return {
send: false,
error: err instanceof Error ? err.message : 'Unknown delivery error',
};
}
return { send: true };
}
}

View File

@ -46,11 +46,27 @@ async function start() {
process.env.FRONTEND_URL,
'http://localhost:6274',
...(process.env.MAIN_URL ? [process.env.MAIN_URL] : []),
// Optional: the Canva app calls the public API from its iframe origin
// (browsers send it lowercase, e.g. https://app-aabbcc.canva-apps.com)
...(process.env.CANVA_APP_ORIGIN
? [
process.env.CANVA_APP_ORIGIN.trim()
.replace(/\/+$/, '')
.toLowerCase(),
]
: []),
],
},
});
await startMcp(app);
// startMcp wires Mastra, which connects to Postgres (pStore) on first use -
// a DB outage/misconfiguration there must not take down the entire backend
// (every other route, not just /mcp and /copilot) by rejecting start().
try {
await startMcp(app);
} catch (e) {
Logger.error('Failed to initialize MCP/Mastra, continuing without it', e);
}
app.useGlobalPipes(
new ValidationPipe({

View File

@ -14,9 +14,11 @@ import {
UseInterceptors,
} from '@nestjs/common';
import { streamUploadOptions } from '@gitroom/nestjs-libraries/upload/multer.stream.engine';
import { omit } from 'lodash';
import { ApiTags } from '@nestjs/swagger';
import { GetOrgFromRequest } from '@gitroom/nestjs-libraries/user/org.from.request';
import { GetIncludeDeletedFromRequest } from '@gitroom/nestjs-libraries/user/include.deleted.from.request';
import { GetOAuthUserIdFromRequest } from '@gitroom/nestjs-libraries/user/oauth.user.id.from.request';
import { Organization } from '@prisma/client';
import { IntegrationService } from '@gitroom/nestjs-libraries/database/prisma/integrations/integration.service';
import { CheckPolicies } from '@gitroom/backend/services/auth/permissions/permissions.ability';
@ -24,6 +26,12 @@ import { PostsService } from '@gitroom/nestjs-libraries/database/prisma/posts/po
import { FileInterceptor } from '@nestjs/platform-express';
import { MediaService } from '@gitroom/nestjs-libraries/database/prisma/media/media.service';
import { GetPostsDto } from '@gitroom/nestjs-libraries/dtos/posts/get.posts.dto';
import {
BulkCreatePostsDto,
BulkCreateResult,
BulkDeleteResult,
BulkPostIdsDto,
} from '@gitroom/nestjs-libraries/dtos/posts/bulk.posts.dto';
import { ChangePostStatusDto } from '@gitroom/nestjs-libraries/dtos/posts/change.post.status.dto';
import { UpdatePostSettingsDto } from '@gitroom/nestjs-libraries/dtos/posts/update.post.settings.dto';
import {
@ -33,6 +41,9 @@ import {
import { VideoDto } from '@gitroom/nestjs-libraries/dtos/videos/video.dto';
import { VideoFunctionDto } from '@gitroom/nestjs-libraries/dtos/videos/video.function.dto';
import { UploadDto } from '@gitroom/nestjs-libraries/dtos/media/upload.dto';
import { GetMediaDto } from '@gitroom/nestjs-libraries/dtos/media/get.media.dto';
import { ClippingDto } from '@gitroom/nestjs-libraries/dtos/clipping/clipping.dto';
import { ClippingService } from '@gitroom/nestjs-libraries/database/prisma/clipping/clipping.service';
import { NotificationService } from '@gitroom/nestjs-libraries/database/prisma/notifications/notification.service';
import { GetNotificationsDto } from '@gitroom/nestjs-libraries/dtos/notifications/get.notifications.dto';
import * as Sentry from '@sentry/nestjs';
@ -51,6 +62,8 @@ import { ioRedis } from '@gitroom/nestjs-libraries/redis/redis.service';
import { AdminStatsService } from '@gitroom/nestjs-libraries/database/prisma/admin-stats/admin-stats.service';
import { OrganizationService } from '@gitroom/nestjs-libraries/database/prisma/organizations/organization.service';
import { GetOrgActivityDto } from '@gitroom/nestjs-libraries/dtos/analytics/get.org.activity.dto';
import { ResetCreditsDto } from '@gitroom/nestjs-libraries/dtos/billing/reset.credits.dto';
import { SubscriptionService } from '@gitroom/nestjs-libraries/database/prisma/subscriptions/subscription.service';
import dayjs from 'dayjs';
@ApiTags('Public API')
@ -65,7 +78,9 @@ export class PublicIntegrationsController {
private _refreshIntegrationService: RefreshIntegrationService,
private _usersService: UsersService,
private _adminStatsService: AdminStatsService,
private _organizationService: OrganizationService
private _organizationService: OrganizationService,
private _clippingService: ClippingService,
private _subscriptionService: SubscriptionService
) {}
@Post('/upload')
@ -128,8 +143,24 @@ export class PublicIntegrationsController {
@Body() rawBody: any
) {
Sentry.metrics.count('public_api-request', 1);
return this.createOnePost(org, rawBody);
}
// Shared by the single POST /posts above and the bulk endpoint below, so
// both go through the exact same validation/creation pipeline and never
// drift. Throws PostValidationException / HttpException on a bad single
// item - callers decide whether that aborts the whole request (single) or
// is caught per-item (bulk).
private async createOnePost(org: Organization, rawBody: any) {
const body = await this._postsService.mapTypeToPost(
rawBody,
{
...rawBody,
// a date per channel is a dashboard feature, the public API keeps one
// date for the whole request
posts: Array.isArray(rawBody?.posts)
? rawBody.posts.map((post: any) => omit(post, 'date'))
: rawBody?.posts,
},
org.id,
rawBody?.type === 'draft' || true
);
@ -201,6 +232,86 @@ export class PublicIntegrationsController {
return this._postsService.createPost(org.id, body, creationMethod);
}
// Creates up to MAX_BULK_CREATE posts in one call. Each entry is the exact
// same body shape as POST /posts; a bad entry never aborts the batch -
// same "schedule what's valid, report the rest" spirit as the dashboard's
// CSV bulk-schedule (see PostsService.bulkSchedule).
@Post('/posts/bulk')
@CheckPolicies([AuthorizationActions.Create, Sections.POSTS_PER_MONTH])
async createPostsBulk(
@GetOrgFromRequest() org: Organization,
@Body() body: BulkCreatePostsDto
) {
Sentry.metrics.count('public_api-request', 1);
const results: BulkCreateResult[] = [];
for (let index = 0; index < body.posts.length; index++) {
try {
const created = await this.createOnePost(org, body.posts[index]);
results.push({
index,
success: !!created?.length,
postId: created?.[0]?.postId,
...(created?.length
? {}
: { error: 'Could not create this post' }),
});
} catch (err) {
results.push({
index,
success: false,
error:
err instanceof HttpException
? JSON.stringify(err.getResponse())
: err instanceof Error
? err.message
: 'Could not create this post',
});
}
}
return { results };
}
// Deletes up to MAX_BULK_IDS posts (by id, same resolution as
// DELETE /posts/:id - each id's whole group is removed) in one call. A
// missing/foreign id never aborts the batch.
@Delete('/posts/bulk')
async deletePostsBulk(
@GetOrgFromRequest() org: Organization,
@Body() body: BulkPostIdsDto
) {
Sentry.metrics.count('public_api-request', 1);
const results: BulkDeleteResult[] = [];
for (const id of body.ids) {
try {
const getPostById = await this._postsService.getPost(org.id, id);
if (!getPostById) {
results.push({ id, success: false, error: 'Post not found' });
continue;
}
const deleted = await this._postsService.deletePost(
org.id,
getPostById.group
);
results.push({
id,
success: !deleted?.error,
...(deleted?.error ? { error: 'Could not delete this post' } : {}),
});
} catch (err) {
results.push({
id,
success: false,
error: err instanceof Error ? err.message : 'Could not delete this post',
});
}
}
return { results };
}
@Delete('/posts/:id')
async deletePost(
@GetOrgFromRequest() org: Organization,
@ -226,6 +337,48 @@ export class PublicIntegrationsController {
return { connected: true };
}
@Get('/media')
async getMedia(
@GetOrgFromRequest() org: Organization,
@Query() query: GetMediaDto
) {
Sentry.metrics.count('public_api-request', 1);
const { pages, results } = await this._mediaService.getMedia(
org.id,
query.page,
query.search
);
return {
pages,
results: results.map((p) => ({
id: p.id,
name: p.name,
originalName: p.originalName,
path: p.path,
createdAt: p.createdAt,
})),
};
}
// `user` is only known for OAuth app tokens; an API key belongs to the
// whole organization
@Get('/me')
async getMe(
@GetOrgFromRequest() org: Organization,
@GetOAuthUserIdFromRequest() userId?: string
) {
Sentry.metrics.count('public_api-request', 1);
const user = userId ? await this._usersService.getPersonal(userId) : null;
return {
organization: { id: org.id, name: org.name },
user: user
? { id: user.id, name: user.name, picture: user.picture?.path || null }
: null,
};
}
@Get('/groups')
async listGroups(@GetOrgFromRequest() org: Organization) {
Sentry.metrics.count('public_api-request', 1);
@ -247,7 +400,7 @@ export class PublicIntegrationsController {
.filter((integration) => !group || integration.customer?.id === group)
.map((integration) => ({
id: integration.id,
name: integration.name,
name: integration.customName || integration.name,
identifier: integration.providerIdentifier,
picture: integration.picture,
disabled: integration.disabled,
@ -389,6 +542,25 @@ export class PublicIntegrationsController {
});
}
@Post('/credits/reset')
@UseGuards(SuperAdminGuard)
async resetCredits(
@GetOrgFromRequest() org: Organization,
@Body() body: ResetCreditsDto
) {
Sentry.metrics.count('public_api-request', 1);
const reset = await this._subscriptionService.resetCredits(
org.id,
body.type
);
if (!reset) {
throw new HttpException({ msg: 'No subscription found' }, 404);
}
return reset;
}
@Get('/notifications')
async getNotifications(
@GetOrgFromRequest() org: Organization,
@ -420,6 +592,30 @@ export class PublicIntegrationsController {
);
}
@Post('/clipping')
startClipping(
@GetOrgFromRequest() org: Organization,
@Body() body: ClippingDto
) {
Sentry.metrics.count('public_api-request', 1);
return this._clippingService.startClipping(org, body);
}
@Get('/clipping')
getClippings(
@GetOrgFromRequest() org: Organization,
@Query('page') page: number
) {
Sentry.metrics.count('public_api-request', 1);
return this._clippingService.getClippings(org.id, page);
}
@Get('/clipping/:id')
getClipping(@GetOrgFromRequest() org: Organization, @Param('id') id: string) {
Sentry.metrics.count('public_api-request', 1);
return this._clippingService.getClipping(org.id, id);
}
@Delete('/integrations/:id')
async deleteChannel(
@GetOrgFromRequest() org: Organization,
@ -527,7 +723,13 @@ export class PublicIntegrationsController {
@Body('releaseId') releaseId: string
) {
Sentry.metrics.count('public_api-request', 1);
return this._postsService.updateReleaseId(org.id, id, releaseId);
// the batch only links the posts in the dashboard
const { batchId, ...post } = await this._postsService.updateReleaseId(
org.id,
id,
releaseId
);
return post;
}
@Get('/analytics/:integration')

View File

@ -43,7 +43,7 @@ export class AuthMiddleware implements NestMiddleware {
const payload = AuthService.verifyJWT(auth) as User | null;
const orgHeader = req.cookies.showorg || req.headers.showorg;
if (!payload?.id) {
if (!payload?.id || typeof payload.id !== 'string') {
throw new HttpForbiddenException();
}
@ -97,7 +97,9 @@ export class AuthMiddleware implements NestMiddleware {
await this._organizationService.getOrgsByUserId(user.id)
).filter((f) => !f.users[0].disabled);
const setOrg =
organization.find((org) => org.id === orgHeader) || organization[0];
organization.find((org) => org.id === orgHeader) ||
organization.find((org) => org.subscription) ||
organization[0];
if (!organization) {
throw new HttpForbiddenException();

View File

@ -0,0 +1,179 @@
// #2199: registering with a pending org invite link always created a brand
// new (junk) organization for the invited user - routeAuth() called
// createOrgAndUser() unconditionally, then only afterwards tried to also
// join the invite via addUserToOrg(). Even when the invite succeeded, the
// user ended up SUPERADMIN of a throwaway org with the invite as a bonus
// membership instead of the intended destination.
//
// This exercises the LOCAL-provider registration branch of routeAuth():
// a user registering with a valid invite in the `org` cookie should join
// the inviting organization without ever creating a new one, and should
// only fall back to a standalone org if the invite can no longer be
// redeemed (already used, or the org hit its seat limit).
process.env.JWT_SECRET = 'test-secret-for-routeauth-invite-spec';
// AuthService's constructor params pull in UsersService -> UsersRepository
// -> helpers/auth's AuthService, which needs the native bcrypt binding.
// emitDecoratorMetadata keeps that import live at runtime even though this
// spec only ever passes plain mocks for those constructor params, so stub
// it out the same way the integration.repository standalone spec stubs
// UploadFactory to dodge its own unrelated native/ESM-only dependency.
jest.mock('bcrypt', () => ({
hashSync: jest.fn(() => 'hashed'),
compareSync: jest.fn(() => true),
}));
// Same chain also drags in UploadFactory -> CloudflareStorage -> `file-type`,
// which is ESM-only and isn't transformable under this standalone Jest
// config (see integration.repository.standalone.spec.ts for precedent).
jest.mock('@gitroom/nestjs-libraries/upload/upload.factory', () => ({
UploadFactory: {
createStorage: () => ({ uploadSimple: jest.fn() }),
},
}));
// AuthService's `_emailService: EmailService` constructor param also keeps
// EmailService's real import alive (emitDecoratorMetadata), which pulls in
// the email provider implementations - unrelated code this spec never
// exercises (a mock EmailService is passed below) and that doesn't compile
// cleanly under this config's relaxed-but-not-identical tsconfig overrides.
jest.mock('@gitroom/nestjs-libraries/services/email.service', () => ({
EmailService: class {},
}));
import { AuthService } from './auth.service';
import { CreateOrgUserDto } from '@gitroom/nestjs-libraries/dtos/auth/create.org.user.dto';
import { Provider } from '@prisma/client';
describe('AuthService.routeAuth - registration with a pending org invite', () => {
function makeBody(): CreateOrgUserDto {
const body = new CreateOrgUserDto();
body.email = 'invited@example.com';
body.password = 'super-secret-password';
body.provider = Provider.LOCAL;
body.company = 'Whatever Inc';
body.datafast_visitor_id = '';
return body;
}
function makeService(overrides: {
addUserToOrgResult: any;
}) {
const createdUser = {
id: 'new-user-id',
email: 'invited@example.com',
password: 'hashed',
};
const organizationService = {
getCount: jest.fn().mockResolvedValue(1),
createOrgAndUser: jest.fn(),
createUser: jest.fn().mockResolvedValue(createdUser),
createOrgForExistingUser: jest.fn().mockResolvedValue({ id: 'fallback-org-id' }),
addUserToOrg: jest.fn().mockResolvedValue(overrides.addUserToOrgResult),
};
const userService = {
getUserByEmail: jest.fn().mockResolvedValue(null),
};
const emailService = {
sendEmailSync: jest.fn().mockResolvedValue(undefined),
hasProvider: jest.fn().mockReturnValue(false),
};
const service = new AuthService(
userService as any,
organizationService as any,
emailService as any,
{} as any
);
return { service, organizationService, userService, createdUser };
}
it('joins the inviting org and never creates a new organization when the invite is redeemable', async () => {
const { service, organizationService, createdUser } = makeService({
addUserToOrgResult: { id: 'membership-id', organizationId: 'inviting-org-id' },
});
const result = await service.routeAuth(
Provider.LOCAL,
makeBody(),
'127.0.0.1',
'test-agent',
{ orgId: 'inviting-org-id', role: 'USER', id: 'invite-id' }
);
expect(organizationService.createOrgAndUser).not.toHaveBeenCalled();
expect(organizationService.createUser).toHaveBeenCalledTimes(1);
expect(organizationService.addUserToOrg).toHaveBeenCalledWith(
createdUser.id,
'invite-id',
'inviting-org-id',
'USER'
);
expect(organizationService.createOrgForExistingUser).not.toHaveBeenCalled();
expect(result.addedOrg).toEqual({
id: 'membership-id',
organizationId: 'inviting-org-id',
});
});
it('falls back to a standalone org only when the invite can no longer be redeemed', async () => {
const { service, organizationService, createdUser } = makeService({
addUserToOrgResult: false,
});
await service.routeAuth(
Provider.LOCAL,
makeBody(),
'127.0.0.1',
'test-agent',
{ orgId: 'inviting-org-id', role: 'USER', id: 'invite-id' }
);
expect(organizationService.createOrgAndUser).not.toHaveBeenCalled();
expect(organizationService.createUser).toHaveBeenCalledTimes(1);
expect(organizationService.createOrgForExistingUser).toHaveBeenCalledWith(
createdUser.id,
'Whatever Inc'
);
});
it('still creates a normal organization when there is no invite', async () => {
const organizationService = {
getCount: jest.fn().mockResolvedValue(1),
createOrgAndUser: jest.fn().mockResolvedValue({
id: 'org-id',
users: [{ user: { id: 'owner-id', email: 'owner@example.com' } }],
}),
createUser: jest.fn(),
createOrgForExistingUser: jest.fn(),
addUserToOrg: jest.fn(),
};
const userService = { getUserByEmail: jest.fn().mockResolvedValue(null) };
const emailService = {
sendEmailSync: jest.fn().mockResolvedValue(undefined),
hasProvider: jest.fn().mockReturnValue(false),
};
const service = new AuthService(
userService as any,
organizationService as any,
emailService as any,
{} as any
);
const result = await service.routeAuth(
Provider.LOCAL,
makeBody(),
'127.0.0.1',
'test-agent',
undefined
);
expect(organizationService.createOrgAndUser).toHaveBeenCalledTimes(1);
expect(organizationService.createUser).not.toHaveBeenCalled();
expect(result.addedOrg).toBe(false);
});
});

View File

@ -7,7 +7,6 @@ import { OrganizationService } from '@gitroom/nestjs-libraries/database/prisma/o
import { AuthService as AuthChecker } from '@gitroom/helpers/auth/auth.service';
import { AuthProviderManager } from '@gitroom/backend/services/auth/providers/providers.manager';
import dayjs from 'dayjs';
import { NotificationService } from '@gitroom/nestjs-libraries/database/prisma/notifications/notification.service';
import { ForgotReturnPasswordDto } from '@gitroom/nestjs-libraries/dtos/auth/forgot-return.password.dto';
import { EmailService } from '@gitroom/nestjs-libraries/services/email.service';
import { NewsletterService } from '@gitroom/nestjs-libraries/newsletter/newsletter.service';
@ -17,7 +16,6 @@ export class AuthService {
constructor(
private _userService: UsersService,
private _organizationService: OrganizationService,
private _notificationService: NotificationService,
private _emailService: EmailService,
private _providerManager: AuthProviderManager
) {}
@ -56,28 +54,54 @@ export class AuthService {
throw new Error('Registration is disabled');
}
const create = await this._organizationService.createOrgAndUser(
body,
ip,
userAgent
);
const invite =
addToOrg && typeof addToOrg !== 'boolean' ? addToOrg : undefined;
const addedOrg =
addToOrg && typeof addToOrg !== 'boolean'
? await this._organizationService.addUserToOrg(
create.users[0].user.id,
addToOrg.id,
addToOrg.orgId,
addToOrg.role
)
: false;
let registeredUser: User;
let addedOrg: boolean | Awaited<
ReturnType<OrganizationService['addUserToOrg']>
> = false;
const obj = { addedOrg, jwt: await this.jwt(create.users[0].user) };
await this._emailService.sendEmail(
if (invite) {
// A pending invite joins the inviting organization directly,
// instead of always spinning up a new one for the registering
// user and only afterwards trying to also join the invite (#2199).
registeredUser = await this._organizationService.createUser(
body,
ip,
userAgent
);
addedOrg = await this._organizationService.addUserToOrg(
registeredUser.id,
invite.id,
invite.orgId,
invite.role
);
// The invite could be unusable by the time registration posts
// (already redeemed, or the org hit its seat limit) - fall back
// to a standalone org so the new account isn't left with none.
if (!addedOrg) {
await this._organizationService.createOrgForExistingUser(
registeredUser.id,
body.company
);
}
} else {
const create = await this._organizationService.createOrgAndUser(
body,
ip,
userAgent
);
registeredUser = create.users[0].user;
}
const obj = { addedOrg, jwt: await this.jwt(registeredUser) };
await this._emailService.sendEmailSync(
body.email,
'Activate your account',
`Click <a href="${process.env.FRONTEND_URL}/auth/activate/${obj.jwt}">here</a> to activate your account`,
'top'
`Click <a href="${process.env.FRONTEND_URL}/auth/activate/${obj.jwt}">here</a> to activate your account`
);
return obj;
}
@ -119,7 +143,13 @@ export class AuthService {
try {
const getOrg: any = AuthChecker.verifyJWT(cookie);
if (dayjs(getOrg.timeLimit).isBefore(dayjs())) {
if (
typeof getOrg.orgId !== 'string' ||
typeof getOrg.id !== 'string' ||
!['USER', 'ADMIN'].includes(getOrg.role) ||
!getOrg.timeLimit ||
dayjs(getOrg.timeLimit).isBefore(dayjs())
) {
return false;
}
@ -225,10 +255,10 @@ export class AuthService {
expires: dayjs().add(20, 'minutes').format('YYYY-MM-DD HH:mm:ss'),
});
await this._notificationService.sendEmail(
await this._emailService.sendEmailSync(
user.email,
'Reset your password',
`You have requested to reset your passsord. <br />Click <a href="${process.env.FRONTEND_URL}/auth/forgot/${resetValues}">here</a> to reset your password<br />The link will expire in 20 minutes`
`You have requested to reset your password. <br />Click <a href="${process.env.FRONTEND_URL}/auth/forgot/${resetValues}">here</a> to reset your password<br />The link will expire in 20 minutes`
);
}
@ -237,7 +267,7 @@ export class AuthService {
id: string;
expires: string;
};
if (dayjs(user.expires).isBefore(dayjs())) {
if (typeof user.id !== 'string' || dayjs(user.expires).isBefore(dayjs())) {
return false;
}
@ -278,11 +308,10 @@ export class AuthService {
const jwt = await this.jwt(user);
await this._emailService.sendEmail(
await this._emailService.sendEmailSync(
user.email,
'Activate your account',
`Click <a href="${process.env.FRONTEND_URL}/auth/activate/${jwt}">here</a> to activate your account`,
'top'
`Click <a href="${process.env.FRONTEND_URL}/auth/activate/${jwt}">here</a> to activate your account`
);
return true;

View File

@ -70,7 +70,7 @@ export class PermissionsService {
// but only if the channel actually belongs to this org
if (refreshChannelId) {
const existingIntegration =
await this._integrationService.getIntegrationById(
await this._integrationService.getIntegrationByInternalId(
orgId,
refreshChannelId
);

View File

@ -1,4 +1,5 @@
import { google } from 'googleapis';
import { HttpException } from '@nestjs/common';
import {
AuthProvider,
AuthProviderAbstract,
@ -32,8 +33,19 @@ export class GoogleProvider extends AuthProviderAbstract {
async getToken(code: string, redirectUri?: string) {
const client = makeClient(redirectUri || defaultRedirect());
const { tokens } = await client.getToken(code);
return tokens.access_token!;
try {
const { tokens } = await client.getToken(code);
return tokens.access_token!;
} catch (err: any) {
// The code is single use and short lived (callback reloaded or too slow)
if (err?.response?.data?.error === 'invalid_grant') {
throw new HttpException(
'Google sign-in expired, please sign in again',
400
);
}
throw err;
}
}
async getUser(providerToken: string) {

View File

@ -44,6 +44,9 @@ export class PublicAuthMiddleware implements NestMiddleware {
}
org = authorization.organization;
// The user who approved the OAuth app, so /me can show who is connected
// @ts-ignore
req.oauthUserId = authorization.userId;
} else {
org = await this._organizationService.getOrgByApiKey(auth);
if (!org) {

9
apps/frontend/AGENTS.md Normal file
View File

@ -0,0 +1,9 @@
<!-- BEGIN:nextjs-agent-rules -->
# This is NOT the Next.js you know
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.
This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.
<!-- END:nextjs-agent-rules -->

1
apps/frontend/CLAUDE.md Normal file
View File

@ -0,0 +1 @@
@AGENTS.md

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,22 @@
import { Metadata } from 'next';
import { isGeneralServerSide } from '@gitroom/helpers/utils/is.general.server.side';
import { CompareLandingPage } from '@gitroom/frontend/components/compare/compare.page.component';
import {
compareCompetitors,
compareMetaDescription,
} from '@gitroom/frontend/components/compare/compare.data';
const brandName = isGeneralServerSide() ? 'Postiz' : 'Gitroom';
const data = compareCompetitors.buffer;
export const metadata: Metadata = {
title: `${data.headline} | ${brandName}`,
description: compareMetaDescription(data, brandName),
alternates: {
canonical: '/compare/buffer',
},
};
export default function CompareBufferPage() {
return <CompareLandingPage data={data} brandName={brandName} />;
}

View File

@ -0,0 +1,22 @@
import { Metadata } from 'next';
import { isGeneralServerSide } from '@gitroom/helpers/utils/is.general.server.side';
import { CompareLandingPage } from '@gitroom/frontend/components/compare/compare.page.component';
import {
compareCompetitors,
compareMetaDescription,
} from '@gitroom/frontend/components/compare/compare.data';
const brandName = isGeneralServerSide() ? 'Postiz' : 'Gitroom';
const data = compareCompetitors.hootsuite;
export const metadata: Metadata = {
title: `${data.headline} | ${brandName}`,
description: compareMetaDescription(data, brandName),
alternates: {
canonical: '/compare/hootsuite',
},
};
export default function CompareHootsuitePage() {
return <CompareLandingPage data={data} brandName={brandName} />;
}

View File

@ -0,0 +1,22 @@
import { Metadata } from 'next';
import { isGeneralServerSide } from '@gitroom/helpers/utils/is.general.server.side';
import { CompareLandingPage } from '@gitroom/frontend/components/compare/compare.page.component';
import {
compareCompetitors,
compareMetaDescription,
} from '@gitroom/frontend/components/compare/compare.data';
const brandName = isGeneralServerSide() ? 'Postiz' : 'Gitroom';
const data = compareCompetitors.later;
export const metadata: Metadata = {
title: `${data.headline} | ${brandName}`,
description: compareMetaDescription(data, brandName),
alternates: {
canonical: '/compare/later',
},
};
export default function CompareLaterPage() {
return <CompareLandingPage data={data} brandName={brandName} />;
}

View File

@ -0,0 +1,22 @@
import { Metadata } from 'next';
import { isGeneralServerSide } from '@gitroom/helpers/utils/is.general.server.side';
import { CompareLandingPage } from '@gitroom/frontend/components/compare/compare.page.component';
import {
compareCompetitors,
compareMetaDescription,
} from '@gitroom/frontend/components/compare/compare.data';
const brandName = isGeneralServerSide() ? 'Postiz' : 'Gitroom';
const data = compareCompetitors.metricool;
export const metadata: Metadata = {
title: `${data.headline} | ${brandName}`,
description: compareMetaDescription(data, brandName),
alternates: {
canonical: '/compare/metricool',
},
};
export default function CompareMetricoolPage() {
return <CompareLandingPage data={data} brandName={brandName} />;
}

View File

@ -0,0 +1,22 @@
import { Metadata } from 'next';
import { isGeneralServerSide } from '@gitroom/helpers/utils/is.general.server.side';
import { CompareLandingPage } from '@gitroom/frontend/components/compare/compare.page.component';
import {
compareCompetitors,
compareMetaDescription,
} from '@gitroom/frontend/components/compare/compare.data';
const brandName = isGeneralServerSide() ? 'Postiz' : 'Gitroom';
const data = compareCompetitors.mixpost;
export const metadata: Metadata = {
title: `${data.headline} | ${brandName}`,
description: compareMetaDescription(data, brandName),
alternates: {
canonical: '/compare/mixpost',
},
};
export default function CompareMixpostPage() {
return <CompareLandingPage data={data} brandName={brandName} />;
}

View File

@ -0,0 +1,22 @@
import { Metadata } from 'next';
import { isGeneralServerSide } from '@gitroom/helpers/utils/is.general.server.side';
import { CompareLandingPage } from '@gitroom/frontend/components/compare/compare.page.component';
import {
compareCompetitors,
compareMetaDescription,
} from '@gitroom/frontend/components/compare/compare.data';
const brandName = isGeneralServerSide() ? 'Postiz' : 'Gitroom';
const data = compareCompetitors.publer;
export const metadata: Metadata = {
title: `${data.headline} | ${brandName}`,
description: compareMetaDescription(data, brandName),
alternates: {
canonical: '/compare/publer',
},
};
export default function ComparePublerPage() {
return <CompareLandingPage data={data} brandName={brandName} />;
}

View File

@ -0,0 +1,22 @@
import { Metadata } from 'next';
import { isGeneralServerSide } from '@gitroom/helpers/utils/is.general.server.side';
import { CompareLandingPage } from '@gitroom/frontend/components/compare/compare.page.component';
import {
compareCompetitors,
compareMetaDescription,
} from '@gitroom/frontend/components/compare/compare.data';
const brandName = isGeneralServerSide() ? 'Postiz' : 'Gitroom';
const data = compareCompetitors.socialbee;
export const metadata: Metadata = {
title: `${data.headline} | ${brandName}`,
description: compareMetaDescription(data, brandName),
alternates: {
canonical: '/compare/socialbee',
},
};
export default function CompareSocialbeePage() {
return <CompareLandingPage data={data} brandName={brandName} />;
}

View File

@ -0,0 +1,8 @@
import { ReactNode } from 'react';
// Public, unauthenticated route group for the /compare/* SEO landing pages.
// Deliberately does not use (site)/layout.tsx's LayoutComponent, which assumes
// a logged-in organization context and would redirect an anonymous visitor.
export default async function CompareLayout({ children }: { children: ReactNode }) {
return <>{children}</>;
}

View File

@ -3,7 +3,7 @@ import { PreviewWrapper } from '@gitroom/frontend/components/preview/preview.wra
export default async function AppLayout({ children }: { children: ReactNode }) {
return (
<div className="bg-[#000000] min-h-screen">
<div className="bg-newBgColor min-h-screen text-newTextColor">
<PreviewWrapper>{children}</PreviewWrapper>
</div>
);

View File

@ -6,6 +6,8 @@ import { isGeneralServerSide } from '@gitroom/helpers/utils/is.general.server.si
import SafeImage from '@gitroom/react/helpers/safe.image';
import Link from 'next/link';
import { CommentsComponents } from '@gitroom/frontend/components/preview/comments.components';
import { PreviewCommentsProvider } from '@gitroom/frontend/components/preview/preview.comments.context';
import { PostContentClient } from '@gitroom/frontend/components/preview/post.content.client';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import { VideoOrImage } from '@gitroom/react/helpers/video.or.image';
@ -40,107 +42,103 @@ export default async function Auth(
const t = await getT();
if (!post.length) {
return (
<div className="text-white fixed start-0 top-0 w-full h-full flex justify-center items-center text-[20px]">
<div className="text-newTextColor fixed start-0 top-0 w-full h-full flex justify-center items-center text-[20px]">
{t('post_not_found', 'Post not found')}
</div>
);
}
return (
<div>
<div className="mx-auto w-full max-w-[1346px] py-3 text-white">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-4">
<div className="flex items-center space-x-2">
<div className="min-w-[55px]">
<Link
href="/"
className="text-2xl flex items-center justify-center gap-[10px] text-textColor order-1"
>
<div className="max-w-[55px]">
<SafeImage
src={'/postiz.svg'}
width={55}
height={55}
alt="Logo"
/>
</div>
<div>
<svg
width="80"
height="75"
viewBox="0 0 366 167"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M24.9659 30.4263V43.3825C26.9237 41.3095 29.3998 39.582 32.3941 38.2C35.3885 36.7028 39.0162 35.9543 43.2774 35.9543C47.1931 35.9543 50.8784 36.7028 54.3334 38.2C57.9036 39.6972 61.0131 42.1157 63.6619 45.4555C66.4259 48.6802 68.6141 52.9989 70.2264 58.4118C71.8387 63.8246 72.6449 70.3891 72.6449 78.1053C72.6449 83.6333 72.1266 89.1613 71.0902 94.6893C70.1688 100.217 68.4989 105.169 66.0804 109.546C63.6619 113.922 60.3796 117.492 56.2336 120.256C52.2028 122.905 47.1355 124.23 41.0316 124.23C36.6553 124.23 33.2003 123.654 30.6666 122.502C28.1329 121.235 26.2327 119.796 24.9659 118.183V160.162L0.0898438 166.381V30.4263H24.9659ZM32.7396 109.2C35.734 109.2 38.2676 108.221 40.3406 106.264C42.4136 104.191 44.026 101.542 45.1776 98.3171C46.4445 95.0924 47.3082 91.5222 47.7689 87.6066C48.3447 83.5757 48.6326 79.6025 48.6326 75.6868C48.6326 69.3526 48.0568 64.3429 46.9051 60.6575C45.8686 56.9722 44.6018 54.2658 43.1046 52.5383C41.6075 50.6956 40.1103 49.5439 38.6131 49.0833C37.2311 48.6226 36.137 48.3923 35.3309 48.3923C33.2579 48.3923 31.2425 49.1409 29.2846 50.638C27.3268 52.02 25.8872 54.1506 24.9659 57.0298V105.227C25.5417 106.148 26.463 107.07 27.7299 107.991C28.9967 108.797 30.6666 109.2 32.7396 109.2Z"
fill="currentColor"
/>
<path
d="M188.176 31.4627C191.055 42.5188 193.588 51.5593 195.777 58.5845C197.965 65.4945 199.807 71.3105 201.305 76.0323C202.917 80.7541 204.126 84.9001 204.932 88.4703C205.854 92.0405 206.314 96.0137 206.314 100.39C208.272 99.1232 210.172 97.7988 212.015 96.4168C213.858 94.9196 215.413 93.5376 216.679 92.2708H223.935C220.825 96.9926 217.543 100.908 214.088 104.018C210.633 107.012 207.293 109.661 204.069 111.964C201.996 116.456 198.829 119.623 194.567 121.466C190.306 123.308 185.872 124.23 181.266 124.23C176.083 124.23 171.649 123.539 167.964 122.157C164.279 120.659 161.227 118.702 158.808 116.283C156.505 113.749 154.777 110.87 153.626 107.646C152.474 104.421 151.898 101.023 151.898 97.4533C151.898 93.5376 152.819 90.4857 154.662 88.2975C156.62 85.9942 158.866 84.8426 161.399 84.8426C168.424 84.8426 171.937 87.6641 171.937 93.3073C171.937 95.15 171.304 96.7047 170.037 97.9716C168.77 99.2384 167.158 99.8718 165.2 99.8718C164.278 99.8718 163.3 99.7566 162.263 99.5263C161.342 99.1808 160.593 98.5474 160.017 97.6261C160.939 101.657 162.436 104.824 164.509 107.127C166.697 109.431 169.461 110.582 172.801 110.582C175.68 110.582 177.811 109.891 179.193 108.509C180.575 107.012 181.266 104.478 181.266 100.908C181.266 97.1078 180.92 93.7104 180.229 90.7161C179.653 87.6066 178.732 84.2091 177.465 80.5238C176.198 76.8385 174.644 72.4621 172.801 67.3948C170.958 62.2123 168.885 55.5326 166.582 47.3558C160.823 59.6786 153.222 67.5675 143.779 71.0225C143.779 71.9439 143.779 72.8652 143.779 73.7865C143.894 74.5927 143.952 75.4565 143.952 76.3778C143.952 83.0575 143.376 89.334 142.224 95.2076C141.072 100.966 139.115 106.033 136.351 110.41C133.702 114.671 130.247 118.068 125.986 120.602C121.724 123.02 116.484 124.23 110.265 124.23C106.004 124.23 101.916 123.596 98 122.329C94.1995 120.947 90.8021 118.759 87.8078 115.765C84.8134 112.655 82.3949 108.624 80.5523 103.672C78.8248 98.605 77.961 92.4436 77.961 85.188C77.961 80.2359 78.4793 74.9382 79.5158 69.295C80.5523 63.5367 82.4525 58.1814 85.2165 53.2293C87.9805 48.2771 91.7234 44.1887 96.4453 40.964C101.282 37.6242 107.444 35.9543 114.93 35.9543C122.646 35.9543 128.807 38.0273 133.414 42.1733C138.136 46.3193 141.303 52.9989 142.915 62.2123C146.946 61.2909 150.574 58.5269 153.798 53.9203C157.138 49.1984 160.305 42.8643 163.3 34.9177L188.176 31.4627ZM115.102 107.991C117.521 107.991 119.594 107.185 121.321 105.573C123.164 103.845 124.661 101.542 125.813 98.6626C126.964 95.6682 127.771 92.1556 128.231 88.1248C128.807 84.094 129.095 79.7176 129.095 74.9958V72.75C124.488 71.7135 122.185 68.3161 122.185 62.5578C122.185 58.8724 123.682 56.4539 126.677 55.3023C125.41 51.6169 123.855 49.1984 122.012 48.0468C120.285 46.8951 118.788 46.3193 117.521 46.3193C114.987 46.3193 112.799 47.5285 110.956 49.947C109.229 52.2504 107.789 55.2447 106.638 58.93C105.486 62.5002 104.622 66.4734 104.046 70.8498C103.586 75.2261 103.355 79.4297 103.355 83.4605C103.355 88.6431 103.701 92.8466 104.392 96.0713C105.198 99.296 106.177 101.772 107.329 103.5C108.48 105.227 109.747 106.436 111.129 107.127C112.511 107.703 113.835 107.991 115.102 107.991Z"
fill="currentColor"
/>
<path
d="M239.554 9.52348V36.818H250.092V43.728H239.554V95.5531C239.554 100.39 240.187 103.615 241.454 105.227C242.836 106.724 245.197 107.473 248.537 107.473C251.877 107.473 254.641 106.033 256.829 103.154C259.132 100.275 260.457 96.6471 260.802 92.2708H268.058C267.136 99.296 265.524 104.939 263.221 109.2C260.917 113.346 258.326 116.571 255.447 118.874C252.568 121.062 249.631 122.502 246.637 123.193C243.642 123.884 240.993 124.23 238.69 124.23C229.822 124.23 223.603 121.811 220.033 116.974C216.463 112.022 214.678 105.515 214.678 97.4533V43.728H209.15V36.818H214.678V12.9785L239.554 9.52348Z"
fill="currentColor"
/>
<path
d="M258.833 13.8422C258.833 10.0417 260.158 6.81706 262.806 4.16823C265.455 1.40422 268.68 0.0222168 272.48 0.0222168C276.281 0.0222168 279.506 1.40422 282.154 4.16823C284.918 6.81706 286.3 10.0417 286.3 13.8422C286.3 17.6427 284.918 20.8674 282.154 23.5162C279.506 26.1651 276.281 27.4895 272.48 27.4895C268.68 27.4895 265.455 26.1651 262.806 23.5162C260.158 20.8674 258.833 17.6427 258.833 13.8422ZM285.609 36.818V95.5531C285.609 100.39 286.243 103.615 287.51 105.227C288.892 106.724 291.253 107.473 294.592 107.473C296.09 107.473 297.184 107.358 297.875 107.127C298.681 106.897 299.372 106.667 299.948 106.436C300.063 107.012 300.12 107.588 300.12 108.164C300.12 108.74 300.12 109.315 300.12 109.891C300.12 112.77 299.602 115.131 298.566 116.974C297.644 118.817 296.377 120.314 294.765 121.466C293.268 122.502 291.598 123.193 289.755 123.539C288.028 123.999 286.358 124.23 284.746 124.23C275.878 124.23 269.659 121.811 266.089 116.974C262.518 112.022 260.733 105.515 260.733 97.4533V36.818H285.609ZM351.773 107.473C350.391 107.358 349.354 106.897 348.663 106.091C347.972 105.169 347.627 104.133 347.627 102.981C347.627 101.484 348.26 100.045 349.527 98.6626C350.794 97.1654 352.867 96.4168 355.746 96.4168C358.971 96.4168 361.389 97.5109 363.001 99.6991C364.614 101.772 365.42 104.248 365.42 107.127C365.42 108.97 365.074 110.87 364.383 112.828C363.692 114.671 362.598 116.398 361.101 118.011C359.604 119.508 357.761 120.775 355.573 121.811C353.385 122.732 350.851 123.193 347.972 123.193H300.293L334.152 46.1465H321.369C318.835 46.1465 316.704 46.3193 314.977 46.6648C313.365 46.8951 312.558 47.5285 312.558 48.565C312.558 49.0257 312.674 49.256 312.904 49.256C313.249 49.256 313.595 49.3712 313.94 49.6015C314.401 49.8318 314.747 50.2925 314.977 50.9835C315.322 51.6745 315.495 52.8838 315.495 54.6113C315.495 57.1449 314.689 58.9876 313.077 60.1393C311.579 61.2909 309.852 61.8668 307.894 61.8668C305.591 61.8668 303.345 61.1182 301.157 59.621C299.084 58.0087 298.047 55.5902 298.047 52.3655C298.047 50.638 298.393 48.9105 299.084 47.183C299.775 45.3403 300.811 43.6704 302.193 42.1733C303.575 40.5609 305.303 39.2941 307.376 38.3728C309.449 37.3363 311.867 36.818 314.631 36.818H362.138L329.142 109.891C329.833 109.891 330.812 109.949 332.079 110.064C333.346 110.179 334.67 110.294 336.052 110.41C337.55 110.525 338.989 110.64 340.371 110.755C341.868 110.87 343.193 110.928 344.344 110.928C346.417 110.928 348.145 110.697 349.527 110.237C351.024 109.776 351.773 108.855 351.773 107.473Z"
fill="currentColor"
/>
</svg>
</div>
</Link>
</div>
<PreviewCommentsProvider
previewId={id}
postIds={post.map((p: any) => p.id)}
organizationId={post[0].organizationId}
postState={post[0].state}
>
<div className="mx-auto w-full max-w-[1346px] p-[12px] flex flex-col gap-[8px] text-newTextColor">
<div className="flex bg-newBgColorInner rounded-[12px] min-h-[80px] px-[20px] py-[12px] items-center gap-[20px] flex-wrap">
<Link
href="/"
className="flex items-center gap-[10px] text-textColor"
>
<div className="w-[44px]">
<SafeImage src={'/postiz.svg'} width={44} height={44} alt="Logo" />
</div>
</div>
<div className="text-sm text-gray-400 flex items-center gap-[20px]">
{!!searchParams?.share && (
<div>
<CopyClient />
</div>
)}
<div className="flex-1">
<div>
<svg
width="64"
height="60"
viewBox="0 0 366 167"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M24.9659 30.4263V43.3825C26.9237 41.3095 29.3998 39.582 32.3941 38.2C35.3885 36.7028 39.0162 35.9543 43.2774 35.9543C47.1931 35.9543 50.8784 36.7028 54.3334 38.2C57.9036 39.6972 61.0131 42.1157 63.6619 45.4555C66.4259 48.6802 68.6141 52.9989 70.2264 58.4118C71.8387 63.8246 72.6449 70.3891 72.6449 78.1053C72.6449 83.6333 72.1266 89.1613 71.0902 94.6893C70.1688 100.217 68.4989 105.169 66.0804 109.546C63.6619 113.922 60.3796 117.492 56.2336 120.256C52.2028 122.905 47.1355 124.23 41.0316 124.23C36.6553 124.23 33.2003 123.654 30.6666 122.502C28.1329 121.235 26.2327 119.796 24.9659 118.183V160.162L0.0898438 166.381V30.4263H24.9659ZM32.7396 109.2C35.734 109.2 38.2676 108.221 40.3406 106.264C42.4136 104.191 44.026 101.542 45.1776 98.3171C46.4445 95.0924 47.3082 91.5222 47.7689 87.6066C48.3447 83.5757 48.6326 79.6025 48.6326 75.6868C48.6326 69.3526 48.0568 64.3429 46.9051 60.6575C45.8686 56.9722 44.6018 54.2658 43.1046 52.5383C41.6075 50.6956 40.1103 49.5439 38.6131 49.0833C37.2311 48.6226 36.137 48.3923 35.3309 48.3923C33.2579 48.3923 31.2425 49.1409 29.2846 50.638C27.3268 52.02 25.8872 54.1506 24.9659 57.0298V105.227C25.5417 106.148 26.463 107.07 27.7299 107.991C28.9967 108.797 30.6666 109.2 32.7396 109.2Z"
fill="currentColor"
/>
<path
d="M188.176 31.4627C191.055 42.5188 193.588 51.5593 195.777 58.5845C197.965 65.4945 199.807 71.3105 201.305 76.0323C202.917 80.7541 204.126 84.9001 204.932 88.4703C205.854 92.0405 206.314 96.0137 206.314 100.39C208.272 99.1232 210.172 97.7988 212.015 96.4168C213.858 94.9196 215.413 93.5376 216.679 92.2708H223.935C220.825 96.9926 217.543 100.908 214.088 104.018C210.633 107.012 207.293 109.661 204.069 111.964C201.996 116.456 198.829 119.623 194.567 121.466C190.306 123.308 185.872 124.23 181.266 124.23C176.083 124.23 171.649 123.539 167.964 122.157C164.279 120.659 161.227 118.702 158.808 116.283C156.505 113.749 154.777 110.87 153.626 107.646C152.474 104.421 151.898 101.023 151.898 97.4533C151.898 93.5376 152.819 90.4857 154.662 88.2975C156.62 85.9942 158.866 84.8426 161.399 84.8426C168.424 84.8426 171.937 87.6641 171.937 93.3073C171.937 95.15 171.304 96.7047 170.037 97.9716C168.77 99.2384 167.158 99.8718 165.2 99.8718C164.278 99.8718 163.3 99.7566 162.263 99.5263C161.342 99.1808 160.593 98.5474 160.017 97.6261C160.939 101.657 162.436 104.824 164.509 107.127C166.697 109.431 169.461 110.582 172.801 110.582C175.68 110.582 177.811 109.891 179.193 108.509C180.575 107.012 181.266 104.478 181.266 100.908C181.266 97.1078 180.92 93.7104 180.229 90.7161C179.653 87.6066 178.732 84.2091 177.465 80.5238C176.198 76.8385 174.644 72.4621 172.801 67.3948C170.958 62.2123 168.885 55.5326 166.582 47.3558C160.823 59.6786 153.222 67.5675 143.779 71.0225C143.779 71.9439 143.779 72.8652 143.779 73.7865C143.894 74.5927 143.952 75.4565 143.952 76.3778C143.952 83.0575 143.376 89.334 142.224 95.2076C141.072 100.966 139.115 106.033 136.351 110.41C133.702 114.671 130.247 118.068 125.986 120.602C121.724 123.02 116.484 124.23 110.265 124.23C106.004 124.23 101.916 123.596 98 122.329C94.1995 120.947 90.8021 118.759 87.8078 115.765C84.8134 112.655 82.3949 108.624 80.5523 103.672C78.8248 98.605 77.961 92.4436 77.961 85.188C77.961 80.2359 78.4793 74.9382 79.5158 69.295C80.5523 63.5367 82.4525 58.1814 85.2165 53.2293C87.9805 48.2771 91.7234 44.1887 96.4453 40.964C101.282 37.6242 107.444 35.9543 114.93 35.9543C122.646 35.9543 128.807 38.0273 133.414 42.1733C138.136 46.3193 141.303 52.9989 142.915 62.2123C146.946 61.2909 150.574 58.5269 153.798 53.9203C157.138 49.1984 160.305 42.8643 163.3 34.9177L188.176 31.4627ZM115.102 107.991C117.521 107.991 119.594 107.185 121.321 105.573C123.164 103.845 124.661 101.542 125.813 98.6626C126.964 95.6682 127.771 92.1556 128.231 88.1248C128.807 84.094 129.095 79.7176 129.095 74.9958V72.75C124.488 71.7135 122.185 68.3161 122.185 62.5578C122.185 58.8724 123.682 56.4539 126.677 55.3023C125.41 51.6169 123.855 49.1984 122.012 48.0468C120.285 46.8951 118.788 46.3193 117.521 46.3193C114.987 46.3193 112.799 47.5285 110.956 49.947C109.229 52.2504 107.789 55.2447 106.638 58.93C105.486 62.5002 104.622 66.4734 104.046 70.8498C103.586 75.2261 103.355 79.4297 103.355 83.4605C103.355 88.6431 103.701 92.8466 104.392 96.0713C105.198 99.296 106.177 101.772 107.329 103.5C108.48 105.227 109.747 106.436 111.129 107.127C112.511 107.703 113.835 107.991 115.102 107.991Z"
fill="currentColor"
/>
<path
d="M239.554 9.52348V36.818H250.092V43.728H239.554V95.5531C239.554 100.39 240.187 103.615 241.454 105.227C242.836 106.724 245.197 107.473 248.537 107.473C251.877 107.473 254.641 106.033 256.829 103.154C259.132 100.275 260.457 96.6471 260.802 92.2708H268.058C267.136 99.296 265.524 104.939 263.221 109.2C260.917 113.346 258.326 116.571 255.447 118.874C252.568 121.062 249.631 122.502 246.637 123.193C243.642 123.884 240.993 124.23 238.69 124.23C229.822 124.23 223.603 121.811 220.033 116.974C216.463 112.022 214.678 105.515 214.678 97.4533V43.728H209.15V36.818H214.678V12.9785L239.554 9.52348Z"
fill="currentColor"
/>
<path
d="M258.833 13.8422C258.833 10.0417 260.158 6.81706 262.806 4.16823C265.455 1.40422 268.68 0.0222168 272.48 0.0222168C276.281 0.0222168 279.506 1.40422 282.154 4.16823C284.918 6.81706 286.3 10.0417 286.3 13.8422C286.3 17.6427 284.918 20.8674 282.154 23.5162C279.506 26.1651 276.281 27.4895 272.48 27.4895C268.68 27.4895 265.455 26.1651 262.806 23.5162C260.158 20.8674 258.833 17.6427 258.833 13.8422ZM285.609 36.818V95.5531C285.609 100.39 286.243 103.615 287.51 105.227C288.892 106.724 291.253 107.473 294.592 107.473C296.09 107.473 297.184 107.358 297.875 107.127C298.681 106.897 299.372 106.667 299.948 106.436C300.063 107.012 300.12 107.588 300.12 108.164C300.12 108.74 300.12 109.315 300.12 109.891C300.12 112.77 299.602 115.131 298.566 116.974C297.644 118.817 296.377 120.314 294.765 121.466C293.268 122.502 291.598 123.193 289.755 123.539C288.028 123.999 286.358 124.23 284.746 124.23C275.878 124.23 269.659 121.811 266.089 116.974C262.518 112.022 260.733 105.515 260.733 97.4533V36.818H285.609ZM351.773 107.473C350.391 107.358 349.354 106.897 348.663 106.091C347.972 105.169 347.627 104.133 347.627 102.981C347.627 101.484 348.26 100.045 349.527 98.6626C350.794 97.1654 352.867 96.4168 355.746 96.4168C358.971 96.4168 361.389 97.5109 363.001 99.6991C364.614 101.772 365.42 104.248 365.42 107.127C365.42 108.97 365.074 110.87 364.383 112.828C363.692 114.671 362.598 116.398 361.101 118.011C359.604 119.508 357.761 120.775 355.573 121.811C353.385 122.732 350.851 123.193 347.972 123.193H300.293L334.152 46.1465H321.369C318.835 46.1465 316.704 46.3193 314.977 46.6648C313.365 46.8951 312.558 47.5285 312.558 48.565C312.558 49.0257 312.674 49.256 312.904 49.256C313.249 49.256 313.595 49.3712 313.94 49.6015C314.401 49.8318 314.747 50.2925 314.977 50.9835C315.322 51.6745 315.495 52.8838 315.495 54.6113C315.495 57.1449 314.689 58.9876 313.077 60.1393C311.579 61.2909 309.852 61.8668 307.894 61.8668C305.591 61.8668 303.345 61.1182 301.157 59.621C299.084 58.0087 298.047 55.5902 298.047 52.3655C298.047 50.638 298.393 48.9105 299.084 47.183C299.775 45.3403 300.811 43.6704 302.193 42.1733C303.575 40.5609 305.303 39.2941 307.376 38.3728C309.449 37.3363 311.867 36.818 314.631 36.818H362.138L329.142 109.891C329.833 109.891 330.812 109.949 332.079 110.064C333.346 110.179 334.67 110.294 336.052 110.41C337.55 110.525 338.989 110.64 340.371 110.755C341.868 110.87 343.193 110.928 344.344 110.928C346.417 110.928 348.145 110.697 349.527 110.237C351.024 109.776 351.773 108.855 351.773 107.473Z"
fill="currentColor"
/>
</svg>
</div>
</Link>
<div className="flex-1" />
<div className="flex items-center gap-[20px] text-[14px] text-textItemBlur">
<div>
{t('publication_date', 'Publication Date:')}{' '}
<RenderPreviewDateClient date={post[0].publishDate} />
<span className="text-newTextColor">
<RenderPreviewDateClient date={post[0].publishDate} />
</span>
</div>
{!!searchParams?.share && (
<>
<div className="w-[1px] h-[20px] bg-blockSeparator" />
<CopyClient />
</>
)}
</div>
</div>
</div>
<div className="flex flex-col lg:flex-row text-white w-full max-w-[1346px] mx-auto">
<div className="flex-1">
<div className="gap-[20px] flex flex-col">
<div className="flex flex-col lg:flex-row gap-[8px]">
<div className="flex-1 flex flex-col gap-[8px]">
{post.map((p: any, index: number) => (
<div
key={String(p.id)}
className="relative px-4 py-4 bg-third border border-tableBorder"
className="bg-newBgColorInner border border-newTableBorder rounded-[12px] p-[20px]"
>
<div className="flex space-x-3">
<div className="flex gap-[12px]">
<div>
<div className="flex shrink-0 rounded-full h-30 w-30 relative">
<div className="flex shrink-0 rounded-full relative">
<div className="w-[50px] h-[50px] z-[20]">
<img
className="w-full h-full relative z-[20] bg-black aspect-square rounded-full border-tableBorder"
className="w-full h-full relative z-[20] bg-newBgColor aspect-square rounded-full"
alt={post[0].integration.name}
src={post[0].integration.picture}
/>
</div>
<div className="absolute -end-[5px] -bottom-[5px] w-[30px] h-[30px] z-[20]">
<div className="absolute -end-[5px] -bottom-[5px] w-[24px] h-[24px] z-[20]">
<img
className="w-full h-full bg-black aspect-square rounded-full border-tableBorder"
className="w-full h-full bg-newBgColor aspect-square rounded-full"
alt={post[0].integration.providerIdentifier}
src={`/icons/platforms/${post[0].integration.providerIdentifier}.png`}
/>
</div>
</div>
</div>
<div className="flex-1 space-y-1">
<div className="flex items-center space-x-2">
<h2 className="text-sm font-semibold">
<div className="flex-1 flex flex-col gap-[8px] min-w-0">
<div className="flex items-center gap-[8px]">
<h2 className="text-[14px] font-[600]">
{post[0].integration.name}
</h2>
<span className="text-sm text-gray-500">
<span className="text-[14px] text-textItemBlur">
@{post[0].integration.profile}
</span>
{index === 0 && (
@ -150,40 +148,40 @@ export default async function Auth(
/>
)}
</div>
<div className="flex flex-col gap-[20px]">
<div
className="text-sm whitespace-pre-wrap"
dangerouslySetInnerHTML={{
__html: sanitizePostContent(p.content),
}}
<div className="flex flex-col gap-[16px]">
<PostContentClient
postId={p.id}
html={sanitizePostContent(p.content)}
/>
<div className="flex w-full gap-[10px]">
{JSON.parse(p?.image || '[]').map((p: any) => (
<div
key={p.name}
className="flex-1 rounded-[10px] max-h-[500px] overflow-hidden"
>
<VideoOrImage
isContain={true}
src={p.path}
autoplay={true}
/>
</div>
))}
</div>
{!!JSON.parse(p?.image || '[]').length && (
<div className="flex w-full gap-[10px]">
{JSON.parse(p?.image || '[]').map((p: any) => (
<div
key={p.name}
className="flex-1 rounded-[10px] max-h-[500px] overflow-hidden"
>
<VideoOrImage
isContain={true}
src={p.path}
autoplay={true}
/>
</div>
))}
</div>
)}
</div>
</div>
</div>
</div>
))}
</div>
</div>
<div className="w-full lg:w-96 lg:flex-shrink-0">
<div className="p-4 pt-0">
<CommentsComponents postId={id} />
<div className="w-full lg:w-[380px] lg:flex-shrink-0">
<div className="bg-newBgColorInner border border-newTableBorder rounded-[12px] p-[20px] lg:sticky lg:top-[12px]">
<CommentsComponents previewId={id} />
</div>
</div>
</div>
</div>
</div>
</PreviewCommentsProvider>
);
}

View File

@ -1,11 +1,7 @@
import { Plugs } from '@gitroom/frontend/components/plugs/plugs';
import { redirect } from 'next/navigation';
export const dynamic = 'force-dynamic';
import { Metadata } from 'next';
import { isGeneralServerSide } from '@gitroom/helpers/utils/is.general.server.side';
export const metadata: Metadata = {
title: `${isGeneralServerSide() ? 'Postiz' : 'Gitroom'} Plugs`,
description: '',
};
export default async function Index() {
return <Plugs />;
return redirect('/settings?tab=plugs');
}

View File

@ -1,14 +1,7 @@
import { ThirdPartyComponent } from '@gitroom/frontend/components/third-parties/third-party.component';
import { redirect } from 'next/navigation';
export const dynamic = 'force-dynamic';
import { Metadata } from 'next';
import { isGeneralServerSide } from '@gitroom/helpers/utils/is.general.server.side';
export const metadata: Metadata = {
title: `${
isGeneralServerSide() ? 'Postiz Integrations' : 'Gitroom Integrations'
}`,
description: '',
};
export default async function Index() {
return <ThirdPartyComponent />;
return redirect('/settings?tab=integrations');
}

View File

@ -36,20 +36,43 @@ export const GET = async (
if (filePath !== base && !filePath.startsWith(base + sep)) {
return new NextResponse('Not found', { status: 404 });
}
const response = createReadStream(filePath);
const fileStats = statSync(filePath);
const contentType = mime.getType(filePath) || 'application/octet-stream';
// Honor ranged requests: providers that push video in chunks (TikTok,
// YouTube, LinkedIn, X) fetch byte windows with a Range header and reject
// anything but a 206, so ignoring Range breaks their uploads.
const range = /^bytes=(\d+)-(\d*)$/.exec(request.headers.get('range') || '');
const start = range ? Number(range[1]) : 0;
const end =
range && range[2]
? Math.min(Number(range[2]), fileStats.size - 1)
: fileStats.size - 1;
if (range && (start >= fileStats.size || start > end)) {
return new NextResponse(null, {
status: 416,
headers: { 'Content-Range': `bytes */${fileStats.size}` },
});
}
const response = createReadStream(filePath, range ? { start, end } : {});
const iterator = nodeStreamToIterator(response);
const webStream = iteratorToStream(iterator);
return new Response(webStream, {
status: range ? 206 : 200,
headers: {
'Content-Type': contentType,
// Set the appropriate content-type header
'Content-Length': fileStats.size.toString(),
'Content-Length': (end - start + 1).toString(),
// Set the content-length header
'Last-Modified': fileStats.mtime.toUTCString(),
// Set the last-modified header
'Cache-Control': 'public, max-age=31536000, immutable', // Example cache-control header
'Accept-Ranges': 'bytes',
...(range
? { 'Content-Range': `bytes ${start}-${end}/${fileStats.size}` }
: {}),
},
});
};

View File

@ -2,12 +2,31 @@
import { useSearchParams } from 'next/navigation';
import { FC, useCallback, useEffect } from 'react';
// Only an address on this app, so signing in can never send someone to
// another site or run a javascript: URL
const sameOriginUrl = (url: string | null) => {
if (!url) {
return null;
}
try {
const parsed = new URL(url);
return parsed.origin === window.location.origin &&
parsed.protocol === window.location.protocol
? parsed.toString()
: null;
} catch {
return null;
}
};
const ReturnUrlComponent: FC = () => {
const params = useSearchParams();
const url = params.get('returnUrl');
useEffect(() => {
if (url?.indexOf?.('http')! > -1) {
localStorage.setItem('returnUrl', url!);
const returnUrl = sameOriginUrl(url);
if (returnUrl) {
localStorage.setItem('returnUrl', returnUrl);
}
}, [url]);
return null;
@ -17,7 +36,8 @@ export const useReturnUrl = () => {
getAndClear: useCallback(() => {
const data = localStorage.getItem('returnUrl');
localStorage.removeItem('returnUrl');
return data;
// also on read: localStorage can hold a value saved before this check
return sameOriginUrl(data);
}, []),
};
};

View File

@ -6,7 +6,7 @@ import 'react-tooltip/dist/react-tooltip.css';
import '@copilotkit/react-ui/styles.css';
import LayoutContext from '@gitroom/frontend/components/layout/layout.context';
import { ReactNode } from 'react';
import { Plus_Jakarta_Sans } from 'next/font/google';
import { jakartaSans } from '@gitroom/frontend/fonts/plus-jakarta-sans/plus.jakarta.sans.font';
import PlausibleProvider from 'next-plausible';
import clsx from 'clsx';
import { VariableContextComponent } from '@gitroom/react/helpers/variable.context';
@ -25,12 +25,6 @@ import { HtmlComponent } from '@gitroom/frontend/components/layout/html.componen
import Script from 'next/script';
import { ChangeDirClient } from '@gitroom/frontend/components/new-layout/change.dir.client';
const jakartaSans = Plus_Jakarta_Sans({
weight: ['600', '500'],
style: ['normal', 'italic'],
subsets: ['latin'],
});
export default async function AppLayout({ children }: { children: ReactNode }) {
const cookieStore = await cookies();
const language = cookieStore.get(cookieName)?.value || fallbackLng;
@ -87,6 +81,7 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
googleAdsId={process.env.NEXT_PUBLIC_GTM_ID}
googleAdsTrialTracking={process.env.NEXT_PUBLIC_TRACKING_TRIAL}
language={language}
recaptchaSiteKey={process.env.RECAPTCHA_SITE_KEY || ''}
mediaProcessing={
process.env.STORAGE_PROVIDER === 'cloudflare' &&
!!process.env.RUNPOD_API_KEY &&

View File

@ -1,221 +1,10 @@
'use client';
import { OAuthAuthorize } from '@gitroom/frontend/components/oauth/authorize.component';
import { cookies } from 'next/headers';
import { useCallback, useEffect, useState } from 'react';
import { useSearchParams } from 'next/navigation';
import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
import { Logo } from '@gitroom/frontend/components/new-layout/logo';
export const dynamic = 'force-dynamic';
export default function OAuthAuthorizePage() {
const searchParams = useSearchParams();
const fetch = useFetch();
const [appInfo, setAppInfo] = useState<any>(null);
const [error, setError] = useState('');
const [loading, setLoading] = useState(true);
const [submitting, setSubmitting] = useState(false);
const clientId = searchParams.get('client_id');
const responseType = searchParams.get('response_type');
const state = searchParams.get('state');
const redirectUri = searchParams.get('redirect_uri');
const codeChallenge = searchParams.get('code_challenge');
const codeChallengeMethod = searchParams.get('code_challenge_method');
useEffect(() => {
if (!clientId || !responseType) {
setError('Missing required parameters (client_id, response_type)');
setLoading(false);
return;
}
if (responseType !== 'code') {
setError('Only response_type=code is supported');
setLoading(false);
return;
}
const params = new URLSearchParams({
client_id: clientId,
response_type: responseType,
...(state ? { state } : {}),
...(redirectUri ? { redirect_uri: redirectUri } : {}),
...(codeChallenge ? { code_challenge: codeChallenge } : {}),
...(codeChallengeMethod
? { code_challenge_method: codeChallengeMethod }
: {}),
});
fetch(`/oauth/authorize?${params}`)
.then((r) => r.json())
.then((data) => {
if (data.statusCode && data.statusCode >= 400) {
setError(data.message || 'Invalid OAuth request');
} else {
setAppInfo(data);
}
setLoading(false);
})
.catch(() => {
setError('Failed to validate OAuth request');
setLoading(false);
});
}, [clientId, responseType, state, redirectUri, codeChallenge, codeChallengeMethod]);
const handleAction = useCallback(
async (action: 'approve' | 'deny') => {
setSubmitting(true);
try {
const result = await (
await fetch('/oauth/authorize', {
method: 'POST',
body: JSON.stringify({
client_id: clientId,
state,
action,
...(redirectUri ? { redirect_uri: redirectUri } : {}),
...(codeChallenge ? { code_challenge: codeChallenge } : {}),
...(codeChallengeMethod
? { code_challenge_method: codeChallengeMethod }
: {}),
}),
})
).json();
if (result.redirect) {
window.location.href = result.redirect;
}
} catch {
setError('Failed to process authorization');
setSubmitting(false);
}
},
[clientId, state, redirectUri, codeChallenge, codeChallengeMethod]
);
if (loading) {
return (
<div className="flex flex-1 items-center justify-center text-white relative overflow-hidden">
<div className="absolute inset-0 opacity-30">
<div className="absolute top-[20%] left-[10%] w-[300px] h-[300px] bg-[#612BD3] rounded-full blur-[120px]" />
<div className="absolute bottom-[20%] right-[10%] w-[250px] h-[250px] bg-[#FC69FF] rounded-full blur-[120px]" />
</div>
<div className="relative z-10 text-center">
<div className="flex justify-center mb-[24px]">
<Logo />
</div>
<div className="text-[16px] text-gray-400">
Please wait...
</div>
<div className="mt-[32px] flex justify-center">
<div className="w-[48px] h-[48px] border-[3px] border-[#612BD3] border-t-transparent rounded-full animate-spin" />
</div>
</div>
</div>
);
}
if (error) {
return (
<div className="flex flex-1 items-center justify-center text-white relative overflow-hidden">
<div className="absolute inset-0 opacity-30">
<div className="absolute top-[20%] left-[10%] w-[300px] h-[300px] bg-[#612BD3] rounded-full blur-[120px]" />
<div className="absolute bottom-[20%] right-[10%] w-[250px] h-[250px] bg-[#FC69FF] rounded-full blur-[120px]" />
</div>
<div className="relative z-10 text-center">
<div className="flex justify-center mb-[24px]">
<Logo />
</div>
<div className="w-[80px] h-[80px] mx-auto mb-[24px] rounded-full bg-red-500/20 flex items-center justify-center">
<svg
className="w-[40px] h-[40px] text-red-500"
fill="currentColor"
viewBox="0 0 20 20"
>
<path
fillRule="evenodd"
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clipRule="evenodd"
/>
</svg>
</div>
<div className="text-[28px] font-semibold mb-[12px]">
Authorization Error
</div>
<div className="text-[16px] text-gray-400 max-w-[400px]">
{error}
</div>
</div>
</div>
);
}
if (!appInfo) {
return null;
}
return (
<div className="flex flex-1 items-center justify-center text-white relative overflow-hidden">
<div className="absolute inset-0 opacity-30">
<div className="absolute top-[20%] left-[10%] w-[300px] h-[300px] bg-[#612BD3] rounded-full blur-[120px]" />
<div className="absolute bottom-[20%] right-[10%] w-[250px] h-[250px] bg-[#FC69FF] rounded-full blur-[120px]" />
</div>
<div className="relative z-10 w-full max-w-[500px] mx-auto px-[20px]">
<div className="flex justify-center mb-[32px]">
<Logo />
</div>
<div className="bg-[#1A1919] rounded-[16px] p-[32px] flex flex-col gap-[24px]">
<div className="flex flex-col items-center gap-[16px]">
{appInfo.app.picture?.path ? (
<img
src={appInfo.app.picture.path}
alt={appInfo.app.name}
className="w-[64px] h-[64px] rounded-full object-cover"
/>
) : (
<div className="w-[64px] h-[64px] rounded-full bg-[#2A2929] flex items-center justify-center text-[24px] text-gray-400">
{appInfo.app.name?.[0]?.toUpperCase() || '?'}
</div>
)}
<h2 className="text-[24px] font-semibold text-center">
{appInfo.app.name}
</h2>
{appInfo.app.description && (
<div className="text-gray-400 text-center text-[14px]">
{appInfo.app.description}
</div>
)}
</div>
<div className="border-t border-[#2A2929] pt-[16px]">
<div className="text-[14px] text-gray-400 mb-[12px]">
This application is requesting access to your Postiz account. It
will be able to:
</div>
<ul className="text-[14px] list-disc list-inside space-y-[4px]">
<li>Access your integrations and channels</li>
<li>Create and schedule posts on your behalf</li>
<li>Read your post analytics</li>
</ul>
</div>
<div className="flex gap-[12px]">
<button
onClick={() => handleAction('approve')}
disabled={submitting}
className="flex-1 bg-[#612BD3] hover:bg-[#7B3FF2] disabled:opacity-50 text-white rounded-[8px] py-[10px] px-[16px] text-[14px] font-semibold transition-colors"
>
Authorize
</button>
<button
onClick={() => handleAction('deny')}
disabled={submitting}
className="flex-1 bg-[#2A2929] hover:bg-[#3A3939] disabled:opacity-50 text-white rounded-[8px] py-[10px] px-[16px] text-[14px] font-semibold transition-colors"
>
Deny
</button>
</div>
</div>
</div>
</div>
);
// signed-out visitors get the page too (sign in, or use self-hosted)
export default async function OAuthAuthorizePage() {
const get = (await cookies()).get('auth');
return <OAuthAuthorize logged={!!get?.name} />;
}

View File

@ -4,17 +4,11 @@ import 'react-tooltip/dist/react-tooltip.css';
import '@copilotkit/react-ui/styles.css';
import LayoutContext from '@gitroom/frontend/components/layout/layout.context';
import { ReactNode } from 'react';
import { Plus_Jakarta_Sans } from 'next/font/google';
import { jakartaSans } from '@gitroom/frontend/fonts/plus-jakarta-sans/plus.jakarta.sans.font';
import clsx from 'clsx';
import { VariableContextComponent } from '@gitroom/react/helpers/variable.context';
import UtmSaver from '@gitroom/helpers/utils/utm.saver';
const jakartaSans = Plus_Jakarta_Sans({
weight: ['600', '500'],
style: ['normal', 'italic'],
subsets: ['latin'],
});
export default async function AppLayout({ children }: { children: ReactNode }) {
return (
<html>

View File

@ -6,17 +6,11 @@ import 'react-tooltip/dist/react-tooltip.css';
import '@copilotkit/react-ui/styles.css';
import LayoutContext from '@gitroom/frontend/components/layout/layout.context';
import { ReactNode } from 'react';
import { Plus_Jakarta_Sans } from 'next/font/google';
import { jakartaSans } from '@gitroom/frontend/fonts/plus-jakarta-sans/plus.jakarta.sans.font';
import clsx from 'clsx';
import { VariableContextComponent } from '@gitroom/react/helpers/variable.context';
import UtmSaver from '@gitroom/helpers/utils/utm.saver';
const jakartaSans = Plus_Jakarta_Sans({
weight: ['600', '500'],
style: ['normal', 'italic'],
subsets: ['latin'],
});
export default async function AppLayout({ children }: { children: ReactNode }) {
return (
<html>

View File

@ -2,31 +2,17 @@
import * as Sentry from '@sentry/nextjs';
import NextError from 'next/error';
import { useEffect } from 'react';
import { useVariables } from '@gitroom/react/helpers/variable.context';
export default function GlobalError({
error,
}: {
error: Error & { digest?: string };
}) {
const { sentryDsn } = useVariables();
useEffect(() => {
if (!sentryDsn) {
return;
}
const eventId = Sentry.captureException(error);
Sentry.showReportDialog({
eventId,
title: 'Something broke!',
subtitle: 'Please help us fix the issue by providing some details.',
labelComments: 'What happened?',
labelName: 'Your name',
labelEmail: 'Your email',
labelSubmit: 'Send Report',
lang: 'en',
});
// The variables context is not mounted here (this replaces the root
// layout), so don't gate on its DSN. Without a client this is a no-op, and
// beforeSend already opens the report dialog for captured exceptions
Sentry.captureException(error);
}, [error]);
return (
<html>

View File

@ -526,7 +526,10 @@ div div .set-font-family {
.hideChatbase #chatbase-bubble-button,
.hideChatbase #chatbase-bubble-window,
.hideChatbase #chatbase-message-bubbles {
.hideChatbase #chatbase-message-bubbles,
.bottomSheetOpen #chatbase-bubble-button,
.bottomSheetOpen #chatbase-bubble-window,
.bottomSheetOpen #chatbase-message-bubbles {
display: none !important;
}
@ -599,11 +602,35 @@ html[dir='rtl'] [dir='ltr'] {
outline: none;
}
// the composer on phones follows the app typography
@media (max-width: 1025px) {
.flat-editor .ProseMirror {
font-family: inherit;
font-size: 14px;
line-height: 20px;
}
.flat-editor .tiptap p.is-editor-empty:first-child::before {
color: #656464;
}
}
.ProseMirror .mention {
font-weight: bold;
color: #ae8afc;
}
.ProseMirror img:not(.ProseMirror-separator) {
max-height: 300px;
margin: 16px 0;
border-radius: 6px;
cursor: grab;
}
.ProseMirror img.ProseMirror-selectednode {
outline: 2px solid var(--new-btn-primary);
}
.ProseMirror ul,
.preview ul {
list-style: disc;
@ -637,6 +664,22 @@ html[dir='rtl'] [dir='ltr'] {
font-weight: bold;
}
// paragraphs stay tight, in most channels every line is a paragraph
.ProseMirror h1,
.ProseMirror h2,
.ProseMirror h3 {
margin: 16px 0 8px;
line-height: 1.3;
}
.ProseMirror ul {
margin: 8px 0;
}
.ProseMirror li + li {
margin-top: 4px;
}
.preview p {
min-height: 24px;
}
@ -822,3 +865,8 @@ html[dir='rtl'] [dir='ltr'] {
text-shadow: -1px -1px 0 black, 1px -1px 0 black, -1px 1px 0 black,
1px 1px 0 black;
}
/* Preview page: text that can be selected to leave an inline comment */
.preview-comment-cursor {
cursor: url("data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 width%3D%2228%22 height%3D%2228%22 viewBox%3D%220 0 28 28%22%3E%3Cg fill%3D%22none%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22%3E%3Cpath d%3D%22M3 4h6M3 24h6M6 4v20%22 stroke%3D%22%23fff%22 stroke-width%3D%224%22%2F%3E%3Cpath d%3D%22M3 4h6M3 24h6M6 4v20%22 stroke%3D%22%23000%22 stroke-width%3D%221.6%22%2F%3E%3Cpath d%3D%22M14 4h10a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2h-6l-4 3v-3a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z%22 fill%3D%22%23612bd3%22 stroke%3D%22%23fff%22 stroke-width%3D%221.5%22%2F%3E%3Cpath d%3D%22M17 8h6M17 11h4%22 stroke%3D%22%23fff%22 stroke-width%3D%221.5%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") 6 14, text;
}

View File

@ -28,6 +28,7 @@ interface StatsResponse {
publishingChannels?: StatsBlock;
scheduledChannels?: StatsBlock;
activeOrgsBySource?: StatsBlock;
connectedClients?: StatsBlock;
}
const isoDaysAgo = (days: number) => {
@ -289,6 +290,14 @@ export const AdminStatsComponent: FC = () => {
/>
</div>
)}
{data.connectedClients && (
<div className="flex-1 min-w-[220px] shrink-0">
<SummaryCard
label="Connected clients (all clients combined)"
value={data.connectedClients.total}
/>
</div>
)}
</div>
<div className="flex gap-[12px] items-start">
@ -354,6 +363,14 @@ export const AdminStatsComponent: FC = () => {
/>
</div>
)}
{data.connectedClients && (
<div className="flex-1 min-w-[220px] shrink-0">
<PerSocialTable
title="Connected clients per name"
block={data.connectedClients}
/>
</div>
)}
</div>
</div>
)}

View File

@ -82,7 +82,7 @@ You can select the channels you want to use from the left menu.
You can see your previous conversations from the right menu.
You can also use me as an MCP Server, check Settings >> Public API
You can also use me as an MCP Server, check Settings >> Agents
`),
}}
UserMessage={Message}

View File

@ -107,12 +107,12 @@ export const AgentList: FC<{ onChange: (arr: any[]) => void }> = ({
return (
<div
className={clsx(
'trz bg-newBgColorInner flex flex-col gap-[15px] transition-all relative',
'trz bg-newBgColorInner flex flex-col gap-[15px] transition-all relative mobile:w-full mobile:order-1',
collapseMenu === '1' ? 'group sidebar w-[100px]' : 'w-[260px]'
)}
>
<div className="absolute top-0 start-0 w-full h-full p-[20px] overflow-auto scrollbar scrollbar-thumb-fifth scrollbar-track-newBgColor">
<div className="flex items-center">
<div className="absolute top-0 start-0 w-full h-full p-[20px] mobile:p-[12px] mobile:static mobile:h-auto overflow-auto scrollbar scrollbar-thumb-fifth scrollbar-track-newBgColor">
<div className="flex items-center mobile:hidden">
<h2 className="group-[.sidebar]:hidden flex-1 text-[20px] font-[500] mb-[15px]">
{t('select_channels', 'Select Channels')}
</h2>
@ -137,13 +137,17 @@ export const AgentList: FC<{ onChange: (arr: any[]) => void }> = ({
</svg>
</div>
</div>
<div className={clsx('flex flex-col gap-[15px]')}>
<div
className={clsx(
'flex flex-col gap-[15px] mobile:flex-row mobile:gap-[12px] mobile:ps-[12px] mobile:pt-[6px]'
)}
>
{sortedIntegrations.map((integration, index) => (
<div
onClick={setIntegration(integration)}
key={integration.id}
className={clsx(
'flex gap-[12px] items-center group/profile justify-center hover:bg-boxHover rounded-e-[8px] hover:opacity-100 cursor-pointer',
'flex gap-[12px] items-center group/profile justify-center hover:bg-boxHover rounded-e-[8px] hover:opacity-100 cursor-pointer mobile:shrink-0',
!selected.some((p) => p.id === integration.id) && 'opacity-20'
)}
>
@ -182,7 +186,7 @@ export const AgentList: FC<{ onChange: (arr: any[]) => void }> = ({
</div>
<div
className={clsx(
'flex-1 whitespace-nowrap text-ellipsis overflow-hidden group-[.sidebar]:hidden',
'flex-1 whitespace-nowrap text-ellipsis overflow-hidden group-[.sidebar]:hidden mobile:hidden',
integration.disabled && 'opacity-50'
)}
>
@ -203,7 +207,9 @@ export const Agent: FC<{ children: ReactNode }> = ({ children }) => {
return (
<PropertiesContext.Provider value={{ properties }}>
<AgentList onChange={setProperties} />
<div className="bg-newBgColorInner flex flex-1">{children}</div>
<div className="bg-newBgColorInner flex flex-1 mobile:order-3 mobile:min-h-[500px]">
{children}
</div>
<Threads />
</PropertiesContext.Provider>
);
@ -225,11 +231,11 @@ const Threads: FC = () => {
<div
className={clsx(
'trz bg-newBgColorInner flex flex-col gap-[15px] transition-all relative',
'w-[260px]'
'w-[260px] mobile:w-full mobile:order-2'
)}
>
<div className="absolute top-0 start-0 w-full h-full p-[20px] overflow-auto scrollbar scrollbar-thumb-fifth scrollbar-track-newBgColor">
<div className="mb-[15px] justify-center flex group-[.sidebar]:pb-[15px]">
<div className="absolute top-0 start-0 w-full h-full p-[20px] mobile:p-[12px] mobile:static mobile:h-auto mobile:flex mobile:gap-[8px] mobile:items-center overflow-auto scrollbar scrollbar-thumb-fifth scrollbar-track-newBgColor">
<div className="mb-[15px] mobile:mb-0 justify-center flex group-[.sidebar]:pb-[15px] mobile:shrink-0">
<Link
href={`/agents`}
className="text-white whitespace-nowrap flex-1 pt-[12px] pb-[14px] ps-[16px] pe-[20px] group-[.sidebar]:p-0 min-h-[44px] max-h-[44px] rounded-md bg-btnPrimary flex justify-center items-center gap-[5px] outline-none"
@ -255,11 +261,11 @@ const Threads: FC = () => {
</div>
</Link>
</div>
<div className="flex flex-col gap-[1px]">
<div className="flex flex-col gap-[1px] mobile:flex-row mobile:gap-[4px]">
{data?.threads?.map((p: any) => (
<Link
className={clsx(
'overflow-ellipsis overflow-hidden whitespace-nowrap hover:bg-newBgColor px-[10px] py-[6px] rounded-[10px] cursor-pointer',
'overflow-ellipsis overflow-hidden whitespace-nowrap hover:bg-newBgColor px-[10px] py-[6px] rounded-[10px] cursor-pointer mobile:shrink-0 mobile:max-w-[180px] mobile:border mobile:border-newTableBorder',
p.id === id && 'bg-newBgColor'
)}
href={`/agents/${p.id}`}

View File

@ -60,16 +60,11 @@ export const ApprovedAppsComponent: FC = () => {
return (
<div className="flex flex-col gap-[20px]">
<div className="flex flex-col">
<h3 className="text-[20px]">
{t('approved_apps', 'Approved Apps')}
</h3>
<div className="text-customColor18 mt-[4px]">
{t(
'apps_you_have_authorized',
'Applications you have authorized to access your Postiz account.'
)}
</div>
<div className="text-customColor18">
{t(
'apps_you_have_authorized',
'Applications you have authorized to access your Postiz account.'
)}
</div>
<div className="bg-sixth border-fifth border rounded-[4px] p-[24px]">

View File

@ -23,18 +23,20 @@ export const AfterActivate = () => {
}, []);
const loadCode = useCallback(async () => {
if (params.code) {
const { can } = await (
await fetch(`/auth/activate`, {
method: 'POST',
body: JSON.stringify({
code: params.code,
datafast_visitor_id,
}),
headers: {
'Content-Type': 'application/json',
},
})
).json();
const response = await fetch(`/auth/activate`, {
method: 'POST',
body: JSON.stringify({
code: params.code,
datafast_visitor_id,
}),
headers: {
'Content-Type': 'application/json',
},
});
if (response.headers.get('onboarding')) {
return;
}
const { can } = await response.json();
if (!can) {
setShowLoader(false);
}

View File

@ -0,0 +1,430 @@
'use client';
import React, { FC, useCallback, useMemo, useState } from 'react';
import useSWR from 'swr';
import dayjs from 'dayjs';
import clsx from 'clsx';
import { capitalize } from 'lodash';
import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
import { useT } from '@gitroom/react/translation/get.transation.service.client';
import { Select } from '@gitroom/react/form/select';
interface Invoice {
id: string;
number: string | null;
tier: string | null;
period: string | null;
description: string | null;
amount: number;
currency: string;
created: number;
periodEnd: number;
status: 'paid' | 'pending' | 'failed' | 'void';
downloadUrl: string | null;
viewUrl: string | null;
}
const PAGE_SIZE = 10;
// invoices under $10 (trial starts, proration leftovers) are left out of the history
const MIN_AMOUNT = 1000;
const useInvoices = () => {
const fetch = useFetch();
return useSWR<Invoice[]>(
'/billing/invoices',
async () => {
const response = await fetch('/billing/invoices');
if (!response.ok) {
throw new Error('Failed to load invoices');
}
return response.json();
},
{
revalidateOnFocus: false,
revalidateOnReconnect: false,
}
);
};
const formatAmount = (amount: number, currency: string) => {
const formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: currency.toUpperCase(),
});
return formatter.format(
amount / 10 ** (formatter.resolvedOptions().maximumFractionDigits ?? 2)
);
};
const formatDate = (unix: number | null) =>
unix
? dayjs
.utc(unix * 1000)
.local()
.format('D MMM, YYYY')
: '';
const ActionLink: FC<{
href: string;
label: string;
icon: React.ReactNode;
}> = ({ href, label, icon }) => (
<a
href={href}
target="_blank"
rel="noopener noreferrer"
aria-label={label}
data-tooltip-id="tooltip"
data-tooltip-content={label}
className="w-[36px] h-[36px] rounded-[8px] border border-newTableBorder flex items-center justify-center text-textItemBlur hover:text-newTextColor hover:bg-boxHover transition-colors"
>
{icon}
</a>
);
export const BillingHistory: FC = () => {
const t = useT();
const { data, isLoading, error } = useInvoices();
const [search, setSearch] = useState('');
const [status, setStatus] = useState('all');
const [visible, setVisible] = useState(PAGE_SIZE);
const statuses = useMemo(
() =>
({
paid: {
label: t('billing_status_paid', 'Paid'),
color: 'text-[#32D583]',
},
pending: {
label: t('billing_status_open', 'Pending'),
color: 'text-[#FFAC30]',
},
failed: {
label: t('billing_status_failed', 'Failed'),
color: 'text-[#F97066]',
},
void: {
label: t('billing_status_void', 'Void'),
color: 'text-textItemBlur',
},
} as Record<Invoice['status'], { label: string; color: string }>),
[t]
);
const rows = useMemo(
() =>
(data || [])
.filter((invoice) => invoice.amount >= MIN_AMOUNT)
.map((invoice) => ({
...invoice,
plan: invoice.tier
? capitalize(invoice.tier)
: invoice.description || t('billing_subscription', 'Subscription'),
periodLabel:
invoice.period === 'YEARLY'
? t('billing_yearly', 'Yearly')
: invoice.period === 'MONTHLY'
? t('billing_monthly', 'Monthly')
: '',
amountLabel: formatAmount(invoice.amount, invoice.currency),
purchaseDate: formatDate(invoice.created),
endDate: formatDate(invoice.periodEnd),
statusInfo: statuses[invoice.status] || statuses.void,
})),
[data, statuses, t]
);
const filtered = useMemo(() => {
const query = search.trim().toLowerCase();
return rows.filter(
(row) =>
(status === 'all' || row.status === status) &&
(!query ||
[
row.plan,
row.periodLabel,
row.number,
row.amountLabel,
row.purchaseDate,
row.endDate,
row.statusInfo.label,
].some((value) => value?.toLowerCase().includes(query)))
);
}, [rows, search, status]);
const exportCsv = useCallback(() => {
const escape = (value: string | null) =>
`"${(value || '').replace(/"/g, '""')}"`;
const lines = [
[
t('billing_plan', 'Plan'),
t('billing_amount', 'Amount'),
t('billing_purchase_date', 'Purchase Date'),
t('billing_end_date', 'End Date'),
t('billing_status', 'Status'),
t('billing_invoice', 'Invoice'),
],
...filtered.map((row) => [
[row.plan, row.periodLabel].filter((p) => p).join(' - '),
row.amountLabel,
row.purchaseDate,
row.endDate,
row.statusInfo.label,
row.viewUrl || row.downloadUrl || row.number,
]),
];
const url = URL.createObjectURL(
new Blob(
['\uFEFF' + lines.map((line) => line.map(escape).join(',')).join('\n')],
{ type: 'text/csv;charset=utf-8' }
)
);
const link = document.createElement('a');
link.href = url;
link.download = 'billing-history.csv';
document.body.appendChild(link);
link.click();
link.remove();
setTimeout(() => URL.revokeObjectURL(url), 1000);
}, [filtered, t]);
const columns =
'grid grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_88px] gap-x-[16px] items-center px-[16px]';
if (isLoading || error || !rows.length) {
return null;
}
return (
<div className="flex flex-col gap-[20px] rounded-[12px] border border-newTableBorder bg-newBgColorInner shadow-previewShadow p-[24px] mobile:p-[16px]">
<div className="flex items-center gap-[12px] mobile:flex-col mobile:items-stretch">
<div className="flex-1 text-[20px] font-[600]">
{t('billing_history', 'Billing History')}
</div>
<div className="flex items-center gap-[8px] mobile:flex-wrap">
<div className="relative w-[240px] mobile:w-full">
<svg
xmlns="http://www.w3.org/2000/svg"
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="absolute start-[12px] top-1/2 -translate-y-1/2 text-textItemBlur pointer-events-none"
>
<circle cx="11" cy="11" r="7" />
<path d="M20 20L16.5 16.5" />
</svg>
<input
type="text"
value={search}
onChange={(e) => {
setSearch(e.target.value);
setVisible(PAGE_SIZE);
}}
placeholder={t('billing_search', 'Search...')}
className="w-full h-[42px] ps-[38px] pe-[12px] rounded-[8px] bg-newBgColorInner border border-newTableBorder text-[14px] outline-none focus:border-[#612BD3]"
/>
</div>
<div className="mobile:flex-1">
<Select
label=""
name="status"
disableForm={true}
hideErrors={true}
value={status}
className="w-full"
onChange={(e) => {
setStatus(e.target.value);
setVisible(PAGE_SIZE);
}}
>
<option value="all">
{t('billing_all_statuses', 'All statuses')}
</option>
{Object.entries(statuses).map(([key, value]) => (
<option key={key} value={key}>
{value.label}
</option>
))}
</Select>
</div>
<button
type="button"
onClick={exportCsv}
disabled={!filtered.length}
className="h-[42px] px-[16px] rounded-[8px] border border-newTableBorder bg-newBgColorInner flex items-center gap-[8px] text-[14px] font-[500] hover:bg-boxHover transition-colors disabled:opacity-50 disabled:pointer-events-none"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="17 8 12 3 7 8" />
<line x1="12" y1="3" x2="12" y2="15" />
</svg>
{t('billing_export', 'Export')}
</button>
</div>
</div>
<div className="flex flex-col">
<div
className={clsx(
columns,
'h-[48px] rounded-[8px] border border-newTableBorder bg-newTableHeader text-[14px] text-newTableText mobile:hidden'
)}
>
<div>{t('billing_plan', 'Plan')}</div>
<div>{t('billing_amount', 'Amount')}</div>
<div>{t('billing_purchase_date', 'Purchase Date')}</div>
<div>{t('billing_end_date', 'End Date')}</div>
<div>{t('billing_status', 'Status')}</div>
<div>{t('billing_action', 'Action')}</div>
</div>
{!filtered.length ? (
<div className="flex flex-col items-center justify-center gap-[12px] py-[40px] px-[16px] text-center">
<div className="w-[48px] h-[48px] rounded-full bg-[#612bd3]/10 flex items-center justify-center text-[#612bd3]">
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M4 3h16v18l-3-2-3 2-2-2-2 2-3-2-3 2V3z" />
<path d="M8 8h8M8 12h8M8 16h5" />
</svg>
</div>
<div className="text-[15px] text-newTableText">
{t(
'billing_no_matching_invoices',
'No invoices match your search'
)}
</div>
</div>
) : (
filtered.slice(0, visible).map((row) => (
<div
key={row.id}
className={clsx(
columns,
'min-h-[64px] py-[12px] border-b border-newTableBorder last:border-b-0 text-[14px] mobile:grid-cols-[minmax(0,1fr)_auto] mobile:gap-y-[6px] mobile:py-[14px] mobile:px-0'
)}
>
<div className="flex flex-col min-w-0 mobile:col-start-1 mobile:row-start-1">
<div className="text-[15px] font-[500] truncate">
{row.plan}
</div>
{(!!row.periodLabel || !!row.number) && (
<div className="text-[13px] text-textItemBlur truncate">
{[row.periodLabel, row.number].filter((p) => p).join(' · ')}
</div>
)}
</div>
<div className="font-[500] mobile:col-start-2 mobile:row-start-1 mobile:text-end">
{row.amountLabel}
</div>
<div className="mobile:col-start-1 mobile:row-start-2 mobile:text-[13px] mobile:text-textItemBlur">
<bdi>{row.purchaseDate}</bdi>
{!!row.endDate && (
<span className="hidden mobile:inline">
{' - '}
<bdi>{row.endDate}</bdi>
</span>
)}
</div>
<div className="mobile:hidden">
<bdi>{row.endDate}</bdi>
</div>
<div
className={clsx(
'flex items-center gap-[8px] font-[500] mobile:col-start-2 mobile:row-start-2 mobile:justify-end',
row.statusInfo.color
)}
>
<span className="w-[8px] h-[8px] rounded-full bg-current shrink-0" />
{row.statusInfo.label}
</div>
<div className="flex items-center gap-[8px] mobile:col-span-2 mobile:row-start-3">
{!row.downloadUrl ? (
<div className="w-[36px] mobile:hidden" />
) : (
<ActionLink
href={row.downloadUrl}
label={t('billing_download_invoice', 'Download invoice')}
icon={
<svg
xmlns="http://www.w3.org/2000/svg"
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
<line x1="12" y1="15" x2="12" y2="3" />
</svg>
}
/>
)}
{!!row.viewUrl && (
<ActionLink
href={row.viewUrl}
label={t('billing_view_invoice', 'View invoice')}
icon={
<svg
xmlns="http://www.w3.org/2000/svg"
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z" />
<circle cx="12" cy="12" r="3" />
</svg>
}
/>
)}
</div>
</div>
))
)}
</div>
{filtered.length > visible && (
<button
type="button"
onClick={() => setVisible((current) => current + PAGE_SIZE)}
className="self-center h-[36px] px-[16px] rounded-[8px] text-[14px] font-[500] text-textItemBlur hover:text-newTextColor hover:bg-boxHover transition-colors"
>
{t('show_more', '+ Show more')}
</button>
)}
</div>
);
};

View File

@ -1,7 +1,7 @@
'use client';
import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';
import useSWR from 'swr';
import useSWR, { useSWRConfig } from 'swr';
import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
import { useVariables } from '@gitroom/react/helpers/variable.context';
import { loadStripe, Stripe } from '@stripe/stripe-js';
@ -47,21 +47,35 @@ const EmbeddedBilling = dynamic(
);
export const FirstBillingComponent = () => {
const { stripeClient } = useVariables();
const { stripeClient, billingEnabled } = useVariables();
const user = useUser();
const dub = useDubClickId();
const [stripe, setStripe] = useState<null | Promise<Stripe>>(null);
const [stripeFailed, setStripeFailed] = useState(false);
const [tier, setTier] = useState('STANDARD');
const [period, setPeriod] = useState('MONTHLY');
const fetch = useFetch();
const { mutate } = useSWRConfig();
const modals = useModals();
const t = useT();
const [datafast_visitor_id] = useCookie('datafast_visitor_id', '');
const [datafast_session_id] = useCookie('datafast_session_id', '');
useEffect(() => {
setStripe(loadStripe(stripeClient));
}, []);
// loadStripe injects the js.stripe.com script tag (and its fingerprinting
// requests) as soon as it's called, independent of whether the key it's
// given is valid. Never call it unless billing is actually turned on for
// this deployment - self-hosters without Stripe configured must not have
// it loaded just because this component happened to mount.
if (!billingEnabled || !stripeClient) {
setStripeFailed(true);
return;
}
const stripePromise = loadStripe(stripeClient);
stripePromise.catch(() => setStripeFailed(true));
setStripe(stripePromise);
}, [billingEnabled, stripeClient]);
const loadCheckout = useCallback(async () => {
return (
@ -106,6 +120,12 @@ export const FirstBillingComponent = () => {
}
);
useEffect(() => {
if (data?.blocked) {
mutate('/user/self');
}
}, [data?.blocked, mutate]);
const price = useMemo(
() => Object.entries(pricing).filter(([key, value]) => key !== 'FREE'),
[]
@ -212,6 +232,13 @@ export const FirstBillingComponent = () => {
'Another account with this email already has an active subscription. Please log off and sign in to that account to manage your subscription.'
)}
</div>
) : stripeFailed ? (
<div className="mt-[24px] p-[24px] rounded-[20px] border-[1.5px] border-newColColor text-[16px] font-[500]">
{t(
'billing_stripe_load_failed',
'The payment form could not be loaded. Please disable ad blockers or privacy extensions for this page and reload.'
)}
</div>
) : !isLoading && data && stripe ? (
<EmbeddedBilling
stripe={stripe}
@ -317,7 +344,7 @@ type FeatureItem = {
prefix?: string | number;
};
export const BillingFeatures: FC<{ tier: string }> = ({ tier }) => {
export const useBillingFeatures = (tier: string) => {
const t = useT();
const features = useMemo(() => {
const currentPricing = pricing[tier];
@ -395,6 +422,15 @@ export const BillingFeatures: FC<{ tier: string }> = ({ tier }) => {
return translatedText;
};
return features.map((feature) => ({
key: feature.key,
label: renderFeature(feature),
}));
};
export const BillingFeatures: FC<{ tier: string }> = ({ tier }) => {
const features = useBillingFeatures(tier);
return (
<div className="grid grid-cols-2 mobile:grid-cols-1 gap-y-[8px] gap-x-[32px]">
{features.map((feature) => (
@ -413,7 +449,7 @@ export const BillingFeatures: FC<{ tier: string }> = ({ tier }) => {
/>
</svg>
</div>
<div>{renderFeature(feature)}</div>
<div>{feature.label}</div>
</div>
))}
</div>

View File

@ -1,6 +1,5 @@
'use client';
import { Slider } from '@gitroom/react/form/slider';
import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { Button } from '@gitroom/react/form/button';
import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
@ -11,9 +10,12 @@ import { deleteDialog } from '@gitroom/react/helpers/delete.dialog';
import { useToaster } from '@gitroom/react/toaster/toaster';
import dayjs from 'dayjs';
import clsx from 'clsx';
import { capitalize } from 'lodash';
import { pricing } from '@gitroom/nestjs-libraries/database/prisma/subscriptions/pricing';
import { FAQComponent } from '@gitroom/frontend/components/billing/faq.component';
import { useSWRConfig } from 'swr';
import { useBillingFeatures } from '@gitroom/frontend/components/billing/first.billing.component';
import { BillingHistory } from '@gitroom/frontend/components/billing/billing.history.component';
import useSWR, { useSWRConfig } from 'swr';
import { useUser } from '@gitroom/frontend/components/layout/user.context';
import { useRouter, useSearchParams } from 'next/navigation';
import { useVariables } from '@gitroom/react/helpers/variable.context';
@ -26,6 +28,7 @@ import { TrackEnum } from '@gitroom/nestjs-libraries/user/track.enum';
import { useT } from '@gitroom/react/translation/get.transation.service.client';
import { FinishTrial } from '@gitroom/frontend/components/billing/finish.trial';
import { newDayjs } from '@gitroom/frontend/components/layout/set.timezone';
import { timer } from '@gitroom/helpers/utils/timer';
import { useDubClickId } from '@gitroom/frontend/components/layout/dubAnalytics';
import { LogoutComponent } from '@gitroom/frontend/components/layout/logout.component';
@ -40,10 +43,8 @@ export const Prorate: FC<{
const { period, pack } = props;
const t = useT();
const fetch = useFetch();
const [price, setPrice] = useState<number | false>(0);
const [loading, setLoading] = useState(false);
const [price, setPrice] = useState<number | false>(false);
const calculatePrice = useDebouncedCallback(async () => {
setLoading(true);
setPrice(
(
await (
@ -57,89 +58,327 @@ export const Prorate: FC<{
).json()
).price
);
setLoading(false);
}, 500);
useEffect(() => {
setPrice(false);
calculatePrice();
}, [period, pack]);
if (loading) {
return (
<div className="pt-[12px]">
<ReactLoading type="spin" color="#fff" width={20} height={20} />
</div>
);
}
if (price === false) {
// nothing is shown while the preview loads, the price is missing when it fails
if (typeof price !== 'number') {
return null;
}
return (
<div className="text-[12px] flex pt-[12px]">
({t('pay_today', 'Pay Today')} ${(price < 0 ? 0 : price)?.toFixed(1)})
<div className="animate-fadeIn">
{t('pay_today', 'Pay Today')} ${Math.max(price, 0).toFixed(2)}
</div>
);
};
export const Features: FC<{
pack: 'FREE' | 'STANDARD' | 'PRO';
const creditTypes = ['ai_images', 'ai_videos', 'clipping_minutes'] as const;
const useLoadCredits = () => {
const fetch = useFetch();
return useCallback(
async (
type: (typeof creditTypes)[number]
): Promise<{ credits: number }> => {
const response = await fetch(`/copilot/credits?type=${type}`);
if (!response.ok) {
throw new Error('Failed to load credits');
}
return response.json();
},
[]
);
};
const useCredits = (type: (typeof creditTypes)[number]) => {
const loadCredits = useLoadCredits();
return useSWR<{ credits: number }>(
`/copilot/credits?type=${type}`,
() => loadCredits(type),
{
revalidateOnFocus: false,
revalidateOnReconnect: false,
}
);
};
const useRenewal = () => {
const fetch = useFetch();
return useSWR<{ renewsAt: number | null; trialing: boolean }>(
'/billing/renewal',
async () => {
const response = await fetch('/billing/renewal');
if (!response.ok) {
throw new Error('Failed to load renewal date');
}
return response.json();
},
{
revalidateOnFocus: false,
revalidateOnReconnect: false,
}
);
};
const BillingCycle: FC<{
tier: string;
canceled: boolean;
}> = (props) => {
const { pack } = props;
const features = useMemo(() => {
const currentPricing = pricing[pack];
const channelsOr = currentPricing.channel;
const list = [];
list.push(`${channelsOr} ${channelsOr === 1 ? 'channel' : 'channels'}`);
list.push(
`${
currentPricing.posts_per_month > 10000
? 'Unlimited'
: currentPricing.posts_per_month
} posts per month`
);
if (currentPricing.team_members) {
list.push(`Unlimited team members`);
}
if (currentPricing?.ai) {
list.push(`AI auto-complete`);
list.push(`AI copilots`);
list.push(`AI Autocomplete`);
}
list.push(`Advanced Picture Editor`);
if (currentPricing?.image_generator) {
list.push(
`${currentPricing?.image_generation_count} AI Images per month`
);
}
if (currentPricing?.generate_videos) {
list.push(`${currentPricing?.generate_videos} AI Videos per month`);
}
if (currentPricing?.clipping_minutes) {
list.push(
`${currentPricing?.clipping_minutes} minutes of AI video clipping per month`
);
}
return list;
}, [pack]);
const { tier, canceled } = props;
const t = useT();
const { data: renewal } = useRenewal();
const { data: images } = useCredits('ai_images');
const { data: videos } = useCredits('ai_videos');
const { data: clipping } = useCredits('clipping_minutes');
const usage = [
{
label: t('billing_ai_images', 'AI images'),
total: pricing[tier]?.image_generation_count,
left: images?.credits,
},
{
label: t('billing_ai_videos', 'AI videos'),
total: pricing[tier]?.generate_videos,
left: videos?.credits,
},
{
label: t('billing_clipping_minutes', 'Clipping minutes'),
total: pricing[tier]?.clipping_minutes,
left: clipping?.credits,
},
].filter((p) => p.total);
return (
<div className="flex flex-col gap-[10px] justify-center text-[16px] text-customColor18">
{features.map((feature) => (
<div key={feature} className="flex gap-[20px]">
<div>
<div className="flex items-center gap-[16px] rounded-[12px] border border-newTableBorder bg-newBgColorInner shadow-previewShadow px-[24px] py-[20px] mobile:flex-col mobile:items-stretch mobile:p-[16px]">
<div className="w-[48px] h-[48px] rounded-full bg-[#612bd3]/10 text-[#612bd3] flex items-center justify-center shrink-0 mobile:hidden">
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<rect x="3" y="4" width="18" height="18" rx="2" />
<path d="M16 2v4M8 2v4M3 10h18" />
</svg>
</div>
<div className="flex-1 flex flex-col gap-[4px]">
<div className="text-[16px] font-[600]">
{t('billing_cycle', 'Billing cycle')}
</div>
<div className="text-[14px] text-textItemBlur">
{!canceled && !!renewal?.renewsAt && (
<>
{renewal.trialing
? t(
'billing_trial_ends_on',
'Your free trial ends and your first payment is charged on'
)
: t('billing_renews_on', 'Your plan renews on')}{' '}
<bdi className="font-[600] text-newTextColor">
{newDayjs(renewal.renewsAt * 1000)
.local()
.format('D MMM, YYYY')}
</bdi>
{'. '}
</>
)}
{t(
'billing_ai_credits_reset_monthly',
'AI credits reset every month.'
)}
</div>
</div>
<div className="flex gap-[8px] mobile:flex-col">
{usage.map((p) => (
<div
key={p.label}
className="flex flex-col gap-[2px] min-w-[120px] rounded-[8px] border border-newTableBorder px-[16px] py-[10px]"
>
<div className="text-[12px] text-textItemBlur">{p.label}</div>
<div className="text-[16px] font-[600]">
{typeof p.left === 'number' ? Math.max(p.left, 0) : '-'}
<span className="text-[14px] font-[400] text-textItemBlur">
{' / '}
{p.total}
</span>
</div>
</div>
))}
</div>
</div>
);
};
type PlanAction = {
label: string;
onClick?: () => void;
disabled?: boolean;
variant: 'primary' | 'simple' | 'current' | 'danger';
};
const planButton = {
primary: 'bg-btnPrimary text-white hover:bg-[#5023b8]',
simple: 'bg-btnSimple text-btnText hover:opacity-80',
current: 'bg-newBgLineColor text-textItemBlur',
danger: 'bg-red-500 text-white hover:bg-red-600',
};
const PlanCard: FC<{
name: string;
price: number;
yearly: boolean;
current: boolean;
action: PlanAction;
loading: boolean;
disabled: boolean;
note?: React.ReactNode;
}> = (props) => {
const { name, price, yearly, current, action, loading, disabled, note } =
props;
const t = useT();
const features = useBillingFeatures(name);
return (
<div
className={clsx(
'relative flex flex-col gap-[20px] rounded-[12px] border p-[24px] mobile:p-[20px]',
current
? 'border-transparent bg-gradient-to-b from-seventh to-btnPrimary text-white shadow-lg shadow-purple-500/25'
: 'border-newTableBorder bg-newBgColorInner shadow-previewShadow'
)}
>
{[
'top-[10px] start-[10px]',
'top-[10px] end-[10px]',
'bottom-[10px] start-[10px]',
'bottom-[10px] end-[10px]',
].map((position) => (
<span
key={position}
className={clsx(
'absolute w-[8px] h-[8px] rounded-full border pointer-events-none',
position,
current
? 'border-white/25 bg-white/10'
: 'border-newTableBorder bg-newBgColor'
)}
/>
))}
<div className="flex items-center justify-between gap-[8px] min-h-[26px]">
<div className="text-[18px] font-[600]">{capitalize(name)}</div>
{current && (
<div className="flex items-center gap-[6px] h-[26px] px-[10px] rounded-full bg-white/15 text-[12px] font-[600] uppercase whitespace-nowrap">
<span className="w-[6px] h-[6px] rounded-full bg-[#32D583]" />
{t('active', 'Active')}
</div>
)}
</div>
<div className="flex items-baseline gap-[6px]">
<div className="text-[40px] leading-[48px] font-[600] tracking-tight">
${price}
</div>
<div
className={clsx(
'text-[14px]',
current ? 'text-white/70' : 'text-textItemBlur'
)}
>
{yearly
? t('billing_per_year', '/ year')
: t('billing_per_month', '/ month')}
</div>
</div>
<div className="relative flex flex-col mb-[8px]">
<button
type="button"
onClick={action.onClick}
disabled={disabled}
className={clsx(
'h-[44px] px-[16px] rounded-[8px] text-[15px] font-[600] flex items-center justify-center transition-all',
current
? action.variant === 'current'
? 'bg-white/15 text-white'
: 'bg-white text-btnPrimary hover:bg-white/90'
: planButton[action.variant],
disabled ? 'cursor-default' : 'cursor-pointer',
disabled && action.variant !== 'current' && 'opacity-50'
)}
>
{loading ? (
<ReactLoading
type="spin"
color="currentColor"
width={18}
height={18}
/>
) : (
action.label
)}
</button>
{!!note && (
<div
className={clsx(
'absolute top-full inset-x-0 h-[28px] flex items-center justify-center text-[12px]',
current ? 'text-white/70' : 'text-textItemBlur'
)}
>
{note}
</div>
)}
</div>
<div
className={clsx(
'h-[1px]',
current ? 'bg-white/15' : 'bg-newTableBorder'
)}
/>
<div className="flex flex-col gap-[12px] text-[14px] leading-[20px]">
{features.map((feature) => (
<div
key={feature.key}
className={clsx(
'flex gap-[10px]',
current ? 'text-white' : 'text-newTextColor/90'
)}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
className={clsx(
'shrink-0',
current ? 'text-white/75' : 'text-[#8b5cf6]'
)}
>
<circle
cx="10"
cy="10"
r="7.75"
stroke="currentColor"
strokeWidth="1.5"
/>
<path
d="M16.2806 9.21937C16.3504 9.28903 16.4057 9.37175 16.4434 9.46279C16.4812 9.55384 16.5006 9.65144 16.5006 9.75C16.5006 9.84856 16.4812 9.94616 16.4434 10.0372C16.4057 10.1283 16.3504 10.211 16.2806 10.2806L11.0306 15.5306C10.961 15.6004 10.8783 15.6557 10.7872 15.6934C10.6962 15.7312 10.5986 15.7506 10.5 15.7506C10.4014 15.7506 10.3038 15.7312 10.2128 15.6934C10.1218 15.6557 10.039 15.6004 9.96938 15.5306L7.71938 13.2806C7.57865 13.1399 7.49959 12.949 7.49959 12.75C7.49959 12.551 7.57865 12.3601 7.71938 12.2194C7.86011 12.0786 8.05098 11.9996 8.25 11.9996C8.44903 11.9996 8.6399 12.0786 8.78063 12.2194L10.5 13.9397L15.2194 9.21937C15.289 9.14964 15.3718 9.09432 15.4628 9.05658C15.5538 9.01884 15.6514 8.99941 15.75 8.99941C15.8486 8.99941 15.9462 9.01884 16.0372 9.05658C16.1283 9.09432 16.211 9.14964 16.2806 9.21937ZM21.75 12C21.75 13.9284 21.1782 15.8134 20.1068 17.4168C19.0355 19.0202 17.5127 20.2699 15.7312 21.0078C13.9496 21.7458 11.9892 21.9389 10.0979 21.5627C8.20656 21.1865 6.46928 20.2579 5.10571 18.8943C3.74215 17.5307 2.81355 15.7934 2.43735 13.9021C2.06114 12.0108 2.25422 10.0504 2.99218 8.26884C3.73013 6.48726 4.97982 4.96451 6.58319 3.89317C8.18657 2.82183 10.0716 2.25 12 2.25C14.585 2.25273 17.0634 3.28084 18.8913 5.10872C20.7192 6.93661 21.7473 9.41498 21.75 12ZM20.25 12C20.25 10.3683 19.7661 8.77325 18.8596 7.41655C17.9531 6.05984 16.6646 5.00242 15.1571 4.37799C13.6497 3.75357 11.9909 3.59019 10.3905 3.90852C8.79017 4.22685 7.32016 5.01259 6.16637 6.16637C5.01259 7.32015 4.22685 8.79016 3.90853 10.3905C3.5902 11.9908 3.75358 13.6496 4.378 15.1571C5.00242 16.6646 6.05984 17.9531 7.41655 18.8596C8.77326 19.7661 10.3683 20.25 12 20.25C14.1873 20.2475 16.2843 19.3775 17.8309 17.8309C19.3775 16.2843 20.2475 14.1873 20.25 12Z"
fill="#06ff00"
d="M7 10.25L9 12.25L13 8.25"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
<div>{feature.label}</div>
</div>
<div>{feature}</div>
</div>
))}
))}
</div>
</div>
);
};
@ -237,10 +476,12 @@ export const MainBillingComponent: FC<{
!!queryParams.get('finishTrial')
);
const [subscription, setSubscription] = useState<SubscriptionWithPlatform | undefined>(
sub
);
const [subscription, setSubscription] = useState<
SubscriptionWithPlatform | undefined
>(sub);
const [loading, setLoading] = useState<boolean>(false);
// which button started the request, so only that one shows a spinner
const [clicked, setClicked] = useState('');
const [period, setPeriod] = useState<'MONTHLY' | 'YEARLY'>(
subscription?.period || 'MONTHLY'
);
@ -262,6 +503,34 @@ export const MainBillingComponent: FC<{
}
setSubscription(sub);
}, [sub]);
const loadCredits = useLoadCredits();
// credits follow the plan stored by the Stripe webhook: wait for it, then
// show the new plan's totals and credits together
const showConfirmedPlan = useCallback(
async (billing: string, period: string, attempt = 0) => {
try {
const current = await (await fetch('/user/subscription')).json();
if (
current?.subscription?.subscriptionTier !== billing ||
current?.subscription?.period !== period
) {
if (attempt < 9) {
await timer(1000);
return showConfirmedPlan(billing, period, attempt + 1);
}
return;
}
const credits = await Promise.all(creditTypes.map(loadCredits));
creditTypes.forEach((type, index) =>
mutate(`/copilot/credits?type=${type}`, credits[index], {
revalidate: false,
})
);
mutate('/user/subscription', current, { revalidate: false });
} catch (err) {}
},
[]
);
const updatePayment = useCallback(async () => {
const { portal } = await (await fetch('/billing/portal')).json();
window.location.href = portal;
@ -299,7 +568,11 @@ export const MainBillingComponent: FC<{
cancelAt: cancel_at,
}));
toast.show('Subscription reactivated successfully');
toast.show(
cancel_at
? 'Your subscription was already active, so it is now set to cancel. Click Reactivate subscription again to keep it.'
: 'Subscription reactivated successfully'
);
setLoading(false);
return;
}
@ -309,9 +582,23 @@ export const MainBillingComponent: FC<{
!pricing[billing].team_members &&
pricing[subscription?.subscriptionTier!]?.team_members
) {
messages.push(
`Your team members will be removed from your organization`
);
let hasMembers = true;
try {
const team = await (await fetch('/settings/team')).json();
hasMembers =
!Array.isArray(team?.users) ||
team.users.some(
(member: { user: { id: string } }) =>
member.user.id !== user?.id
);
} catch (err: any) {
// keep the warning when the team cannot be loaded
}
if (hasMembers) {
messages.push(
`Your team members will be disabled and lose access to your organization until you upgrade to a plan that includes team members again`
);
}
}
if (billing === 'FREE') {
if (
@ -320,7 +607,8 @@ export const MainBillingComponent: FC<{
`Are you sure you want to cancel your subscription?
${messages.join(', ')}`,
'Yes, cancel',
'Cancel Subscription'
'Cancel Subscription',
'No, keep it'
))
) {
const checkDiscount = await (
@ -375,8 +663,11 @@ export const MainBillingComponent: FC<{
...subs!,
cancelAt: cancel_at,
}));
if (cancel_at)
toast.show('Subscription set to canceled successfully');
toast.show(
cancel_at
? 'Subscription set to canceled successfully'
: 'Your subscription was already set to cancel, so it has been reactivated. Click Cancel subscription again to cancel it.'
);
setLoading(false);
}
return;
@ -448,6 +739,12 @@ export const MainBillingComponent: FC<{
revalidate: false,
}
);
mutate('/billing/invoices');
mutate('/billing/renewal');
showConfirmedPlan(
billing,
monthlyOrYearly === 'on' ? 'YEARLY' : 'MONTHLY'
);
toast.show('Subscription updated successfully');
}
setLoading(false);
@ -482,139 +779,226 @@ export const MainBillingComponent: FC<{
</div>
);
}
const yearly = monthlyOrYearly === 'on';
const tiers = Object.keys(pricing);
const currentTier = subscription?.subscriptionTier || 'FREE';
const plans = tiers.filter((name) => !isGeneral || name !== 'FREE');
const planAction = (name: string): PlanAction => {
if (currentPackage === name && subscription?.cancelAt) {
return {
label: t('reactivate_subscription', 'Reactivate subscription'),
onClick: moveToCheckout('FREE', true),
variant: 'primary',
};
}
if (currentPackage === name) {
return {
label: t('billing_current_plan', 'Current Plan'),
disabled: true,
variant: 'current',
};
}
if (name === 'FREE') {
return {
label: subscription?.cancelAt
? t('billing_downgrade_on', 'Downgrade on {{date}}', {
date: dayjs
.utc(subscription.cancelAt)
.local()
.format('D MMM, YYYY'),
})
: t('cancel_subscription_1', 'Cancel subscription'),
onClick: moveToCheckout('FREE'),
disabled: !!subscription?.cancelAt,
variant: 'danger',
};
}
const direction = tiers.indexOf(name) - tiers.indexOf(currentTier);
return {
label: !subscription
? user?.tier?.current === 'FREE' && user.allowTrial
? t('start_7_days_free_trial', 'Start 7 days free trial')
: t('billing_purchase', 'Purchase')
: direction > 0
? t('billing_upgrade', 'Upgrade')
: direction < 0
? t('billing_downgrade', 'Downgrade')
: yearly
? t('billing_switch_to_yearly', 'Switch to yearly')
: t('billing_switch_to_monthly', 'Switch to monthly'),
onClick: moveToCheckout(name as 'STANDARD' | 'PRO'),
variant: !!subscription && direction < 0 ? 'simple' : 'primary',
};
};
return (
<div className="flex flex-col gap-[16px]">
<div className="flex flex-row">
<div className="flex-1 text-[20px]">{t('plans', 'Plans')}</div>
<div className="flex items-center gap-[16px]">
<div>{t('monthly', 'MONTHLY')}</div>
<div>
<Slider value={monthlyOrYearly} onChange={setMonthlyOrYearly} />
<div className="flex flex-col gap-[24px]">
{finishTrial && <FinishTrial close={() => setFinishTrial(false)} />}
<div className="flex items-center gap-[16px] mobile:flex-col mobile:items-stretch">
<div className="flex-1 flex flex-col gap-[4px]">
<div className="text-[20px] font-[600]">
{t('billing_and_subscription', 'Billing & Subscription')}
</div>
<div className="text-[14px] text-textItemBlur">
{t(
'billing_and_subscription_description',
'Keep track of your subscription, update your payment method and download your invoices'
)}
</div>
</div>
<div className="flex p-[4px] border border-newTableBorder rounded-[8px] text-[14px] font-[500] select-none">
<div
onClick={() => setMonthlyOrYearly('off')}
className={clsx(
'h-[34px] px-[16px] rounded-[6px] flex items-center justify-center mobile:flex-1',
!yearly ? 'bg-boxFocused text-textItemFocused' : 'cursor-pointer'
)}
>
{t('billing_monthly', 'Monthly')}
</div>
<div
onClick={() => setMonthlyOrYearly('on')}
className={clsx(
'h-[34px] px-[16px] rounded-[6px] flex items-center justify-center gap-[8px] mobile:flex-1',
yearly ? 'bg-boxFocused text-textItemFocused' : 'cursor-pointer'
)}
>
{t('billing_yearly', 'Yearly')}
<div className="bg-[#AA0FA4] text-white text-[12px] px-[6px] rounded-[4px]">
{t('billing_20_percent_off', '20% Off')}
</div>
</div>
<div>{t('yearly', 'YEARLY')}</div>
</div>
</div>
{finishTrial && <FinishTrial close={() => setFinishTrial(false)} />}
<div className="flex gap-[16px] [@media(max-width:1024px)]:flex-col [@media(max-width:1024px)]:text-center">
{Object.entries(pricing)
.filter((f) => !isGeneral || f[0] !== 'FREE')
.map(([name, values]) => (
<div
{subscription?.cancelAt && isGeneral && (
<div className="flex items-center gap-[12px] rounded-[12px] border border-[#FFAC30]/30 bg-[#FFAC30]/10 px-[16px] py-[12px] text-[14px]">
<div className="w-[8px] h-[8px] rounded-full bg-[#FFAC30] shrink-0" />
<div>
{t(
'your_subscription_will_be_canceled_at',
'Your subscription will be canceled at'
)}{' '}
<bdi className="font-[600]">
{newDayjs(subscription.cancelAt).local().format('D MMM, YYYY')}
</bdi>
{'. '}
{t(
'you_will_never_be_charged_again',
'You will never be charged again'
)}
</div>
</div>
)}
<div
className={clsx(
'grid gap-[16px] tablet:grid-cols-2 mobile:!grid-cols-1',
plans.length > 4 ? 'grid-cols-5' : 'grid-cols-4'
)}
>
{plans.map((name) => {
const action = planAction(name);
return (
<PlanCard
key={name}
className="flex-1 bg-sixth border border-customColor6 rounded-[4px] p-[24px] gap-[16px] flex flex-col [@media(max-width:1024px)]:items-center"
>
<div className="text-[18px]">{name}</div>
<div className="text-[38px] flex gap-[2px] items-center">
<div>
$
{monthlyOrYearly === 'on'
? values.year_price
: values.month_price}
</div>
<div className={`text-[14px] text-customColor18`}>
{monthlyOrYearly === 'on' ? '/year' : '/month'}
</div>
</div>
<div className="text-[14px] flex gap-[10px]">
{currentPackage === name.toUpperCase() &&
subscription?.cancelAt ? (
<div className="gap-[3px] flex flex-col">
<div>
<Button
onClick={moveToCheckout('FREE', true)}
loading={loading}
>
{t(
'reactivate_subscription',
'Reactivate subscription'
)}
</Button>
</div>
</div>
) : (
<Button
loading={loading}
disabled={
(!!subscription?.cancelAt &&
name.toUpperCase() === 'FREE') ||
currentPackage === name.toUpperCase()
}
className={clsx(
subscription &&
name.toUpperCase() === 'FREE' &&
'!bg-red-500'
)}
onClick={moveToCheckout(
name.toUpperCase() as 'STANDARD' | 'PRO'
)}
>
{currentPackage === name.toUpperCase()
? 'Current Plan'
: name.toUpperCase() === 'FREE'
? subscription?.cancelAt
? `Downgrade on ${dayjs
.utc(subscription?.cancelAt)
.local()
.format('D MMM, YYYY')}`
: 'Cancel subscription'
: // @ts-ignore
(user?.tier === 'FREE' ||
user?.tier?.current === 'FREE') &&
user.allowTrial
? t('start_7_days_free_trial', 'Start 7 days free trial')
: 'Purchase'}
</Button>
)}
{subscription &&
currentPackage !== name.toUpperCase() &&
name !== 'FREE' &&
!!name && (
<Prorate
period={monthlyOrYearly === 'on' ? 'YEARLY' : 'MONTHLY'}
pack={name.toUpperCase() as 'STANDARD' | 'PRO'}
/>
)}
</div>
<Features
pack={name.toUpperCase() as 'FREE' | 'STANDARD' | 'PRO'}
/>
</div>
))}
name={name}
price={
yearly ? pricing[name].year_price : pricing[name].month_price
}
yearly={yearly}
current={currentPackage === name}
action={{
...action,
onClick: () => {
setClicked(name);
action.onClick?.();
},
}}
loading={loading && clicked === name}
disabled={!!action.disabled || loading}
note={
!!subscription &&
currentPackage !== name &&
name !== 'FREE' && (
<Prorate
period={yearly ? 'YEARLY' : 'MONTHLY'}
pack={name as 'STANDARD' | 'PRO'}
/>
)
}
/>
);
})}
</div>
{!!subscription?.id && (
<div className="flex justify-center mt-[20px] gap-[10px]">
<Button onClick={updatePayment}>
{t(
'update_payment_method_invoices_history',
'Update Payment Method / Invoices History'
)}
</Button>
{isGeneral && !subscription?.cancelAt && (
<Button
className="bg-red-500"
loading={loading}
onClick={moveToCheckout('FREE')}
<BillingCycle
tier={sub?.subscriptionTier || subscription.subscriptionTier}
canceled={!!subscription.cancelAt}
/>
)}
{!!subscription?.id && (
<div className="flex items-center gap-[16px] rounded-[12px] border border-newTableBorder bg-newBgColorInner shadow-previewShadow px-[24px] py-[20px] mobile:flex-col mobile:items-stretch mobile:p-[16px]">
<div className="w-[48px] h-[48px] rounded-full bg-[#612bd3]/10 text-[#612bd3] flex items-center justify-center shrink-0 mobile:hidden">
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
{t('cancel_subscription_1', 'Cancel subscription')}
</Button>
)}
</div>
)}
{subscription?.cancelAt && isGeneral && (
<div className="text-center">
{t(
'your_subscription_will_be_canceled_at',
'Your subscription will be canceled at'
)}{' '}
{newDayjs(subscription.cancelAt).local().format('D MMM, YYYY')}
<br />
{t(
'you_will_never_be_charged_again',
'You will never be charged again'
)}
<rect x="2" y="5" width="20" height="14" rx="2" />
<path d="M2 10h20M6 15h4" />
</svg>
</div>
<div className="flex-1 flex flex-col gap-[4px]">
<div className="text-[16px] font-[600]">
{t('billing_payment_method', 'Payment method')}
</div>
<div className="text-[14px] text-textItemBlur">
{t(
'billing_payment_method_description',
'Update your card, billing address and tax details in the secure billing portal'
)}
</div>
</div>
<div className="flex items-center gap-[8px] mobile:flex-col-reverse mobile:items-stretch">
{isGeneral && !subscription?.cancelAt && (
<button
type="button"
disabled={loading}
onClick={() => {
setClicked('CANCEL');
moveToCheckout('FREE')();
}}
className="h-[44px] px-[16px] rounded-[8px] border border-red-500/40 text-red-500 text-[14px] font-[500] flex items-center justify-center hover:bg-red-500/10 transition-colors disabled:opacity-50"
>
{loading && clicked === 'CANCEL' ? (
<ReactLoading
type="spin"
color="currentColor"
width={18}
height={18}
/>
) : (
t('cancel_subscription_1', 'Cancel subscription')
)}
</button>
)}
<button
type="button"
onClick={updatePayment}
className="h-[44px] px-[16px] rounded-[8px] bg-btnSimple text-btnText text-[14px] font-[500] hover:opacity-80 transition-opacity"
>
{t('billing_update_payment_method', 'Update payment method')}
</button>
</div>
</div>
)}
{!!subscription?.id && <BillingHistory />}
<FAQComponent />
<div className="flex justify-center mt-[20px]">
<LogoutComponent />

View File

@ -0,0 +1,534 @@
// Content for the /compare/* landing pages.
// Every number here is sourced from libraries/nestjs-libraries/src/database/prisma/subscriptions/pricing.ts
// (Postiz side) and the competitor's own public pricing page (checked 2026-10-23).
// Do not invent a number here - if a competitor changes price, update the value and the "asOf" field.
export interface ComparePricingRow {
label: string;
postiz: string;
competitor: string;
}
export interface CompareChecklistRow {
label: string;
postiz: boolean;
competitor: boolean;
}
export interface CompareFaqItem {
question: string;
answer: string;
}
export interface CompareCompetitor {
slug: string;
name: string;
domain: string;
asOf: string;
headline: string;
subheadline: string;
summary: string;
pricingRows: ComparePricingRow[];
structuralChecklist: CompareChecklistRow[];
featureChecklist: CompareChecklistRow[];
verdict: string;
faq: CompareFaqItem[];
}
const structuralChecklistTemplate = (competitorName: string): CompareChecklistRow[] => [
{
label: 'Open-source and self-hostable',
postiz: true,
competitor: false,
},
{
label: 'Managed cloud option at indie-friendly pricing',
postiz: true,
competitor: competitorName !== 'Mixpost',
},
{
label: 'Public API + npm SDK + CLI + browser extension',
postiz: true,
competitor: false,
},
{
label: 'Native MCP server (Claude/ChatGPT/Codex agents can post directly)',
postiz: true,
competitor: false,
},
];
export const compareCompetitors: Record<string, CompareCompetitor> = {
buffer: {
slug: 'buffer',
name: 'Buffer',
domain: 'buffer.com',
asOf: '2026-10-23',
headline: 'Postiz vs Buffer',
subheadline:
"Buffer's per-channel price, plus the public API, MCP server, and AI agent Buffer doesn't ship at any price.",
summary:
'Buffer Essentials charges per channel with no AI drafting, no public API, and no self-host option. Postiz STANDARD is a flat $29/mo for 5 channels ($5.80/channel) and already includes AI post generation, a public API, and 60 minutes/month of video clipping.',
pricingRows: [
{
label: 'Entry plan price',
postiz: '$29/mo flat (STANDARD)',
competitor: '$5/channel/mo (Essentials)',
},
{
label: 'Channels included at entry price',
postiz: '5 channels ($5.80/channel effective)',
competitor: 'Priced per channel, no bundle discount',
},
{
label: 'AI post drafting',
postiz: 'Included (LangGraph agent + live web research)',
competitor: 'Not available',
},
{
label: 'Public API access',
postiz: 'Included from $29/mo',
competitor: 'Not offered',
},
{
label: 'Self-hosting option',
postiz: 'AGPL self-host, same features as cloud',
competitor: 'Not offered',
},
],
structuralChecklist: structuralChecklistTemplate('Buffer'),
featureChecklist: [
{
label: 'Video-to-clips scheduler (long video → scheduled short clips)',
postiz: true,
competitor: false,
},
{
label: 'Team seats included',
postiz: true,
competitor: false,
},
{
label: 'Webhooks for workflow automation',
postiz: true,
competitor: false,
},
],
verdict:
"If you're comparing per-channel pricing, Buffer looks cheaper on paper for a single channel. The moment you need a second channel, an API, or AI drafting, Postiz's flat $29/mo covers all of it where Buffer charges more and still can't match the feature set.",
faq: [
{
question: 'Is Postiz actually cheaper than Buffer?',
answer:
'At 5 channels, Postiz STANDARD is $29/mo total ($5.80/channel) versus Buffer Essentials at $5/channel with no bundle discount and no AI, API, or self-host option included at any price.',
},
{
question: 'Can I self-host Postiz instead of using the cloud version?',
answer:
'Yes. Postiz is AGPL-licensed and open-source; the self-hosted version has the exact same feature set as Postiz Cloud, which Buffer does not offer in any form.',
},
{
question: 'Does Buffer have an MCP server or AI agent?',
answer:
"No. Buffer has no public MCP server and no built-in AI agent. Postiz ships both: a native MCP server so Claude, ChatGPT, or Codex agents can schedule posts directly, and a LangGraph-based agent that does live web research before drafting.",
},
],
},
hootsuite: {
slug: 'hootsuite',
name: 'Hootsuite',
domain: 'hootsuite.com',
asOf: '2026-10-23',
headline: 'Postiz vs Hootsuite',
subheadline:
'The same 10-channel, 3-seat, approval-workflow shape Hootsuite prices at $1,197/mo - Postiz TEAM ships it for $39/mo flat.',
summary:
'Hootsuite overcharges for the exact workflow small teams need: multiple channels, team seats, and approval before publish. Postiz TEAM bundles 10 channels, team members, and autopost for $39/mo - a fraction of Hootsuite Advanced plus 3 seats.',
pricingRows: [
{
label: 'Plan matching 10 channels + team + approval',
postiz: '$39/mo flat (TEAM)',
competitor: '$1,197/mo (Advanced + 3 seats)',
},
{
label: 'Team members included',
postiz: 'Included at $39/mo',
competitor: 'Extra seats billed on top of Advanced',
},
{
label: 'AI post drafting',
postiz: 'Included (LangGraph agent + live web research)',
competitor: 'Add-on on higher tiers',
},
{
label: 'Public API access',
postiz: 'Included from $29/mo',
competitor: 'Enterprise tier only',
},
],
structuralChecklist: structuralChecklistTemplate('Hootsuite'),
featureChecklist: [
{
label: 'Video-to-clips scheduler',
postiz: true,
competitor: false,
},
{
label: 'Flat pricing, no per-seat surcharge at this tier',
postiz: true,
competitor: false,
},
{
label: 'Self-host option for data residency',
postiz: true,
competitor: false,
},
],
verdict:
"Hootsuite's enterprise pricing model charges per-seat on top of a high base plan. For a 3-person team managing 10 channels with approval, that's $1,197/mo on Hootsuite versus $39/mo flat on Postiz TEAM - a gap large enough to fund the rest of your marketing stack.",
faq: [
{
question: 'Why is Hootsuite so much more expensive for the same features?',
answer:
"Hootsuite's Advanced plan plus 3 seats runs approximately $1,197/mo for team + approval workflows on ~10 channels. Postiz TEAM covers the same 10-channel, team-member, approval-adjacent shape for $39/mo flat.",
},
{
question: 'Does Postiz TEAM really include team members at $39/mo?',
answer:
'Yes - team_members is enabled starting at the TEAM tier ($39/mo) in the live pricing config, alongside 10 channels and autopost.',
},
{
question: 'Can I migrate from Hootsuite to Postiz?',
answer:
'Postiz supports 36+ social providers and a public API/SDK for scripted migration of scheduled content; most teams reconnect channels directly via OAuth and rebuild their queue from the calendar view.',
},
],
},
later: {
slug: 'later',
name: 'Later',
domain: 'later.com',
asOf: '2026-10-23',
headline: 'Postiz vs Later',
subheadline: 'Every channel Later has, plus full X (Twitter), Threads, Bluesky, and 20+ more.',
summary:
"Later is built around Instagram-grid-style visual planning but has no X (Twitter) support at all. Postiz covers Later's channels plus X, Threads, Bluesky, Mastodon, LinkedIn, and 20+ more from a single calendar.",
pricingRows: [
{
label: 'X (Twitter) support',
postiz: 'Full support, included',
competitor: 'Not supported',
},
{
label: 'Entry plan price',
postiz: '$29/mo flat (STANDARD, 5 channels)',
competitor: 'Per-plan, channel-limited',
},
{
label: 'AI post drafting',
postiz: 'Included (LangGraph agent)',
competitor: 'Limited AI caption assist',
},
{
label: 'Public API access',
postiz: 'Included from $29/mo',
competitor: 'Not offered on consumer plans',
},
],
structuralChecklist: structuralChecklistTemplate('Later'),
featureChecklist: [
{
label: 'X (Twitter) posting',
postiz: true,
competitor: false,
},
{
label: 'Threads and Bluesky posting',
postiz: true,
competitor: false,
},
{
label: 'Video-to-clips scheduler',
postiz: true,
competitor: false,
},
],
verdict:
"If your channel mix includes X, Threads, or Bluesky, Later structurally can't cover it. Postiz schedules every channel Later supports plus the ones it doesn't, from the same calendar and composer.",
faq: [
{
question: 'Does Later support posting to X (Twitter)?',
answer:
'No, Later does not support X (Twitter) at all. Postiz supports X alongside Threads, Bluesky, and 30+ other channels from one composer.',
},
{
question: 'Is Postiz as good for Instagram-grid planning as Later?',
answer:
"Postiz's calendar and media library cover the same visual scheduling workflow for Instagram, plus the channels Later can't reach.",
},
],
},
socialbee: {
slug: 'socialbee',
name: 'SocialBee',
domain: 'socialbee.com',
asOf: '2026-10-23',
headline: 'Postiz vs SocialBee',
subheadline: 'Team seats at $39/mo, not SocialBee\'s $99/mo Pro gate.',
summary:
"SocialBee requires its $99/mo Pro plan before a single extra team member can be added. Postiz TEAM includes team members, 10 channels, and autopost for $39/mo - a $60/mo gap for the same capability.",
pricingRows: [
{
label: 'Cheapest plan with team members',
postiz: '$39/mo (TEAM)',
competitor: '$99/mo (Pro)',
},
{
label: 'Content recycling / evergreen queue',
postiz: 'Category-based queue rotation',
competitor: 'Category-based queue rotation (SocialBee original)',
},
{
label: 'Public API access',
postiz: 'Included from $29/mo',
competitor: 'Not publicly documented',
},
{
label: 'Self-hosting option',
postiz: 'AGPL self-host available',
competitor: 'Not offered',
},
],
structuralChecklist: structuralChecklistTemplate('SocialBee'),
featureChecklist: [
{
label: 'Team seats at the cheapest multi-channel tier',
postiz: true,
competitor: false,
},
{
label: 'Video-to-clips scheduler',
postiz: true,
competitor: false,
},
{
label: 'Native MCP server',
postiz: true,
competitor: false,
},
],
verdict:
"SocialBee pioneered evergreen content recycling, and Postiz matches that category-based rotation - while undercutting SocialBee by $60/mo on the cheapest plan that includes a second team seat.",
faq: [
{
question: 'Does Postiz have content recycling like SocialBee?',
answer:
"Yes - Postiz supports a recycle-after-days, category-based queue rotation for evergreen content, the same workflow SocialBee popularized.",
},
{
question: 'How much cheaper is Postiz for a 2-person team?',
answer:
"Postiz TEAM at $39/mo includes team members. SocialBee requires its $99/mo Pro plan for the same capability - a $60/mo difference.",
},
],
},
metricool: {
slug: 'metricool',
name: 'Metricool',
domain: 'metricool.com',
asOf: '2026-10-23',
headline: 'Postiz vs Metricool',
subheadline: 'Every channel, every tier, no platform tax.',
summary:
"Metricool is strong on analytics and competitor tracking, but Postiz matches scheduling depth while never gating a specific platform like X or LinkedIn behind a higher tier - channel count is the only paid gate, not platform identity.",
pricingRows: [
{
label: 'Platform-based feature gating',
postiz: 'None - channel count is the only gate',
competitor: 'Some advanced analytics gated by plan',
},
{
label: 'Entry plan price',
postiz: '$29/mo flat (5 channels)',
competitor: 'Tiered by channel + feature',
},
{
label: 'Built-in AI drafting agent',
postiz: 'Included (LangGraph + live web research)',
competitor: 'Not a core feature',
},
{
label: 'Video-to-clips scheduler',
postiz: 'Included (Deepgram transcription)',
competitor: 'Not offered',
},
],
structuralChecklist: structuralChecklistTemplate('Metricool'),
featureChecklist: [
{
label: 'No per-platform feature tax',
postiz: true,
competitor: false,
},
{
label: 'Bundled AI agent with web research',
postiz: true,
competitor: false,
},
{
label: 'Self-host option',
postiz: true,
competitor: false,
},
],
verdict:
"Metricool's analytics and competitor tracking are genuinely strong - Postiz answers with the same scheduling coverage, an AI agent Metricool doesn't have, and a pricing model that never charges extra for which platform you post to.",
faq: [
{
question: 'Does Postiz have competitor tracking like Metricool?',
answer:
"Postiz tracks competitor handles per organization using each provider's public analytics endpoints, with scheduled snapshots and a comparison chart in the analytics view.",
},
{
question: 'Does Postiz charge more for X or LinkedIn specifically?',
answer:
'No. Every tier in the live pricing config gates on channel count only, never on which specific platform you connect.',
},
],
},
publer: {
slug: 'publer',
name: 'Publer',
domain: 'publer.io',
asOf: '2026-10-23',
headline: 'Postiz vs Publer',
subheadline: "The self-host, SDK, CLI, and MCP server Publer structurally can't ship.",
summary:
"Publer is a solid closed-source SaaS scheduler, but it has no self-host option, no npm SDK, no CLI, and no native MCP server. Postiz ships all four, on top of the same multi-channel scheduling Publer offers.",
pricingRows: [
{
label: 'Self-hosting option',
postiz: 'AGPL self-host, full feature parity with cloud',
competitor: 'Not offered - cloud SaaS only',
},
{
label: 'Official npm SDK (@postiz/node)',
postiz: 'Published, documented',
competitor: 'Not offered',
},
{
label: 'CLI tool',
postiz: 'apps/commands CLI',
competitor: 'Not offered',
},
{
label: 'Native MCP server for AI agents',
postiz: 'Built-in (start.mcp.ts)',
competitor: 'Not offered',
},
],
structuralChecklist: structuralChecklistTemplate('Publer'),
featureChecklist: [
{
label: 'Runs your own MCP server',
postiz: true,
competitor: false,
},
{
label: 'Browser extension for quick scheduling',
postiz: true,
competitor: false,
},
{
label: 'Video-to-clips scheduler',
postiz: true,
competitor: false,
},
],
verdict:
"Publer covers day-to-day scheduling well, but anything programmatic - a script, an agent, a CI pipeline, a self-hosted deployment - hits a wall Publer was never built to support. Postiz was.",
faq: [
{
question: 'Can I run Postiz with Claude, ChatGPT, or another AI agent?',
answer:
'Yes - Postiz runs a native MCP server (start.mcp.ts) so AI agents can schedule and manage posts directly. Publer has no equivalent.',
},
{
question: 'Does Publer offer a self-hosted version?',
answer:
'No, Publer is cloud-only. Postiz is AGPL-licensed and can be self-hosted with the same feature set as Postiz Cloud.',
},
],
},
mixpost: {
slug: 'mixpost',
name: 'Mixpost',
domain: 'mixpost.app',
asOf: '2026-10-23',
headline: 'Postiz vs Mixpost',
subheadline:
"The other self-hosted option - won on recurring feature velocity a perpetual license can't match.",
summary:
"Mixpost is the closest direct competitor: open-source and self-hostable. But its Pro tier is a $299 one-time license with an MCP integration and no bundled LLM agent or video-clipping pipeline. Postiz ships a LangGraph agent with live web research, inline DALL-E image generation, and a Temporal-orchestrated video-to-clips pipeline with Deepgram transcription - all included, continuously shipped.",
pricingRows: [
{
label: 'License model',
postiz: 'Open-core, AGPL self-host + managed cloud',
competitor: '$299 one-time perpetual license (Pro)',
},
{
label: 'Bundled LLM agent with live web research',
postiz: 'Included (LangGraph + Tavily)',
competitor: 'Not offered',
},
{
label: 'Video-to-clips pipeline (Deepgram transcription)',
postiz: 'Included',
competitor: 'Not offered',
},
{
label: 'MCP integration',
postiz: 'Native MCP server',
competitor: 'Available on Pro tier',
},
],
structuralChecklist: structuralChecklistTemplate('Mixpost'),
featureChecklist: [
{
label: 'Turn one long video into scheduled clips across every channel',
postiz: true,
competitor: false,
},
{
label: 'Inline AI image generation (DALL-E)',
postiz: true,
competitor: false,
},
{
label: 'Continuously shipped features (no perpetual-license lock)',
postiz: true,
competitor: false,
},
],
verdict:
"Mixpost earned its spot as the self-hosted alternative to SaaS schedulers, and its one-time license is attractive on cost alone. But a perpetual license means a frozen feature set - Postiz's agent graph and video-clipping pipeline are both already-shipped features no competitor in this category, Mixpost included, currently matches.",
faq: [
{
question: 'Is Postiz also open-source and self-hostable like Mixpost?',
answer:
'Yes. Postiz is AGPL-licensed and self-hostable with the exact same feature set as Postiz Cloud - the open-core model gates nothing between the two.',
},
{
question: "What can't Mixpost do that Postiz can?",
answer:
"Mixpost's Pro tier has an MCP integration but no bundled LLM agent graph with live web research, no inline AI image generation, and no video-clipping pipeline. Postiz ships all three today.",
},
],
},
};
export type CompareSlug = keyof typeof compareCompetitors;
export const compareMetaDescription = (data: CompareCompetitor, brandName: string): string =>
`${brandName} vs ${data.name}: ${data.subheadline} Compare pricing, features, and self-hosting options.`;

View File

@ -0,0 +1,215 @@
import Link from 'next/link';
import type { CompareCompetitor } from '@gitroom/frontend/components/compare/compare.data';
const CheckIcon = () => (
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
aria-hidden="true"
className="shrink-0"
>
<path
d="M13.5 4.5L6 12L2.5 8.5"
stroke="currentColor"
strokeWidth="1.75"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);
const CrossIcon = () => (
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
aria-hidden="true"
className="shrink-0"
>
<path
d="M3.5 3.5L12.5 12.5M12.5 3.5L3.5 12.5"
stroke="currentColor"
strokeWidth="1.75"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);
const ChecklistMark = ({ value }: { value: boolean }) => (
<span
className={value ? 'text-customColor28' : 'text-customColor18'}
aria-label={value ? 'Yes' : 'No'}
>
{value ? <CheckIcon /> : <CrossIcon />}
</span>
);
interface CompareLandingPageProps {
data: CompareCompetitor;
brandName: string;
}
export const CompareLandingPage = ({ data, brandName }: CompareLandingPageProps) => {
return (
<div className="bg-newBgColor min-h-screen text-newTextColor">
<header className="border-b border-newBorder px-[24px] py-[20px] flex items-center justify-between max-w-[1040px] mx-auto">
<Link href="/" className="text-[18px] font-semibold tracking-tight">
{brandName}
</Link>
<Link
href="/auth"
className="bg-btnPrimary text-btnText px-[18px] h-[38px] rounded-[6px] flex items-center justify-center text-[14px] font-medium"
>
Start free
</Link>
</header>
<main className="max-w-[1040px] mx-auto px-[24px] py-[56px] flex flex-col gap-[64px]">
{/* Hero */}
<section className="flex flex-col gap-[16px] text-center max-w-[760px] mx-auto">
<h1 className="text-[40px] leading-[1.1] font-semibold tracking-tight">
{data.headline}
</h1>
<p className="text-[20px] opacity-80">{data.subheadline}</p>
<p className="text-[15px] opacity-60 leading-[1.6]">{data.summary}</p>
<div className="flex items-center justify-center gap-[12px] mt-[8px]">
<Link
href="/auth"
className="bg-btnPrimary text-btnText px-[24px] h-[44px] rounded-[6px] flex items-center justify-center text-[15px] font-medium"
>
Try Postiz free
</Link>
<a
href={`https://${data.domain}`}
target="_blank"
rel="nofollow noopener noreferrer"
className="bg-btnSimple text-btnText px-[24px] h-[44px] rounded-[6px] flex items-center justify-center text-[15px] font-medium"
>
Visit {data.name} ↗
</a>
</div>
</section>
{/* Structural moat checklist */}
<section className="flex flex-col gap-[20px]">
<h2 className="text-[24px] font-semibold text-center">
What {data.name} structurally can&apos;t match
</h2>
<div className="border border-newBorder rounded-[8px] overflow-hidden">
<div className="grid grid-cols-[1fr,120px,120px] bg-newBgColorInner text-[13px] opacity-60 px-[20px] py-[12px]">
<div>Capability</div>
<div className="text-center">Postiz</div>
<div className="text-center">{data.name}</div>
</div>
{data.structuralChecklist.map((row, index) => (
<div
key={row.label}
className={`grid grid-cols-[1fr,120px,120px] px-[20px] py-[14px] text-[14px] ${
index % 2 === 1 ? 'bg-newBgColorInner' : ''
}`}
>
<div>{row.label}</div>
<div className="flex justify-center">
<ChecklistMark value={row.postiz} />
</div>
<div className="flex justify-center">
<ChecklistMark value={row.competitor} />
</div>
</div>
))}
</div>
</section>
{/* Pricing comparison */}
<section className="flex flex-col gap-[20px]">
<h2 className="text-[24px] font-semibold text-center">Pricing, side by side</h2>
<div className="border border-newBorder rounded-[8px] overflow-hidden">
<div className="grid grid-cols-[1fr,1fr,1fr] bg-newBgColorInner text-[13px] opacity-60 px-[20px] py-[12px]">
<div></div>
<div className="text-center font-medium">Postiz</div>
<div className="text-center font-medium">{data.name}</div>
</div>
{data.pricingRows.map((row, index) => (
<div
key={row.label}
className={`grid grid-cols-[1fr,1fr,1fr] px-[20px] py-[14px] text-[14px] gap-[8px] ${
index % 2 === 1 ? 'bg-newBgColorInner' : ''
}`}
>
<div className="opacity-70">{row.label}</div>
<div className="text-center font-medium">{row.postiz}</div>
<div className="text-center opacity-80">{row.competitor}</div>
</div>
))}
</div>
<p className="text-[12px] opacity-50 text-center">
Pricing checked against {data.domain} and Postiz&apos;s live pricing config as of{' '}
{data.asOf}. Competitor pricing may change - verify on their site before purchase.
</p>
</section>
{/* Feature checklist */}
<section className="flex flex-col gap-[20px]">
<h2 className="text-[24px] font-semibold text-center">Feature checklist</h2>
<div className="border border-newBorder rounded-[8px] overflow-hidden">
{data.featureChecklist.map((row, index) => (
<div
key={row.label}
className={`grid grid-cols-[1fr,120px,120px] px-[20px] py-[14px] text-[14px] ${
index % 2 === 1 ? 'bg-newBgColorInner' : ''
}`}
>
<div>{row.label}</div>
<div className="flex justify-center">
<ChecklistMark value={row.postiz} />
</div>
<div className="flex justify-center">
<ChecklistMark value={row.competitor} />
</div>
</div>
))}
</div>
</section>
{/* Verdict */}
<section className="flex flex-col gap-[16px] bg-newBgColorInner border border-newBorder rounded-[8px] p-[32px]">
<h2 className="text-[20px] font-semibold">The verdict</h2>
<p className="text-[15px] opacity-80 leading-[1.6]">{data.verdict}</p>
</section>
{/* FAQ */}
<section className="flex flex-col gap-[20px]">
<h2 className="text-[24px] font-semibold text-center">Frequently asked questions</h2>
<div className="flex flex-col gap-[16px]">
{data.faq.map((item) => (
<div
key={item.question}
className="border border-newBorder rounded-[8px] p-[20px]"
>
<div className="text-[15px] font-medium mb-[8px]">{item.question}</div>
<div className="text-[14px] opacity-70 leading-[1.6]">{item.answer}</div>
</div>
))}
</div>
</section>
{/* Bottom CTA */}
<section className="flex flex-col items-center gap-[16px] text-center">
<h2 className="text-[24px] font-semibold">
Switch from {data.name} to {brandName}
</h2>
<Link
href="/auth"
className="bg-btnPrimary text-btnText px-[28px] h-[46px] rounded-[6px] flex items-center justify-center text-[15px] font-medium"
>
Start free, no credit card
</Link>
</section>
</main>
</div>
);
};

View File

@ -5,7 +5,10 @@ import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
import useSWR from 'swr';
import { useToaster } from '@gitroom/react/toaster/toaster';
import { useDecisionModal, useModals } from '@gitroom/frontend/components/layout/new-modal';
import { MediaBox } from '@gitroom/frontend/components/media/media.component';
import {
MediaBox,
mediaLibrarySize,
} from '@gitroom/frontend/components/media/media.component';
import copy from 'copy-to-clipboard';
import { useT } from '@gitroom/react/translation/get.transation.service.client';
@ -102,8 +105,8 @@ export const DeveloperComponent: FC = () => {
askClose: false,
closeOnEscape: true,
fullScreen: true,
size: 'calc(100% - 80px)',
height: 'calc(100% - 80px)',
size: mediaLibrarySize(),
height: mediaLibrarySize(),
children: (close: () => void) => (
<MediaBox
setMedia={changeMedia}
@ -229,7 +232,7 @@ export const DeveloperComponent: FC = () => {
)}
</div>
<div className="bg-newBgColorInner rounded-[12px] border border-newBorder overflow-hidden">
<div className="bg-newBgColorInner px-[20px] py-[14px] border-b border-newBorder flex items-start justify-between gap-[12px]">
<div className="bg-newBgColorInner px-[20px] mobile:px-[14px] py-[14px] border-b border-newBorder flex items-start justify-between gap-[12px] mobile:flex-col">
<div>
<div className="text-[15px] font-[600]">
{t('oauth_application', 'OAuth Application')}
@ -241,7 +244,7 @@ export const DeveloperComponent: FC = () => {
)}
</div>
</div>
<div className="flex gap-[6px] shrink-0 pt-[2px]">
<div className="flex flex-wrap gap-[6px] shrink-0 pt-[2px]">
<a
className="cursor-pointer px-[16px] h-[36px] bg-[#612BD3] hover:bg-[#5520CB] text-white transition-colors rounded-[8px] text-[13px] font-[600] flex items-center gap-[6px]"
href="https://docs.postiz.com/public-api/oauth"
@ -293,7 +296,7 @@ export const DeveloperComponent: FC = () => {
)}
</div>
</div>
<div className="p-[20px] flex flex-col gap-[16px]">
<div className="p-[20px] mobile:p-[14px] flex flex-col gap-[16px]">
<div className="flex flex-col gap-[6px]">
<label className="text-[13px] font-[600] text-customColor18">
{t('app_name', 'App Name')} *
@ -354,7 +357,7 @@ export const DeveloperComponent: FC = () => {
placeholder="https://yourapp.com/callback"
/>
</div>
<div className="flex gap-[8px]">
<div className="flex flex-wrap gap-[8px]">
<button
type="button"
onClick={createApp}
@ -392,7 +395,7 @@ export const DeveloperComponent: FC = () => {
</div>
{/* App details / edit */}
<div className="bg-newBgColorInner rounded-[12px] border border-newBorder overflow-hidden">
<div className="bg-newBgColorInner px-[20px] py-[14px] border-b border-newBorder flex items-start justify-between gap-[12px]">
<div className="bg-newBgColorInner px-[20px] mobile:px-[14px] py-[14px] border-b border-newBorder flex items-start justify-between gap-[12px] mobile:flex-col">
<div>
<div className="text-[15px] font-[600]">
{t('oauth_application', 'OAuth Application')}
@ -404,7 +407,7 @@ export const DeveloperComponent: FC = () => {
)}
</div>
</div>
<div className="flex gap-[6px] shrink-0 pt-[2px]">
<div className="flex flex-wrap gap-[6px] shrink-0 pt-[2px]">
<a
className="cursor-pointer px-[16px] h-[36px] bg-[#612BD3] hover:bg-[#5520CB] text-white transition-colors rounded-[8px] text-[13px] font-[600] flex items-center gap-[6px]"
href="https://docs.postiz.com/public-api/oauth"
@ -417,7 +420,7 @@ export const DeveloperComponent: FC = () => {
</div>
{editing ? (
<div className="p-[20px] flex flex-col gap-[16px]">
<div className="p-[20px] mobile:p-[14px] flex flex-col gap-[16px]">
<div className="flex flex-col gap-[6px]">
<label className="text-[13px] font-[600] text-customColor18">
{t('app_name', 'App Name')} *
@ -478,7 +481,7 @@ export const DeveloperComponent: FC = () => {
placeholder="https://yourapp.com/callback"
/>
</div>
<div className="flex gap-[8px]">
<div className="flex flex-wrap gap-[8px]">
<button
type="button"
onClick={updateApp}
@ -496,7 +499,7 @@ export const DeveloperComponent: FC = () => {
</div>
</div>
) : (
<div className="p-[20px] flex flex-col gap-[16px]">
<div className="p-[20px] mobile:p-[14px] flex flex-col gap-[16px]">
<div className="flex items-center gap-[12px]">
{app.picture?.path ? (
<img
@ -522,9 +525,9 @@ export const DeveloperComponent: FC = () => {
<div className="text-[13px] font-[600] text-customColor18">
{t('redirect_url', 'Redirect URL')}
</div>
<div className="text-[14px]">{app.redirectUrl}</div>
<div className="text-[14px] break-all">{app.redirectUrl}</div>
</div>
<div className="flex gap-[8px]">
<div className="flex flex-wrap gap-[8px]">
<button
type="button"
onClick={startEditing}
@ -545,7 +548,7 @@ export const DeveloperComponent: FC = () => {
{t('credentials', 'Credentials')}
</div>
</div>
<div className="p-[20px] flex flex-col gap-[16px]">
<div className="p-[20px] mobile:p-[14px] flex flex-col gap-[16px]">
<div className="flex flex-col gap-[6px]">
<div className="text-[13px] font-[600] text-customColor18">
{t('client_id', 'Client ID')}
@ -558,7 +561,7 @@ export const DeveloperComponent: FC = () => {
<div className="text-[13px] font-[600] text-customColor18">
{t('client_secret', 'Client Secret')}
</div>
<div className="bg-newBgColorInner border border-newBorder rounded-[8px] px-[16px] h-[44px] flex items-center overflow-hidden">
<div className="bg-newBgColorInner border border-newBorder rounded-[8px] px-[16px] h-[44px] mobile:h-auto mobile:min-h-[44px] mobile:py-[10px] flex items-center overflow-hidden">
{plaintextSecret ? (
<code className="text-[14px] flex-1 truncate">
{plaintextSecret}
@ -573,7 +576,7 @@ export const DeveloperComponent: FC = () => {
)}
</div>
</div>
<div className="flex gap-[8px]">
<div className="flex flex-wrap gap-[8px]">
<CopyButton text={app.clientId} label={t('copy_id', 'Copy ID')} />
{plaintextSecret && (
<CopyButton

View File

@ -209,13 +209,15 @@ export const CustomVariables: FC<{
});
const submit = useCallback(
async (data: FieldValues) => {
const { url } = await (
await fetch(
`/integrations/social/${identifier}${
onboarding ? '?onboarding=true' : ''
}`
)
).json();
const response = await fetch(
`/integrations/social/${identifier}${
onboarding ? '?onboarding=true' : ''
}`
);
if (response.status === 402) {
return;
}
const { url } = await response.json();
modals.closeAll();
gotoUrl(
`/integrations/social/${identifier}?state=${url}&code=${Buffer.from(
@ -433,13 +435,15 @@ export const AddProviderComponent: FC<{
const { component: Web3Providers } = web3List.find(
(item) => item.identifier === identifier
)!;
const { url } = await (
await fetch(
`/integrations/social/${identifier}${
onboarding ? '?onboarding=true' : ''
}`
)
).json();
const response = await fetch(
`/integrations/social/${identifier}${
onboarding ? '?onboarding=true' : ''
}`
);
if (response.status === 402) {
return;
}
const { url } = await response.json();
modal.openModal({
title: `Add ${capitalize(identifier)}`,
withCloseButton: true,
@ -478,17 +482,20 @@ export const AddProviderComponent: FC<{
]
.filter(Boolean)
.join('&');
const { url, err } = await (
await fetch(
`/integrations/social/${identifier}${params ? `?${params}` : ''}`
)
).json();
const response = await fetch(
`/integrations/social/${identifier}${params ? `?${params}` : ''}`
);
if (response.status === 402) {
return;
}
const { url, err, message } = await response.json();
if (err) {
toaster.show(
t(
'could_not_connect_to_platform',
'Could not connect to the platform'
),
message ||
t(
'could_not_connect_to_platform',
'Could not connect to the platform'
),
'warning'
);
return;
@ -548,7 +555,11 @@ export const AddProviderComponent: FC<{
if (!confirmed) {
return;
}
if (!extensionId || !chrome?.runtime?.sendMessage) {
if (
!extensionId ||
typeof chrome === 'undefined' ||
!chrome?.runtime?.sendMessage
) {
modal.openModal({
title: t('extension_not_available_title', 'Extension Not Found'),
withCloseButton: true,
@ -605,13 +616,15 @@ export const AddProviderComponent: FC<{
);
return;
}
const { url } = await (
await fetch(
`/integrations/social/${identifier}${
onboarding ? '?onboarding=true' : ''
}`
)
).json();
const response = await fetch(
`/integrations/social/${identifier}${
onboarding ? '?onboarding=true' : ''
}`
);
if (response.status === 402) {
return;
}
const { url } = await response.json();
modal.closeAll();
window.location.href = `/integrations/social/${identifier}?state=${url}&code=${Buffer.from(
JSON.stringify(cookieResponse.cookies)
@ -676,7 +689,7 @@ export const AddProviderComponent: FC<{
className={clsx(
isMobile && 'gap-[20px] flex flex-col',
!isMobile &&
'grid grid-cols-5 gap-[10px] justify-items-center justify-center',
'grid grid-cols-5 gap-[10px] justify-items-center justify-center mobile:!grid-cols-3',
isMobile ? {} : onboarding ? 'grid-cols-9' : 'grid-cols-5'
)}
>
@ -713,7 +726,7 @@ export const AddProviderComponent: FC<{
className={clsx(
isMobile
? 'flex-row h-[72px] p-[16px]'
: 'flex-col p-[10px] h-[100px] justify-center',
: 'flex-col p-[10px] h-[100px] justify-center mobile:text-[13px] mobile:leading-[1.2]',
'w-full text-[14px] rounded-[8px] bg-newTableHeader text-textColor relative items-center flex gap-[10px] cursor-pointer'
)}
>

View File

@ -147,7 +147,7 @@ export const AiImage: FC<{
<div
onClick={openImageModal}
className={clsx(
'cursor-pointer h-[30px] rounded-[6px] justify-center items-center flex bg-newColColor px-[8px]'
'cursor-pointer h-[30px] mobile:h-[40px] mobile:min-w-[40px] rounded-[6px] mobile:rounded-[8px] justify-center items-center flex bg-newColColor mobile:bg-newSettings px-[8px]'
)}
>
{loading && (
@ -166,6 +166,7 @@ export const AiImage: FC<{
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
className="mobile:w-[20px] mobile:h-[20px]"
viewBox="0 0 16 16"
fill="none"
>

View File

@ -90,7 +90,7 @@ export const Modal: FC<{
<div>
<div className="relative h-[400px]">
<div className="absolute left-0 top-0 w-full h-full overflow-hidden overflow-y-auto">
<div className="mt-[10px] flex w-full justify-center items-center gap-[10px]">
<div className="mt-[10px] flex w-full justify-center items-center gap-[10px] mobile:flex-col mobile:items-stretch">
<div className="flex-1 flex">
<Button
className="!flex-1"
@ -100,7 +100,7 @@ export const Modal: FC<{
Vertical (Stories, Reels)
</Button>
</div>
<div className="flex-1 flex mt-[10px]">
<div className="flex-1 flex mt-[10px] mobile:mt-0">
<Button
className="!flex-1"
onClick={() => setPosition('horizontal')}
@ -213,7 +213,7 @@ export const AiVideo: FC<{
<div
onClick={openVideoModal}
className={clsx(
'cursor-pointer h-[30px] rounded-[6px] justify-center items-center flex bg-newColColor px-[8px]'
'cursor-pointer h-[30px] mobile:h-[40px] mobile:min-w-[40px] rounded-[6px] mobile:rounded-[8px] justify-center items-center flex bg-newColColor mobile:bg-newSettings px-[8px]'
)}
>
{loading && (
@ -229,6 +229,7 @@ export const AiVideo: FC<{
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
className="mobile:w-[20px] mobile:h-[20px]"
viewBox="0 0 16 16"
fill="none"
>

View File

@ -19,7 +19,9 @@ export const BotPicture: FC<{
const t = useT();
const modal = useModals();
const toast = useToaster();
const [nick, setNickname] = useState(props.integration.name);
const [nick, setNickname] = useState(
props.integration.originalName || props.integration.name
);
const [picture, setPicture] = useState(
props.integration.picture || '/no-picture.jpg'
);

View File

@ -0,0 +1,55 @@
'use client';
import { useCallback } from 'react';
import { useModals } from '@gitroom/frontend/components/layout/new-modal';
import { useT } from '@gitroom/react/translation/get.transation.service.client';
import { useCalendar } from '@gitroom/frontend/components/launches/calendar.context';
import { BulkScheduleModal } from '@gitroom/frontend/components/launches/bulk-schedule/bulk.schedule.modal';
export const BulkScheduleButton = () => {
const t = useT();
const modal = useModals();
const { integrations, reloadCalendarView } = useCalendar();
const open = useCallback(() => {
modal.openModal({
title: t('bulk_schedule_title', 'Bulk schedule from CSV'),
withCloseButton: true,
classNames: {
modal: 'text-textColor',
},
children: (close: () => void) => (
<BulkScheduleModal
integrations={integrations}
close={close}
mutate={reloadCalendarView}
/>
),
});
}, [integrations]);
return (
<div
className="h-[44px] w-[44px] group-[.sidebar]:w-full bg-btnSimple text-btnText justify-center items-center flex rounded-[8px] cursor-pointer"
onClick={open}
data-tooltip-id="tooltip"
data-tooltip-content={t('bulk_schedule_title', 'Bulk schedule from CSV')}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={1.8}
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<path d="M14 2v6h6" />
<path d="M9 15h6M9 11h6M9 19h3" />
</svg>
</div>
);
};

View File

@ -0,0 +1,75 @@
import { parseBulkScheduleCsv, rowsToBulkSchedule } from './bulk.schedule.modal';
describe('parseBulkScheduleCsv', () => {
it('parses a simple header + rows CSV', () => {
const csv = 'date,content\n2026-11-01 09:00,Hello world\n2026-11-02 09:00,Second post';
expect(parseBulkScheduleCsv(csv)).toEqual([
['date', 'content'],
['2026-11-01 09:00', 'Hello world'],
['2026-11-02 09:00', 'Second post'],
]);
});
it('handles quoted fields with embedded commas and escaped quotes', () => {
const csv = 'date,content\n2026-11-01 09:00,"Hello, ""world"""';
expect(parseBulkScheduleCsv(csv)).toEqual([
['date', 'content'],
['2026-11-01 09:00', 'Hello, "world"'],
]);
});
it('handles CRLF line endings', () => {
const csv = 'date,content\r\n2026-11-01 09:00,One\r\n2026-11-02 09:00,Two';
expect(parseBulkScheduleCsv(csv)).toEqual([
['date', 'content'],
['2026-11-01 09:00', 'One'],
['2026-11-02 09:00', 'Two'],
]);
});
it('skips blank lines', () => {
const csv = 'date,content\n\n2026-11-01 09:00,One\n\n';
expect(parseBulkScheduleCsv(csv)).toEqual([
['date', 'content'],
['2026-11-01 09:00', 'One'],
]);
});
});
describe('rowsToBulkSchedule', () => {
it('drops a recognized date,content header row', () => {
const rows = [
['date', 'content'],
['2026-11-01T09:00:00Z', 'Hello'],
];
const parsed = rowsToBulkSchedule(rows);
expect(parsed).toHaveLength(1);
expect(parsed[0].error).toBeUndefined();
expect(parsed[0].content).toBe('Hello');
});
it('treats every row as data when there is no header', () => {
const rows = [['2026-11-01T09:00:00Z', 'Hello']];
const parsed = rowsToBulkSchedule(rows);
expect(parsed).toHaveLength(1);
expect(parsed[0].error).toBeUndefined();
});
it('flags a row with an invalid date', () => {
const rows = [
['date', 'content'],
['not-a-date', 'Hello'],
];
const parsed = rowsToBulkSchedule(rows);
expect(parsed[0].error).toMatch(/date/i);
});
it('flags a row with no content', () => {
const rows = [
['date', 'content'],
['2026-11-01T09:00:00Z', ''],
];
const parsed = rowsToBulkSchedule(rows);
expect(parsed[0].error).toMatch(/content/i);
});
});

View File

@ -0,0 +1,317 @@
'use client';
import { FC, useCallback, useMemo, useState } from 'react';
import dayjs from 'dayjs';
import clsx from 'clsx';
import useSWR from 'swr';
import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
import { useToaster } from '@gitroom/react/toaster/toaster';
import { useT } from '@gitroom/react/translation/get.transation.service.client';
import { Button } from '@gitroom/react/form/button';
import { Integrations } from '@gitroom/frontend/components/launches/calendar.context';
import { LoadingComponent } from '@gitroom/frontend/components/layout/loading';
// Bulk CSV scheduling only ever had a bare date/content row to work with (no
// media, no per-provider settings), so it only supports the platforms that
// don't need extra settings beyond their identifier. The actual list isn't
// hardcoded here — it's fetched from GET /posts/bulk-schedule/supported-providers,
// which returns the same generic, data-driven simpleTextProviders() the
// backend enforces in bulkSchedule(), so this never drifts out of sync.
const useBulkScheduleSupportedProviders = () => {
const fetch = useFetch();
const load = useCallback(async () => {
return (
await (await fetch('/posts/bulk-schedule/supported-providers')).json()
).providers as string[];
}, []);
return useSWR<string[]>('/posts/bulk-schedule/supported-providers', load, {
revalidateOnFocus: false,
fallbackData: [],
});
};
export interface ParsedBulkRow {
line: number;
date: string;
content: string;
error?: string;
}
// A tiny RFC4180-ish CSV parser: two columns (date, content), quoted fields
// may contain commas/newlines, "" inside a quoted field is a literal quote.
// Good enough for the simple two-column sheet this feature asks for, not a
// general-purpose CSV library.
export const parseBulkScheduleCsv = (csv: string): string[][] => {
const rows: string[][] = [];
let row: string[] = [];
let field = '';
let inQuotes = false;
for (let i = 0; i < csv.length; i++) {
const char = csv[i];
const next = csv[i + 1];
if (inQuotes) {
if (char === '"' && next === '"') {
field += '"';
i++;
} else if (char === '"') {
inQuotes = false;
} else {
field += char;
}
continue;
}
if (char === '"') {
inQuotes = true;
} else if (char === ',') {
row.push(field);
field = '';
} else if (char === '\n' || char === '\r') {
if (char === '\r' && next === '\n') {
i++;
}
row.push(field);
field = '';
rows.push(row);
row = [];
} else {
field += char;
}
}
if (field.length || row.length) {
row.push(field);
rows.push(row);
}
return rows.filter((r) => r.some((cell) => cell.trim().length));
};
export const rowsToBulkSchedule = (rows: string[][]): ParsedBulkRow[] => {
const dataRows =
rows.length &&
rows[0][0]?.trim().toLowerCase() === 'date' &&
rows[0][1]?.trim().toLowerCase() === 'content'
? rows.slice(1)
: rows;
return dataRows.map((cols, index) => {
const date = (cols[0] || '').trim();
const content = (cols[1] || '').trim();
const line = index + 1;
if (!date || !dayjs(date).isValid()) {
return { line, date, content, error: 'Invalid or missing date' };
}
if (!content) {
return { line, date, content, error: 'Missing content' };
}
return { line, date: dayjs(date).toISOString(), content };
});
};
interface BulkScheduleResult {
row: number;
success: boolean;
postId?: string;
error?: string;
}
export const BulkScheduleModal: FC<{
integrations: Integrations[];
close: () => void;
mutate: () => void;
}> = ({ integrations, close, mutate }) => {
const t = useT();
const fetch = useFetch();
const toaster = useToaster();
const { data: supportedProviders, isLoading: loadingProviders } =
useBulkScheduleSupportedProviders();
const [integrationId, setIntegrationId] = useState('');
const [csvText, setCsvText] = useState('');
const [submitting, setSubmitting] = useState(false);
const [results, setResults] = useState<BulkScheduleResult[] | null>(null);
const supportedIntegrations = useMemo(
() =>
integrations.filter(
(integration) =>
!integration.disabled &&
(supportedProviders || []).includes(integration.identifier)
),
[integrations, supportedProviders]
);
const parsedRows = useMemo(() => {
if (!csvText.trim()) {
return [];
}
return rowsToBulkSchedule(parseBulkScheduleCsv(csvText));
}, [csvText]);
const validRows = useMemo(
() => parsedRows.filter((row) => !row.error),
[parsedRows]
);
const submit = useCallback(async () => {
if (!integrationId || !validRows.length) {
return;
}
setSubmitting(true);
setResults(null);
try {
const response = await fetch('/posts/bulk-schedule', {
method: 'POST',
body: JSON.stringify({
integration: { id: integrationId },
posts: validRows.map((row) => ({
date: row.date,
content: row.content,
})),
}),
});
if (!response.ok) {
const body = await response.json().catch(() => ({}));
toaster.show(
body?.message ||
t('bulk_schedule_failed', 'Could not schedule these posts'),
'warning'
);
return;
}
const data: BulkScheduleResult[] = await response.json();
setResults(data);
const succeeded = data.filter((r) => r.success).length;
if (succeeded) {
toaster.show(
t('bulk_schedule_success', '{{count}} posts scheduled', {
count: succeeded,
}),
'success'
);
mutate();
}
} finally {
setSubmitting(false);
}
}, [integrationId, validRows, mutate]);
if (loadingProviders) {
return <LoadingComponent />;
}
return (
<div className="flex flex-col gap-[16px] min-w-[560px] max-w-[640px]">
<div className="text-[13px] text-textItemBlur">
{t(
'bulk_schedule_hint',
'Paste a CSV with "date" and "content" columns (one post per row) to schedule many posts at once. Only works for channels that don\'t need extra settings: {{providers}}.',
{ providers: (supportedProviders || []).join(', ') }
)}
</div>
<div className="flex flex-col gap-[6px]">
<div className="text-[13px] font-[600]">
{t('bulk_schedule_channel', 'Channel')}
</div>
{supportedIntegrations.length === 0 ? (
<div className="text-[13px] text-red-400">
{t(
'bulk_schedule_no_channels',
'Connect one of these channels first: {{providers}}.',
{ providers: (supportedProviders || []).join(', ') }
)}
</div>
) : (
<div className="flex flex-col gap-[6px]">
{supportedIntegrations.map((integration) => (
<div
key={integration.id}
onClick={() => setIntegrationId(integration.id)}
className={clsx(
'flex items-center gap-[10px] p-[10px] rounded-[8px] border cursor-pointer transition-all',
integrationId === integration.id
? 'border-forth bg-forth/10'
: 'border-tableBorder hover:border-textColor/30'
)}
>
<img
src={integration.picture || '/no-picture.jpg'}
className="w-[24px] h-[24px] rounded-[6px]"
alt={integration.name}
/>
<div className="text-[13px]">{integration.name}</div>
</div>
))}
</div>
)}
</div>
<textarea
className="w-full h-[180px] p-[12px] rounded-[8px] bg-input border border-tableBorder text-textColor font-mono text-[13px] resize-y"
placeholder={
'date,content\n2026-11-01 09:00,First post\n2026-11-02 09:00,Second post'
}
value={csvText}
onChange={(e) => setCsvText(e.target.value)}
/>
{!!parsedRows.length && (
<div className="flex flex-col gap-[4px] max-h-[160px] overflow-y-auto text-[12px]">
{parsedRows.map((row) => (
<div
key={row.line}
className={clsx(
'flex gap-[8px]',
row.error ? 'text-red-400' : 'text-textItemBlur'
)}
>
<div className="w-[16px]">{row.line}.</div>
<div className="flex-1 truncate">
{row.error || `${row.date} — ${row.content}`}
</div>
</div>
))}
</div>
)}
{!!results && (
<div className="flex flex-col gap-[4px] max-h-[160px] overflow-y-auto text-[12px]">
{results.map((r) => (
<div
key={r.row}
className={r.success ? 'text-green-400' : 'text-red-400'}
>
{t('row', 'Row')} {r.row + 1}:{' '}
{r.success
? t('scheduled', 'Scheduled')
: r.error || t('failed', 'Failed')}
</div>
))}
</div>
)}
<div className="flex justify-end gap-[10px]">
<Button type="button" secondary={true} onClick={close}>
{t('cancel', 'Cancel')}
</Button>
<Button
onClick={submit}
loading={submitting}
disabled={!integrationId || !validRows.length}
>
{t('bulk_schedule_submit', 'Schedule {{count}} posts', {
count: validRows.length,
})}
</Button>
</div>
</div>
);
};

View File

@ -84,10 +84,16 @@ export const CalendarContext = createContext({
setListState: (state: ListStateFilter) => {
/** empty **/
},
selectedChannels: null as string[] | null,
setSelectedChannels: (channels: string[] | null) => {
/** empty **/
},
currentHour: newDayjs().startOf('hour'),
});
export interface Integrations {
name: string;
originalName?: string;
id: string;
disabled?: boolean;
inBetweenSteps: boolean;
@ -137,6 +143,23 @@ function getDateRange(display: string, referenceDate?: string) {
}
}
// The current time rounded down to the unit. It checks on every minute, so it
// also catches up within a minute after the computer wakes up from sleep.
export const useNow = (unit: 'minute' | 'hour' = 'minute') => {
const [now, setNow] = useState(() => newDayjs().startOf(unit).valueOf());
useEffect(() => {
let timeout: NodeJS.Timeout;
const tick = () => {
// same number = no re-render, so the hour clock only renders once an hour
setNow(newDayjs().startOf(unit).valueOf());
timeout = setTimeout(tick, 60000 - (Date.now() % 60000));
};
tick();
return () => clearTimeout(timeout);
}, [unit]);
return useMemo(() => newDayjs(now), [now]);
};
export const CalendarWeekProvider: FC<{
children: ReactNode;
integrations: Integrations[];
@ -145,7 +168,14 @@ export const CalendarWeekProvider: FC<{
const [internalData, setInternalData] = useState([] as any[]);
const [trendings] = useState<string[]>([]);
const searchParams = useSearchParams();
const [displaySaved, setDisplaySaved] = useCookie('calendar-display', 'week');
// A 7-column week doesn't fit a phone, so default small screens (tailwind `mobile`) to the day view
const [displaySaved, setDisplaySaved] = useCookie(
'calendar-display',
typeof window !== 'undefined' &&
window.matchMedia('(max-width: 1025px)').matches
? 'day'
: 'week'
);
const display = searchParams.get('display') || displaySaved;
// List view state
@ -166,6 +196,14 @@ export const CalendarWeekProvider: FC<{
? { startDate: initStartDate, endDate: initEndDate }
: getDateRange(display);
const [selectedChannels, setSelectedChannelsRaw] = useState<
string[] | null
>(null);
const setSelectedChannels = useCallback((next: string[] | null) => {
setSelectedChannelsRaw(next);
setListPage(0);
}, []);
const [filters, setFilters] = useState({
startDate: initialRange.startDate,
endDate: initialRange.endDate,
@ -173,6 +211,10 @@ export const CalendarWeekProvider: FC<{
display,
});
useEffect(() => {
setSelectedChannels(null);
}, [filters.customer]);
const params = useMemo(() => {
return new URLSearchParams({
display: filters.display,
@ -202,8 +244,9 @@ export const CalendarWeekProvider: FC<{
limit: '100',
customer: filters?.customer?.toString() || '',
state: listState,
...(selectedChannels ? { integrations: selectedChannels.join(',') } : {}),
}).toString();
}, [listPage, filters.customer, listState]);
}, [listPage, filters.customer, listState, selectedChannels]);
const loadListData = useCallback(async () => {
const response = await fetch(`/posts/list?${listParams}`);
@ -294,6 +337,14 @@ export const CalendarWeekProvider: FC<{
[]
);
const filterByChannels = useCallback(
(list: any[]) =>
selectedChannels
? list.filter((p) => selectedChannels.includes(p.integration.id))
: list,
[selectedChannels]
);
const posts = useMemo(() => calendarData?.posts || [], [calendarData?.posts]);
const comments = useMemo(() => calendarData?.comments || [], [calendarData?.comments]);
@ -334,13 +385,16 @@ export const CalendarWeekProvider: FC<{
// Determine loading state based on current view
const loading = filters.display === 'list' ? listIsLoading : calendarIsLoading;
// one clock for every calendar cell, instead of a timer per cell
const currentHour = useNow('hour');
return (
<CalendarContext.Provider
value={{
trendings,
reloadCalendarView,
...filters,
posts: calendarIsLoading ? [] : internalData,
posts: calendarIsLoading ? [] : filterByChannels(internalData),
loading,
integrations,
setFilters: setFiltersWrapper,
@ -355,6 +409,9 @@ export const CalendarWeekProvider: FC<{
setListPage,
listState,
setListState,
selectedChannels,
setSelectedChannels,
currentHour,
}}
>
{children}

File diff suppressed because it is too large Load Diff

View File

@ -183,7 +183,11 @@ export const ContinueIntegration: FC<{
jwt: extensionToken,
backendUrl,
},
() => {}
() => {
if (chrome.runtime.lastError) {
return;
}
}
);
} catch {
// Silently ignore — extension may not be available

View File

@ -0,0 +1,193 @@
import { FC, useCallback, useState } from 'react';
import useSWR from 'swr';
import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
import { useT } from '@gitroom/react/translation/get.transation.service.client';
import { useToaster } from '@gitroom/react/toaster/toaster';
import { Button } from '@gitroom/react/form/button';
import { Input } from '@gitroom/react/form/input';
import { LoadingComponent } from '@gitroom/frontend/components/layout/loading';
import dayjs from 'dayjs';
interface EvergreenRecycle {
id: string;
active: boolean;
intervalDays: number;
maxRecycles: number | null;
totalRecycles: number;
lastRecycledAt: string | null;
nextRecycleAt: string;
}
// Content recycling for an already-published post (Organization ->
// EvergreenRecycle, see schema.prisma). The actual republishing happens in
// the daily evergreenRecycleWorkflow batch, not from this modal - this is
// just schedule management (create/pause/resume/remove).
export const EvergreenModal: FC<{ postId: string }> = ({ postId }) => {
const t = useT();
const fetch = useFetch();
const toast = useToaster();
const [intervalDays, setIntervalDays] = useState('30');
const [maxRecycles, setMaxRecycles] = useState('');
const [loading, setLoading] = useState(false);
const load = useCallback(async () => {
return (await fetch(`/posts/${postId}/evergreen`)).json();
}, [postId]);
const { data, isLoading, mutate } = useSWR<EvergreenRecycle[]>(
`/posts/${postId}/evergreen`,
load
);
const create = useCallback(async () => {
const days = Number(intervalDays);
if (!days || days < 1) {
toast.show(
t('evergreen_invalid_interval', 'Enter how many days between recycles'),
'warning'
);
return;
}
setLoading(true);
try {
const response = await fetch(`/posts/${postId}/evergreen`, {
method: 'POST',
body: JSON.stringify({
intervalDays: days,
...(maxRecycles ? { maxRecycles: Number(maxRecycles) } : {}),
}),
});
if (!response.ok) {
const body = await response.json().catch(() => ({}));
toast.show(
body?.message ||
t('evergreen_create_failed', 'Could not enable recycling'),
'warning'
);
return;
}
toast.show(
t('evergreen_created', 'This post will be recycled automatically'),
'success'
);
await mutate();
} finally {
setLoading(false);
}
}, [intervalDays, maxRecycles, postId, mutate]);
const toggleActive = useCallback(
(entry: EvergreenRecycle) => async () => {
await fetch(`/posts/evergreen/${entry.id}`, {
method: 'PUT',
body: JSON.stringify({ active: !entry.active }),
});
mutate();
},
[mutate]
);
const remove = useCallback(
(entry: EvergreenRecycle) => async () => {
await fetch(`/posts/evergreen/${entry.id}`, { method: 'DELETE' });
mutate();
},
[mutate]
);
return (
<div className="flex flex-col gap-[16px]">
<div className="text-[13px] text-textItemBlur">
{t(
'evergreen_hint',
'Automatically republish this post as a brand-new post every N days, so it keeps reaching new followers without touching the original.'
)}
</div>
{isLoading ? (
<LoadingComponent />
) : (
<>
{!!data?.length && (
<div className="flex flex-col gap-[8px]">
{data.map((entry) => (
<div
key={entry.id}
className="flex items-center justify-between gap-[10px] rounded-[8px] border border-tableBorder p-[10px] text-[13px]"
>
<div className="flex flex-col gap-[2px]">
<div>
{t('evergreen_every_days', 'Every {{days}} days', {
days: entry.intervalDays,
})}
{entry.maxRecycles
? ` · ${t('evergreen_max', 'max {{max}}', {
max: entry.maxRecycles,
})}`
: ''}
</div>
<div className="text-[11px] text-textItemBlur">
{t('evergreen_recycled_count', '{{count}} recycled', {
count: entry.totalRecycles,
})}
{entry.active
? ` · ${t('evergreen_next', 'next')} ${dayjs(
entry.nextRecycleAt
).format('MMM D, YYYY')}`
: ` · ${t('paused', 'Paused')}`}
</div>
</div>
<div className="flex gap-[10px]">
<button
type="button"
className="text-[12px] hover:underline"
onClick={toggleActive(entry)}
>
{entry.active
? t('pause', 'Pause')
: t('resume', 'Resume')}
</button>
<button
type="button"
className="text-[12px] hover:underline"
onClick={remove(entry)}
>
{t('remove', 'Remove')}
</button>
</div>
</div>
))}
</div>
)}
<div className="flex items-end gap-[10px]">
<div className="flex-1">
<Input
label={t('evergreen_interval_label', 'Days between recycles')}
name="intervalDays"
disableForm={true}
value={intervalDays}
onChange={(e: { target: { value: string } }) =>
setIntervalDays(e.target.value)
}
/>
</div>
<div className="flex-1">
<Input
label={t('evergreen_max_label', 'Max recycles (optional)')}
name="maxRecycles"
disableForm={true}
value={maxRecycles}
onChange={(e: { target: { value: string } }) =>
setMaxRecycles(e.target.value)
}
/>
</div>
<Button loading={loading} onClick={create}>
{t('evergreen_add', 'Add schedule')}
</Button>
</div>
</>
)}
</div>
);
};

View File

@ -3,11 +3,14 @@
import { useCalendar, ListStateFilter } from '@gitroom/frontend/components/launches/calendar.context';
import clsx from 'clsx';
import dayjs from 'dayjs';
import { useCallback } from 'react';
import { useCallback, useState } from 'react';
import { SelectCustomer } from '@gitroom/frontend/components/launches/select.customer';
import { SelectChannels } from '@gitroom/frontend/components/launches/select.channels';
import { useT } from '@gitroom/react/translation/get.transation.service.client';
import i18next from 'i18next';
import { newDayjs } from '@gitroom/frontend/components/layout/set.timezone';
import { BottomSheet } from '@gitroom/frontend/components/ui/bottom.sheet.component';
import { FilterIcon } from '@gitroom/frontend/components/ui/icons';
// Helper function to get start and end dates based on display type
function getDateRange(
@ -43,19 +46,20 @@ function getDateRange(
export const Filters = () => {
const calendar = useCalendar();
const t = useT();
const [filtersOpen, setFiltersOpen] = useState(false);
// Set dayjs locale based on current language
const currentLanguage = i18next.resolvedLanguage || 'en';
dayjs.locale();
// Calculate display date range text
const getDisplayText = () => {
// Calculate display date range text, short is the phone version
const getDisplayText = (short?: boolean) => {
const startDate = newDayjs(calendar.startDate);
const endDate = newDayjs(calendar.endDate);
switch (calendar.display) {
case 'day':
return startDate.format('dddd (L)');
return startDate.format(short ? 'ddd (L)' : 'dddd (L)');
case 'week':
return `${startDate.format('L')} - ${endDate.format('L')}`;
case 'month':
@ -287,13 +291,14 @@ export const Filters = () => {
}, [calendar]);
return (
<div className="text-textColor flex flex-col md:flex-row gap-[8px] items-center select-none">
<div className="text-textColor flex flex-row flex-wrap gap-[8px] items-center select-none">
{/* phones: view switcher and filter first, then the date or list row */}
{!isListView && (
<div className="flex flex-grow flex-row items-center gap-[10px]">
<div className="border h-[42px] border-newTableBorder bg-newTableBorder gap-[1px] flex items-center rounded-[8px] overflow-hidden">
<div className="flex flex-grow flex-row items-center gap-[10px] mobile:order-3 mobile:basis-full mobile:min-w-0 mobile:gap-[8px]">
<div className="border h-[42px] border-newTableBorder bg-newTableBorder gap-[1px] flex items-center rounded-[8px] overflow-hidden mobile:flex-1 mobile:min-w-0">
<div
onClick={previous}
className="cursor-pointer text-textColor rtl:rotate-180 px-[9px] bg-newBgColorInner h-full flex items-center justify-center hover:text-textItemFocused hover:bg-boxFocused"
className="cursor-pointer text-textColor rtl:rotate-180 px-[9px] mobile:px-0 mobile:w-[36px] bg-newBgColorInner h-full flex items-center justify-center hover:text-textItemFocused hover:bg-boxFocused"
>
<svg
xmlns="http://www.w3.org/2000/svg"
@ -311,14 +316,17 @@ export const Filters = () => {
/>
</svg>
</div>
<div className="min-w-[200px] text-center bg-newBgColorInner h-full flex items-center justify-center">
<div className="py-[3px] px-[9px] rounded-[5px] transition-all text-[14px]">
{getDisplayText()}
<div className="min-w-[200px] mobile:min-w-0 mobile:flex-1 text-center bg-newBgColorInner h-full flex items-center justify-center">
<div className="py-[3px] px-[9px] mobile:px-[4px] rounded-[5px] transition-all text-[14px] mobile:truncate">
<span className="mobile:hidden">{getDisplayText()}</span>
<span className="hidden mobile:inline">
{getDisplayText(true)}
</span>
</div>
</div>
<div
onClick={next}
className="cursor-pointer text-textColor rtl:rotate-180 px-[9px] bg-newBgColorInner h-full flex items-center justify-center hover:text-textItemFocused hover:bg-boxFocused"
className="cursor-pointer text-textColor rtl:rotate-180 px-[9px] mobile:px-0 mobile:w-[36px] bg-newBgColorInner h-full flex items-center justify-center hover:text-textItemFocused hover:bg-boxFocused"
>
<svg
xmlns="http://www.w3.org/2000/svg"
@ -337,7 +345,7 @@ export const Filters = () => {
</svg>
</div>
</div>
<div className="flex-1 text-[14px] font-[500]">
<div className="flex-1 mobile:flex-none text-[14px] font-[500]">
<div className="text-center flex h-[42px]">
<div
onClick={setToday}
@ -350,12 +358,17 @@ export const Filters = () => {
</div>
)}
{isListView && (
<div className="flex flex-grow flex-row items-center gap-[10px]">
<div className="border h-[42px] border-newTableBorder bg-newTableBorder gap-[1px] flex items-center rounded-[8px] overflow-hidden">
<div className="flex flex-grow flex-row items-center gap-[10px] mobile:flex-wrap mobile:order-3 mobile:basis-full mobile:min-w-0 mobile:gap-[8px]">
<div
className={clsx(
'border h-[42px] border-newTableBorder bg-newTableBorder gap-[1px] flex items-center rounded-[8px] overflow-hidden mobile:order-2 mobile:w-full',
calendar.listTotalPages <= 1 && 'mobile:hidden'
)}
>
<div
onClick={previousPage}
className={clsx(
'text-textColor rtl:rotate-180 px-[9px] bg-newBgColorInner h-full flex items-center justify-center',
'text-textColor rtl:rotate-180 px-[9px] mobile:px-0 mobile:w-[36px] bg-newBgColorInner h-full flex items-center justify-center',
calendar.listPage > 0
? 'cursor-pointer hover:text-textItemFocused hover:bg-boxFocused'
: 'opacity-50 cursor-not-allowed'
@ -377,7 +390,7 @@ export const Filters = () => {
/>
</svg>
</div>
<div className="min-w-[200px] text-center bg-newBgColorInner h-full flex items-center justify-center">
<div className="min-w-[200px] mobile:min-w-0 mobile:flex-1 text-center bg-newBgColorInner h-full flex items-center justify-center">
<div className="py-[3px] px-[9px] rounded-[5px] transition-all text-[14px]">
{t('page', 'Page')} {calendar.listPage + 1} {t('of', 'of')} {Math.max(1, calendar.listTotalPages)}
</div>
@ -385,7 +398,7 @@ export const Filters = () => {
<div
onClick={nextPage}
className={clsx(
'text-textColor rtl:rotate-180 px-[9px] bg-newBgColorInner h-full flex items-center justify-center',
'text-textColor rtl:rotate-180 px-[9px] mobile:px-0 mobile:w-[36px] bg-newBgColorInner h-full flex items-center justify-center',
calendar.listPage < calendar.listTotalPages - 1
? 'cursor-pointer hover:text-textItemFocused hover:bg-boxFocused'
: 'opacity-50 cursor-not-allowed'
@ -408,13 +421,13 @@ export const Filters = () => {
</svg>
</div>
</div>
<div className="flex flex-row p-[4px] border border-newTableBorder rounded-[8px] text-[14px] font-[500]">
<div className="flex flex-row p-[4px] border border-newTableBorder rounded-[8px] text-[14px] font-[500] mobile:order-1 mobile:w-full mobile:overflow-x-auto">
{listStateOptions.map((option) => (
<div
key={option.value}
onClick={setListStateFilter(option.value)}
className={clsx(
'pt-[6px] pb-[5px] cursor-pointer min-w-[80px] px-[12px] text-center rounded-[6px]',
'pt-[6px] pb-[5px] cursor-pointer min-w-[80px] px-[12px] text-center rounded-[6px] mobile:flex-1 mobile:min-w-fit mobile:px-[8px] mobile:whitespace-nowrap',
calendar.listState === option.value &&
'text-textItemFocused bg-boxFocused'
)}
@ -423,46 +436,79 @@ export const Filters = () => {
</div>
))}
</div>
<div className="flex-1" />
<div className="flex-1 mobile:hidden" />
</div>
)}
<SelectCustomer
customer={calendar.customer as string}
onChange={(customer: string) => setCustomer(customer)}
integrations={calendar.integrations}
/>
{!isListView && (
<div className="flex flex-row p-[4px] border border-newTableBorder rounded-[8px] text-[14px] font-[500]">
<div
className={clsx(
'pt-[6px] pb-[5px] cursor-pointer w-[74px] text-center rounded-[6px]',
calendar.display === 'day' && 'text-textItemFocused bg-boxFocused'
)}
onClick={setDay}
>
{t('day', 'Day')}
</div>
<div
className={clsx(
'pt-[6px] pb-[5px] cursor-pointer w-[74px] text-center rounded-[6px]',
calendar.display === 'week' && 'text-textItemFocused bg-boxFocused'
)}
onClick={setWeek}
>
{t('week', 'Week')}
</div>
<div
className={clsx(
'pt-[6px] pb-[5px] cursor-pointer w-[74px] text-center rounded-[6px]',
calendar.display === 'month' && 'text-textItemFocused bg-boxFocused'
)}
onClick={setMonth}
>
{t('month', 'Month')}
</div>
{/* phones get a single filter button that opens the filters sheet */}
<div className="contents mobile:hidden">
<SelectCustomer
customer={calendar.customer as string}
onChange={(customer: string) => setCustomer(customer)}
integrations={calendar.integrations}
/>
<SelectChannels />
</div>
{calendar.integrations.length > 1 && (
<div
onClick={() => setFiltersOpen(true)}
className={clsx(
'hidden mobile:flex mobile:order-2 relative w-[42px] h-[42px] rounded-[8px] border justify-center items-center cursor-pointer',
calendar.selectedChannels
? 'border-[#612BD3] text-[#612BD3]'
: 'border-newTableBorder'
)}
>
<FilterIcon />
{calendar.selectedChannels && (
<div className="absolute top-[6px] end-[6px] w-[6px] h-[6px] rounded-full bg-[#612BD3]" />
)}
</div>
)}
<div className="flex flex-row p-[4px] border border-newTableBorder rounded-[8px] text-[14px] font-[500]">
<div
className={clsx(
'flex flex-row p-[4px] border border-newTableBorder rounded-[8px] text-[14px] font-[500] mobile:order-1 mobile:flex-1 mobile:overflow-x-auto',
isListView && 'hidden mobile:flex'
)}
>
<div
className={clsx(
'pt-[6px] pb-[5px] cursor-pointer w-[74px] mobile:w-auto mobile:flex-1 mobile:min-w-fit mobile:px-[6px] mobile:whitespace-nowrap text-center rounded-[6px]',
calendar.display === 'day' && 'text-textItemFocused bg-boxFocused'
)}
onClick={setDay}
>
{t('day', 'Day')}
</div>
<div
className={clsx(
'pt-[6px] pb-[5px] cursor-pointer w-[74px] mobile:w-auto mobile:flex-1 mobile:min-w-fit mobile:px-[6px] mobile:whitespace-nowrap text-center rounded-[6px]',
calendar.display === 'week' && 'text-textItemFocused bg-boxFocused'
)}
onClick={setWeek}
>
{t('week', 'Week')}
</div>
<div
className={clsx(
'pt-[6px] pb-[5px] cursor-pointer w-[74px] mobile:w-auto mobile:flex-1 mobile:min-w-fit mobile:px-[6px] mobile:whitespace-nowrap text-center rounded-[6px]',
calendar.display === 'month' && 'text-textItemFocused bg-boxFocused'
)}
onClick={setMonth}
>
{t('month', 'Month')}
</div>
{/* the list toggle joins the view switcher on phones */}
<div
className={clsx(
'hidden mobile:block pt-[6px] pb-[5px] cursor-pointer mobile:flex-1 mobile:min-w-fit mobile:px-[6px] mobile:whitespace-nowrap text-center rounded-[6px]',
isListView && 'text-textItemFocused bg-boxFocused'
)}
onClick={setList}
>
{t('list', 'List')}
</div>
</div>
<div className="flex flex-row p-[4px] border border-newTableBorder rounded-[8px] text-[14px] font-[500] mobile:hidden">
<div
onClick={setCalendarView}
className={clsx(
@ -512,6 +558,24 @@ export const Filters = () => {
</svg>
</div>
</div>
{filtersOpen && (
<BottomSheet
title={t('select_channels', 'Select Channels')}
onClose={() => setFiltersOpen(false)}
button={{
label: t('done', 'Done'),
onClick: () => setFiltersOpen(false),
}}
>
<SelectCustomer
list={true}
customer={calendar.customer as string}
onChange={(customer: string) => setCustomer(customer)}
integrations={calendar.integrations}
/>
<SelectChannels list={true} />
</BottomSheet>
)}
</div>
);
};

View File

@ -111,6 +111,7 @@ export const GeneralPreviewComponent: FC<{
</div>
</div>
<div
dir="auto"
className={clsx('text-wrap whitespace-pre', 'preview')}
dangerouslySetInnerHTML={{
__html: value.text,

View File

@ -1,26 +1,73 @@
import { FC, useCallback, useState } from 'react';
import dayjs from 'dayjs';
import clsx from 'clsx';
import { Calendar, TimeInput } from '@mantine/dates';
import { useClickOutside } from '@mantine/hooks';
import { Button } from '@gitroom/react/form/button';
import { isUSCitizen } from './isuscitizen.utils';
import { useT } from '@gitroom/react/translation/get.transation.service.client';
import { newDayjs } from '@gitroom/frontend/components/layout/set.timezone';
import { CalendarIcon } from '@gitroom/frontend/components/ui/icons';
export const DatePicker: FC<{
import {
CalendarIcon,
ChevronLeftIcon,
ChevronRightIcon,
DropdownArrowIcon,
} from '@gitroom/frontend/components/ui/icons';
// one part of the time in the mobile sheet, typed or stepped with the arrows
const TimeField: FC<{
value: number;
min: number;
max: number;
pad?: boolean;
onChange: (value: number) => void;
}> = ({ value, min, max, pad, onChange }) => {
const [text, setText] = useState<string | null>(null);
const format = (num: number) =>
pad ? String(num).padStart(2, '0') : String(num);
const step = (delta: number) => () => {
const range = max - min + 1;
onChange(((value - min + delta + range) % range) + min);
};
return (
<div className="w-[74px] min-w-[56px] flex flex-col items-center gap-[4px] text-textItemBlur">
<div onClick={step(1)} className="cursor-pointer">
<DropdownArrowIcon rotated={true} />
</div>
<input
value={text ?? format(value)}
placeholder={format(value)}
inputMode="numeric"
maxLength={2}
onFocus={() => setText('')}
onChange={(e) => setText(e.target.value.replace(/\D/g, ''))}
onBlur={() => {
const num = parseInt(text || '', 10);
if (!isNaN(num)) {
onChange(Math.min(max, Math.max(min, num)));
}
setText(null);
}}
className="w-full h-[52px] rounded-[10px] border border-newColColor focus:border-btnPrimary bg-newBgColorInner text-center text-[14px] text-textColor outline-none"
/>
<div onClick={step(-1)} className="cursor-pointer">
<DropdownArrowIcon />
</div>
</div>
);
};
// the calendar and the time, in the desktop popover or in the mobile sheet
export const DatePickerPanel: FC<{
date: dayjs.Dayjs;
onChange: (day: dayjs.Dayjs) => void;
sheet?: boolean;
}> = (props) => {
const { date, onChange } = props;
const [open, setOpen] = useState(false);
const { date, onChange, sheet } = props;
const t = useT();
const [month, setMonth] = useState(date.toDate());
const changeShow = useCallback(() => {
setOpen((prev) => !prev);
}, []);
const ref = useClickOutside<HTMLDivElement>(() => {
setOpen(false);
});
const changeDate = useCallback(
(type: 'date' | 'time') => (day: Date) => {
onChange(
@ -33,54 +80,229 @@ export const DatePicker: FC<{
},
[date]
);
const changeTime = useCallback(
(hour: number, minute: number) => {
onChange(
newDayjs(
date.format('YYYY-MM-DD') +
' ' +
[hour, minute, 0].map((p) => String(p).padStart(2, '0')).join(':')
)
);
},
[date]
);
if (sheet) {
const twelveHours = isUSCitizen();
const pm = date.hour() >= 12;
return (
<div className="flex flex-col">
<div className="flex items-center gap-[16px] mb-[12px]">
<div className="w-[55px] text-[15px] font-[600]">
{t('date', 'Date')}
</div>
<div className="flex-1 h-[52px] px-[16px] flex items-center rounded-[10px] border border-newColColor bg-newBgColorInner text-[14px]">
{date.format('ddd, D MMMM')}
</div>
</div>
<div className="bg-newSettings rounded-[12px] px-[16px] py-[12px] mb-[24px]">
<div className="flex items-center gap-[8px] mb-[12px]">
<div className="flex-1 text-[15px] font-[600]">
{dayjs(month).format('MMMM, YYYY')}
</div>
<div
onClick={() =>
setMonth(dayjs(month).subtract(1, 'month').toDate())
}
className="w-[32px] h-[32px] flex justify-center items-center cursor-pointer text-textItemBlur"
>
<ChevronLeftIcon
size={20}
strokeWidth={1.8}
className="rtl:rotate-180"
/>
</div>
<div
onClick={() => setMonth(dayjs(month).add(1, 'month').toDate())}
className="w-[32px] h-[32px] flex justify-center items-center cursor-pointer text-textItemBlur"
>
<ChevronRightIcon
size={20}
strokeWidth={1.8}
className="rtl:rotate-180"
/>
</div>
</div>
<Calendar
fullWidth={true}
locale={dayjs.locale()}
month={month}
onMonthChange={setMonth}
onChange={(day) => {
setMonth(day);
changeDate('date')(day);
}}
value={date.toDate()}
dayClassName={(day, modifiers) =>
clsx(
'!w-full !max-w-[40px] !h-[40px] !leading-[40px] !rounded-[8px] !text-[14px]',
modifiers.selected
? '!bg-boxFocused !text-textItemFocused !font-[600] !outline-none'
: modifiers.outside
? '!text-newTextColor/20 !font-[400]'
: dayjs(day).isSame(dayjs(), 'day')
? '!text-[#FC69FF] !font-[600]'
: '!text-textItemBlur !font-[400]'
)
}
classNames={{
calendarHeader: '!hidden',
cell: '!py-[4px] !border-t-0 text-center',
day: 'hover:bg-boxHover',
weekday: '!text-[15px] !font-[600] !text-textItemBlur',
weekdayCell: '!pb-[4px] !h-[39px]',
}}
/>
</div>
<div className="flex items-center gap-[16px]">
<div className="w-[55px] text-[15px] font-[600]">
{t('time', 'Time')}
</div>
<div className="flex items-center gap-[12px] min-w-0">
<div className="flex rtl:flex-row-reverse items-center gap-[4px] min-w-0">
{twelveHours ? (
<TimeField
value={date.hour() % 12 || 12}
min={1}
max={12}
onChange={(hour) =>
changeTime((hour % 12) + (pm ? 12 : 0), date.minute())
}
/>
) : (
<TimeField
value={date.hour()}
min={0}
max={23}
pad={true}
onChange={(hour) => changeTime(hour, date.minute())}
/>
)}
<div className="text-[14px] font-[600]">:</div>
<TimeField
value={date.minute()}
min={0}
max={59}
pad={true}
onChange={(minute) => changeTime(date.hour(), minute)}
/>
</div>
{twelveHours && (
<div className="h-[52px] flex gap-[3px] p-[4px] rounded-[8px] border border-newColColor bg-newBgColorInner">
{[false, true].map((isPm) => (
<div
key={String(isPm)}
onClick={() =>
changeTime(
(date.hour() % 12) + (isPm ? 12 : 0),
date.minute()
)
}
className={clsx(
'w-[44px] h-[44px] flex justify-center items-center rounded-[6px] text-[14px] cursor-pointer select-none',
isPm === pm
? 'bg-boxFocused text-textItemFocused'
: 'text-textItemBlur'
)}
>
{isPm ? 'pm' : 'am'}
</div>
))}
</div>
)}
</div>
</div>
</div>
);
}
return (
<>
<Calendar
onChange={changeDate('date')}
value={date.toDate()}
dayClassName={(date, modifiers) => {
if (modifiers.weekend) {
return '!text-customColor28';
}
if (modifiers.outside) {
return '!text-gray';
}
if (modifiers.selected) {
return '!text-white !bg-seventh !outline-none';
}
return '!text-textColor';
}}
classNames={{
day: 'hover:bg-seventh',
calendarHeaderControl: 'text-textColor hover:bg-third',
calendarHeaderLevel: 'text-textColor hover:bg-third', // cell: 'child:!text-textColor'
}}
/>
<TimeInput
onChange={changeDate('time')}
format={isUSCitizen() ? '12' : '24'}
label="Pick time"
classNames={{
label: 'text-textColor py-[12px]',
input:
'bg-sixth h-[40px] border border-tableBorder text-textColor rounded-[4px] outline-none',
}}
defaultValue={date.toDate()}
/>
</>
);
};
export const DatePicker: FC<{
date: dayjs.Dayjs;
onChange: (day: dayjs.Dayjs) => void;
// opens a picker somewhere else instead of the popover
onOpen?: () => void;
}> = (props) => {
const { date, onChange, onOpen } = props;
const [open, setOpen] = useState(false);
const t = useT();
const changeShow = useCallback(() => {
setOpen((prev) => !prev);
}, []);
const ref = useClickOutside<HTMLDivElement>(() => {
setOpen(false);
});
return (
<div
className="px-[16px] border border-newTextColor/10 rounded-[8px] justify-center flex gap-[8px] items-center relative h-[44px] text-[15px] font-[600] ml-[7px] select-none flex-1"
onClick={changeShow}
className="px-[16px] border border-newTextColor/10 mobile:border-newTextColor/[0.08] rounded-[8px] mobile:rounded-[6px] justify-center flex gap-[8px] items-center relative h-[44px] mobile:h-[34px] text-[15px] mobile:text-[13px] whitespace-nowrap font-[600] ml-[7px] mobile:ml-0 select-none flex-1 mobile:min-w-0"
onClick={onOpen || changeShow}
ref={ref}
>
<div className="cursor-pointer">
<CalendarIcon />
</div>
<div className="cursor-pointer">
<div className="cursor-pointer mobile:hidden">
{date.format(isUSCitizen() ? 'MM/DD/YYYY hh:mm A' : 'DD/MM/YYYY HH:mm')}
</div>
<div className="cursor-pointer hidden mobile:block truncate">
{date.format(isUSCitizen() ? 'MMM D, h:mm A' : 'D MMM, HH:mm')}
</div>
{open && (
<div
onClick={(e) => e.stopPropagation()}
className="animate-fadeIn absolute bottom-[100%] mb-[16px] start-[50%] -translate-x-[50%] bg-sixth border border-tableBorder text-textColor rounded-[16px] z-[300] p-[16px] flex flex-col"
>
<Calendar
onChange={changeDate('date')}
value={date.toDate()}
dayClassName={(date, modifiers) => {
if (modifiers.weekend) {
return '!text-customColor28';
}
if (modifiers.outside) {
return '!text-gray';
}
if (modifiers.selected) {
return '!text-white !bg-seventh !outline-none';
}
return '!text-textColor';
}}
classNames={{
day: 'hover:bg-seventh',
calendarHeaderControl: 'text-textColor hover:bg-third',
calendarHeaderLevel: 'text-textColor hover:bg-third', // cell: 'child:!text-textColor'
}}
/>
<TimeInput
onChange={changeDate('time')}
label="Pick time"
classNames={{
label: 'text-textColor py-[12px]',
input:
'bg-sixth h-[40px] border border-tableBorder text-textColor rounded-[4px] outline-none',
}}
defaultValue={date.toDate()}
/>
<DatePickerPanel date={date} onChange={onChange} />
<Button className="mt-[12px]" onClick={changeShow}>
{t('close', 'Close')}
</Button>

View File

@ -3,8 +3,49 @@
import { FC, ReactNode } from 'react';
import { HTML5Backend } from 'react-dnd-html5-backend';
import { DndProvider } from 'react-dnd';
const DRAG_HANDLERS = [
'handleTopDragStart',
'handleTopDragStartCapture',
'handleTopDragEndCapture',
'handleTopDragEnter',
'handleTopDragEnterCapture',
'handleTopDragLeaveCapture',
'handleTopDragOver',
'handleTopDragOverCapture',
'handleTopDrop',
'handleTopDropCapture',
];
// the path is kept from the start of the dispatch, the editor can re-render
// the target out of the page before the event bubbles up to the window
const isInsideEditor = (event: Event) =>
event
.composedPath()
.some((node) => (node as HTMLElement).isContentEditable);
// the backend listens to every drag on the window and cancels the native drops
// it doesn't own, so dragging text or pictures inside the post editor did nothing
const CalendarBackend: typeof HTML5Backend = (manager, context, options) => {
const backend = HTML5Backend(manager, context, options) as any;
for (const name of DRAG_HANDLERS) {
const handler = backend[name];
if (typeof handler !== 'function') {
continue;
}
backend[name] = (event: DragEvent) => {
if (!isInsideEditor(event)) {
handler(event);
}
};
}
return backend;
};
export const DNDProvider: FC<{
children: ReactNode;
}> = ({ children }) => {
return <DndProvider backend={HTML5Backend}>{children}</DndProvider>;
return <DndProvider backend={CalendarBackend}>{children}</DndProvider>;
};

View File

@ -5,6 +5,15 @@ const ExistingDataContext = createContext({
group: undefined as undefined | string,
posts: [] as Post[],
settings: {} as any,
// the other channels the post was created with
siblings: undefined as
| undefined
| {
integration: string;
group: string;
posts: Post[];
settings: any;
}[],
});
export const ExistingDataContextProvider: FC<{
children: ReactNode;

View File

@ -0,0 +1,39 @@
'use client';
import { FC, useEffect, useRef } from 'react';
import { useRouter, useSearchParams } from 'next/navigation';
import { useDecisionModal } from '@gitroom/frontend/components/layout/new-modal';
import { useT } from '@gitroom/react/translation/get.transation.service.client';
// /oauth/hubspot/callback sends people here after they install the Postiz
// app in HubSpot, and the calendar alone doesn't say what just happened
export const HubspotInstalled: FC = () => {
const installed = useSearchParams().get('hubspot') === 'installed';
const modal = useDecisionModal();
const router = useRouter();
const t = useT();
const shown = useRef(false);
useEffect(() => {
if (!installed || shown.current) {
return;
}
shown.current = true;
(async () => {
await modal.open({
title: t('hubspot_installed', 'Postiz is installed in HubSpot'),
onlyApprove: true,
approveLabel: t('ok', 'OK'),
description: t(
'hubspot_installed_description',
'Connect the channels you want to post to here in Postiz. Then, in HubSpot, open Agent Hub > Agent Builder, add a tool, pick Postiz MCP under MCP Servers and click Connect and add.'
),
});
// like Onboarding, drop the param once closed so a calendar reload
// doesn't show it again
router.replace('/launches');
})();
}, [installed]);
return null;
};

View File

@ -30,7 +30,7 @@ const Valid: FC = () => {
);
};
const Invalid: FC = () => {
const Invalid: FC<{ className?: string }> = ({ className }) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
@ -38,11 +38,12 @@ const Invalid: FC = () => {
height="16"
viewBox="0 0 16 16"
fill="none"
className={className}
>
<g clipPath="url(#clip0_2482_97670)">
<path
d="M8.00049 6.00015V8.66682M8.00049 11.3335H8.00715M7.07737 2.59464L1.59411 12.0657C1.28997 12.591 1.1379 12.8537 1.16038 13.0693C1.17998 13.2573 1.2785 13.4282 1.4314 13.5394C1.60671 13.6668 1.91022 13.6668 2.51723 13.6668H13.4837C14.0908 13.6668 14.3943 13.6668 14.5696 13.5394C14.7225 13.4282 14.821 13.2573 14.8406 13.0693C14.8631 12.8537 14.711 12.591 14.4069 12.0657L8.92361 2.59463C8.62056 2.07119 8.46904 1.80947 8.27135 1.72157C8.09892 1.64489 7.90206 1.64489 7.72962 1.72157C7.53193 1.80947 7.38041 2.07119 7.07737 2.59464Z"
stroke="white"
stroke="currentColor"
strokeWidth="1.2"
strokeLinecap="round"
strokeLinejoin="round"
@ -184,25 +185,51 @@ export const InformationComponent: FC<{
return (
<div
className={clsx(
'group rounded-[6px] gap-[4px] h-[30px] px-[6px] flex justify-center items-center relative',
isValid ? 'border border-newColColor' : 'bg-[#FF3F3F]'
'group rounded-[6px] gap-[4px] mobile:gap-[6px] h-[30px] px-[6px] mobile:px-0 flex justify-center items-center relative',
isValid
? 'border border-newColColor mobile:border-0'
: 'bg-[#FF3F3F] mobile:bg-transparent',
!selectedIntegrations.length && 'mobile:hidden'
)}
>
{isValid ? <Valid /> : <Invalid />}
{isValid ? (
<Valid />
) : (
<Invalid className="text-white mobile:text-[#FF3F3F]" />
)}
{!isGlobal && (
<div className={clsx("text-[10px] font-[600] flex justify-center items-center", !isValid && 'text-white')}>
<div
className={clsx(
'text-[10px] mobile:text-[12px] font-[600] mobile:font-[500] flex justify-center items-center',
isValid
? 'mobile:text-newTextColor/40'
: 'text-white mobile:text-[#FF3F3F]'
)}
>
{currentChars}/{totalAllowedChars}
</div>
)}
{isGlobal && globalDisplayLimit !== null && (
<div className={clsx("text-[10px] font-[600] flex justify-center items-center", !isValid && 'text-white')}>
<div
className={clsx(
'text-[10px] mobile:text-[12px] font-[600] mobile:font-[500] flex justify-center items-center',
isValid
? 'mobile:text-newTextColor/40'
: 'text-white mobile:text-[#FF3F3F]'
)}
>
{globalDisplayLimit.count}/{globalDisplayLimit.limit}
</div>
)}
{((isGlobal && selectedIntegrations.length) || !isValid) && (
<svg
className={clsx('group-hover:rotate-180', !isValid && 'text-white')}
className={clsx(
'group-hover:rotate-180',
isValid
? 'mobile:text-newTextColor/40'
: 'text-white mobile:text-[#FF3F3F]'
)}
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"

View File

@ -25,11 +25,16 @@ import { DNDProvider } from '@gitroom/frontend/components/launches/helpers/dnd.p
import { GeneratorComponent } from './generator/generator';
import { useVariables } from '@gitroom/react/helpers/variable.context';
import { NewPost } from '@gitroom/frontend/components/launches/new.post';
import { BulkScheduleButton } from '@gitroom/frontend/components/launches/bulk-schedule/bulk.schedule.button';
import { useT } from '@gitroom/react/translation/get.transation.service.client';
import { useIntegrationList } from '@gitroom/frontend/components/launches/helpers/use.integration.list';
import useCookie from 'react-use-cookie';
import { Onboarding } from '@gitroom/frontend/components/onboarding/onboarding';
import { ChannelsAfterPayment } from '@gitroom/frontend/components/layout/check.payment';
import { HubspotInstalled } from '@gitroom/frontend/components/launches/hubspot.installed';
import { useModals } from '@gitroom/frontend/components/layout/new-modal';
import { Input } from '@gitroom/react/form/input';
import { Button } from '@gitroom/react/form/button';
export const SVGLine = () => {
return (
@ -111,6 +116,70 @@ export const OpenClose: FC<{
</svg>
);
};
const EditGroupNameModal: FC<{
name: string;
id: string;
close: () => void;
resolve: (value: string) => void;
}> = (props) => {
const t = useT();
const { close, name, id, resolve } = props;
const fetch = useFetch();
const toaster = useToaster();
const [groupName, setGroupName] = useState<string>(name);
const save = useCallback(async () => {
const response = await fetch(`/integrations/customers/${id}`, {
method: 'PUT',
body: JSON.stringify({ name: groupName }),
});
if (!response.ok) {
const { message } = await response.json().catch(() => ({} as any));
toaster.show(
(Array.isArray(message) ? message[0] : message) ||
t('could_not_save_group', 'Could not save the group.'),
'warning'
);
return;
}
resolve(groupName);
close();
}, [groupName, id]);
return (
<div>
<Input
name="name"
disableForm={true}
label={t('group_name', 'Name')}
value={groupName}
onChange={(e) => setGroupName(e.target.value)}
/>
<Button onClick={save} className="mt-[16px]">
{t('save', 'Save')}
</Button>
</div>
);
};
const EditPencil = () => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
>
<path
d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);
};
export const MenuGroupComponent: FC<
MenuComponentInterface & {
changeItemGroup: (id: string, group: string) => void;
@ -137,9 +206,37 @@ export const MenuGroupComponent: FC<
changeItemGroup,
collapsed,
} = props;
const t = useT();
const modals = useModals();
const toaster = useToaster();
const [isOpen, setIsOpen] = useState(
!!+(localStorage.getItem(group.name + '_isOpen') || '1')
);
const editGroupName = useCallback(
async (e: any) => {
e.stopPropagation();
const val: string | undefined = await new Promise((resolve) => {
modals.openModal({
title: t('edit_group_name', 'Edit group name'),
onClose: () => resolve(undefined),
children: (close) => (
<EditGroupNameModal
name={group.name}
id={group.id}
close={close}
resolve={resolve}
/>
),
});
});
if (!val) {
return;
}
await mutate();
toaster.show(t('group_updated', 'Group Updated'), 'success');
},
[group.name, group.id, mutate, modals, t]
);
const changeOpenClose = useCallback(
(e: any) => {
setIsOpen(!isOpen);
@ -177,7 +274,7 @@ export const MenuGroupComponent: FC<
)}
{!!group.name && (
<div
className="flex items-center gap-[5px] cursor-pointer"
className="flex items-center gap-[5px] cursor-pointer group"
onClick={changeOpenClose}
>
<div>
@ -194,6 +291,14 @@ export const MenuGroupComponent: FC<
>
{group.name}
</div>
{!collapsed && (
<div
className="hidden group-hover:block hover:opacity-70"
onClick={editGroupName}
>
<EditPencil />
</div>
)}
</div>
)}
<div
@ -365,6 +470,7 @@ export const LaunchesComponent = () => {
const modal = useModals();
const [reload, setReload] = useState(false);
const [collapseMenu, setCollapseMenu] = useCookie('collapseMenu', '0');
const [channelsOpen, setChannelsOpen] = useState(false);
const [mode] = useCookie('mode', 'dark');
const { isLoading, data: integrations, mutate } = useIntegrationList();
@ -523,27 +629,59 @@ export const LaunchesComponent = () => {
return (
<DNDProvider>
<Onboarding />
<ChannelsAfterPayment integrations={integrations} />
<HubspotInstalled />
<CalendarWeekProvider integrations={sortedIntegrations}>
{channelsOpen && (
<div
className="hidden mobile:block fixed inset-0 bg-newBackdrop opacity-60 z-[149]"
onClick={() => setChannelsOpen(false)}
/>
)}
<div
className={clsx(
'flex relative flex-col',
collapseMenu === '1' ? 'group sidebar w-[100px]' : 'w-[260px]'
collapseMenu === '1' && !channelsOpen
? 'group sidebar w-[100px]'
: 'w-[260px]',
channelsOpen
? 'mobile:fixed mobile:inset-x-0 mobile:bottom-0 mobile:z-[150] mobile:w-full mobile:max-h-[80vh] mobile:rounded-t-[16px] mobile:overflow-hidden'
: 'mobile:hidden'
)}
>
<div
className={clsx(
'bg-newBgColorInner p-[20px] flex flex-col gap-[15px] transition-all absolute start-0 top-0 w-full h-full overflow-x-hidden overflow-y-auto scrollbar scrollbar-thumb-fifth scrollbar-track-newBgColor'
'bg-newBgColorInner p-[20px] flex flex-col gap-[15px] transition-all absolute start-0 top-0 w-full h-full mobile:static mobile:h-auto mobile:max-h-[80vh] mobile:pb-[80px] overflow-x-hidden overflow-y-auto scrollbar scrollbar-thumb-fifth scrollbar-track-newBgColor'
)}
>
<div className="flex items-center">
<h2 className="group-[.sidebar]:hidden flex-1 text-[20px] font-[500]">
{t('channels')}
</h2>
<div
onClick={() => setChannelsOpen(false)}
className="hidden mobile:flex text-btnText bg-btnSimple rounded-[6px] w-[28px] h-[28px] items-center justify-center cursor-pointer select-none"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="12"
height="12"
viewBox="0 0 12 12"
fill="none"
>
<path
d="M1 1L11 11M11 1L1 11"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
/>
</svg>
</div>
<div
onClick={() =>
setCollapseMenu(collapseMenu === '1' ? '0' : '1')
}
className="group-[.sidebar]:rotate-[180deg] group-[.sidebar]:mx-auto text-btnText bg-btnSimple rounded-[6px] w-[24px] h-[24px] flex items-center justify-center cursor-pointer select-none"
className="group-[.sidebar]:rotate-[180deg] group-[.sidebar]:mx-auto mobile:hidden text-btnText bg-btnSimple rounded-[6px] w-[24px] h-[24px] flex items-center justify-center cursor-pointer select-none"
>
<svg
xmlns="http://www.w3.org/2000/svg"
@ -564,38 +702,40 @@ export const LaunchesComponent = () => {
</div>
<div className="flex flex-col gap-[8px] group-[.sidebar]:mx-auto group-[.sidebar]:w-[44px]">
<AddProviderButton update={() => update(true)} />
<div className="flex gap-[8px] group-[.sidebar]:flex-col">
<div className="flex gap-[8px] group-[.sidebar]:flex-col mobile:hidden">
{sortedIntegrations?.length > 0 && <NewPost />}
{sortedIntegrations?.length > 0 && <BulkScheduleButton />}
{sortedIntegrations?.length > 0 &&
user?.tier?.ai &&
billingEnabled && <GeneratorComponent />}
</div>
</div>
<div className="gap-[32px] flex flex-col select-none flex-1">
{sortedIntegrations.length === 0 && collapseMenu === '0' && (
<div className="flex-1 max-h-[500px] justify-center items-center flex">
<div className="flex flex-col gap-[12px] text-center">
<img
src={
mode === 'dark'
? '/no-channels.svg'
: '/no-channels-colors.svg'
}
alt="No channels"
className="mx-auto min-w-[100%]"
/>
<div className="font-[600] text-[20px]">
{t('no_channels', 'No channels yet')}
</div>
<div className="text-[14px]">
{t('connect_your_accounts')}
{sortedIntegrations.length === 0 &&
(collapseMenu === '0' || channelsOpen) && (
<div className="flex-1 max-h-[500px] justify-center items-center flex">
<div className="flex flex-col gap-[12px] text-center">
<img
src={
mode === 'dark'
? '/no-channels.svg'
: '/no-channels-colors.svg'
}
alt="No channels"
className="mx-auto min-w-[100%]"
/>
<div className="font-[600] text-[20px]">
{t('no_channels', 'No channels yet')}
</div>
<div className="text-[14px]">
{t('connect_your_accounts')}
</div>
</div>
</div>
</div>
)}
)}
{menuIntegrations.map((menu) => (
<MenuGroupComponent
collapsed={collapseMenu === '1'}
collapsed={collapseMenu === '1' && !channelsOpen}
changeItemGroup={changeItemGroup}
key={menu.name}
group={menu}
@ -607,7 +747,7 @@ export const LaunchesComponent = () => {
/>
))}
</div>
<div className="mt-[5px] text-center flex flex-col">
<div className="mt-[5px] text-center flex flex-col mobile:hidden">
{billingEnabled && user?.isLifetime && (
<div>{capitalize(user?.tier?.current || '')} tier</div>
)}
@ -619,7 +759,41 @@ export const LaunchesComponent = () => {
</div>
</div>
</div>
<div className="bg-newBgColorInner flex-1 flex-col flex p-[20px] gap-[12px]">
<div className="bg-newBgColorInner flex-1 min-w-0 flex-col flex p-[20px] mobile:p-[12px] gap-[12px] mobile:min-h-[600px]">
<div className="hidden mobile:flex gap-[8px]">
<div
onClick={() => setChannelsOpen(true)}
className="cursor-pointer h-[44px] px-[12px] bg-btnSimple text-btnText rounded-[8px] flex items-center gap-[8px] select-none"
>
<div className="flex -space-x-[10px] rtl:space-x-reverse">
{sortedIntegrations.slice(0, 3).map((integration: any) => (
<ImageWithFallback
key={integration.id}
fallbackSrc={`/icons/platforms/${integration.identifier}.png`}
src={integration.picture}
className="rounded-full border-2 border-btnSimple"
alt={integration.identifier}
width={24}
height={24}
/>
))}
</div>
<div className="text-[14px] font-[500]">
{sortedIntegrations.length || t('channels')}
</div>
</div>
{sortedIntegrations?.length > 0 ? (
<>
<NewPost />
<BulkScheduleButton />
{user?.tier?.ai && billingEnabled && <GeneratorComponent />}
</>
) : (
<div className="flex-1">
<AddProviderButton update={() => update(true)} />
</div>
)}
</div>
<Filters />
<div className="flex-1 flex">
<Calendar />

Some files were not shown because too many files have changed in this diff Show More