Compare commits

..

2 Commits

Author SHA1 Message Date
Gilad Resisi
26c58fdad6 fix(agent): next postsListTool page keeps the same parameters
The paging hint said to repeat only the dates, which would drop a
"customer" filter on the following pages.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 17:19:24 +07:00
Gilad Resisi
dcad18742f fix(agent): page postsListTool results
postsListTool returned every post in the window with full content and
settings, and its description told the model to pass a wide window. On a
large organization a single tool result grew past the model provider's
10 MB per-output limit and the agent chat failed with
context_length_exceeded / "string too long".

Results are now sorted by publish date then id and returned 50 per page,
with an optional "page" input and additive "total", "page" and "hasMore"
outputs. The description and the agent prompt explain paging and prefer
narrow windows. getPosts is unchanged, the slice happens in the tool.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 14:36:47 +07:00
356 changed files with 4506 additions and 24059 deletions

View File

@ -51,10 +51,6 @@ 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)
@ -125,17 +121,6 @@ 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
@ -145,11 +130,6 @@ 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=""
@ -204,10 +184,6 @@ 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

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 285 B

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 500 B

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 815 B

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 1.0 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 25 KiB

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 323 B

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 370 B

View File

@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 745 B

View File

@ -1,138 +0,0 @@
# 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.

View File

@ -1,130 +0,0 @@
# 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,9 +72,4 @@ 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.
- 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.
- 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.

View File

@ -1,3 +0,0 @@
# 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.

View File

@ -1,117 +0,0 @@
# 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,12 +13,31 @@
</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>
<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.
<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 />
</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">
@ -46,46 +65,7 @@
<a href="https://apps.make.com/postiz">Make.com integration</a>
</p>
<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 />
<br /><br />
## 🔌 See the leading Postiz features
@ -108,8 +88,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
@ -117,6 +97,7 @@
- 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
@ -134,53 +115,15 @@ To have the project up and running, please follow the [Quick Start Guide](https:
## Sponsor Postiz
We now offer a few options to sponsor Postiz:
We now give 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
- 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 is an open-source, self-hosted social media scheduling tool that supports platforms like X (formerly Twitter), Bluesky, Mastodon, Discord, and others.
- 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.
- Gelhaus Solutions (@egelhaus): [contact@gplatform.org](mailto:contact@gplatform.org)
- @egelhaus ([E-Mail](mailto:egelhaus@ennogelhaus.de))
### AI Reports

View File

@ -1,89 +0,0 @@
# 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,15 +4,13 @@ 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 _postEngagementService: PostEngagementService
private _postsService: PostsService
) {}
@Get('/:integration')
@ -32,15 +30,4 @@ 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 { makeSecureId } from '@gitroom/nestjs-libraries/services/make.secure.id';
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
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-${makeSecureId(16)}`;
const state = `login-${makeId(16)}`;
response.cookie('oauth_state', state, {
domain: getCookieUrlFromDomain(process.env.FRONTEND_URL!),
...(!process.env.NOT_SECURED

View File

@ -20,11 +20,6 @@ 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')
@ -163,17 +158,6 @@ 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);
@ -185,18 +169,14 @@ export class BillingController {
@GetUserFromRequest() user: User,
@Body() body: { feedback: string }
) {
const result = await (await this.provider(org)).setToCancel(org.id);
await this._notificationService.sendEmail(
process.env.EMAIL_FROM_ADDRESS,
'Subscription Cancelled',
`Organization ${org.name} has cancelled their subscription because: ${body.feedback}`,
user.email
);
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;
return (await this.provider(org)).setToCancel(org.id);
}
@Post('/prorate')

View File

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

View File

@ -17,33 +17,15 @@ 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 } = this.verifyEnterpriseToken<{
const { id, name, saasName, email } = AuthService.verifyJWT(params) as {
id: string;
name: string;
email: string;
saasName: string;
}>(params);
if (!id || !saasName) {
return { success: false };
}
};
try {
return await this._organizationService.createMaxUser(
@ -63,21 +45,15 @@ export class EnterpriseController {
@Post('/url')
async redirectParams(@Body('params') params: string) {
try {
const load = this.verifyEnterpriseToken<{
const load = AuthService.verifyJWT(params) as {
redirectUrl: string;
apiKey: string;
refreshId?: string;
provider: string;
webhookUrl: string;
}>(params);
};
if (
!load ||
!load.redirectUrl ||
!load.apiKey ||
typeof load.apiKey !== 'string' ||
!load.provider
) {
if (!load || !load.redirectUrl || !load.apiKey || !load.provider) {
return;
}
@ -118,18 +94,12 @@ export class EnterpriseController {
@Post('/delete-channel')
async deleteChannel(@Body('params') params: string) {
try {
const load = this.verifyEnterpriseToken<{
const load = AuthService.verifyJWT(params) as {
apiKey: string;
id: string;
}>(params);
};
if (
!load ||
!load.apiKey ||
!load.id ||
typeof load.apiKey !== 'string' ||
typeof load.id !== 'string'
) {
if (!load || !load.apiKey || !load.id) {
return { success: false };
}

View File

@ -3,7 +3,6 @@ import {
Controller,
Delete,
Get,
Logger,
Param,
Post,
Put,
@ -21,8 +20,6 @@ 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,
@ -42,8 +39,6 @@ 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,
@ -71,15 +66,6 @@ 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,
@ -102,15 +88,6 @@ 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 {
@ -122,8 +99,7 @@ export class IntegrationsController {
p.providerIdentifier
);
return {
name: p.customName || p.name,
originalName: p.name,
name: p.name,
id: p.id,
internalId: p.internalId,
disabled: p.disabled,
@ -250,27 +226,6 @@ 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
? {
@ -304,17 +259,7 @@ export class IntegrationsController {
);
return { url };
} 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
}`
);
} catch (err) {
return { err: true };
}
}

View File

