Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
55 lines
2.8 KiB
Python
55 lines
2.8 KiB
Python
"""Anonymous reel-preview table (migration ``698dec75c496``).
|
|
|
|
One row per generated preview (free, no-sign-in: paste a link, see a real
|
|
hook line + a real frame from the page/listing). Looked up by ``url_hash``
|
|
to cache repeat pastes of the same link for free (no second LLM/fetch cost),
|
|
and by ``id`` to claim a specific preview into a brand-new account right
|
|
after sign-up (``app.domains.reel_preview.service.claim_preview``) so the
|
|
exact thing a visitor saw survives the sign-up round-trip. Written only by
|
|
:mod:`app.domains.reel_preview`.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import JSON, DateTime, String, func
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.models.db.base import Base
|
|
|
|
|
|
class AnonPreview(Base):
|
|
__tablename__ = "anon_previews"
|
|
|
|
id: Mapped[str] = mapped_column(String(36), primary_key=True)
|
|
# sha256 of the normalized input URL -- the cache-lookup key. Not unique:
|
|
# a stale (TTL-expired) row is left in place and a fresh one inserted
|
|
# rather than updated in place, so claim history on an old row is never
|
|
# silently rewritten by a later, unrelated visitor pasting the same link.
|
|
url_hash: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
|
|
url: Mapped[str] = mapped_column(String(2048), nullable=False)
|
|
# sha256 of the caller IP (never the raw address) -- abuse forensics only.
|
|
ip_hash: Mapped[str] = mapped_column(String(64), nullable=False, default="")
|
|
source_kind: Mapped[str] = mapped_column(String(20), nullable=False, default="")
|
|
preset_id: Mapped[str] = mapped_column(String(40), nullable=False, default="")
|
|
title: Mapped[str] = mapped_column(String(300), nullable=False, default="")
|
|
hook_line: Mapped[str] = mapped_column(String(300), nullable=False, default="")
|
|
hook_style: Mapped[str] = mapped_column(String(40), nullable=False, default="")
|
|
hook_source: Mapped[str] = mapped_column(String(20), nullable=False, default="")
|
|
# Real frame image URLs (app-store screenshots, or the page's own
|
|
# og:image) -- never a rendered/generated image, so this has zero render
|
|
# cost per anonymous visitor.
|
|
frames: Mapped[list] = mapped_column(JSON, default=list, nullable=False)
|
|
# Extracted page/listing facts, reused unchanged by the paid run after
|
|
# claim so sign-up never re-fetches or re-asks the visitor anything.
|
|
content: Mapped[dict] = mapped_column(JSON, default=dict, nullable=False)
|
|
created_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), server_default=func.now(), nullable=False
|
|
)
|
|
claimed_user_id: Mapped[str | None] = mapped_column(String(32), nullable=True, default=None)
|
|
claimed_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True, default=None)
|
|
|
|
|
|
__all__ = ["AnonPreview"]
|