diff --git a/app.py b/app.py index b7f4efb..e60da86 100644 --- a/app.py +++ b/app.py @@ -4927,6 +4927,7 @@ class HookRequest(BaseModel): size: Optional[str] = "M" # S, M, L duration_seconds: Optional[float] = None # None = hook visible for the whole clip style: Optional[str] = "pill" # pill/classic/dark/yellow/red/outline/outline_yellow + font: Optional[str] = None # montserrat/anton/serif (hooks.HOOK_FONTS); None = the style's own remove: Optional[bool] = False # strip the burned hook instead of adding one @app.post("/api/hook") @@ -5002,7 +5003,7 @@ async def add_hook(req: HookRequest, request: Request): try: # Run in thread pool def run_hook(): - add_hook_to_video(input_path, req.text, output_path, position=req.position, font_scale=font_scale, duration=req.duration_seconds, style=req.style) + add_hook_to_video(input_path, req.text, output_path, position=req.position, font_scale=font_scale, duration=req.duration_seconds, style=req.style, font=req.font) loop = asyncio.get_event_loop() await loop.run_in_executor(None, run_hook) @@ -5029,7 +5030,7 @@ async def add_hook(req: HookRequest, request: Request): clip_data.pop('auto_hook', None) else: clip_data['auto_hook'] = { - "text": req.text, "style": req.style, "position": req.position, + "text": req.text, "style": req.style, "font": req.font, "position": req.position, "duration_seconds": req.duration_seconds, } diff --git a/dashboard/public/fonts/Anton-Regular.ttf b/dashboard/public/fonts/Anton-Regular.ttf new file mode 100644 index 0000000..4d65707 Binary files /dev/null and b/dashboard/public/fonts/Anton-Regular.ttf differ diff --git a/dashboard/src/components/AutopilotTab.jsx b/dashboard/src/components/AutopilotTab.jsx index 3c387d0..4ce92ab 100644 --- a/dashboard/src/components/AutopilotTab.jsx +++ b/dashboard/src/components/AutopilotTab.jsx @@ -424,8 +424,9 @@ export default function AutopilotTab({ onOpenProject, onUpgrade, justConnected }
{(videos || []).map((v) => { const run = v.run; - const canRun = eligible && (!run || run.status === 'failed' - || (run.status === 'skipped' && run.reason !== 'youtube_short')); + // Skipped runs can be retried too: private videos used to be + // misread as Shorts, and a real Short just skips again. + const canRun = eligible && (!run || run.status === 'failed' || run.status === 'skipped'); return (
{v.thumbnail_url ? ( diff --git a/dashboard/src/components/HookModal.jsx b/dashboard/src/components/HookModal.jsx index 5c53509..df4c76b 100644 --- a/dashboard/src/components/HookModal.jsx +++ b/dashboard/src/components/HookModal.jsx @@ -22,6 +22,20 @@ const HOOK_STYLES = [ { value: 'outline_yellow', label: 'Outline+', box: 'transparent', text: '#FFD600', outline: true }, ]; +// Must mirror hooks.py HOOK_FONTS (all bundled: /fonts/*.ttf). +const FONT_OPTIONS = [ + { value: 'montserrat', label: 'Montserrat' }, + { value: 'anton', label: 'Anton' }, + { value: 'serif', label: 'Serif' }, +]; +const FONT_CSS = { + montserrat: { fontFamily: "'Montserrat-ExtraBold', 'Montserrat', sans-serif", fontWeight: 800 }, + anton: { fontFamily: "'Anton-Regular', Impact, sans-serif", fontWeight: 400 }, + serif: { fontFamily: "'Noto Serif', Georgia, serif", fontWeight: 700 }, +}; +// The style's own typeface when none is picked (what hooks.py renders). +const styleFont = (st) => (st === 'pill' ? 'montserrat' : 'serif'); + const POSITION_OPTIONS = [ { value: 'top', label: 'top' }, { value: 'center', label: 'center' }, @@ -46,6 +60,9 @@ export default function HookModal({ isOpen, onClose, onGenerate, onRemove, isPro const [position, setPosition] = useState(prefs.position || 'top'); const [size, setSize] = useState(prefs.size || 'M'); const [style, setStyle] = useState(prefs.style || 'pill'); + // null = follow the style's own typeface. + const [font, setFont] = useState(prefs.font || null); + const effectiveFont = font || styleFont(style); const [entranceAnimation, setEntranceAnimation] = useState(prefs.entranceAnimation || 'spring'); const [displayDuration, setDisplayDuration] = useState(5); @@ -57,6 +74,7 @@ export default function HookModal({ isOpen, onClose, onGenerate, onRemove, isPro position, size, style, + font: effectiveFont, entranceAnimation, displayDurationSec: displayDuration, }; @@ -80,14 +98,15 @@ export default function HookModal({ isOpen, onClose, onGenerate, onRemove, isPro } }; - const pillFontFace = "@font-face{font-family:'Montserrat-ExtraBold';src:url('/fonts/Montserrat-ExtraBold.ttf') format('truetype');font-weight:800;}"; + const pillFontFace = "@font-face{font-family:'Montserrat-ExtraBold';src:url('/fonts/Montserrat-ExtraBold.ttf') format('truetype');font-weight:800;}" + + "@font-face{font-family:'Anton-Regular';src:url('/fonts/Anton-Regular.ttf') format('truetype');font-weight:400;}"; return ( - +
{/* Left: Preview */} -
+
{useRemotionPreview ? ( - Aa + {s.value === 'pill' ? ( + + Aa Bb + Cc + + ) : ( + Aa + )} {s.label} ))}
+ {/* Typeface */} +
+

Font

+
+ {FONT_OPTIONS.map((f) => ( + + ))} +
+
+ {/* Position Control */}

Position

@@ -190,7 +234,8 @@ export default function HookModal({ isOpen, onClose, onGenerate, onRemove, isPro
{/* Entrance Animation (new) */} -
+ {!serverRender && ( +

Entrance

- {serverRender && ( -

- This clip re-renders on the server, where the hook is - static — the entrance animation won't apply. -

- )}
+ )} {/* Display Duration (new) */}
@@ -258,11 +298,11 @@ export default function HookModal({ isOpen, onClose, onGenerate, onRemove, isPro onClick={() => { try { localStorage.setItem('os_hook_prefs', JSON.stringify({ - style, position, size, entranceAnimation, + style, font, position, size, entranceAnimation, })); } catch { /* ignore */ } onGenerate({ - text, position, size, style, + text, position, size, style, font: effectiveFont, // Remotion data remotion: hookConfig, }); @@ -271,7 +311,7 @@ export default function HookModal({ isOpen, onClose, onGenerate, onRemove, isPro className="btn-primary flex-1" > {isProcessing && } - {isProcessing ? 'generating...' : 'add hook'} + {isProcessing ? 'saving...' : (burnedHook ? 'update hook' : 'add hook')}
diff --git a/dashboard/src/components/ResultCard.jsx b/dashboard/src/components/ResultCard.jsx index f4c3a3d..2d39ce6 100644 --- a/dashboard/src/components/ResultCard.jsx +++ b/dashboard/src/components/ResultCard.jsx @@ -539,7 +539,8 @@ export default function ResultCard({ clip, index, jobId, durable, uploadPostKey, text: payload.text, position: payload.position, size: payload.size, - style: payload.style || 'classic', + style: payload.style || 'pill', + font: payload.font || null, duration_seconds: payload.remotion?.displayDurationSec ?? null, input_filename: serverVideoFile }) @@ -956,7 +957,7 @@ export default function ResultCard({ clip, index, jobId, durable, uploadPostKey, className={QUIET_BTN} > {isHooking ? : } - {isHooking ? 'adding…' : 'viral hook'} + {isHooking ? 'saving…' : 'edit hook'}