Commit graph

161 commits

Author SHA1 Message Date
juancarlos.cavero
fe4e256cc4 fix(thumbnail): byte-part references, public-figure fallback, frames effect race
Browser run on a real video surfaced three defects:
- references were one PIL Image shared by the worker threads; the SDK's
  encoder raced and every generation died. Now each reference is an
  immutable JPEG byte part.
- Gemini's image model refuses recognisable public figures, by reference
  photo and by name alike (IMAGE_OTHER). The concept planner no longer
  writes real names or brands into scene prompts, and a blocked render is
  retried once without the person; the card says so.
- the frames effect listed its own state as a dependency, so setting it
  re-ran the effect and the cleanup discarded the response in flight.
2026-08-27 12:21:01 +02:00
juancarlos.cavero
eb6ef13bba feat(thumbnail): concept-driven thumbnails, crisp burned text, face frames from the video, scored titles
Titles: transcript + 10 frames instead of uploading the whole video (an hour
was ~1M tokens), a brainstorm across fixed styles then a critic that scores,
dedupes by angle and pairs each title with a 1-4 word thumbnail hook. Mobile
rules: payoff inside 50 chars, keyword first. Text model moves to
GEMINI_MODEL_THUMBNAIL (default gemini-3.5-flash); flash-lite is the weakest
tier and this is the one creative step.

