feat(social): send TikTok uploads to drafts instead of publishing

Upload-Post's `post_mode` defaults to DIRECT_POST, so a clip went straight to
the user's TikTok feed. MEDIA_UPLOAD lands it in their drafts to finish in
TikTok's own editor instead.

Drafts are the right default for an automated pipeline: nothing reaches an
audience without the account owner seeing it, and covers, sounds and trending
hashtags are chosen inside TikTok anyway — the parts that decide whether a clip
travels are exactly the parts this cannot do from the outside.

Applied to both paths that can target TikTok (the clip publisher and the
SaaS-shorts publisher) through one constant, so they cannot drift apart.
TIKTOK_POST_MODE=DIRECT_POST restores publishing without a code change.

The UI now says so before the button is pressed, in both publishers, and leads
with the upside rather than the caveat. Without it the change reads as a bug:
someone expecting a live post, finding nothing on their profile, and concluding
the upload failed. The notice also tells them a TikTok notification is coming,
which the Upload-Post docs confirm for MEDIA_UPLOAD ("users will receive an
inbox notification"), so they know where to look.
This commit is contained in:
juancarlos.cavero 2026-07-29 00:03:14 +02:00
parent 51aafb5290
commit 4c04b37e4f
3 changed files with 38 additions and 0 deletions

12
app.py
View file

@ -36,6 +36,16 @@ os.makedirs(OUTPUT_DIR, exist_ok=True)
# Default to 1 if not set, but user can set higher for powerful servers
MAX_CONCURRENT_JOBS = int(os.environ.get("MAX_CONCURRENT_JOBS", "5"))
MAX_FILE_SIZE_MB = 2048 # 2GB limit
# How TikTok receives our uploads. MEDIA_UPLOAD lands the video in the user's
# TikTok drafts so they finish the post inside TikTok's own editor; DIRECT_POST
# publishes straight to their feed, which is Upload-Post's default.
#
# Drafts are the safer default for an automated pipeline: nothing reaches an
# audience without the account owner seeing it first, and TikTok's own editor is
# where covers, sounds and hashtags actually get chosen. The UI must say so —
# a user who expects a published post and finds a draft will read it as a bug.
TIKTOK_POST_MODE = os.environ.get("TIKTOK_POST_MODE", "MEDIA_UPLOAD").strip()
JOB_RETENTION_SECONDS = int(os.environ.get("JOB_RETENTION_SECONDS", "3600")) # job/file retention (issue #46)
# Ceiling for the working directory once it lives on a persistent volume: the
# age-based sweep alone can't stop a burst of long videos from filling the disk.
@ -2552,6 +2562,7 @@ async def post_to_socials(req: SocialPostRequest, request: Request):
# Add Platform specifics
if "tiktok" in req.platforms:
data_payload["tiktok_title"] = final_description
data_payload["post_mode"] = TIKTOK_POST_MODE
if "instagram" in req.platforms:
data_payload["instagram_title"] = final_description
@ -3425,6 +3436,7 @@ async def saasshorts_post_to_socials(req: SaaSPostRequest, request: Request):
if "tiktok" in req.platforms:
data_payload["tiktok_title"] = final_description
data_payload["post_mode"] = TIKTOK_POST_MODE
if "instagram" in req.platforms:
data_payload["instagram_title"] = final_description
data_payload["media_type"] = "REELS"

View file

@ -849,6 +849,22 @@ export default function ResultCard({ clip, index, jobId, durableUrl, uploadPostK
</div>
)}
{/* TikTok is sent as a draft, so say so before they press publish:
someone expecting a live post and finding nothing on their
profile will read it as a failure. Lead with the upside —
posting from inside the app is what the algorithm rewards. */}
{platforms.tiktok && (
<div className="mb-4 px-3 py-2 rounded-input text-xs text-ink2 bg-paper3 flex items-start gap-2">
<AlertCircle size={14} className="mt-0.5 shrink-0 text-brass" />
<div className="lowercase">
tiktok arrives as a <b className="text-ink">draft</b>, not a live post — you'll
get a notification in the app. finishing it there lets you add trending
sounds, effects and hashtags, which reaches more people than posting
straight from an api.
</div>
</div>
)}
<div className="space-y-4">
{/* Title & Description */}
<div>

View file

@ -1397,6 +1397,16 @@ export default function SaaShortsTab({ geminiApiKey, elevenLabsKey, falKey, uplo
})}
/>
{/* Same notice as ResultCard: TikTok lands as a draft,
and finding nothing live reads as a failed post. */}
{publishPlatforms.tiktok && (
<p className="mt-2 text-xs text-muted lowercase">
tiktok arrives as a <b className="text-ink2">draft</b> and you'll get a
notification in the app — finishing it there lets you add trending sounds
and hashtags, which reaches more people than posting from an api.
</p>
)}
{/* Schedule toggle */}
<div className="flex items-center gap-3">
<label className="flex items-center gap-2 text-xs lowercase text-muted cursor-pointer">