@ -62,11 +62,7 @@ export class NoAuthIntegrationsController {
? 'none'
: await ioRedis.get(`login:${body.state}`);
if (!getCodeVerifier) {
// 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
);
throw new Error('Invalid state');
}
const organization = await ioRedis.get(`organization:${body.state}`);
@ -140,14 +136,7 @@ export class NoAuthIntegrationsController {
refresh,
auth.accessToken
);
// 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,
});
return res({ ...newAuth, refreshToken: body.refresh });
} catch (err: any) {
return res({
error: err.message,
@ -175,7 +164,6 @@ export class NoAuthIntegrationsController {
});
}
console.log(`Authentication failed for ${integration}:`, err);
return res({
error: 'Authentication failed',
accessToken: '',
@ -377,18 +365,7 @@ export class NoAuthIntegrationsController {
}
const { integrationId, organizationId, internalId, provider } = payload;
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
) {
if (!integrationId || !organizationId || !internalId || !provider) {
throw new HttpException('Invalid token payload', 400);
}
@ -396,11 +373,7 @@ export class NoAuthIntegrationsController {
organizationId,
integrationId
);
if (
!integration ||
integration.internalId !== internalId ||
integration.providerIdentifier !== provider
) {
if (!integration || integration.internalId !== internalId) {
throw new HttpException('Integration not found', 404);
}
@ -443,10 +416,8 @@ export class NoAuthIntegrationsController {
false,
undefined,
undefined,
// stored encrypted like connectSocialMedia does, never signed: the
// cookies JSON comes from the request
AuthService.fixedEncryption(
Buffer.from(body.cookies, 'base64').toString()
AuthService.signJWT(
JSON.parse(Buffer.from(body.cookies, 'base64').toString())
)
);

View File

@ -8,35 +8,21 @@ 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,
AuthorizeSelfHostedDto,
} from '@gitroom/nestjs-libraries/dtos/oauth/authorize-oauth.dto';
import { AuthorizeOAuthQueryDto, ApproveOAuthDto } 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,
private _mcpRelayService: McpRelayService
) {}
constructor(private _oauthService: OAuthService) {}
// Dynamic Client Registration (RFC 7591), used by MCP clients like Claude
@Post('/register')
@ -56,11 +42,6 @@ export class OAuthController {
}
);
const selfHosted = this._oauthService.allowsSelfHosted(
app,
query.resource
);
return {
app: {
name: app.name,
@ -70,80 +51,14 @@ 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' },
@ -151,6 +66,10 @@ 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' },
@ -176,26 +95,6 @@ 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')
@ -235,11 +134,13 @@ export class OAuthAuthorizedController {
app.id,
user.id,
org.id,
this._oauthService.pkceBinding(app, {
codeChallenge: body.code_challenge,
codeChallengeMethod: body.code_challenge_method,
redirectUri: body.redirect_uri,
})
app.dynamic
? {
codeChallenge: body.code_challenge,
codeChallengeMethod: body.code_challenge_method,
redirectUri: body.redirect_uri,
}
: undefined
);
const redirectUrl = new URL(redirectTarget);

View File

@ -29,20 +29,6 @@ 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')
@ -50,9 +36,7 @@ export class PostsController {
constructor(
private _postsService: PostsService,
private _agentGraphService: AgentGraphService,
private _shortLinkService: ShortLinkService,
private _organizationService: OrganizationService,
private _evergreenService: EvergreenService
private _shortLinkService: ShortLinkService
) {}
@Get('/:id/statistics')
@ -71,14 +55,6 @@ 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,
@ -88,102 +64,19 @@ 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: CreatePublicCommentDto,
@RealIP() ip: string
@Body() body: { comment: string }
) {
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);
return this._postsService.createComment(org.id, user.id, id, body.comment);
}
@Get('/tags')
@ -266,21 +159,10 @@ 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);
@ -298,7 +180,6 @@ 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.
@ -339,34 +220,7 @@ export class PostsController {
}
const body = await this._postsService.mapTypeToPost(rawBody, org.id);
// 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);
return this._postsService.createPost(org.id, body, 'WEB');
}
@Post('/generator/draft')
@ -427,26 +281,6 @@ 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,10 +27,6 @@ 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);
@ -57,10 +53,8 @@ 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, batchId, ...p }) => ({
({ childrenPost, ...p }) => ({
...p,
...(p.integration
? {
@ -82,24 +76,6 @@ 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,
@ -160,16 +136,7 @@ export class PublicController {
billing: 'FREE' | 'STANDARD' | 'TEAM' | 'PRO' | 'ULTIMATE';
};
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
) {
if (!load || !load.orgId || !load.billing || !pricing[load.billing]) {
return { success: false };
}
@ -187,6 +154,7 @@ export class PublicController {
}
}
@Get('/stream')
async streamFile(
@Query() query: OnlyURL,

View File

@ -15,7 +15,6 @@ 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';
@ -73,18 +72,6 @@ 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);
@ -101,21 +88,4 @@ 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,25 +116,7 @@ export class ThirdPartyController {
throw new HttpException('Invalid identifier', 400);
}
// 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,
return thirdPartyInstance?.instance?.[functionName](
AuthService.fixedDecryption(thirdParty.apiKey),
data
);

View File

@ -79,6 +79,23 @@ 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,
@ -281,14 +298,9 @@ export class UsersController {
@Get('/organizations')
async getOrgs(@GetUserFromRequest() user: User) {
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,
}));
return (await this._orgService.getOrgsByUserId(user.id)).filter(
(f) => !f.users[0].disabled
);
}
@Post('/change-org')
@ -315,11 +327,6 @@ 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,10 +14,9 @@ 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 {
DeliveriesPageDto, OnlyURL, UpdateDto, WebhooksDto
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')
@ -26,7 +25,7 @@ export class WebhookController {
@Get('/')
async getStatistics(@GetOrgFromRequest() org: Organization) {
return this._webhooksService.getWebhooksForDisplay(org.id);
return this._webhooksService.getWebhooks(org.id);
}
@Post('/')
@ -54,58 +53,18 @@ 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 {
const response = await fetch(query.url, {
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) {
return {
send: false,
error: err instanceof Error ? err.message : 'Unknown delivery error',
};
/** sent **/
}
return { send: true };
}
}

View File

@ -46,27 +46,11 @@ 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(),
]
: []),
],
},
});
// 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);
}
await startMcp(app);
app.useGlobalPipes(
new ValidationPipe({

View File

@ -14,11 +14,9 @@ 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';
@ -26,12 +24,6 @@ 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 {
@ -41,9 +33,6 @@ 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';
@ -62,8 +51,6 @@ 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')
@ -78,9 +65,7 @@ export class PublicIntegrationsController {
private _refreshIntegrationService: RefreshIntegrationService,
private _usersService: UsersService,
private _adminStatsService: AdminStatsService,
private _organizationService: OrganizationService,
private _clippingService: ClippingService,
private _subscriptionService: SubscriptionService
private _organizationService: OrganizationService
) {}
@Post('/upload')
@ -143,24 +128,8 @@ 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,
// 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,
},
rawBody,
org.id,
rawBody?.type === 'draft' || true
);
@ -232,86 +201,6 @@ 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,
@ -337,48 +226,6 @@ 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);
@ -400,7 +247,7 @@ export class PublicIntegrationsController {
.filter((integration) => !group || integration.customer?.id === group)
.map((integration) => ({
id: integration.id,
name: integration.customName || integration.name,
name: integration.name,
identifier: integration.providerIdentifier,
picture: integration.picture,
disabled: integration.disabled,
@ -542,25 +389,6 @@ 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,
@ -592,30 +420,6 @@ 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,
@ -723,13 +527,7 @@ export class PublicIntegrationsController {
@Body('releaseId') releaseId: string
) {
Sentry.metrics.count('public_api-request', 1);
// the batch only links the posts in the dashboard
const { batchId, ...post } = await this._postsService.updateReleaseId(
org.id,
id,
releaseId
);
return post;
return this._postsService.updateReleaseId(org.id, id, releaseId);
}
@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 || typeof payload.id !== 'string') {
if (!payload?.id) {
throw new HttpForbiddenException();
}
@ -97,9 +97,7 @@ 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.find((org) => org.subscription) ||
organization[0];
organization.find((org) => org.id === orgHeader) || organization[0];
if (!organization) {
throw new HttpForbiddenException();

View File

@ -1,179 +0,0 @@
// #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,6 +7,7 @@ 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';
@ -16,6 +17,7 @@ export class AuthService {
constructor(
private _userService: UsersService,
private _organizationService: OrganizationService,
private _notificationService: NotificationService,
private _emailService: EmailService,
private _providerManager: AuthProviderManager
) {}
@ -54,54 +56,28 @@ export class AuthService {
throw new Error('Registration is disabled');
}
const invite =
addToOrg && typeof addToOrg !== 'boolean' ? addToOrg : undefined;
const create = await this._organizationService.createOrgAndUser(
body,
ip,
userAgent
);
let registeredUser: User;
let addedOrg: boolean | Awaited<
ReturnType<OrganizationService['addUserToOrg']>
> = false;
const addedOrg =
addToOrg && typeof addToOrg !== 'boolean'
? await this._organizationService.addUserToOrg(
create.users[0].user.id,
addToOrg.id,
addToOrg.orgId,
addToOrg.role
)
: false;
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(
const obj = { addedOrg, jwt: await this.jwt(create.users[0].user) };
await this._emailService.sendEmail(
body.email,
'Activate your account',
`Click <a href="${process.env.FRONTEND_URL}/auth/activate/${obj.jwt}">here</a> to activate your account`
`Click <a href="${process.env.FRONTEND_URL}/auth/activate/${obj.jwt}">here</a> to activate your account`,
'top'
);
return obj;
}
@ -143,13 +119,7 @@ export class AuthService {
try {
const getOrg: any = AuthChecker.verifyJWT(cookie);
if (
typeof getOrg.orgId !== 'string' ||
typeof getOrg.id !== 'string' ||
!['USER', 'ADMIN'].includes(getOrg.role) ||
!getOrg.timeLimit ||
dayjs(getOrg.timeLimit).isBefore(dayjs())
) {
if (dayjs(getOrg.timeLimit).isBefore(dayjs())) {
return false;
}
@ -255,10 +225,10 @@ export class AuthService {
expires: dayjs().add(20, 'minutes').format('YYYY-MM-DD HH:mm:ss'),
});
await this._emailService.sendEmailSync(
await this._notificationService.sendEmail(
user.email,
'Reset your password',
`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`
`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`
);
}
@ -267,7 +237,7 @@ export class AuthService {
id: string;
expires: string;
};
if (typeof user.id !== 'string' || dayjs(user.expires).isBefore(dayjs())) {
if (dayjs(user.expires).isBefore(dayjs())) {
return false;
}
@ -308,10 +278,11 @@ export class AuthService {
const jwt = await this.jwt(user);
await this._emailService.sendEmailSync(
await this._emailService.sendEmail(
user.email,
'Activate your account',
`Click <a href="${process.env.FRONTEND_URL}/auth/activate/${jwt}">here</a> to activate your account`
`Click <a href="${process.env.FRONTEND_URL}/auth/activate/${jwt}">here</a> to activate your account`,
'top'
);
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.getIntegrationByInternalId(
await this._integrationService.getIntegrationById(
orgId,
refreshChannelId
);

View File

@ -1,5 +1,4 @@
import { google } from 'googleapis';
import { HttpException } from '@nestjs/common';
import {
AuthProvider,
AuthProviderAbstract,
@ -33,19 +32,8 @@ export class GoogleProvider extends AuthProviderAbstract {
async getToken(code: string, redirectUri?: string) {
const client = makeClient(redirectUri || defaultRedirect());
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;
}
const { tokens } = await client.getToken(code);
return tokens.access_token!;
}
async getUser(providerToken: string) {

View File

@ -44,9 +44,6 @@ 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) {

View File

@ -1,9 +0,0 @@
<!-- 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 -->

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -1,22 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,8 +0,0 @@
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-newBgColor min-h-screen text-newTextColor">
<div className="bg-[#000000] min-h-screen">
<PreviewWrapper>{children}</PreviewWrapper>
</div>
);

View File

@ -6,8 +6,6 @@ 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';
@ -42,103 +40,107 @@ export default async function Auth(
const t = await getT();
if (!post.length) {
return (
<div className="text-newTextColor fixed start-0 top-0 w-full h-full flex justify-center items-center text-[20px]">
<div className="text-white 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 (
<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>
<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:')}{' '}
<span className="text-newTextColor">
<RenderPreviewDateClient date={post[0].publishDate} />
</span>
<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>
</div>
</div>
<div className="text-sm text-gray-400 flex items-center gap-[20px]">
{!!searchParams?.share && (
<>
<div className="w-[1px] h-[20px] bg-blockSeparator" />
<div>
<CopyClient />
</>
</div>
)}
<div className="flex-1">
{t('publication_date', 'Publication Date:')}{' '}
<RenderPreviewDateClient date={post[0].publishDate} />
</div>
</div>
</div>
</div>
<div className="flex flex-col lg:flex-row gap-[8px]">
<div className="flex-1 flex flex-col gap-[8px]">
<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">
{post.map((p: any, index: number) => (
<div
key={String(p.id)}
className="bg-newBgColorInner border border-newTableBorder rounded-[12px] p-[20px]"
className="relative px-4 py-4 bg-third border border-tableBorder"
>
<div className="flex gap-[12px]">
<div className="flex space-x-3">
<div>
<div className="flex shrink-0 rounded-full relative">
<div className="flex shrink-0 rounded-full h-30 w-30 relative">
<div className="w-[50px] h-[50px] z-[20]">
<img
className="w-full h-full relative z-[20] bg-newBgColor aspect-square rounded-full"
className="w-full h-full relative z-[20] bg-black aspect-square rounded-full border-tableBorder"
alt={post[0].integration.name}
src={post[0].integration.picture}
/>
</div>
<div className="absolute -end-[5px] -bottom-[5px] w-[24px] h-[24px] z-[20]">
<div className="absolute -end-[5px] -bottom-[5px] w-[30px] h-[30px] z-[20]">
<img
className="w-full h-full bg-newBgColor aspect-square rounded-full"
className="w-full h-full bg-black aspect-square rounded-full border-tableBorder"
alt={post[0].integration.providerIdentifier}
src={`/icons/platforms/${post[0].integration.providerIdentifier}.png`}
/>
</div>
</div>
</div>
<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]">
<div className="flex-1 space-y-1">
<div className="flex items-center space-x-2">
<h2 className="text-sm font-semibold">
{post[0].integration.name}
</h2>
<span className="text-[14px] text-textItemBlur">
<span className="text-sm text-gray-500">
@{post[0].integration.profile}
</span>
{index === 0 && (
@ -148,40 +150,40 @@ export default async function Auth(
/>
)}
</div>
<div className="flex flex-col gap-[16px]">
<PostContentClient
postId={p.id}
html={sanitizePostContent(p.content)}
<div className="flex flex-col gap-[20px]">
<div
className="text-sm whitespace-pre-wrap"
dangerouslySetInnerHTML={{
__html: sanitizePostContent(p.content),
}}
/>
{!!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 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 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 className="w-full lg:w-96 lg:flex-shrink-0">
<div className="p-4 pt-0">
<CommentsComponents postId={id} />
</div>
</div>
</div>
</PreviewCommentsProvider>
</div>
);
}

View File

@ -1,7 +1,11 @@
import { redirect } from 'next/navigation';
import { Plugs } from '@gitroom/frontend/components/plugs/plugs';
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 redirect('/settings?tab=plugs');
return <Plugs />;
}

View File

@ -1,7 +1,14 @@
import { redirect } from 'next/navigation';
import { ThirdPartyComponent } from '@gitroom/frontend/components/third-parties/third-party.component';
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 redirect('/settings?tab=integrations');
return <ThirdPartyComponent />;
}

View File

@ -36,43 +36,20 @@ 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': (end - start + 1).toString(),
'Content-Length': fileStats.size.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,31 +2,12 @@
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(() => {
const returnUrl = sameOriginUrl(url);
if (returnUrl) {
localStorage.setItem('returnUrl', returnUrl);
if (url?.indexOf?.('http')! > -1) {
localStorage.setItem('returnUrl', url!);
}
}, [url]);
return null;
@ -36,8 +17,7 @@ export const useReturnUrl = () => {
getAndClear: useCallback(() => {
const data = localStorage.getItem('returnUrl');
localStorage.removeItem('returnUrl');
// also on read: localStorage can hold a value saved before this check
return sameOriginUrl(data);
return 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 { jakartaSans } from '@gitroom/frontend/fonts/plus-jakarta-sans/plus.jakarta.sans.font';
import { Plus_Jakarta_Sans } from 'next/font/google';
import PlausibleProvider from 'next-plausible';
import clsx from 'clsx';
import { VariableContextComponent } from '@gitroom/react/helpers/variable.context';
@ -25,6 +25,12 @@ 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;
@ -81,7 +87,6 @@ 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,10 +1,221 @@
import { OAuthAuthorize } from '@gitroom/frontend/components/oauth/authorize.component';
import { cookies } from 'next/headers';
'use client';
export const dynamic = 'force-dynamic';
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';
// 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} />;
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>
);
}

View File

@ -4,11 +4,17 @@ 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 { jakartaSans } from '@gitroom/frontend/fonts/plus-jakarta-sans/plus.jakarta.sans.font';
import { Plus_Jakarta_Sans } from 'next/font/google';
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,11 +6,17 @@ 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 { jakartaSans } from '@gitroom/frontend/fonts/plus-jakarta-sans/plus.jakarta.sans.font';
import { Plus_Jakarta_Sans } from 'next/font/google';
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,17 +2,31 @@
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(() => {
// 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);
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',
});
}, [error]);
return (
<html>

View File

@ -526,10 +526,7 @@ div div .set-font-family {
.hideChatbase #chatbase-bubble-button,
.hideChatbase #chatbase-bubble-window,
.hideChatbase #chatbase-message-bubbles,
.bottomSheetOpen #chatbase-bubble-button,
.bottomSheetOpen #chatbase-bubble-window,
.bottomSheetOpen #chatbase-message-bubbles {
.hideChatbase #chatbase-message-bubbles {
display: none !important;
}
@ -602,35 +599,11 @@ 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;
@ -664,22 +637,6 @@ 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;
}
@ -865,8 +822,3 @@ 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,7 +28,6 @@ interface StatsResponse {
publishingChannels?: StatsBlock;
scheduledChannels?: StatsBlock;
activeOrgsBySource?: StatsBlock;
connectedClients?: StatsBlock;
}
const isoDaysAgo = (days: number) => {
@ -290,14 +289,6 @@ 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">
@ -363,14 +354,6 @@ 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 >> Agents
You can also use me as an MCP Server, check Settings >> Public API
`),
}}
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 mobile:w-full mobile:order-1',
'trz bg-newBgColorInner flex flex-col gap-[15px] transition-all relative',
collapseMenu === '1' ? 'group sidebar w-[100px]' : 'w-[260px]'
)}
>
<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">
<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">
<h2 className="group-[.sidebar]:hidden flex-1 text-[20px] font-[500] mb-[15px]">
{t('select_channels', 'Select Channels')}
</h2>
@ -137,17 +137,13 @@ export const AgentList: FC<{ onChange: (arr: any[]) => void }> = ({
</svg>
</div>
</div>
<div
className={clsx(
'flex flex-col gap-[15px] mobile:flex-row mobile:gap-[12px] mobile:ps-[12px] mobile:pt-[6px]'
)}
>
<div className={clsx('flex flex-col gap-[15px]')}>
{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 mobile:shrink-0',
'flex gap-[12px] items-center group/profile justify-center hover:bg-boxHover rounded-e-[8px] hover:opacity-100 cursor-pointer',
!selected.some((p) => p.id === integration.id) && 'opacity-20'
)}
>
@ -186,7 +182,7 @@ export const AgentList: FC<{ onChange: (arr: any[]) => void }> = ({
</div>
<div
className={clsx(
'flex-1 whitespace-nowrap text-ellipsis overflow-hidden group-[.sidebar]:hidden mobile:hidden',
'flex-1 whitespace-nowrap text-ellipsis overflow-hidden group-[.sidebar]:hidden',
integration.disabled && 'opacity-50'
)}
>
@ -207,9 +203,7 @@ export const Agent: FC<{ children: ReactNode }> = ({ children }) => {
return (
<PropertiesContext.Provider value={{ properties }}>
<AgentList onChange={setProperties} />
<div className="bg-newBgColorInner flex flex-1 mobile:order-3 mobile:min-h-[500px]">
{children}
</div>
<div className="bg-newBgColorInner flex flex-1">{children}</div>
<Threads />
</PropertiesContext.Provider>
);
@ -231,11 +225,11 @@ const Threads: FC = () => {
<div
className={clsx(
'trz bg-newBgColorInner flex flex-col gap-[15px] transition-all relative',
'w-[260px] mobile:w-full mobile:order-2'
'w-[260px]'
)}
>
<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">
<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]">
<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"
@ -261,11 +255,11 @@ const Threads: FC = () => {
</div>
</Link>
</div>
<div className="flex flex-col gap-[1px] mobile:flex-row mobile:gap-[4px]">
<div className="flex flex-col gap-[1px]">
{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 mobile:shrink-0 mobile:max-w-[180px] mobile:border mobile:border-newTableBorder',
'overflow-ellipsis overflow-hidden whitespace-nowrap hover:bg-newBgColor px-[10px] py-[6px] rounded-[10px] cursor-pointer',
p.id === id && 'bg-newBgColor'
)}
href={`/agents/${p.id}`}

View File

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

View File

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

View File

@ -1,430 +0,0 @@
'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, { useSWRConfig } from 'swr';
import useSWR 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,35 +47,21 @@ const EmbeddedBilling = dynamic(
);
export const FirstBillingComponent = () => {
const { stripeClient, billingEnabled } = useVariables();
const { stripeClient } = 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(() => {
// 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]);
setStripe(loadStripe(stripeClient));
}, []);
const loadCheckout = useCallback(async () => {
return (
@ -120,12 +106,6 @@ export const FirstBillingComponent = () => {
}
);
useEffect(() => {
if (data?.blocked) {
mutate('/user/self');
}
}, [data?.blocked, mutate]);
const price = useMemo(
() => Object.entries(pricing).filter(([key, value]) => key !== 'FREE'),
[]
@ -232,13 +212,6 @@ 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}
@ -344,7 +317,7 @@ type FeatureItem = {
prefix?: string | number;
};
export const useBillingFeatures = (tier: string) => {
export const BillingFeatures: FC<{ tier: string }> = ({ tier }) => {
const t = useT();
const features = useMemo(() => {
const currentPricing = pricing[tier];
@ -422,15 +395,6 @@ export const useBillingFeatures = (tier: string) => {
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) => (
@ -449,7 +413,7 @@ export const BillingFeatures: FC<{ tier: string }> = ({ tier }) => {
/>
</svg>
</div>
<div>{feature.label}</div>
<div>{renderFeature(feature)}</div>
</div>
))}
</div>

View File

@ -1,5 +1,6 @@
'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';
@ -10,12 +11,9 @@ 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 { 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 { 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';
@ -28,7 +26,6 @@ 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';
@ -43,8 +40,10 @@ export const Prorate: FC<{
const { period, pack } = props;
const t = useT();
const fetch = useFetch();
const [price, setPrice] = useState<number | false>(false);
const [price, setPrice] = useState<number | false>(0);
const [loading, setLoading] = useState(false);
const calculatePrice = useDebouncedCallback(async () => {
setLoading(true);
setPrice(
(
await (
@ -58,327 +57,89 @@ export const Prorate: FC<{
).json()
).price
);
setLoading(false);
}, 500);
useEffect(() => {
setPrice(false);
calculatePrice();
}, [period, pack]);
// nothing is shown while the preview loads, the price is missing when it fails
if (typeof price !== 'number') {
if (loading) {
return (
<div className="pt-[12px]">
<ReactLoading type="spin" color="#fff" width={20} height={20} />
</div>
);
}
if (price === false) {
return null;
}
return (
<div className="animate-fadeIn">
{t('pay_today', 'Pay Today')} ${Math.max(price, 0).toFixed(2)}
<div className="text-[12px] flex pt-[12px]">
({t('pay_today', 'Pay Today')} ${(price < 0 ? 0 : price)?.toFixed(1)})
</div>
);
};
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;
export const Features: FC<{
pack: 'FREE' | 'STANDARD' | 'PRO';
}> = (props) => {
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);
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]);
return (
<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'
)}
>
<div className="flex flex-col gap-[10px] justify-center text-[16px] text-customColor18">
{features.map((feature) => (
<div key={feature} className="flex gap-[20px]">
<div>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 20 20"
width="24"
height="24"
viewBox="0 0 24 24"
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="M7 10.25L9 12.25L13 8.25"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
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"
/>
</svg>
<div>{feature.label}</div>
</div>
))}
</div>
<div>{feature}</div>
</div>
))}
</div>
);
};
@ -476,12 +237,10 @@ 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'
);
@ -503,34 +262,6 @@ 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;
@ -568,11 +299,7 @@ export const MainBillingComponent: FC<{
cancelAt: cancel_at,
}));
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'
);
toast.show('Subscription reactivated successfully');
setLoading(false);
return;
}
@ -582,23 +309,9 @@ export const MainBillingComponent: FC<{
!pricing[billing].team_members &&
pricing[subscription?.subscriptionTier!]?.team_members
) {
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`
);
}
messages.push(
`Your team members will be removed from your organization`
);
}
if (billing === 'FREE') {
if (
@ -607,8 +320,7 @@ export const MainBillingComponent: FC<{
`Are you sure you want to cancel your subscription?
${messages.join(', ')}`,
'Yes, cancel',
'Cancel Subscription',
'No, keep it'
'Cancel Subscription'
))
) {
const checkDiscount = await (
@ -663,11 +375,8 @@ export const MainBillingComponent: FC<{
...subs!,
cancelAt: cancel_at,
}));
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.'
);
if (cancel_at)
toast.show('Subscription set to canceled successfully');
setLoading(false);
}
return;
@ -739,12 +448,6 @@ 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);
@ -779,226 +482,139 @@ 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-[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>
</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 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>
{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'
)}
<Slider value={monthlyOrYearly} onChange={setMonthlyOrYearly} />
</div>
<div>{t('yearly', 'YEARLY')}</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
</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
key={name}
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'}
/>
)
}
/>
);
})}
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>
))}
</div>
{!!subscription?.id && (
<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"
>
<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>
<div className="flex justify-center mt-[20px] gap-[10px]">
<Button onClick={updatePayment}>
{t(
'update_payment_method_invoices_history',
'Update Payment Method / Invoices History'
)}
<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"
</Button>
{isGeneral && !subscription?.cancelAt && (
<Button
className="bg-red-500"
loading={loading}
onClick={moveToCheckout('FREE')}
>
{t('billing_update_payment_method', 'Update payment method')}
</button>
</div>
{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'
)}
</div>
)}
{!!subscription?.id && <BillingHistory />}
<FAQComponent />
<div className="flex justify-center mt-[20px]">
<LogoutComponent />

View File

@ -1,534 +0,0 @@
// 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

@ -1,215 +0,0 @@
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,10 +5,7 @@ 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,
mediaLibrarySize,
} from '@gitroom/frontend/components/media/media.component';
import { MediaBox } from '@gitroom/frontend/components/media/media.component';
import copy from 'copy-to-clipboard';
import { useT } from '@gitroom/react/translation/get.transation.service.client';
@ -105,8 +102,8 @@ export const DeveloperComponent: FC = () => {
askClose: false,
closeOnEscape: true,
fullScreen: true,
size: mediaLibrarySize(),
height: mediaLibrarySize(),
size: 'calc(100% - 80px)',
height: 'calc(100% - 80px)',
children: (close: () => void) => (
<MediaBox
setMedia={changeMedia}
@ -232,7 +229,7 @@ export const DeveloperComponent: FC = () => {
)}
</div>
<div className="bg-newBgColorInner rounded-[12px] border border-newBorder overflow-hidden">
<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 className="bg-newBgColorInner px-[20px] py-[14px] border-b border-newBorder flex items-start justify-between gap-[12px]">
<div>
<div className="text-[15px] font-[600]">
{t('oauth_application', 'OAuth Application')}
@ -244,7 +241,7 @@ export const DeveloperComponent: FC = () => {
)}
</div>
</div>
<div className="flex flex-wrap gap-[6px] shrink-0 pt-[2px]">
<div className="flex 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"
@ -296,7 +293,7 @@ export const DeveloperComponent: FC = () => {
)}
</div>
</div>
<div className="p-[20px] mobile:p-[14px] flex flex-col gap-[16px]">
<div className="p-[20px] 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')} *
@ -357,7 +354,7 @@ export const DeveloperComponent: FC = () => {
placeholder="https://yourapp.com/callback"
/>
</div>
<div className="flex flex-wrap gap-[8px]">
<div className="flex gap-[8px]">
<button
type="button"
onClick={createApp}
@ -395,7 +392,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] mobile:px-[14px] py-[14px] border-b border-newBorder flex items-start justify-between gap-[12px] mobile:flex-col">
<div className="bg-newBgColorInner px-[20px] py-[14px] border-b border-newBorder flex items-start justify-between gap-[12px]">
<div>
<div className="text-[15px] font-[600]">
{t('oauth_application', 'OAuth Application')}
@ -407,7 +404,7 @@ export const DeveloperComponent: FC = () => {
)}
</div>
</div>
<div className="flex flex-wrap gap-[6px] shrink-0 pt-[2px]">
<div className="flex 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"
@ -420,7 +417,7 @@ export const DeveloperComponent: FC = () => {
</div>
{editing ? (
<div className="p-[20px] mobile:p-[14px] flex flex-col gap-[16px]">
<div className="p-[20px] 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')} *
@ -481,7 +478,7 @@ export const DeveloperComponent: FC = () => {
placeholder="https://yourapp.com/callback"
/>
</div>
<div className="flex flex-wrap gap-[8px]">
<div className="flex gap-[8px]">
<button
type="button"
onClick={updateApp}
@ -499,7 +496,7 @@ export const DeveloperComponent: FC = () => {
</div>
</div>
) : (
<div className="p-[20px] mobile:p-[14px] flex flex-col gap-[16px]">
<div className="p-[20px] flex flex-col gap-[16px]">
<div className="flex items-center gap-[12px]">
{app.picture?.path ? (
<img
@ -525,9 +522,9 @@ export const DeveloperComponent: FC = () => {
<div className="text-[13px] font-[600] text-customColor18">
{t('redirect_url', 'Redirect URL')}
</div>
<div className="text-[14px] break-all">{app.redirectUrl}</div>
<div className="text-[14px]">{app.redirectUrl}</div>
</div>
<div className="flex flex-wrap gap-[8px]">
<div className="flex gap-[8px]">
<button
type="button"
onClick={startEditing}
@ -548,7 +545,7 @@ export const DeveloperComponent: FC = () => {
{t('credentials', 'Credentials')}
</div>
</div>
<div className="p-[20px] mobile:p-[14px] flex flex-col gap-[16px]">
<div className="p-[20px] 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')}
@ -561,7 +558,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] mobile:h-auto mobile:min-h-[44px] mobile:py-[10px] flex items-center overflow-hidden">
<div className="bg-newBgColorInner border border-newBorder rounded-[8px] px-[16px] h-[44px] flex items-center overflow-hidden">
{plaintextSecret ? (
<code className="text-[14px] flex-1 truncate">
{plaintextSecret}
@ -576,7 +573,7 @@ export const DeveloperComponent: FC = () => {
)}
</div>
</div>
<div className="flex flex-wrap gap-[8px]">
<div className="flex gap-[8px]">
<CopyButton text={app.clientId} label={t('copy_id', 'Copy ID')} />
{plaintextSecret && (
<CopyButton

View File

@ -209,15 +209,13 @@ export const CustomVariables: FC<{
});
const submit = useCallback(
async (data: FieldValues) => {
const response = await fetch(
`/integrations/social/${identifier}${
onboarding ? '?onboarding=true' : ''
}`
);
if (response.status === 402) {
return;
}
const { url } = await response.json();
const { url } = await (
await fetch(
`/integrations/social/${identifier}${
onboarding ? '?onboarding=true' : ''
}`
)
).json();
modals.closeAll();
gotoUrl(
`/integrations/social/${identifier}?state=${url}&code=${Buffer.from(
@ -435,15 +433,13 @@ export const AddProviderComponent: FC<{
const { component: Web3Providers } = web3List.find(
(item) => item.identifier === identifier
)!;
const response = await fetch(
`/integrations/social/${identifier}${
onboarding ? '?onboarding=true' : ''
}`
);
if (response.status === 402) {
return;
}
const { url } = await response.json();
const { url } = await (
await fetch(
`/integrations/social/${identifier}${
onboarding ? '?onboarding=true' : ''
}`
)
).json();
modal.openModal({
title: `Add ${capitalize(identifier)}`,
withCloseButton: true,
@ -482,20 +478,17 @@ export const AddProviderComponent: FC<{
]
.filter(Boolean)
.join('&');
const response = await fetch(
`/integrations/social/${identifier}${params ? `?${params}` : ''}`
);
if (response.status === 402) {
return;
}
const { url, err, message } = await response.json();
const { url, err } = await (
await fetch(
`/integrations/social/${identifier}${params ? `?${params}` : ''}`
)
).json();
if (err) {
toaster.show(
message ||
t(
'could_not_connect_to_platform',
'Could not connect to the platform'
),
t(
'could_not_connect_to_platform',
'Could not connect to the platform'
),
'warning'
);
return;
@ -555,11 +548,7 @@ export const AddProviderComponent: FC<{
if (!confirmed) {
return;
}
if (
!extensionId ||
typeof chrome === 'undefined' ||
!chrome?.runtime?.sendMessage
) {
if (!extensionId || !chrome?.runtime?.sendMessage) {
modal.openModal({
title: t('extension_not_available_title', 'Extension Not Found'),
withCloseButton: true,
@ -616,15 +605,13 @@ export const AddProviderComponent: FC<{
);
return;
}
const response = await fetch(
`/integrations/social/${identifier}${
onboarding ? '?onboarding=true' : ''
}`
);
if (response.status === 402) {
return;
}
const { url } = await response.json();
const { url } = await (
await fetch(
`/integrations/social/${identifier}${
onboarding ? '?onboarding=true' : ''
}`
)
).json();
modal.closeAll();
window.location.href = `/integrations/social/${identifier}?state=${url}&code=${Buffer.from(
JSON.stringify(cookieResponse.cookies)
@ -689,7 +676,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 mobile:!grid-cols-3',
'grid grid-cols-5 gap-[10px] justify-items-center justify-center',
isMobile ? {} : onboarding ? 'grid-cols-9' : 'grid-cols-5'
)}
>
@ -726,7 +713,7 @@ export const AddProviderComponent: FC<{
className={clsx(
isMobile
? 'flex-row h-[72px] p-[16px]'
: 'flex-col p-[10px] h-[100px] justify-center mobile:text-[13px] mobile:leading-[1.2]',
: 'flex-col p-[10px] h-[100px] justify-center',
'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] mobile:h-[40px] mobile:min-w-[40px] rounded-[6px] mobile:rounded-[8px] justify-center items-center flex bg-newColColor mobile:bg-newSettings px-[8px]'
'cursor-pointer h-[30px] rounded-[6px] justify-center items-center flex bg-newColColor px-[8px]'
)}
>
{loading && (
@ -166,7 +166,6 @@ 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] mobile:flex-col mobile:items-stretch">
<div className="mt-[10px] flex w-full justify-center items-center gap-[10px]">
<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] mobile:mt-0">
<div className="flex-1 flex mt-[10px]">
<Button
className="!flex-1"
onClick={() => setPosition('horizontal')}
@ -213,7 +213,7 @@ export const AiVideo: FC<{
<div
onClick={openVideoModal}
className={clsx(
'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]'
'cursor-pointer h-[30px] rounded-[6px] justify-center items-center flex bg-newColColor px-[8px]'
)}
>
{loading && (
@ -229,7 +229,6 @@ 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,9 +19,7 @@ export const BotPicture: FC<{
const t = useT();
const modal = useModals();
const toast = useToaster();
const [nick, setNickname] = useState(
props.integration.originalName || props.integration.name
);
const [nick, setNickname] = useState(props.integration.name);
const [picture, setPicture] = useState(
props.integration.picture || '/no-picture.jpg'
);

View File

@ -1,55 +0,0 @@
'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

@ -1,75 +0,0 @@
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

@ -1,317 +0,0 @@
'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,16 +84,10 @@ 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;
@ -143,23 +137,6 @@ 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[];
@ -168,14 +145,7 @@ export const CalendarWeekProvider: FC<{
const [internalData, setInternalData] = useState([] as any[]);
const [trendings] = useState<string[]>([]);
const searchParams = useSearchParams();
// 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 [displaySaved, setDisplaySaved] = useCookie('calendar-display', 'week');
const display = searchParams.get('display') || displaySaved;
// List view state
@ -196,14 +166,6 @@ 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,
@ -211,10 +173,6 @@ export const CalendarWeekProvider: FC<{
display,
});
useEffect(() => {
setSelectedChannels(null);
}, [filters.customer]);
const params = useMemo(() => {
return new URLSearchParams({
display: filters.display,
@ -244,9 +202,8 @@ export const CalendarWeekProvider: FC<{
limit: '100',
customer: filters?.customer?.toString() || '',
state: listState,
...(selectedChannels ? { integrations: selectedChannels.join(',') } : {}),
}).toString();
}, [listPage, filters.customer, listState, selectedChannels]);
}, [listPage, filters.customer, listState]);
const loadListData = useCallback(async () => {
const response = await fetch(`/posts/list?${listParams}`);
@ -337,14 +294,6 @@ 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]);
@ -385,16 +334,13 @@ 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 ? [] : filterByChannels(internalData),
posts: calendarIsLoading ? [] : internalData,
loading,
integrations,
setFilters: setFiltersWrapper,
@ -409,9 +355,6 @@ export const CalendarWeekProvider: FC<{
setListPage,
listState,
setListState,
selectedChannels,
setSelectedChannels,
currentHour,
}}
>
{children}

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,193 +0,0 @@
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,14 +3,11 @@
import { useCalendar, ListStateFilter } from '@gitroom/frontend/components/launches/calendar.context';
import clsx from 'clsx';
import dayjs from 'dayjs';
import { useCallback, useState } from 'react';
import { useCallback } 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(
@ -46,20 +43,19 @@ 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, short is the phone version
const getDisplayText = (short?: boolean) => {
// Calculate display date range text
const getDisplayText = () => {
const startDate = newDayjs(calendar.startDate);
const endDate = newDayjs(calendar.endDate);
switch (calendar.display) {
case 'day':
return startDate.format(short ? 'ddd (L)' : 'dddd (L)');
return startDate.format('dddd (L)');
case 'week':
return `${startDate.format('L')} - ${endDate.format('L')}`;
case 'month':
@ -291,14 +287,13 @@ export const Filters = () => {
}, [calendar]);
return (
<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 */}
<div className="text-textColor flex flex-col md:flex-row gap-[8px] items-center select-none">
{!isListView && (
<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 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
onClick={previous}
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"
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"
>
<svg
xmlns="http://www.w3.org/2000/svg"
@ -316,17 +311,14 @@ export const Filters = () => {
/>
</svg>
</div>
<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 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>
</div>
<div
onClick={next}
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"
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"
>
<svg
xmlns="http://www.w3.org/2000/svg"
@ -345,7 +337,7 @@ export const Filters = () => {
</svg>
</div>
</div>
<div className="flex-1 mobile:flex-none text-[14px] font-[500]">
<div className="flex-1 text-[14px] font-[500]">
<div className="text-center flex h-[42px]">
<div
onClick={setToday}
@ -358,17 +350,12 @@ export const Filters = () => {
</div>
)}
{isListView && (
<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 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
onClick={previousPage}
className={clsx(
'text-textColor rtl:rotate-180 px-[9px] mobile:px-0 mobile:w-[36px] bg-newBgColorInner h-full flex items-center justify-center',
'text-textColor rtl:rotate-180 px-[9px] 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'
@ -390,7 +377,7 @@ export const Filters = () => {
/>
</svg>
</div>
<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="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]">
{t('page', 'Page')} {calendar.listPage + 1} {t('of', 'of')} {Math.max(1, calendar.listTotalPages)}
</div>
@ -398,7 +385,7 @@ export const Filters = () => {
<div
onClick={nextPage}
className={clsx(
'text-textColor rtl:rotate-180 px-[9px] mobile:px-0 mobile:w-[36px] bg-newBgColorInner h-full flex items-center justify-center',
'text-textColor rtl:rotate-180 px-[9px] 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'
@ -421,13 +408,13 @@ export const Filters = () => {
</svg>
</div>
</div>
<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">
<div className="flex flex-row p-[4px] border border-newTableBorder rounded-[8px] text-[14px] font-[500]">
{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] mobile:flex-1 mobile:min-w-fit mobile:px-[8px] mobile:whitespace-nowrap',
'pt-[6px] pb-[5px] cursor-pointer min-w-[80px] px-[12px] text-center rounded-[6px]',
calendar.listState === option.value &&
'text-textItemFocused bg-boxFocused'
)}
@ -436,79 +423,46 @@ export const Filters = () => {
</div>
))}
</div>
<div className="flex-1 mobile:hidden" />
<div className="flex-1" />
</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]" />
)}
<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>
</div>
)}
<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 className="flex flex-row p-[4px] border border-newTableBorder rounded-[8px] text-[14px] font-[500]">
<div
onClick={setCalendarView}
className={clsx(
@ -558,24 +512,6 @@ 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,7 +111,6 @@ export const GeneralPreviewComponent: FC<{
</div>
</div>
<div
dir="auto"
className={clsx('text-wrap whitespace-pre', 'preview')}
dangerouslySetInnerHTML={{
__html: value.text,

View File

@ -1,73 +1,26 @@
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,
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<{
import { CalendarIcon } from '@gitroom/frontend/components/ui/icons';
export const DatePicker: FC<{
date: dayjs.Dayjs;
onChange: (day: dayjs.Dayjs) => void;
sheet?: boolean;
}> = (props) => {
const { date, onChange, sheet } = props;
const { date, onChange } = props;
const [open, setOpen] = useState(false);
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(
@ -80,229 +33,54 @@ export const DatePickerPanel: 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 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}
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}
ref={ref}
>
<div className="cursor-pointer">
<CalendarIcon />
</div>
<div className="cursor-pointer mobile:hidden">
<div className="cursor-pointer">
{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"
>
<DatePickerPanel date={date} onChange={onChange} />
<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()}
/>
<Button className="mt-[12px]" onClick={changeShow}>
{t('close', 'Close')}
</Button>

View File

@ -3,49 +3,8 @@
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={CalendarBackend}>{children}</DndProvider>;
return <DndProvider backend={HTML5Backend}>{children}</DndProvider>;
};

View File

@ -5,15 +5,6 @@ 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

@ -1,39 +0,0 @@
'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<{ className?: string }> = ({ className }) => {
const Invalid: FC = () => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
@ -38,12 +38,11 @@ const Invalid: FC<{ className?: string }> = ({ className }) => {
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="currentColor"
stroke="white"
strokeWidth="1.2"
strokeLinecap="round"
strokeLinejoin="round"
@ -185,51 +184,25 @@ export const InformationComponent: FC<{
return (
<div
className={clsx(
'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'
'group rounded-[6px] gap-[4px] h-[30px] px-[6px] flex justify-center items-center relative',
isValid ? 'border border-newColColor' : 'bg-[#FF3F3F]'
)}
>
{isValid ? (
<Valid />
) : (
<Invalid className="text-white mobile:text-[#FF3F3F]" />
)}
{isValid ? <Valid /> : <Invalid />}
{!isGlobal && (
<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]'
)}
>
<div className={clsx("text-[10px] font-[600] flex justify-center items-center", !isValid && 'text-white')}>
{currentChars}/{totalAllowedChars}
</div>
)}
{isGlobal && globalDisplayLimit !== null && (
<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]'
)}
>
<div className={clsx("text-[10px] font-[600] flex justify-center items-center", !isValid && 'text-white')}>
{globalDisplayLimit.count}/{globalDisplayLimit.limit}
</div>
)}
{((isGlobal && selectedIntegrations.length) || !isValid) && (
<svg
className={clsx(
'group-hover:rotate-180',
isValid
? 'mobile:text-newTextColor/40'
: 'text-white mobile:text-[#FF3F3F]'
)}
className={clsx('group-hover:rotate-180', !isValid && 'text-white')}
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"

View File

@ -25,16 +25,11 @@ 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 (
@ -116,70 +111,6 @@ 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;
@ -206,37 +137,9 @@ 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);
@ -274,7 +177,7 @@ export const MenuGroupComponent: FC<
)}
{!!group.name && (
<div
className="flex items-center gap-[5px] cursor-pointer group"
className="flex items-center gap-[5px] cursor-pointer"
onClick={changeOpenClose}
>
<div>
@ -291,14 +194,6 @@ export const MenuGroupComponent: FC<
>
{group.name}
</div>
{!collapsed && (
<div
className="hidden group-hover:block hover:opacity-70"
onClick={editGroupName}
>
<EditPencil />
</div>
)}
</div>
)}
<div
@ -470,7 +365,6 @@ 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();
@ -629,59 +523,27 @@ 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' && !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'
collapseMenu === '1' ? 'group sidebar w-[100px]' : 'w-[260px]'
)}
>
<div
className={clsx(
'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'
'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'
)}
>
<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 mobile:hidden 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 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"
@ -702,40 +564,38 @@ 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 mobile:hidden">
<div className="flex gap-[8px] group-[.sidebar]:flex-col">
{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' || 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>
{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')}
</div>
</div>
)}
</div>
)}
{menuIntegrations.map((menu) => (
<MenuGroupComponent
collapsed={collapseMenu === '1' && !channelsOpen}
collapsed={collapseMenu === '1'}
changeItemGroup={changeItemGroup}
key={menu.name}
group={menu}
@ -747,7 +607,7 @@ export const LaunchesComponent = () => {
/>
))}
</div>
<div className="mt-[5px] text-center flex flex-col mobile:hidden">
<div className="mt-[5px] text-center flex flex-col">
{billingEnabled && user?.isLifetime && (
<div>{capitalize(user?.tier?.current || '')} tier</div>
)}
@ -759,41 +619,7 @@ export const LaunchesComponent = () => {
</div>
</div>
</div>
<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>
<div className="bg-newBgColorInner flex-1 flex-col flex p-[20px] gap-[12px]">
<Filters />
<div className="flex-1 flex">
<Calendar />

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