Thumbnails: a text call designs N different concepts, one image call each in
parallel. Default burns the hook text with PIL (Anton, black stroke) over
negative space the image model is told to leave, so accents are never wrong;
'AI painted' toggle keeps the old behaviour. Outputs cover-cropped to
1280x720 under YouTube's 2 MB. GET /api/thumbnail/frames/{session} picks
frames with a large, sharp face spread across the runtime and the dashboard
offers them as the person reference. Phone-size preview row in the UI.
JSON parsing now uses raw_decode: flash appended a stray ]} once.
2026-08-27 10:57:34 +02:00
juancarlos.cavero
83ad817a31 feat(mcp): OAuth 2.1 for claude.ai/ChatGPT, and a "connect an agent" panel
claude.ai and ChatGPT connect to a remote MCP server by URL and expect the
server to run the login: RFC 9728/8414 discovery under /.well-known/,
dynamic client registration (public clients, PKCE S256 mandatory), an
authorization endpoint and a token endpoint. The consent screen is the
dashboard (#/oauth/authorize) because the session JWT lives in localStorage
on the frontend host; the API bounces there and mints the code on a
session-authenticated POST. Redeeming the code mints an ordinary osk_ API
key named after the client and returns it as the access token, so every
existing auth, quota and ownership rule applies unchanged and the user
disconnects an app by revoking that key. The /mcp 401 now carries
WWW-Authenticate: Bearer resource_metadata=... so clients find the flow.

Dashboard: a "Connect an agent" card (Account in cloud, Settings when
self-hosted) with copy-ready setup for claude.ai, ChatGPT, Claude Code,
Claude Desktop, Cursor, n8n and curl; the clip generator links to it. The
/mcp page, README and CLAUDE.md describe the URL-only connection.
2026-08-27 01:17:49 +02:00
juancarlos.cavero
d9152221fd docs(dashboard): name Gemini 3.1 Flash-Lite in landing, pricing and SEO copy 2026-08-26 00:30:51 +02:00
juancarlos.cavero
08e0eca92d chore(dashboard): make npm run lint work again
eslint.config.js was written for ESLint 9's flat config but package.json
pinned ESLint 8 and the script still passed --ext, so lint had not run in
months. Upgrade to ESLint 9 with @eslint/js and globals, keep
eslint-plugin-react-hooks on v5 (v7 ships the React Compiler rules, which
flag 21 places that would be a refactor, not a lint fix), drop the unused
eslint-plugin-react, and tune the rules to the house style: ignored catch
bindings, constant exports next to components, node globals for the build
scripts, and the entry point exempt from fast-refresh checks.

The findings that remained were fixed at the source: two unused Icon
destructures, an unused footer argument, two dead state pairs, one
useCallback dependency memoised, and six run-once effects marked as such.
2026-08-25 19:24:46 +02:00
juancarlos.cavero
fd0e39862c feat(layouts): dashboard layout selector, layouts=none, ranges survive a fast recut
- Advanced options gain "vertical layout": auto (server default, AI picks
  per video), two speakers stacked, screen over presenter, or single crop
  only. Only a deliberate choice travels as `layouts`; remembered in
  localStorage like the hook settings.
- `layouts=none` switches the picker off for one job even though the
  deployment runs AUTO_LAYOUT=1.
- The fast rerender (cut without reframe) wrote no layout sidecar, so a
  stacked clip fell back to bottom captions after a trim. It now carries the
  canonical clip's ranges through the new cut (layout_ranges.remap).
2026-08-25 15:45:19 +02:00
juancarlos.cavero
b4bf211b7b fix(cloud): close the gaps the account-deletion review turned up
Eight findings from re-reading the erasure path, each one something that would
have shown up in production rather than in a test:

- The local purge missed two stores. SaaSShorts outputs (output/saas_<id>) and
  generated thumbnails record ownership in their own in-memory dicts, not in
  the .owner file, so neither was erased. Thumbnails are the serious half: the
  hourly sweep deliberately skips their directory, so a deleted user's
  generated images stayed on disk forever, publicly served at /thumbnails/.
- The purge ran on the event loop. rmtree over gigabytes of video stalled every
  other request on the process; it goes through asyncio.to_thread now.
- Paths from those dicts are now resolved through _safe_under, so a session id
  or output_dir containing ".." deletes nothing.
- Deleting a user made a webhook path reachable that never was: _apply_topup
  takes the user id from Stripe metadata, so a top-up completing around the
  deletion inserted a row pointing at a user that no longer exists. The FK
  violation 500s the webhook, and since the event is only recorded after
  handle_event returns, Stripe retries the same doomed insert for three days.
  It confirms the row exists first.
- The "why are you leaving" box was free text stored in a record that
  deliberately outlives the account, which is how personal data ends up in one
  by accident. It is a closed list now, which also makes twenty deletions a
  month countable instead of readable.
- Two concurrent deletes wrote two erasure records and sent two goodbye emails.
  The DELETE's rowcount now decides which call is the real one; the UI holds a
  ref so a double click doesn't fire a second Stripe cancel and R2 purge.
- The delete button armed itself when the confirm box was empty, if the page
  ever rendered before /api/me resolved.
- The goodbye email claimed we keep "a one-way hash of your email and nothing
  else", which was not true of the Stripe reference beside it. Fixed in the
  email and in the privacy policy, EN and ES.

Also: skip the Upload-Post call when no managed key is configured, and say
plainly in the in-flight comment that it covers metered work only.

tests/test_account_local_purge.py covers tenant isolation across all three
stores and both traversal attempts; test_account_erasure.py gains the
confirmation gate, the API-key refusal, and the already-cancelled-at-Stripe
case that would otherwise trap a user forever.
2026-08-24 19:26:12 +02:00
juancarlos.cavero
1d9fef7445 feat(cloud): self-service account deletion (GDPR art. 17)
The privacy policy already told users that "deleting your account from the
dashboard removes your content" — there was no way to do it. This adds one:
Account -> Delete account in the dashboard, DELETE /api/account on the server.

The endpoint refuses API-key auth (a leaked osk_ must not destroy the account
it was issued from) and requires the caller to retype the account email; the UI
does the same, collapsed behind a danger zone that itemises what actually goes.
Erasure is immediate and irreversible, because after it there is nothing left
to authenticate a recovery request against.

The order of the steps is the design, each one a failure mode:

- Stripe cancel first, aborting everything if it fails, so we never erase a
  user we are still billing. An InvalidRequestError is treated as already
  cancelled: a portal cancellation whose webhook never landed leaves our row
  reading "active" forever, and the one account that could not be deleted
  would be the one Stripe already stopped charging.
- R2 before the database, because those rows are the only index of which
  objects belong to the user; dropping them first turns a failed purge into
  permanent orphans.
- The DB delete is one transaction over an explicit table list, not the
  declared ON DELETE CASCADEs: create_all never ALTERs an existing table, so a
  constraint added after a table shipped lives in the models and not in
  production. tests/test_account_erasure.py fails if a new table references
  users.id without joining that list.
- A reserved usage_ledger row blocks the delete: erasing under a running job
  would pull the output from beneath it and leave the reservation unsettled.

What survives, and why: the Stripe customer and its invoices (six years,
Spanish commercial law) and one account_deletions row holding a sha256 of the
email as proof the erasure happened, itself purged after five years by the
retention sweeper. app.py registers a callback so the working files in output/
and uploads/ go too instead of waiting for the hourly sweep.

Privacy policy sections 6 (EN + ES) now point at the button and name both
survivors; the Legal hub summary says the same in one line.
2026-08-24 19:12:05 +02:00
juancarlos.cavero
b9f232366a fix(dashboard): make the clip-generation view legible on a phone
The "generating" screen was the one the user singled out, and the scan box
was the reason. Interface only; no pipeline, request or data changes.

The visible defect: two HUD pills were pinned to opposite corners of the
preview, ~150px and ~170px wide. Any box narrower than their combined width
made them overlap and interleave their letters — "SCANNING CO|VIRAL_DETECTION:
ACTIVE". That is every phone, and the md tablet width too, where this panel is
only 55% of the viewport. They are now one flex row with justify-between and a
truncating left pill, so they degrade instead of colliding, and the right-hand
pill (which says nothing the left one doesn't) waits for lg.

The rest of the box was desktop flourish that turns to noise at phone scale,
so below sm it drops the blueprint grid, the dashed thirds guides, the ping
ring and the scissors, and the bottom telemetry bar — which was spending a
third of a 175px box on two lines that are always true. The box itself goes
2:1 instead of 16:9 (object-cover crops rather than shrinks, so no picture is
lost) and loses 16px of the margin under it.

Removing the invented telemetry leaves a phone with nothing to read, since the
log terminal starts collapsed there, so the panel now shows the real log tail
under the preview: "Transcribing with faster-whisper", "Asking Gemini to pick
the viral moments". Between that and the tighter box, "Generated Shorts" is
now on the first screen instead of a full scroll down, and its empty state
gets a min-height and a line saying clips appear one by one.

Verified at 360/390/640/768/1024/1440: no pill overlap and no horizontal
scroll at any width; the full HUD is intact from lg up.
2026-08-24 02:34:03 +02:00
juancarlos.cavero
3709d64085 feat(dashboard): make the app usable on a phone
The dashboard was a desktop layout that merely survived a narrow viewport.
The changes below are interface only; no backend behaviour, request shape or
data changes.

Navigation. Below md the 80px icon rail is gone. It cost a fifth of a 360px
screen to show seven unlabelled glyphs. In its place: a bottom tab bar with
the four everyday destinations plus "more", and a drawer behind the header's
menu button carrying the full list. All three surfaces read one `navItems`
array, so they cannot drift. The tab bar is a flex sibling of the scrolling
pane rather than a fixed overlay, so no pane needs compensating padding and
nothing hides behind it. The header gains the section name the rail used to
carry, so a phone still knows where it is.

Shell. h-dvh where supported (100vh hides its own bottom bar behind mobile
browser chrome), body overflow-x hidden, and safe-area padding for the iOS
home indicator via viewport-fit=cover.

Touch and legibility. Inputs render at 16px below sm so iOS stops zooming on
focus and never zooming back; the shared button pills get a 44px floor on
coarse pointers; the 10.5px mono labels come up to 11.5px on phones.

Density. The clip-generator hero no longer fills the fold on its own. The log
terminal starts collapsed on phones. Result cards cap the 9:16 preview so the
title, captions and actions stay on the same screen as the clip. Modals become
bottom sheets below sm — a centred dialog with 4px side margins was wasting the
only width there was. Banners, the results toolbar and the social nudge stack
instead of crushing.

Also fixes three <div>-inside-<p> blocks in Settings that the browser was
silently tearing apart.
2026-08-24 02:25:24 +02:00
juancarlos.cavero
080dd5780b feat(delivery): serve clips from a custom R2 domain, and show download progress
Measured 22-ago-2026 against prod, on one 46 MB / 52 s clip:

  origin -> itself through Traefik   130 MB/s
  origin -> a datacenter client      838 KB/s
  origin -> the author's browser      90 KB/s   (8.5 min for one clip)
  R2 S3 endpoint -> the server        11 MB/s, 206
  R2 S3 endpoint -> that browser      503, every single request

So the API process is not the bottleneck (it serves the file at 130 MB/s while
the box sits at 0.01 MB/s of egress); the long path out of Hetzner is. And the
fix for that, R2, is unreachable from a browser: *.r2.cloudflarestorage.com is
an S3 endpoint, and a presigned GET that curl fetches at 11 MB/s with identical
headers returns 503 to Chrome.

R2_PUBLIC_BASE points presigned_get() at a custom domain bound to the bucket
instead, which serves the same objects through the normal Cloudflare edge.
Unset, everything keeps signing S3 URLs exactly as before, so this is inert
until the domain exists. Switched at that one choke point because every caller
hands the URL to a browser.

The download button streamed nothing to the screen while it buffered tens of MB
into a blob, which on a slow link is minutes of a button that looks dead. It now
reports percentage, which needs Content-Length readable from JS, which needs the
CORS middleware to name it in expose_headers.
2026-08-23 13:49:08 +02:00
juancarlos.cavero
e0fa3fd591 perf(dashboard): play clip previews from R2, not from the render box
Each result card streamed its clip from /videos, which is served by the
same single-worker API process that is running the renders, while the
same clip was already archived to R2 (free egress, edge-served). The
durable URL was in the browser the whole time and was only used as an
error fallback.

It becomes the playback source, but only while R2 holds exactly the file
the server considers current: a server-side edit rewrites the clip and the
re-archive behind it is fire-and-forget, so preferring the durable copy
blindly would show the clip from BEFORE the edit. /api/history therefore
returns the archived filename, and the card compares it against its own
serverVideoFile.

The map is chased after each edit and again once the job completes, since
a job is marked completed before _archive_managed_job finishes uploading
and the first read otherwise lands empty and never retries. The effect
that reads it is keyed on the clip count instead of the results object, so
it no longer re-reads the history on every status poll. The durable copy
is never adopted under a player the user already started, because swapping
src restarts playback.

Display only: currentVideoUrl still drives the download button and every
server operation (all of which pass input_filename, never a URL), so no
edit can be routed to the wrong file by this.
2026-08-22 19:52:17 +02:00
juancarlos.cavero
22d4d1889e copy(banner): one star ask per job, while the clips render
The finished-clips banner made it two asks for the same job, and the old
wording put the word "free" next to the product name for anyone who missed
the pun, which is the one thing this copy must never do.
2026-08-22 19:51:40 +02:00
juancarlos.cavero
119a6da8be feat(seo): canvas screenshot on the n8n page, and link it from the landing
The page opened with a TL;DR box, which is the wrong lead for a page
whose subject is a workflow: the canvas shows in one glance what four
paragraphs were describing. Screenshot in, summary box out, and the
TL;DR block in render.js is now optional so other pages can make the
same call.

Two nodes in act 3 sat on identical coordinates after the queue node
landed, so the template opened with overlapping labels on import.

The landing named n8n in the hero without linking anywhere; it now
points at the workflow page, in the app and in the crawler fallback
that has to mirror it.
2026-08-21 21:41:58 +02:00
juancarlos.cavero
a245f14ec5 feat(seo): landing page for the n8n content-machine template
/n8n-youtube-shorts-automation answers the two loudest unanswered asks
in the n8n community (a free/self-hostable clipper callable from a
workflow, and why posting video to TikTok/Instagram is so painful), and
gives the Reddit and forum posts a stable URL of ours to point at
instead of a raw file on GitHub.

Also drops the now-false 'there is no official n8n template yet' from
the automation page's body and FAQ, and links the two.
2026-08-21 21:14:05 +02:00
juancarlos.cavero
cb1eecaa34 feat(dashboard): post analytics card + connect entry in profile selector
Account page gains a 'Your posts' card: last-30-days impressions with
per-platform split and the top 3 posts by views, backed by the new
analytics endpoints. Hidden for free users (402) and until data loads.

The header profile selector was a no-op for managed users (exactly one
profile, nothing to switch) while displaying greyed-out networks with
no way to connect them — it now ends in a Connect / manage accounts
action that opens the branded Upload-Post connection page.
2026-08-21 19:16:53 +02:00
juancarlos.cavero
8fb5e3b7b6 fix(editor): hide the word-boundary hint when the job kept no transcript
A silent/visual-only job has no words to click, so 'CLICK A WORD, THEN
SET A BOUNDARY' sat right above 'this job kept no transcript'.
2026-08-21 15:17:44 +02:00
juancarlos.cavero
4a71d66066 fix(dashboard): guard the synced-playback seek against a non-finite time
Found while browser-testing the editor: a clip without a start yet makes
ResultCard emit onPlay(NaN), and assigning that to currentTime throws in
a mount effect, taking the whole tree down to a black screen.
2026-08-21 04:49:28 +02:00
juancarlos.cavero
0b59047422 feat(dashboard): social-connect nudge at the results peak
Only 2.7% of cloud users who pass through the social flow ever connect a
network (146 of 5,406 Upload-Post profiles), yet publishing from the app
is the strongest retention loop we have. Show a dismissible banner right
when the clips appear - the moment with the best odds - prompting managed
users with no connected network to open the hosted connect page.

Instrumented like the other conversion moments: SocialNudgeSeen (once per
job), SocialNudgeConnect, SocialNudgeDismissed (persisted in localStorage,
never shown again). Hidden automatically once any network is linked.
2026-08-21 04:36:05 +02:00
juancarlos.cavero
9d18520c2e fix(editor): four UX corrections from issue #73
- The clip track's scale is now the rendered length instead of the
  current total, so trimming a segment visibly shortens its bar; before,
  a single-segment clip always filled 100% of the track and dragging its
  handle appeared to move nothing.

- Playback boundaries are enforced by a per-frame rAF loop instead of
  timeupdate (~4Hz), which let the preview overshoot a trimmed endpoint
  by up to 250ms — the exact frame is what an end trim is judged
  against. Hitting an edge also snaps currentTime back onto it.

- The transcript header now offers 'segment starts/ends here' actions on
  the selected word, where the eye already is when choosing a cut point
  from the text.

- Closing the editor mid-render is allowed and explained: the request
  keeps running and onRerendered (functional setState in App) updates
  the clip card after the editor is gone.
2026-08-21 04:20:18 +02:00
juancarlos.cavero
e4792fd3b3 feat: hand the Thumbnail Studio video and transcript straight to the clip generator
Issue #68: publishing a video to YouTube from the Studio now offers
'create clips from this video'. /api/process accepts a
thumbnail_session_id, hardlinks the session's source under the job's
name (so /api/source, the clip editor and retention treat it like a
normal upload) and forwards the session's transcript via a new
main.py --transcript flag, so the pipeline skips a second Whisper pass.

Any problem with the forwarded transcript (missing file, no segments,
silent source) falls back to transcribing normally, and empty
transcripts are not forwarded at all. Contract pinned by six endpoint
tests plus a fallback case; verified end to end locally against the
running app (speech video: 'Reusing precomputed transcript (4
segments)' in the job log).
2026-08-20 19:48:13 +02:00
juancarlos.cavero
d0e1f5adfd feat: raise the self-host job retention default to 24h and surface it in the UI
Issue #46 round two: the 1h sweep kept deleting finished projects under
self-hosters who never touched their env. The disk is already bounded by
OUTPUT_MAX_GB / UPLOADS_MAX_GB, so age can afford to be generous. Cloud
keeps the tight default because clips are archived to R2 on completion.

The results panel now tells self-host users how long their clips live
and which env var controls it, and the restorable-session window follows
the new default.
2026-08-20 19:29:55 +02:00
mutonby
05f13254e7
Merge pull request #72 from tuliovianna-lab/feat/clip-editor-ux
Clip editor: source monitor, three-point editing, and a timeline that works while edited
2026-08-20 12:33:28 +01:00
juancarlos.cavero
aa0c841b47 feat(landing): mention MCP in the hero description
The hero now pitches the agent audience too: 'also a clipping tool for ai
agents: claude, chatgpt and n8n drive it over mcp', linking to /mcp. Same
sentence added to the crawler-visible fallback copy (landing-fallback.js
must stay in sync with Landing.jsx).
2026-08-20 02:10:08 +02:00
juancarlos.cavero
1be82bc307 fix(legal): drop the 15-day renewal-reminder promise from the Terms
Business decision: the reminder email will not be implemented for now, so
the Terms must not contractually promise it — a broken written promise is
worse than the underlying statutory ambiguity. Renewal terms now state
auto-renewal until cancellation, cancellable anytime from the account.
(The art. 97.1.p TRLGDCU obligation from Ley 10/2025 still exists for
Spanish companies; revisit if enforcement picks up.)
2026-08-20 01:36:46 +02:00
juancarlos.cavero
2900047b78 feat(legal): full legal corpus — Terms, Privacy, Legal Notice in EN+ES
Replaces the single thin Terms & Privacy SPA view with six indexed static
pages (/terms /privacy /legal-notice + /terminos /privacidad /aviso-legal)
built like the SEO pages, in the sitemap and llms.txt but out of the
marketing interlinking ring. The #legal SPA route becomes a hub linking to
them, so the text lives in exactly one place. Footer and the rights-
attestation checkbox now link to the real documents.

Drafted from a clause inventory of OpusClip/Klap/Vizard/Submagic legals
plus a 2026 Spanish/EU compliance review. Notable substance:
- LSSI art. 10 identity (TONVI TECH SL, Málaga) — was missing entirely.
- Rights warranty covers URL-instructed downloads explicitly and declares
  the attestation record (IP+UA+date) as evidence; DSA arts. 11-17
  notice-and-action with repeat-infringer policy.
- Explicit output ownership (clips are the user's; free-tier watermark as
  a written licence condition) and a no-AI-training commitment naming
  Gemini/ElevenLabs/Whisper — clauses none of the competitors have.
- EU withdrawal per CJEU C-234/25: SaaS is a digital service, the 14-day
  right survives with pro-rata payment (not the digital-content forfeit
  the old page used); renewals do not reopen it. 15-day renewal reminder
  duty (Ley 10/2025) stated.
- AI Act art. 50: dubbed clips declared as labelled/marked; users must
  not strip marks.
- Privacy: per-purpose legal bases, named processors, DPF+SCC transfers,
  real retention (7-day free clips, sub+7 days paid — matching
  cloud/config.py), AEPD analytics exemption documented, no cookie
  banner rationale.
- Spanish versions with prevalence clause (art. 60.1 TRLGDCU; AEPD has
  fined foreign-language-only policies). renderPage supports page.lang.
2026-08-19 22:06:11 +02:00
Tulio Vianna
83c45916a2 feat(editor): rebuild the clip editor around a source monitor and a working timeline
Turns the clip editor into a three-point editing surface: mark in/out on
the source, send the range to the clip, and scrub the result — with the
timeline honest about which parts of the edit the last render can already
show.

- Chrome: the source track ignored drags entirely. Without preventDefault
  the gesture became a text selection and then a native drag, which
  swallows every later pointer event and shows the not-allowed cursor.
- The source track's block is draggable (body moves, edges trim) and every
  gesture on it scrubs the source monitor, so a cut is chosen against the
  picture rather than against numbers.
- Three-point editing: mark in / mark out (i / o) off the monitor's
  playhead, then "replace #N" (.) or "insert after #N" (,). Dragging empty
  track marks a range instead of silently appending a segment.
- /edl ships the whole source transcript instead of a ±45s window: a cut
  can only be extended into words the editor was sent. The panel shows all
  of it, follows playback, and seeks the monitor on click.
- Layout: source monitor + its track + transcript | clip preview + its
  track | controls. Each track sits under the video it drives.
- The clip timeline works while edited. A cut that only removes material
  keeps nothing but frames the last render already produced, so it stays
  scrubbable and playable; only material the render never saw is marked
  red, and the playhead — now a solid handle — stops at its edge.

Transcript words render in memoised 50-word slices: repainting a couple of
thousand of them costs ~66ms, and timeupdate fires four times a second.
2026-08-19 15:23:30 -03:00
juancarlos.cavero
2b2e287a9b feat(hook): replace semantics — a new hook swaps the burned one, plus remove
The auto-hook was burned into the canonical clip in place, so editing the
hook stacked a second overlay on top of the first. Hooks now follow the
exact derivation pattern captions use:

- main.py: auto_hook_clip writes hooked_<ts>_<clean>.mp4 next to the clean
  canonical instead of mutating it; captions burn on top of the hooked file
  (subtitled_<ts>_hooked_<ts>_<clean>). Watermark moves BEFORE the hook so
  the branding lives in the canonical and survives hook replacement.
- app.py: _strip_burned_hook walks hooked_/legacy hook_ prefixes back like
  _strip_burned_captions; /api/hook strips captions AND the old hook before
  burning, so a new hook always REPLACES the previous one. New remove flag
  strips the hook entirely (captions re-applied, no metering). Burned hook
  recorded/cleared in clip metadata (auto_hook key) and returned as
  burned_hook. _canonical_clip_file resolves hooked_*/hook_* derivations.
- cloud/videos.py: archive the hooked_ intermediate of a captioned hook so
  restored projects keep the walk-back chain editable.
- ResultCard: stripBurns knows hooked_<ts>_ (the Remotion preview now
  composes over the truly clean clip — no more stacked preview), burned
  hook tracked in state, remove handler wired to the modal.
- HookModal: warning now says replace, plus a 'remove hook from clip'
  action when one is burned.
2026-08-19 16:01:53 +02:00
juancarlos.cavero
ac0138269d feat(hook): auto-burn AI hooks on generated clips + working emoji + editor polish
Auto-hook (opt-in per job, dashboard default ON):
- /api/process accepts auto_hook + auto_hook_style; absent means off, so
  API/MCP/webhook callers keep byte-identical output.
- main.py auto_hook_clip burns each clip's viral_hook_text (Gemini already
  produced it, it was only used to pre-fill the modal) into the canonical
  clip in place — after reframe, under watermark and captions — so every
  derived-name convention (subtitled_/recut_ walk-backs, R2 archive,
  restore) keeps working untouched. Fail-open like auto_caption_clip.
- Burned hook recorded as clip.auto_hook in metadata; the hook modal warns
  before stacking a second one.
- MediaInput: 'auto hook titles' toggle + style select in advanced options,
  persisted in localStorage.

Emoji that actually render:
- Gemini prompt now asks for 1-2 emojis in viral_hook_text.
- Dockerfile installs fonts-noto-color-emoji — without it prod silently
  stripped every emoji (no candidate font existed in the image).
- hooks.py supports fixed-bitmap color fonts (NotoColorEmoji only loads at
  its 109px strike; Apple Color Emoji at 160): glyphs render at native size
  and are Lanczos-rescaled to the text size instead of being treated as
  unavailable. macOS system font added for local dev.

Editor polish:
- HookModal persists last style/position/size/entrance (always reset to
  classic before, which read as the picker being broken).
- Remotion preview positions aligned to hooks.py (top 20%, bottom 70%).
- Warning when a bottom hook will overlap burned/preview captions.
- Entrance-animation control greyed out with a note when the clip
  re-renders on the server, where the hook is static.
2026-08-19 14:28:19 +02:00
juancarlos.cavero
8dbc6ce9bd fix(hook): Remotion overlay ignored the style picker, always rendered classic
d94e126 added the 6 hook styles to hooks.py (server FFmpeg path) and to the
HookModal picker, but never to the Remotion composition — which is what
renders both the modal preview and the final clip on the primary in-browser
render path. Picking dark/yellow/red/outline still produced the white
classic card.

- HookOverlay.tsx: HOOK_LOOKS map mirroring hooks.py HOOK_STYLES (box color,
  text color, outline stroke, shadow), applied via config.style.
- types.ts: HookStyle type on HookConfig and hookConfigSchema (default
  "classic" so older payloads keep validating).
2026-08-19 14:12:10 +02:00
juancarlos.cavero
0bfe27561d Merge PR #70 (manual per-scene reframing) onto current main
Conflicts were the parallel override parameters: render_clip /
process_video_to_vertical / reframe_v2.render / perform_recut now carry
BOTH force_strategy (whole-clip framing, main) and crop_overrides
(per-scene manual framing, PR #70). The v1-fallback safety net now also
raises for force_strategy, which had the same silent-revert hole the PR
fixed for crop_overrides.
2026-08-19 12:01:02 +02:00
juancarlos.cavero
3cff7e8cd6 fix(editor): explain why cuts are limited when the source is gone
Addresses the UX half of #67: with no retained source the editor clamps
cuts to the original clip range but never said why, reading as a bug. A
note in the segments panel now names the reason and that newly processed
videos keep their source.
2026-08-19 10:50:22 +02:00
juancarlos.cavero
3790c65851 fix(subtitles): honor user-edited caption text on the server render path
Fixes #69. The subtitle modal lets the user edit the caption text, but the
edits only traveled through the in-browser Remotion path; the FFmpeg path
(taken by every karaoke style and by any clip with server burns, i.e. all
clips with default captions) sent style params only, so the server
regenerated from the stored transcript and silently discarded the edits.

/api/subtitle now accepts an optional 'words' list (clip-relative ms, the
same shape the /transcript endpoint serves) and builds a synthetic
transcript from it, so both the SRT and karaoke ASS generators burn the
edited words verbatim. Words get Whisper's leading-space convention so the
block collector keeps their boundaries. The modal sends them only when the
text actually differs, and never on bulk apply-to-all (edits are per-clip).

Verified live: an edited 5-word line burned exactly as typed, correctly
grouped into blocks.
2026-08-19 10:50:22 +02:00
Tulio Vianna
b92012d824 feat: manual reframing, per scene
The reframe engine picks the crop automatically and is right most of the
time. When it is wrong it is badly wrong, and there was no way to say
"no, frame it here".

The unit is the SCENE, not the clip. A podcast cuts between a fixed close
camera and a fixed wide one, and the right crop differs per camera; scene
boundaries already are those camera changes. Scenes the user never touches
keep the automatic camera, so correcting one bad shot cannot spoil the
shots the tracker got right.

Backend:
- reframe_v2.apply_crop_overrides() replaces a scene's slice of the camera
  trajectory with a constant and forces it to TRACK, so a scene the
  classifier had sent to GENERAL comes back to a vertical crop. It runs
  after every automatic pass, including the ALTERNATE writes, so a manual
  choice always wins.
- A scene can also be split by hand: the override writes straight into
  `splits`, which means the user can stack a scene the detector never
  proposed, with no dependency on SPLIT_LAYOUT being enabled.
- GET /api/clip/{job}/{i}/scenes returns the scenes with a frame from the
  UNCROPPED cut plus a light preview with audio, and suggests a centre from
  the largest face in each shot.
- POST /api/clip/reframe re-renders with the clip's cut untouched. It is
  deliberately separate from /api/clip/rerender: a scene index only means
  something against a given cut, so letting framing ride along with a trim
  save would move every override onto the wrong shot.
- render_clip raises instead of falling back to the v1 engine when manual
  framing is present, since v1 ignores it and would silently return an
  automatically framed clip.

Frontend:
- ReframeEditor lists the scenes, each with the source frame, a draggable
  9:16 window, and a play button that plays that scene from the preview so
  the user can hear who is talking before choosing.
- Saved overrides are loaded when the editor reopens. Without that the next
  save would discard every earlier adjustment, because a re-render rebuilds
  from source using only what it receives.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 22:33:52 -03:00
juancarlos.cavero
9c220efddb feat(editor): manual framing override (auto / full frame / track subject)
The scene classifier only counts faces, so a screencast-style video with a
presenter in frame gets TRACK and the crop eats the slide (the SCREENCAST/
WIDE detectors sit behind the opt-in layouts=auto flag). The clip editor now
has a framing selector that pins every scene's layout: 'full' renders the
whole source frame (WIDE: no side-crop, blurred bands), 'track' forces the
subject-tracking crop, 'auto' returns to the classifier.

Plumbed as force_strategy through reframe_v2.render -> render_clip ->
perform_recut -> /api/clip/rerender (and the recut_clip MCP tool). A
non-auto choice always re-reframes from the retained source (409 without
it) and persists in the clip's recipe, so later plain trims inherit the
look instead of silently reverting; an explicit 'auto' resets it.

Verified live: framing=full on a TRACK-cropped clip re-rendered with the
full frame visible edge to edge (125s source path), and the editor reopens
with the persisted choice preselected.
2026-08-19 01:06:48 +02:00
juancarlos.cavero
100fa583a1 Merge feat/clip-editor: per-clip EDL editor + manual generation controls (PR #62, discussion #65) 2026-08-18 19:27:49 +02:00
juancarlos.cavero
b81125c572 feat(generate): manual clip count and duration controls (discussion #65)
/api/process (and the process_video MCP tool) now accept optional
target_clips (1-15) and clip_min_seconds / clip_max_seconds (5-180),
surfaced in the dashboard as a collapsed 'advanced options' section.
Blank means the AI decides, keeping the default request byte-identical.

Plumbed through the same env overrides the A/B harness already reads:
CLIP_TARGET_MIN/MAX (existing) and a new clip_duration_bounds() in
clip_selection.py backing CLIP_MIN_SECONDS/MAX_SECONDS. The detail and
visual prompts take the band as template placeholders instead of the
hardcoded 15-60, and word-snapping enforces the same bounds. All three
knobs are honest targets, not guarantees: the model still returns fewer
clips when the material doesn't hold them, and the UI copy says so.

Verified live: target_clips=2 + band 8-15s on the demo video returned
exactly 2 clips of 13.3s and 13.7s (the uncontrolled run gave one 41.7s
clip); out-of-range values 400 with a named reason.
2026-08-18 19:21:42 +02:00
juancarlos.cavero
d1bf36c666 fix(dashboard): recut duration display and stale durable URL
- A recut clip's start/end are the covering source range, so end - start
  showed a 20s two-segment clip as minutes long; duration now sums the
  recipe segments when present.
- Drop the clip's durable R2 URL after a rerender: archive_clip_edit
  deletes the superseded object, so the stale URL would 404 as the
  playback fallback.
2026-08-18 15:26:45 +02:00
juancarlos.cavero
46c61e407b feat(mcp): list_clips renders as an MCP App clip picker in UI-capable clients
New mcp_ui module holds the template: preview each 9:16 clip inline,
select the keepers and publish them via publish_clip from inside the
conversation. One template, three data paths, because the ecosystem has
not converged: baked-in JSON on the per-call embedded resource, the
ChatGPT Apps window.openai bridge, and the MCP Apps ready/render-data
postMessage handshake. Titles are JSON-escaped so a clip name cannot
break out of the script tag, and the template is fully inline because
host CSPs block external fetches.

The server grows resources/list, resources/read and the resources
capability; list_clips declares the template under both _meta.ui
.resourceUri and openai/outputTemplate. Non-UI clients see the same
text and structured content as before; the extra content entry is
spec-tolerated. The unknown-method protocol test moves off
resources/list, which is now a real method.
2026-08-05 23:59:02 +02:00
juancarlos.cavero
40f530f9aa feat(landing): surface the CLI wherever the agent surface is described
Feature card, FAQ answer, crawler fallback, /mcp and the automation
page all name pip install openshorts alongside MCP and the REST API.
2026-08-05 15:04:39 +02:00
victorcavero14
b884131639 feat(editor): clip editor frontend — ClipEditor overlay wired into results
- ClipEditor.jsx: per-clip edit overlay driving the /edl + /rerender backend
- App.jsx: editingClip state, handleClipRerendered syncs results, reopened
  project state and per-clip edit state after a recut (burned layers reset)
- ResultCard.jsx: "edit clip" entry button (Scissors), layout tweak
- recut.py: write absolute paths in the concat list — the demuxer resolves
  relative entries against the list file's dir, not the process cwd

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 12:03:15 +02:00
juancarlos.cavero
9f3bedecde feat(seo): five demand-backed pages + honest agent-access comparison on /mcp
New static pages, each re-housing demand GSC already shows landing on the
homepage: no-watermark clip generator (the AI-answer gap: unwatermarked
free clipping only exists self-hosted), open-source AI video generator
(splits the text-to-video intent honestly), podcast-to-shorts (the SPLIT
layout as the capability no competitor page can show), YouTube-to-Shorts
converter (link import is free here, paid at Opus Clip), and an
automation recipe page (API + signed webhooks + n8n shape).

/mcp gains a checked comparison table: Opus Clip shipped MCP in July
2026, so the claim that survives is flat-minute billing and self-hosted
agent access with no meter, not MCP existence. All competitor claims
carry checked dates.
2026-08-04 17:58:25 +02:00
juancarlos.cavero
4c94c29964 feat(seo): close the internal-link gaps around the static cluster
The rendered React landing had zero links to the static SEO pages, so
Googlebot's rendered homepage dropped the whole cluster; the static
pages' nav and footer missed /mcp and the /alternatives hub; and the
crawler fallback missed both too. Every surface now links the full set
with descriptive anchors.
2026-08-04 14:19:28 +02:00
juancarlos.cavero
cc8fa54ffa feat(pricing): MCP + API access named where buyers compare plans
A bullet on every plan card, the always-on framing in 'included in
every plan', and a billing FAQ answering the question that actually
blocks a purchase: API calls draw from the same minutes, nothing extra
to buy, free plan included.
2026-08-04 00:24:50 +02:00
juancarlos.cavero
7eab5649a6 feat(landing): surface the agent API as a hosted-first benefit
The MCP server existed everywhere except the one page most visitors
see. Feature card + FAQ on the landing (mirrored in the SEO fallback,
which must stay in sync with Landing.jsx), and a new row in the README
edition table framing it honestly: both editions serve /mcp, but an
agent needs an endpoint that is always on, and only the hosted one is.
2026-08-04 00:02:16 +02:00
juancarlos.cavero
a69f595aa7 feat(seo): /mcp page — the agent surface as citable content
The MCP server documents itself over the protocol, but nothing on the
site existed for a human or an answer engine to cite when asked 'how do
I automate shorts with Claude/ChatGPT'. One page in the established
shape (TL;DR, one question per H2, FAQ schema): connect command, the
six tools, REST + webhooks, self-host parity, and pricing stated next
to every 'free'. Lands in sitemap.xml and llms.txt automatically via
the shared page list.
2026-08-03 23:22:57 +02:00
juancarlos.cavero
f10655fd1c feat(agents): the pipeline as a platform — API keys, MCP server, webhooks
Agents don't forget to come back; humans do. Make the whole pipeline
drivable without the dashboard:

- API keys (osk_...): sha256-stored tokens minted from the account page.
  get_current_user_optional resolves them like a session, so metering,
  entitlement, priority and job ownership apply to agents with zero
  endpoint changes. Key management refuses API-key auth (a leaked key
  cannot mint replacements).
- MCP server at /mcp: stateless Streamable-HTTP JSON-RPC, no SDK
  dependency. Six tools (process_video, get_job_status, list_clips,
  get_quota, add_subtitles, publish_clip) that call back into this same
  app in-process via ASGITransport with the caller's auth headers, so
  MCP can never drift from REST behavior. Cloud requires a key;
  self-host stays BYOK-open.
- Completion webhooks: webhook_url (+ optional HMAC webhook_secret) on
  /api/process, SSRF-checked at submit AND delivery, fired once after
  the R2 archive so payloads carry durable links, survives redeploys
  via the resume manifest.
- Dashboard: API keys card in the account page (create once-shown key,
  list, revoke).
- Tests pin BILLING_ENABLED=0 in conftest so the suite no longer
  depends on the developer's personal .env.
2026-08-03 22:33:16 +02:00
juancarlos.cavero
db3e7849af feat(billing): measure the click-to-Stripe gap, and sell the outcome
Between 25-jul and 1-ago the upgrade modals logged 35 checkout clicks and
Stripe recorded one new subscription. Nothing in between was measured:
TopUpModal fired only QuotaWallCheckout/UpsellModalCheckout, and
CheckoutStarted lived exclusively in PricingSection, so the funnel could
not tell "never reached Stripe" from "reached Stripe and abandoned".

Both surfaces now emit the same chain — CheckoutStarted (click) ->
CheckoutRedirected (we hold a Stripe URL) -> CheckoutFailed (we don't,
with the reason) — segmented by a `source` prop of wall | upsell |
pricing. The modal also writes the os_pending_checkout stash that
PricingSection already wrote, so a plan bought from a modal stops losing
its revenue attribution on the Subscribed goal.

The modal copy now leads with what the user gets (clips ready to post, a
library that stays) and states the free-plan limit second. Leading with
the watermark and the 7-day deletion framed the paid tier as "pay to undo
restrictions we added", which is the losing side of an argument against
our own MIT repo, whose headline is "no watermarks, no limits".

GPU rendering and the bundled Gemini key stay out of the modal on
purpose: they are the real reasons the cloud beats self-hosting, but the
free plan already gets both, so they belong on the pricing surface facing
repo visitors rather than in a modal shown to someone already using them.
2026-08-02 01:27:35 +02:00
juancarlos.cavero
4c04b37e4f 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.
2026-07-29 00:23:59 +02:00
victorcavero14
4fcc1cd5ed fix(analytics): make product analytics opt-in and host-scoped
The OpenPanel endpoint and client id were hardcoded in dashboard/index.html, so
every clone, fork and self-hosted deployment inherited them and reported into
the hosted instance's dashboard. src/lib/analytics.js already documents the
intended behaviour ('analytics can never leak into the open-source experience');
this makes that true.

- apiUrl and clientId now come from VITE_OPENPANEL_API_URL /
  VITE_OPENPANEL_CLIENT_ID, substituted by Vite at build time and unset by
  default, so npm run dev and a plain npm run build initialise nothing.
- The third-party script is only fetched once analytics is actually enabled: a
  default build makes no external analytics request at all.
- Reporting is additionally gated on a hostname allowlist, so a dist/ built with
  credentials stays inert if it is served anywhere else.

Verified with a headless browser against real production builds:
  credentials + non-allowlisted host -> no requests
  credentials + allowlisted host     -> initialises and reports
  no credentials + allowlisted host  -> no requests

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 09:58:33 +02:00