feat: 인스타 릴스 — 릴스 mp4 저장·공개 주소(/v1/reel)·REELS 게시 API, 관리자 relay, 소개 릴스 HyperFrames 프로젝트·배경 5장, 인스타 올리기 nginx 타임아웃 600s
No files matched your search
@@ -0,0 +1,4 @@
|
||||
node_modules/
|
||||
.hyperframes/
|
||||
out/
|
||||
*.mp4
|
||||
@@ -0,0 +1,109 @@
|
||||
# HyperFrames Composition Project
|
||||
|
||||
This folder is a [HyperFrames](https://hyperframes.heygen.com) video: HTML, CSS and seekable
|
||||
animations (GSAP by default) that the `hyperframes` CLI previews in the browser and renders to
|
||||
MP4.
|
||||
|
||||
## Skills — read these first
|
||||
|
||||
**Invoke the relevant skill before writing or modifying compositions.** Skills encode framework-specific patterns (e.g., `window.__timelines` registration, `data-*` attribute semantics, shader-compatible CSS rules) that generic web docs don't cover, so compositions written without them break.
|
||||
|
||||
**Doing anything with HyperFrames?** Start at `/hyperframes`. Make any video by asking for it; the `/hyperframes` skill carries the contract and the references (each kind of film, story, motion, look, sound, review, captions, overlays). Read it first, especially when there's no project context to orient you.
|
||||
|
||||
- `/hyperframes` — read first for any request to make, edit, animate or render a video, motion graphic, captions or overlays. Holds the render contract and the work loop.
|
||||
- `/hyperframes-cli` — the CLI by job: scaffold, check, look at frames, edit the timeline, preview, render, publish, project history.
|
||||
- `/hyperframes-registry` — ready-made blocks and components installed as editable source. Search it before hand-building any named visual.
|
||||
- `/media-use` — get or make any media (music, sound effects, images, voiceover, avatar and generated video, transcripts, cutouts, colour grades) and mix placed audio.
|
||||
- `/figma` — bring a Figma design, frame, logo or brand into a video.
|
||||
- `/slideshow` — a presentation or pitch deck. Output is a navigable deck, not a rendered MP4.
|
||||
- `/remotion-to-hyperframes` — bring existing video code or footage into HyperFrames (Remotion first; also Motion Canvas, Lottie, Three.js, canvas, or renders from other tools) and verify it frame by frame against the original.
|
||||
|
||||
**Changing how real footage or images look or reveal?** Load `/media-use` and read its `references/media-treatments.md` before editing, even when the request only says dark, flat, boring, retro, private, or “make the reveal cooler.” It governs how footage is treated, never whether media may be used. Use canonical media treatments and seek-safe motion; do not improvise equivalent CSS/SVG filters or overlays.
|
||||
|
||||
> **Tailwind v4 projects** (`hyperframes init --tailwind`): see `hyperframes-cli/references/init-and-scaffold.md` (Tailwind).
|
||||
|
||||
> **Using a HyperFrames plugin?** Load skills from that installed bundle and follow
|
||||
> its `hyperframes/references/plugin-installation.md` execution rules. Update via
|
||||
> the plugin manager, not the standalone commands below.
|
||||
>
|
||||
> **Standalone skill missing or stale?** Run `npx hyperframes skills update <name>` to install/refresh
|
||||
> the specific skill you need, or bare `npx hyperframes skills update` to refresh the core set plus
|
||||
> everything already installed — neither pulls the full set. Restart the agent session so
|
||||
> newly installed skills load.
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
npm run dev # human-operated foreground preview (blocks until stopped)
|
||||
npx hyperframes preview --background # agent-safe persistent Studio preview
|
||||
npx hyperframes preview --status # verify the persistent preview is listening
|
||||
npx hyperframes preview --stop # stop it when review is finished
|
||||
npm run check # lint + runtime + layout + motion + contrast (one command)
|
||||
npx hyperframes snapshot --at 1,3,5 # PNG frames at those seconds, to look at before rendering
|
||||
npm run render # render to MP4
|
||||
npm run publish # publish and get a shareable link
|
||||
npx hyperframes lint --verbose # include info-level findings
|
||||
npx hyperframes lint --json # machine-readable output for CI
|
||||
npx hyperframes docs <topic> # reference docs in terminal
|
||||
```
|
||||
|
||||
> **Agents must use `npx hyperframes preview --background` for Studio handoff.** Do not rely
|
||||
> on a shell/tool `run_in_background` wrapper around `npm run dev`: that foreground process
|
||||
> remains owned by the invoking session and can disappear while the browser stays open,
|
||||
> leaving refreshes at `ERR_CONNECTION_TIMED_OUT`. Verify with `preview --status`, keep it
|
||||
> alive through review, and stop it explicitly with `preview --stop` afterward.
|
||||
|
||||
> **Back from the desktop app.** Once this project was opened in the HyperFrames desktop app, run `npx hyperframes catch-up` before your next change here: it lists what the person asked Framey in the app and which files changed since.
|
||||
|
||||
> **Pinned CLI version.** These scripts pin an exact `hyperframes@X.Y.Z` so this project re-renders identically over time. Weeks later that pin lags fixes shipped since. To move up: `npx hyperframes@latest upgrade --project . --check` (shows the delta), then `npx hyperframes@latest upgrade --project .` to rewrite the pins. Always unpinned — the pinned script re-runs the old version against itself.
|
||||
|
||||
## Documentation
|
||||
|
||||
**For quick reference**, use the local CLI docs command (no network required):
|
||||
|
||||
```bash
|
||||
npx hyperframes docs <topic>
|
||||
```
|
||||
|
||||
Topics: `data-attributes`, `gsap`, `compositions`, `rendering`, `examples`, `troubleshooting`
|
||||
|
||||
**For full documentation**, discover pages via the machine-readable index — do NOT guess URLs:
|
||||
|
||||
```
|
||||
https://hyperframes.heygen.com/llms.txt
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `index.html` — main composition (root timeline)
|
||||
- `compositions/` — sub-compositions referenced via `data-composition-src`
|
||||
- `meta.json` — project metadata (id, name)
|
||||
- `transcript.json` — whisper word-level transcript (if generated)
|
||||
|
||||
## Linting — ALWAYS RUN AFTER CHANGES
|
||||
|
||||
After creating or editing any `.html` composition, **always** run the full check before considering the task complete:
|
||||
|
||||
```bash
|
||||
npm run check
|
||||
```
|
||||
|
||||
Fix all errors before presenting the result. Warnings should be reviewed before rendering.
|
||||
|
||||
Then look at what you changed: `npx hyperframes snapshot --at <seconds>` (or `--range START,END`, `--composition <id>`) at the moments you edited, and read the frames before you reply. A passing check does not show how it looks.
|
||||
|
||||
## Key Rules
|
||||
|
||||
1. Every timed element needs `data-start` and a duration. `data-start` is what marks it as timed; `data-track-index` is an optional Studio display lane the render never reads
|
||||
2. Give timed visual elements `class="clip"`. The framework keys visibility off `data-start`, not the class, but the shared `.clip` CSS is what gives a scene its full-frame box, and `lint` warns without it
|
||||
3. Register one paused root timeline per composition on `window.__timelines`:
|
||||
```js
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["composition-id"] = gsap.timeline({ paused: true });
|
||||
```
|
||||
Scene timelines manually added to this root must not be paused. A paused
|
||||
child does not advance when the root is seeked. The runtime activates
|
||||
registered composition siblings, not arbitrary nested scene timelines.
|
||||
4. A video with sound keeps it on the `<video>` (`data-has-audio="true"`, no `muted`). Use a separate `<audio>` for music, voiceover, replacement audio, J/L cuts, or audio detached in Studio. Silent footage and b-roll: `muted`.
|
||||
5. Sub-compositions use `data-composition-src="compositions/file.html"` to reference other HTML files
|
||||
6. Only deterministic logic — no `Date.now()`, no `Math.random()`, no network fetches
|
||||
@@ -0,0 +1,24 @@
|
||||
GOAL: 20~50대가 "날씨를 보면 오늘 할 일을 알려 주는 앱이구나"를 20초 안에 알고, 프로필 링크(또는 토스 검색)로 열어 본다.
|
||||
OUTPUT: HyperFrames, 1080 x 1920, 30 fps
|
||||
TIME: 20 s x 30 = 600 frames. 음악이 있으면 ~110 BPM(16.4 f/beat, 65 f/bar), 장면 전환은 마디에.
|
||||
LOOK: 땅 = Codex 클레이 3D 렌더 배경(assets/bg/*.webp, 1024x1820 → 1080x1920 cover, 위쪽 40%가 하늘이라 글자 자리).
|
||||
브랜드 땅(등장·보상·엔드카드) = 평면 #e3efff, 질감 없음. 잉크 #28304a. 강조 주황 #ff7a45: 한 장면에 한 단어·한 칩.
|
||||
디스플레이 Jua 120 px(H의 6.25%) 흰색, 자간 -2 px, 잉크 그림자 0 6px 18px rgba(40,48,74,.38) — 배경 위에서만 흰색, 브랜드 땅 위에서는 잉크색.
|
||||
본문 Pretendard 700 52 px, 칩 Pretendard 800 72 px(점수) + 48 px(이름). 글자 폭 최대 900 px(오른쪽 액션 레일 피함).
|
||||
깊이: 배경 scale 1.08~1.14 드리프트, 중간층(아이콘) 이동 1.6배, 앞층(흐린 구름·잎) 2.2배 + blur 6 px. 그림자: 아이콘 아래 타원 contact shadow 0.35.
|
||||
OBJECTS: 하늘·구름(assets/bg/sky), 비 오는 도시(rain-city), 해변(beach), 가을 산길(mountain), 한강 노을(hangang-sunset);
|
||||
3D 아이콘: 해 sun.png, 구름 cloud.png, 비 rain.png, 드라이브 drive.png, 산책 walk.png, 한강 hangang.png, 피크닉 picnic.png, 토끼 rabbit.png, 곰 bear.png;
|
||||
앱 아이콘 app-icon.png(실제 apple-touch-icon), 실제 홈 화면 shot-home.webp(390x844)을 폰 틀(검정 8 px, 반지름 44 px) 안에.
|
||||
점수 칩: 흰 배경 둥근 사각(반지름 28 px) + 왼쪽 아이콘 96 px + 이름 + 주황 점수, 그림자 0 10px 30px rgba(40,48,74,.25).
|
||||
MOTION: 등장 expo.out 0.5 s(글자 단어별 blur 8→0, 0.13 s, 0.07 s 간격) · 카메라 power2.inOut · 퇴장 power3.in 0.25 s · 칩 스프링 back.out(1.6) 0.45 s(위치·크기만) · 점수 카운트 0.6 s power2.out.
|
||||
휩 전환 0.25 s(세로, blur 16 px) · 색 플러드 0.4 s power2.inOut · 줌스루 0.35 s power3.in(아이콘 8%→250%).
|
||||
SHOTS: S1 f0–75 하늘. 배경 1.14→1.08 푸시. "오늘 뭐 하기 / 좋은 날이지?" 단어별 맺힘 f9~f30, 해 아이콘 우상단 드리프트, 앞층 구름 좌하단. 읽기창 f30–f70. 소리: 비트 시작. → 휩 업.
|
||||
S2 f75–165 비 도시. 칩 "흐림" "19°" "습도 70%" 스프링 낙하 f81·f84·f87, 구름·비 아이콘 중간층. f114 "…그래서 / 오늘 뭐 하죠?" 맺힘. 읽기창 f120–f158. → 색 플러드(f158–f170) 하늘색.
|
||||
S3 f165–240 브랜드 땅. 앱 아이콘 스프링 f168(0.2→1.0), "날씨각" 글자별 f180(0.1 s 간격), "날씨를 *할 일*로 바꿔 주는 앱" f198. 토끼·곰 아래서 고개 f186. 읽기창 f205–f232. → 아이콘 줌스루 f232–f242.
|
||||
S4 f240–300 해변. 배경 1.15→1.05 안착 0.5 s. 칩 "드라이브각 82" 스프링 f246 + 점수 카운트, drive 아이콘 해안선 따라 x+70 px/2 s. 작은 글 "해안 드라이브 딱 좋은 날" f258. → 휩 업.
|
||||
S5 f300–360 산길. 칩 "산책각 81" + walk 아이콘 걷기(y 흔들림 ±6 px, 0.4 s). "숲길 한 바퀴" f318. → 휩 업.
|
||||
S6 f360–420 한강 노을. 칩 "한강각 85" + hangang·picnic 아이콘. "노을 보며 돗자리" f378. → 폰 캐리(폰이 아래서 올라오며 배경이 하늘색으로 플러드 f414–f426).
|
||||
S7 f420–525 보상. 브랜드 땅. 폰(720 px 폭) 아래서 y 1900→470 power4.out 0.7 s, 실제 홈 화면. 위 "지금 내 동네 / 1위는?" f438. 칩 "68가지 각" f480 스프링. 작은 글 "10.24 서울 기준" 폰 아래. 읽기창 f450–f515. → 폰이 아래로 빠지며(0.3 s) 엔드카드.
|
||||
S8 f525–600 엔드카드. 아이콘 스프링 f528 가운데 위(폭 260 px), "날씨각" f540, "설치 없이 바로, *무료*" f552, "weather.o2o.kr" f564, "토스에서 '날씨각' 검색" f576. f585–600 정지. 음악 페이드.
|
||||
BANNED: 검은 보이드, 글로우·파티클·렌즈플레어, 유리 카드, 보라·파랑 그라데이션, 세 카드 나란히, 코너 로고, 전부 페이드+슬라이드 업, 착지 뒤 떠다니는 제목, 흐린 스크린샷 위 제목, 점수 숫자 지어내기(오늘 API 값만), 사용자 글 노출.
|
||||
QA: f0(썸네일: 하늘+질문 첫 단어 보임), f60(질문 다 읽힘), f150("그래서 뭐 하죠?"), f225(아이콘·워드마크·부제), f270/f330/f390(세 세상 칩·아이콘), f480(폰 전체·칩), f598(엔드카드 네 줄). 360 px 폰 시트에서 모든 글 읽힘. 글자 y 168~1330, x ≤ 900.
|
||||
@@ -0,0 +1,17 @@
|
||||
# 날씨각 소개 릴스 — 스토리라인 세 개 (2026-10-24)
|
||||
|
||||
사용자 지시: 인스타 릴스 20초 안팎, 9:16, 2.5D(Codex 3D 렌더풍 배경 + 기존 3D 아이콘 레이어 + 카메라 패럴랙스), 무료 BGM, 20~50대, 토스 앱 검색 언급, 해시태그. "알아서" → 질문 없이 A를 만든다.
|
||||
|
||||
## A. 질문 하나, 세 세상 (추천) — 질문+입력 장치 × 세상을 나는 카메라
|
||||
하늘 위 큰 글자 "오늘 뭐 하기 좋은 날이지?"로 시작해, 비 오는 도시에서 날씨 숫자만 떠다니다 "그래서 뭐 하죠?"가 막히고, 날씨각 아이콘이 튀어나오며 답이 시작된다. 카메라가 해변·산길·한강 노을 세 세상을 차례로 날아가고, 세상마다 오늘 진짜 점수(드라이브각 82 · 산책각 81 · 한강각 85)가 칩으로 떨어진다. 마지막에 진짜 앱 화면이 올라오고 "설치 없이 바로, 무료 · 토스에서 '날씨각' 검색"으로 닫는다.
|
||||
- 첫 2초: 파란 하늘·구름 3D 배경이 천천히 밀려 들어오고, 흰 Jua 글자가 단어마다 블러로 맺힌다. 해 아이콘이 오른쪽 위에서 살짝 떠 있다.
|
||||
- 비트: 훅(하늘 질문) → 막힘(비 도시, 숫자 칩, "그래서?") → 등장(색 플러드 → 아이콘·워드마크) → 증명(해변→산→한강, 점수 칩 3번) → 보상(진짜 홈 화면) → 한 줄(설치 없이 무료) → 엔드카드(아이콘·주소·토스).
|
||||
- 룩: 배경은 Codex 클레이 3D 렌더, 글자는 흰 Jua + 잉크 그림자, 강조는 주황 한 단어, 브랜드 땅은 연한 하늘색 평면. 패럴랙스 3겹(배경 1.0 · 아이콘 1.6 · 앞 구름 2.2).
|
||||
- 소리: 밝고 가벼운 팝 비트(~110 BPM), 등장 장면에서 음악이 열리고, 엔드카드 아래서 짧게 페이드.
|
||||
- 전환: 휩(세상 사이) · 색 플러드(비→브랜드) · 아이콘 줌스루(브랜드→해변) · 폰이 아래서 올라오는 캐리.
|
||||
|
||||
## B. 토끼와 곰의 하루 — 캐릭터가 일한다 × 물건에서 물건으로
|
||||
토끼가 창밖을 보고, 곰이 폰을 들고, 둘이 점수 칩을 들고 세상 사이를 뛰어다닌다. 귀엽지만 캐릭터가 정지 PNG라 연기가 얕다. (안 만듦)
|
||||
|
||||
## C. 숫자가 글자가 된다 — 타입이 논증 × 한 프레임이 계속 바뀐다
|
||||
"19° 흐림 70%"가 큰 글자로 화면을 채우다 스스로 "한강각 85"로 재배열되는 키네틱 타이포. 배경 그림을 거의 안 써서 2.5D 지시와 어긋난다. (안 만듦)
|
||||
|
After Width: | Height: | Size: 167 KiB |
|
After Width: | Height: | Size: 162 KiB |
|
After Width: | Height: | Size: 201 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 27 KiB |
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<style>
|
||||
@font-face { font-family: 'Jua'; src: url('assets/fonts/Jua-Regular.ttf'); }
|
||||
@font-face { font-family: 'Pretendard'; src: url('assets/fonts/PretendardVariable.woff2'); font-weight: 100 900; }
|
||||
#root { position: absolute; inset: 0; overflow: hidden; background: #cfe3fb; color: #fff; }
|
||||
#s1-world { position: absolute; inset: 0; }
|
||||
#s1-cam { position: absolute; inset: 0; transform-origin: 50% 45%; }
|
||||
#s1-bg { position: absolute; left: 0; top: 0; width: 1080px; height: 1920px; object-fit: cover; }
|
||||
#s1-fog { position: absolute; left: -120px; top: 1450px; width: 620px; filter: blur(6px); opacity: 0.9; }
|
||||
#s1-title { position: absolute; left: 90px; top: 300px; width: 900px; font: 400 120px/1.18 'Jua', sans-serif; letter-spacing: -2px; color: #28304a; text-shadow: 0 0 22px rgba(255, 255, 255, 0.85), 0 4px 14px rgba(255, 255, 255, 0.6); word-break: keep-all; }
|
||||
#s1-title .w { display: inline-block; margin-right: 0.22em; }
|
||||
</style>
|
||||
<div id="root" data-composition-id="s1" data-width="1080" data-height="1920">
|
||||
<div id="s1-world" class="clip" data-start="0" data-duration="2.5">
|
||||
<div id="s1-cam">
|
||||
<img id="s1-bg" src="assets/bg/sky.webp" alt="" />
|
||||
<h1 id="s1-title"><span class="w">오늘</span><span class="w">뭐</span><span class="w">하기</span><br /><span class="w">좋은</span><span class="w">날이지?</span></h1>
|
||||
<img id="s1-fog" src="assets/icons/cloud.png" alt="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
// 카메라: 천천히 밀어 들어감 (배경 1.0, 해 1.6배, 앞 구름 2.2배로 깊이)
|
||||
tl.fromTo("#s1-cam", { scale: 1.14, y: 0, filter: "blur(0px)" }, { scale: 1.08, duration: 2.25, ease: "power2.inOut" }, 0);
|
||||
tl.fromTo("#s1-fog", { x: 40 }, { x: -70, duration: 2.5, ease: "none" }, 0);
|
||||
// 제목: 단어마다 블러로 맺힘, 착지 뒤엔 멈춤
|
||||
tl.fromTo("#s1-title .w", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.13, ease: "power4.out", stagger: 0.07 }, 0.05);
|
||||
// 휩 아웃: 다음 세상으로
|
||||
tl.to("#s1-cam", { y: -420, filter: "blur(16px)", duration: 0.25, ease: "power3.in" }, 2.25);
|
||||
window.__timelines["s1"] = tl;
|
||||
</script>
|
||||
</template>
|
||||
@@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<style>
|
||||
@font-face { font-family: 'Jua'; src: url('assets/fonts/Jua-Regular.ttf'); }
|
||||
@font-face { font-family: 'Pretendard'; src: url('assets/fonts/PretendardVariable.woff2'); font-weight: 100 900; }
|
||||
#root { position: absolute; inset: 0; overflow: hidden; background: #8e9bb3; color: #fff; }
|
||||
#s2-world { position: absolute; inset: 0; }
|
||||
#s2-cam { position: absolute; inset: 0; transform-origin: 50% 50%; }
|
||||
#s2-bg { position: absolute; left: 0; top: 0; width: 1080px; height: 1920px; object-fit: cover; }
|
||||
#s2-cloud { position: absolute; left: 640px; top: 250px; width: 300px; }
|
||||
#s2-rain { position: absolute; left: 120px; top: 1420px; width: 220px; }
|
||||
.s2-chip { position: absolute; padding: 18px 40px; border-radius: 28px; background: #fff; color: #28304a; font: 800 60px/1 'Pretendard', sans-serif; letter-spacing: -1px; box-shadow: 0 10px 30px rgba(40, 48, 74, 0.25); white-space: nowrap; }
|
||||
#s2-c1 { left: 90px; top: 420px; }
|
||||
#s2-c2 { left: 330px; top: 560px; }
|
||||
#s2-c3 { left: 150px; top: 700px; }
|
||||
#s2-ask { position: absolute; left: 90px; top: 960px; width: 900px; font: 400 112px/1.18 'Jua', sans-serif; letter-spacing: -2px; color: #28304a; text-shadow: 0 0 22px rgba(255, 255, 255, 0.85), 0 4px 14px rgba(255, 255, 255, 0.6); word-break: keep-all; }
|
||||
#s2-ask .w { display: inline-block; margin-right: 0.22em; }
|
||||
#s2-flood { position: absolute; inset: 0; background: #e3efff; }
|
||||
</style>
|
||||
<div id="root" data-composition-id="s2" data-width="1080" data-height="1920">
|
||||
<div id="s2-world" class="clip" data-start="0" data-duration="3">
|
||||
<div id="s2-cam">
|
||||
<img id="s2-bg" src="assets/bg/rain-city.webp" alt="" />
|
||||
<img id="s2-cloud" src="assets/icons/cloud.png" alt="" />
|
||||
<img id="s2-rain" src="assets/icons/rain.png" alt="" />
|
||||
<div id="s2-c1" class="s2-chip">흐림</div>
|
||||
<div id="s2-c2" class="s2-chip">19°</div>
|
||||
<div id="s2-c3" class="s2-chip">습도 70%</div>
|
||||
<h1 id="s2-ask"><span class="w">…그래서</span><br /><span class="w">오늘</span><span class="w">뭐</span><span class="w">하죠?</span></h1>
|
||||
</div>
|
||||
<div id="s2-flood"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
// 휩 인: 아래서 올라와 맺힘, 그 뒤 느린 드리프트
|
||||
tl.fromTo("#s2-cam", { y: 420, filter: "blur(16px)", scale: 1.1 }, { y: 0, filter: "blur(0px)", duration: 0.25, ease: "expo.out" }, 0);
|
||||
tl.to("#s2-cam", { scale: 1.04, duration: 2.6, ease: "power2.inOut" }, 0.25);
|
||||
tl.fromTo("#s2-cloud", { x: 30, y: 0 }, { x: -40, y: 12, duration: 3, ease: "none" }, 0);
|
||||
tl.fromTo("#s2-rain", { y: -10 }, { y: 30, duration: 3, ease: "none" }, 0);
|
||||
// 날씨 숫자 칩: 위에서 떨어져 튕김 (위치·크기만 튕기고 투명도는 안 튕김)
|
||||
tl.fromTo(["#s2-c1", "#s2-c2", "#s2-c3"], { y: -220, scale: 0.6, opacity: 0 }, { y: 0, scale: 1, opacity: 1, duration: 0.45, ease: "back.out(1.6)", stagger: 0.1 }, 0.2);
|
||||
// …그래서 뭐 하죠?
|
||||
tl.fromTo("#s2-ask .w", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.13, ease: "power4.out", stagger: 0.07 }, 1.3);
|
||||
// 색 플러드: 브랜드 땅이 가운데서 번져 다음 장면으로
|
||||
tl.fromTo("#s2-flood", { clipPath: "circle(0% at 50% 62%)" }, { clipPath: "circle(120% at 50% 62%)", duration: 0.4, ease: "power2.inOut" }, 2.6);
|
||||
window.__timelines["s2"] = tl;
|
||||
</script>
|
||||
</template>
|
||||
@@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<style>
|
||||
@font-face { font-family: 'Jua'; src: url('assets/fonts/Jua-Regular.ttf'); }
|
||||
@font-face { font-family: 'Pretendard'; src: url('assets/fonts/PretendardVariable.woff2'); font-weight: 100 900; }
|
||||
#root { position: absolute; inset: 0; overflow: hidden; background: #e3efff; color: #28304a; }
|
||||
#s3-world { position: absolute; inset: 0; }
|
||||
#s3-icon { position: absolute; left: 390px; top: 560px; width: 300px; height: 300px; border-radius: 68px; box-shadow: 0 24px 60px rgba(40, 48, 74, 0.28); transform-origin: 50% 50%; }
|
||||
#s3-name { position: absolute; left: 0; top: 920px; width: 1080px; text-align: center; font: 400 150px/1 'Jua', sans-serif; letter-spacing: -3px; }
|
||||
#s3-name .l { display: inline-block; }
|
||||
#s3-sub { position: absolute; left: 90px; top: 1120px; width: 900px; text-align: center; font: 700 56px/1.3 'Pretendard', sans-serif; letter-spacing: -1px; word-break: keep-all; }
|
||||
#s3-sub b { color: #d4552a; font-weight: 800; }
|
||||
#s3-rabbit { position: absolute; left: 90px; top: 1520px; width: 260px; }
|
||||
#s3-bear { position: absolute; left: 730px; top: 1540px; width: 260px; }
|
||||
</style>
|
||||
<div id="root" data-composition-id="s3" data-width="1080" data-height="1920">
|
||||
<div id="s3-world" class="clip" data-start="0" data-duration="3">
|
||||
<h1 id="s3-name"><span class="l">날</span><span class="l">씨</span><span class="l">각</span></h1>
|
||||
<p id="s3-sub">날씨를 <b>할 일</b>로 바꿔 주는 앱</p>
|
||||
<img id="s3-rabbit" src="assets/icons/rabbit.png" alt="" />
|
||||
<img id="s3-bear" src="assets/icons/bear.png" alt="" />
|
||||
<img id="s3-icon" src="assets/img/app-icon.png" alt="" />
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
// 앱 아이콘이 튀어나오고(스프링), 이름이 글자별로, 부제가 맺힘
|
||||
tl.fromTo("#s3-icon", { scale: 0.2, opacity: 0 }, { scale: 1, opacity: 1, duration: 0.5, ease: "back.out(1.7)" }, 0.1);
|
||||
tl.fromTo("#s3-name .l", { opacity: 0.3, filter: "blur(6px)", y: 14 }, { opacity: 1, filter: "blur(0px)", y: 0, duration: 0.2, ease: "power4.out", stagger: 0.1 }, 0.5);
|
||||
tl.fromTo("#s3-sub", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.2, ease: "power4.out" }, 0.8);
|
||||
tl.fromTo(["#s3-rabbit", "#s3-bear"], { y: 240 }, { y: 0, duration: 0.6, ease: "expo.out", stagger: 0.08 }, 0.7);
|
||||
// 줌 스루: 아이콘이 화면을 덮으며 다음 세상으로
|
||||
tl.to("#s3-icon", { scale: 9, duration: 0.35, ease: "power3.in" }, 2.65);
|
||||
tl.to(["#s3-name", "#s3-sub"], { opacity: 0, filter: "blur(8px)", duration: 0.2, ease: "power3.in" }, 2.75);
|
||||
window.__timelines["s3"] = tl;
|
||||
</script>
|
||||
</template>
|
||||
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<style>
|
||||
@font-face { font-family: 'Jua'; src: url('assets/fonts/Jua-Regular.ttf'); }
|
||||
@font-face { font-family: 'Pretendard'; src: url('assets/fonts/PretendardVariable.woff2'); font-weight: 100 900; }
|
||||
#root { position: absolute; inset: 0; overflow: hidden; background: #cfe3fb; color: #fff; }
|
||||
#s4-world { position: absolute; inset: 0; }
|
||||
#s4-cam { position: absolute; inset: 0; transform-origin: 50% 50%; }
|
||||
#s4-bg { position: absolute; left: 0; top: 0; width: 1080px; height: 1920px; object-fit: cover; }
|
||||
#s4-drive { position: absolute; left: 120px; top: 1120px; width: 320px; }
|
||||
#s4-chip { position: absolute; left: 90px; top: 560px; display: flex; align-items: center; gap: 22px; padding: 22px 40px 22px 24px; border-radius: 32px; background: #fff; color: #28304a; box-shadow: 0 12px 34px rgba(40, 48, 74, 0.28); transform-origin: 0% 50%; }
|
||||
#s4-chip img { width: 110px; height: 110px; }
|
||||
#s4-chip .n { font: 800 54px/1 'Pretendard', sans-serif; letter-spacing: -1px; white-space: nowrap; }
|
||||
#s4-chip .v { font: 800 92px/1 'Pretendard', sans-serif; color: #d4552a; letter-spacing: -2px; min-width: 120px; text-align: right; }
|
||||
#s4-line { position: absolute; left: 90px; top: 760px; width: 900px; font: 400 76px/1.2 'Jua', sans-serif; letter-spacing: -1px; color: #28304a; text-shadow: 0 0 22px rgba(255, 255, 255, 0.85), 0 4px 14px rgba(255, 255, 255, 0.6); word-break: keep-all; }
|
||||
</style>
|
||||
<div id="root" data-composition-id="s4" data-width="1080" data-height="1920">
|
||||
<div id="s4-world" class="clip" data-start="0" data-duration="2">
|
||||
<div id="s4-cam">
|
||||
<img id="s4-bg" src="assets/bg/beach.webp" alt="" />
|
||||
<img id="s4-drive" src="assets/icons/drive.png" alt="" />
|
||||
<div id="s4-chip"><img src="assets/icons/drive.png" alt="" /><span class="n">드라이브각</span><span class="v" id="s4-score">0</span></div>
|
||||
<p id="s4-line">해안 드라이브 딱 좋은 날</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
// 줌 스루 끝에서 크게 들어와 안착, 그 뒤 살짝 드리프트
|
||||
tl.fromTo("#s4-cam", { scale: 1.2, filter: "blur(6px)" }, { scale: 1.06, filter: "blur(0px)", duration: 0.55, ease: "power3.out" }, 0);
|
||||
tl.to("#s4-cam", { scale: 1.09, duration: 1.2, ease: "power2.inOut" }, 0.55);
|
||||
tl.fromTo("#s4-drive", { x: -40, y: 10 }, { x: 70, y: -6, duration: 2, ease: "none" }, 0);
|
||||
// 오늘 점수 칩: 튕겨 들어오고 숫자가 올라감 (2026-10-24 서울 중구 API 값)
|
||||
tl.fromTo("#s4-chip", { scale: 0.5, x: -80, opacity: 0 }, { scale: 1, x: 0, opacity: 1, duration: 0.45, ease: "back.out(1.6)" }, 0.15);
|
||||
const score = { v: 0 };
|
||||
tl.to(score, { v: 82, duration: 0.6, ease: "power2.out", onUpdate: () => { document.getElementById("s4-score").textContent = Math.round(score.v); } }, 0.25);
|
||||
tl.fromTo("#s4-line", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.2, ease: "power4.out" }, 0.28);
|
||||
tl.to("#s4-cam", { y: -420, filter: "blur(16px)", duration: 0.18, ease: "power3.in" }, 1.84);
|
||||
window.__timelines["s4"] = tl;
|
||||
</script>
|
||||
</template>
|
||||
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<style>
|
||||
@font-face { font-family: 'Jua'; src: url('assets/fonts/Jua-Regular.ttf'); }
|
||||
@font-face { font-family: 'Pretendard'; src: url('assets/fonts/PretendardVariable.woff2'); font-weight: 100 900; }
|
||||
#root { position: absolute; inset: 0; overflow: hidden; background: #cfe3fb; color: #fff; }
|
||||
#s5-world { position: absolute; inset: 0; }
|
||||
#s5-cam { position: absolute; inset: 0; transform-origin: 50% 50%; }
|
||||
#s5-bg { position: absolute; left: 0; top: 0; width: 1080px; height: 1920px; object-fit: cover; }
|
||||
#s5-walk { position: absolute; left: 620px; top: 1140px; width: 300px; }
|
||||
#s5-chip { position: absolute; left: 90px; top: 560px; display: flex; align-items: center; gap: 22px; padding: 22px 40px 22px 24px; border-radius: 32px; background: #fff; color: #28304a; box-shadow: 0 12px 34px rgba(40, 48, 74, 0.28); transform-origin: 0% 50%; }
|
||||
#s5-chip img { width: 110px; height: 110px; }
|
||||
#s5-chip .n { font: 800 54px/1 'Pretendard', sans-serif; letter-spacing: -1px; white-space: nowrap; }
|
||||
#s5-chip .v { font: 800 92px/1 'Pretendard', sans-serif; color: #d4552a; letter-spacing: -2px; min-width: 120px; text-align: right; }
|
||||
#s5-line { position: absolute; left: 90px; top: 760px; width: 900px; font: 400 76px/1.2 'Jua', sans-serif; letter-spacing: -1px; color: #28304a; text-shadow: 0 0 22px rgba(255, 255, 255, 0.85), 0 4px 14px rgba(255, 255, 255, 0.6); word-break: keep-all; }
|
||||
</style>
|
||||
<div id="root" data-composition-id="s5" data-width="1080" data-height="1920">
|
||||
<div id="s5-world" class="clip" data-start="0" data-duration="2">
|
||||
<div id="s5-cam">
|
||||
<img id="s5-bg" src="assets/bg/mountain.webp" alt="" />
|
||||
<img id="s5-walk" src="assets/icons/walk.png" alt="" />
|
||||
<div id="s5-chip"><img src="assets/icons/walk.png" alt="" /><span class="n">산책각</span><span class="v" id="s5-score">0</span></div>
|
||||
<p id="s5-line">숲길 산책 딱 좋은 날</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
tl.fromTo("#s5-cam", { y: 420, filter: "blur(16px)", scale: 1.12 }, { y: 0, filter: "blur(0px)", duration: 0.25, ease: "expo.out" }, 0);
|
||||
tl.to("#s5-cam", { scale: 1.06, duration: 1.5, ease: "power2.inOut" }, 0.25);
|
||||
// 산책 아이콘: 걷는 듯 위아래 (유한 반복)
|
||||
tl.fromTo("#s5-walk", { y: 0, x: 20 }, { y: -8, x: -30, duration: 0.4, ease: "sine.inOut", repeat: 4, yoyo: true }, 0);
|
||||
tl.fromTo("#s5-chip", { scale: 0.5, x: -80, opacity: 0 }, { scale: 1, x: 0, opacity: 1, duration: 0.45, ease: "back.out(1.6)" }, 0.2);
|
||||
const score = { v: 0 };
|
||||
tl.to(score, { v: 81, duration: 0.6, ease: "power2.out", onUpdate: () => { document.getElementById("s5-score").textContent = Math.round(score.v); } }, 0.3);
|
||||
tl.fromTo("#s5-line", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.2, ease: "power4.out" }, 0.28);
|
||||
tl.to("#s5-cam", { y: -420, filter: "blur(16px)", duration: 0.18, ease: "power3.in" }, 1.84);
|
||||
window.__timelines["s5"] = tl;
|
||||
</script>
|
||||
</template>
|
||||
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<style>
|
||||
@font-face { font-family: 'Jua'; src: url('assets/fonts/Jua-Regular.ttf'); }
|
||||
@font-face { font-family: 'Pretendard'; src: url('assets/fonts/PretendardVariable.woff2'); font-weight: 100 900; }
|
||||
#root { position: absolute; inset: 0; overflow: hidden; background: #f7b27a; color: #fff; }
|
||||
#s6-world { position: absolute; inset: 0; }
|
||||
#s6-cam { position: absolute; inset: 0; transform-origin: 50% 50%; }
|
||||
#s6-bg { position: absolute; left: 0; top: 0; width: 1080px; height: 1920px; object-fit: cover; }
|
||||
#s6-hangang { position: absolute; left: 560px; top: 1080px; width: 340px; }
|
||||
#s6-picnic { position: absolute; left: 110px; top: 1300px; width: 220px; }
|
||||
#s6-chip { position: absolute; left: 90px; top: 560px; display: flex; align-items: center; gap: 22px; padding: 22px 40px 22px 24px; border-radius: 32px; background: #fff; color: #28304a; box-shadow: 0 12px 34px rgba(40, 48, 74, 0.28); transform-origin: 0% 50%; }
|
||||
#s6-chip img { width: 110px; height: 110px; }
|
||||
#s6-chip .n { font: 800 54px/1 'Pretendard', sans-serif; letter-spacing: -1px; white-space: nowrap; }
|
||||
#s6-chip .v { font: 800 92px/1 'Pretendard', sans-serif; color: #d4552a; letter-spacing: -2px; min-width: 120px; text-align: right; }
|
||||
#s6-line { position: absolute; left: 90px; top: 760px; width: 900px; font: 400 76px/1.2 'Jua', sans-serif; letter-spacing: -1px; color: #28304a; text-shadow: 0 0 22px rgba(255, 255, 255, 0.85), 0 4px 14px rgba(255, 255, 255, 0.6); word-break: keep-all; }
|
||||
#s6-flood { position: absolute; inset: 0; background: #e3efff; }
|
||||
</style>
|
||||
<div id="root" data-composition-id="s6" data-width="1080" data-height="1920">
|
||||
<div id="s6-world" class="clip" data-start="0" data-duration="2">
|
||||
<div id="s6-cam">
|
||||
<img id="s6-bg" src="assets/bg/hangang-sunset.webp" alt="" />
|
||||
<img id="s6-hangang" src="assets/icons/hangang.png" alt="" />
|
||||
<img id="s6-picnic" src="assets/icons/picnic.png" alt="" />
|
||||
<div id="s6-chip"><img src="assets/icons/hangang.png" alt="" /><span class="n">한강각</span><span class="v" id="s6-score">0</span></div>
|
||||
<p id="s6-line">노을 보며 돗자리 딱</p>
|
||||
</div>
|
||||
<div id="s6-flood"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
tl.fromTo("#s6-cam", { y: 420, filter: "blur(16px)", scale: 1.12 }, { y: 0, filter: "blur(0px)", duration: 0.25, ease: "expo.out" }, 0);
|
||||
tl.to("#s6-cam", { scale: 1.06, duration: 1.5, ease: "power2.inOut" }, 0.25);
|
||||
tl.fromTo("#s6-hangang", { x: 20, y: 6 }, { x: -30, y: -10, duration: 2, ease: "none" }, 0);
|
||||
tl.fromTo("#s6-picnic", { x: -20 }, { x: 30, duration: 2, ease: "none" }, 0);
|
||||
tl.fromTo("#s6-chip", { scale: 0.5, x: -80, opacity: 0 }, { scale: 1, x: 0, opacity: 1, duration: 0.45, ease: "back.out(1.6)" }, 0.2);
|
||||
const score = { v: 0 };
|
||||
tl.to(score, { v: 85, duration: 0.6, ease: "power2.out", onUpdate: () => { document.getElementById("s6-score").textContent = Math.round(score.v); } }, 0.3);
|
||||
tl.fromTo("#s6-line", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.2, ease: "power4.out" }, 0.28);
|
||||
// 브랜드 땅으로 플러드 (폰이 올라올 자리)
|
||||
tl.fromTo("#s6-flood", { clipPath: "circle(0% at 50% 100%)" }, { clipPath: "circle(140% at 50% 100%)", duration: 0.3, ease: "power2.inOut" }, 1.74);
|
||||
window.__timelines["s6"] = tl;
|
||||
</script>
|
||||
</template>
|
||||
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<style>
|
||||
@font-face { font-family: 'Jua'; src: url('assets/fonts/Jua-Regular.ttf'); }
|
||||
@font-face { font-family: 'Pretendard'; src: url('assets/fonts/PretendardVariable.woff2'); font-weight: 100 900; }
|
||||
#root { position: absolute; inset: 0; overflow: hidden; background: #e3efff; color: #28304a; }
|
||||
#s7-world { position: absolute; inset: 0; }
|
||||
#s7-title { position: absolute; left: 90px; top: 230px; width: 900px; font: 400 112px/1.18 'Jua', sans-serif; letter-spacing: -2px; word-break: keep-all; }
|
||||
#s7-title .w { display: inline-block; margin-right: 0.22em; }
|
||||
#s7-phone { position: absolute; left: 180px; top: 560px; width: 720px; height: 1500px; padding: 22px; border: 12px solid #28304a; border-radius: 88px; background: #28304a; box-shadow: 0 30px 70px rgba(40, 48, 74, 0.3); overflow: hidden; }
|
||||
#s7-phone img { display: block; width: 100%; border-radius: 52px; }
|
||||
#s7-chip { position: absolute; left: 560px; top: 480px; padding: 18px 36px; border-radius: 28px; background: #d4552a; color: #fff; font: 800 56px/1 'Pretendard', sans-serif; letter-spacing: -1px; box-shadow: 0 12px 34px rgba(212, 85, 42, 0.35); white-space: nowrap; transform-origin: 50% 50%; z-index: 2; }
|
||||
#s7-note { position: absolute; left: 90px; top: 500px; font: 600 36px/1 'Pretendard', sans-serif; color: #546078; }
|
||||
</style>
|
||||
<div id="root" data-composition-id="s7" data-width="1080" data-height="1920">
|
||||
<div id="s7-world" class="clip" data-start="0" data-duration="3" data-layout-allow-overlap>
|
||||
<h1 id="s7-title"><span class="w">지금</span><span class="w">내</span><span class="w">동네</span><br /><span class="w">1위는?</span></h1>
|
||||
<div id="s7-phone"><img src="assets/img/shot-home.webp" alt="날씨각 홈 화면" /></div>
|
||||
<div id="s7-chip">68가지 각</div>
|
||||
<p id="s7-note">실제 화면 · 10.24 마포구</p>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
// 진짜 홈 화면이 아래서 올라오고, 제목이 맺히고, 68가지 칩이 튕김
|
||||
tl.fromTo("#s7-phone", { y: 1400 }, { y: 0, duration: 0.7, ease: "power4.out" }, 0.05);
|
||||
tl.fromTo("#s7-title .w", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.13, ease: "power4.out", stagger: 0.07 }, 0.4);
|
||||
tl.fromTo("#s7-chip", { scale: 0.4, opacity: 0, rotate: -8 }, { scale: 1, opacity: 1, rotate: -6, duration: 0.45, ease: "back.out(1.6)" }, 1.2);
|
||||
tl.fromTo("#s7-note", { opacity: 0 }, { opacity: 1, duration: 0.2, ease: "power2.out" }, 0.6);
|
||||
// 폰이 아래로 빠지며 엔드카드로
|
||||
tl.to("#s7-phone", { y: 1500, duration: 0.3, ease: "power3.in" }, 2.7);
|
||||
tl.to(["#s7-title", "#s7-chip", "#s7-note"], { opacity: 0, filter: "blur(8px)", duration: 0.2, ease: "power3.in" }, 2.75);
|
||||
window.__timelines["s7"] = tl;
|
||||
</script>
|
||||
</template>
|
||||
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<style>
|
||||
@font-face { font-family: 'Jua'; src: url('assets/fonts/Jua-Regular.ttf'); }
|
||||
@font-face { font-family: 'Pretendard'; src: url('assets/fonts/PretendardVariable.woff2'); font-weight: 100 900; }
|
||||
#root { position: absolute; inset: 0; overflow: hidden; background: #e3efff; color: #28304a; }
|
||||
#s8-world { position: absolute; inset: 0; }
|
||||
#s8-icon { position: absolute; left: 410px; top: 520px; width: 260px; height: 260px; border-radius: 60px; box-shadow: 0 24px 60px rgba(40, 48, 74, 0.28); transform-origin: 50% 50%; }
|
||||
#s8-name { position: absolute; left: 0; top: 830px; width: 1080px; text-align: center; font: 400 140px/1 'Jua', sans-serif; letter-spacing: -3px; }
|
||||
#s8-claim { position: absolute; left: 90px; top: 1010px; width: 900px; text-align: center; font: 800 64px/1.2 'Pretendard', sans-serif; letter-spacing: -1px; word-break: keep-all; }
|
||||
#s8-claim b { color: #d4552a; }
|
||||
#s8-url { position: absolute; left: 90px; top: 1125px; width: 900px; text-align: center; font: 700 58px/1.2 'Pretendard', sans-serif; letter-spacing: -1px; color: #2b6cb8; }
|
||||
#s8-toss { position: absolute; left: 90px; top: 1215px; width: 900px; text-align: center; font: 600 50px/1.2 'Pretendard', sans-serif; letter-spacing: -1px; color: #546078; word-break: keep-all; }
|
||||
#s8-rabbit { position: absolute; left: 90px; top: 1520px; width: 260px; }
|
||||
#s8-bear { position: absolute; left: 730px; top: 1540px; width: 260px; }
|
||||
</style>
|
||||
<div id="root" data-composition-id="s8" data-width="1080" data-height="1920">
|
||||
<div id="s8-world" class="clip" data-start="0" data-duration="3.5">
|
||||
<img id="s8-icon" src="assets/img/app-icon.png" alt="" />
|
||||
<h1 id="s8-name">날씨각</h1>
|
||||
<p id="s8-claim">설치 없이 바로, <b>무료</b></p>
|
||||
<p id="s8-url">weather.o2o.kr</p>
|
||||
<p id="s8-toss">토스 앱에서 '날씨각' 검색해도 열려요</p>
|
||||
<img id="s8-rabbit" src="assets/icons/rabbit.png" alt="" />
|
||||
<img id="s8-bear" src="assets/icons/bear.png" alt="" />
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
tl.fromTo("#s8-icon", { scale: 0.2, opacity: 0 }, { scale: 1, opacity: 1, duration: 0.5, ease: "back.out(1.7)" }, 0.1);
|
||||
tl.fromTo("#s8-name", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.2, ease: "power4.out" }, 0.4);
|
||||
tl.fromTo("#s8-claim", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.2, ease: "power4.out" }, 0.7);
|
||||
tl.fromTo("#s8-url", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.2, ease: "power4.out" }, 1.0);
|
||||
tl.fromTo("#s8-toss", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.2, ease: "power4.out" }, 1.3);
|
||||
tl.fromTo(["#s8-rabbit", "#s8-bear"], { y: 240 }, { y: 0, duration: 0.6, ease: "expo.out", stagger: 0.08 }, 0.3);
|
||||
// 마지막 0.6초는 정지 (마지막 프레임 유지)
|
||||
tl.to({}, { duration: 0.2 }, 3.3);
|
||||
window.__timelines["s8"] = tl;
|
||||
</script>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/hyperframes.json",
|
||||
"registry": "https://raw.githubusercontent.com/heygen-com/hyperframes/main/registry",
|
||||
"paths": {
|
||||
"blocks": "compositions",
|
||||
"components": "compositions/components",
|
||||
"assets": "assets"
|
||||
},
|
||||
"media": {
|
||||
"autoProxy": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<!doctype html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1080, height=1920" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { margin: 0; width: 1080px; height: 1920px; overflow: hidden; background: #e3efff; }
|
||||
#root { position: relative; width: 100%; height: 100%; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 날씨각 소개 릴스 20초. 장면마다 sub-composition 하나 (SPEC.md의 S1~S8) -->
|
||||
<div id="root" data-composition-id="main" data-start="0" data-duration="21" data-width="1080" data-height="1920">
|
||||
<div id="s1" data-composition-id="s1" data-composition-src="compositions/s1.html" data-start="0" data-duration="2.5" data-track-index="1" data-track-kind="graphics" data-width="1080" data-height="1920"></div>
|
||||
<div id="s2" data-composition-id="s2" data-composition-src="compositions/s2.html" data-start="2.5" data-duration="3" data-track-index="1" data-track-kind="graphics" data-width="1080" data-height="1920"></div>
|
||||
<div id="s3" data-composition-id="s3" data-composition-src="compositions/s3.html" data-start="5.5" data-duration="3" data-track-index="1" data-track-kind="graphics" data-width="1080" data-height="1920"></div>
|
||||
<div id="s4" data-composition-id="s4" data-composition-src="compositions/s4.html" data-start="8.5" data-duration="2" data-track-index="1" data-track-kind="graphics" data-width="1080" data-height="1920"></div>
|
||||
<div id="s5" data-composition-id="s5" data-composition-src="compositions/s5.html" data-start="10.5" data-duration="2" data-track-index="1" data-track-kind="graphics" data-width="1080" data-height="1920"></div>
|
||||
<div id="s6" data-composition-id="s6" data-composition-src="compositions/s6.html" data-start="12.5" data-duration="2" data-track-index="1" data-track-kind="graphics" data-width="1080" data-height="1920"></div>
|
||||
<div id="s7" data-composition-id="s7" data-composition-src="compositions/s7.html" data-start="14.5" data-duration="3" data-track-index="1" data-track-kind="graphics" data-width="1080" data-height="1920"></div>
|
||||
<div id="s8" data-composition-id="s8" data-composition-src="compositions/s8.html" data-start="17.5" data-duration="3.5" data-track-index="1" data-track-kind="graphics" data-width="1080" data-height="1920"></div>
|
||||
</div>
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
window.__timelines["main"] = tl;
|
||||
tl.seek(0);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"id": "intro",
|
||||
"name": "intro",
|
||||
"createdAt": "2026-10-24T09:16:40.854Z"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "intro",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "npx --yes hyperframes@0.8.191 preview",
|
||||
"check": "npx --yes hyperframes@0.8.191 check",
|
||||
"render": "npx --yes hyperframes@0.8.191 render",
|
||||
"publish": "npx --yes hyperframes@0.8.191 publish"
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,7 @@ const picked =
|
||||
const bands = exact.length === 0 && styleFilter ? picked.filter((j) => j.style === styleFilter) : picked
|
||||
if (bands.length === 0) fail(target === 'missing' ? '빠진 그림이 없어요.' : `'${target}' 은 ${promptFile} 에 없어요.${spec.bands ? ` 구간: ${spec.bands.map((b) => b.id).join(', ')} / 스타일: ${Object.keys(spec.styles).join(', ')} / 사람: ${Object.keys(spec.personas).join(', ')}` : ` id: ${spec.items.map((i) => i.id).join(', ')}`}`)
|
||||
|
||||
const failed = []
|
||||
for (const band of bands) {
|
||||
if (existsSync(outPath(band.id)) && !force) {
|
||||
console.log(`${band.id}: 이미 있어요 (다시 만들려면 --force)`)
|
||||
@@ -84,8 +85,15 @@ for (const band of bands) {
|
||||
fail(`${band.id}: Codex 실행이 실패했어요 (${e.message}). 사용 한도나 로그인을 확인하세요.`)
|
||||
}
|
||||
const png = readdirSync(work).find((f) => f === 'result.png') ?? readdirSync(work).find((f) => f.endsWith('.png'))
|
||||
if (!png) fail(`${band.id}: Codex가 그림을 저장하지 않았어요. 작업 폴더: ${work}`)
|
||||
// 저장을 빼먹는 건 그 한 장 문제라 나머지는 계속 만들고 끝에 모아서 알린다 (한도·로그인 실패는 위에서 바로 멈춤)
|
||||
if (!png) {
|
||||
console.error(`${band.id}: Codex가 그림을 저장하지 않았어요. 작업 폴더: ${work}`)
|
||||
failed.push(band.id)
|
||||
continue
|
||||
}
|
||||
execFileSync('cwebp', ['-quiet', '-q', '88', '-resize', '1024', '0', join(work, png), '-o', outPath(band.id)])
|
||||
rmSync(work, { recursive: true, force: true })
|
||||
console.log(`${band.id}: ${outPath(band.id)}`)
|
||||
}
|
||||
|
||||
if (failed.length) fail(`못 만든 그림: ${failed.join(", ")} — 다시: npm run gen-image -- ${kind} ${failed.join(" ")}`)
|
||||
|
After Width: | Height: | Size: 167 KiB |
|
After Width: | Height: | Size: 162 KiB |
|
After Width: | Height: | Size: 201 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 99 KiB |
@@ -136,6 +136,23 @@ function postApi(): Plugin {
|
||||
res.end(JSON.stringify({ error: e instanceof Error ? e.message : String(e) }))
|
||||
}
|
||||
})
|
||||
// 릴스: GET /api/reel → 목록 · POST /api/reel {title, caption, hashtags, video, cover?} → 저장 · POST /api/reel/<id>/instagram → 인스타에 올리기
|
||||
server.middlewares.use('/api/reel', async (req, res) => {
|
||||
res.setHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
try {
|
||||
const t = targetOf(req)
|
||||
const path = (req.url ?? '').split('?')[0]
|
||||
const m = path.match(/^\/(\d+)\/instagram$/)
|
||||
if (req.method === 'GET') return await relay(res, await fetch(`${t.api}/v1/reel?limit=100`, { headers: headers(t) }))
|
||||
if (req.method === 'POST' && m) return await relay(res, await fetch(`${t.api}/v1/reel/${m[1]}/instagram`, { method: 'POST', headers: headers(t) }))
|
||||
if (req.method === 'POST' && path === '/') return await relay(res, await fetch(`${t.api}/v1/reel`, { method: 'POST', headers: headers(t), body: JSON.stringify(await readJson(req)) }))
|
||||
throw new Error('GET /api/reel · POST /api/reel · POST /api/reel/<id>/instagram')
|
||||
} catch (e) {
|
||||
server.config.logger.error(`[reel-api] ${e instanceof Error ? e.message : String(e)}`)
|
||||
res.statusCode = 500
|
||||
res.end(JSON.stringify({ error: e instanceof Error ? e.message : String(e) }))
|
||||
}
|
||||
})
|
||||
server.middlewares.use('/api/post', async (req, res) => {
|
||||
res.setHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
try {
|
||||
|
||||
@@ -334,6 +334,19 @@ class CardImage(Base):
|
||||
data: Mapped[bytes] = mapped_column(LargeBinary)
|
||||
|
||||
|
||||
class Reel(Base):
|
||||
__tablename__ = "reel"
|
||||
|
||||
reel_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
title: Mapped[str] = mapped_column(String(80))
|
||||
caption: Mapped[str] = mapped_column(Text, default="")
|
||||
hashtags: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
||||
video: Mapped[bytes] = mapped_column(LargeBinary)
|
||||
cover: Mapped[Optional[bytes]] = mapped_column(LargeBinary, nullable=True)
|
||||
ig_media_id: Mapped[Optional[str]] = mapped_column(String(40), nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = "users"
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.orm import defer
|
||||
|
||||
from common.database.model.models import Reel
|
||||
|
||||
|
||||
class ReelCRUD:
|
||||
async def create(self, s: AsyncSession, reel: Reel) -> Reel:
|
||||
s.add(reel)
|
||||
await s.flush()
|
||||
return reel
|
||||
|
||||
async def get(self, s: AsyncSession, reel_id: int) -> Optional[Reel]:
|
||||
return await s.get(Reel, reel_id)
|
||||
|
||||
async def recent(self, s: AsyncSession, limit: int) -> list[Reel]:
|
||||
"""만든 순서 역순. 영상·표지 바이트는 안 읽는다."""
|
||||
return list((await s.scalars(select(Reel).options(defer(Reel.video), defer(Reel.cover)).order_by(Reel.reel_id.desc()).limit(limit))).all())
|
||||
|
||||
async def video(self, s: AsyncSession, reel_id: int) -> Optional[bytes]:
|
||||
return await s.scalar(select(Reel.video).where(Reel.reel_id == reel_id))
|
||||
|
||||
async def cover(self, s: AsyncSession, reel_id: int) -> Optional[bytes]:
|
||||
return await s.scalar(select(Reel.cover).where(Reel.reel_id == reel_id))
|
||||
@@ -497,3 +497,15 @@ CREATE TABLE IF NOT EXISTS public.article (
|
||||
);
|
||||
ALTER TABLE public.article ADD COLUMN IF NOT EXISTS image_url VARCHAR(200) NULL;
|
||||
ALTER TABLE public.article ADD COLUMN IF NOT EXISTS image_credit VARCHAR(60) NULL;
|
||||
|
||||
-- 인스타 릴스 (관리자가 만든 mp4를 공개 주소로 내보내 인스타 REELS API 로 올린다. 날씨각 피드에는 안 나간다)
|
||||
CREATE TABLE IF NOT EXISTS public.reel (
|
||||
reel_id BIGSERIAL PRIMARY KEY,
|
||||
title VARCHAR(80) NOT NULL,
|
||||
caption TEXT NOT NULL DEFAULT '',
|
||||
hashtags TEXT NULL,
|
||||
video BYTEA NOT NULL, -- mp4 (H.264, 9:16)
|
||||
cover BYTEA NULL, -- 표지 JPEG
|
||||
ig_media_id VARCHAR(40) NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
@@ -9,6 +9,7 @@ from common.database.db_session_manager import DB_SESSION_MNG
|
||||
from common.models.gmodel import Res_WebPacketProtocol
|
||||
from router.v1.auth.account import router as auth_router
|
||||
from router.v1.card.card import router as card_router
|
||||
from router.v1.reel.reel import router as reel_router
|
||||
from router.v1.feed.feed import router as feed_router
|
||||
from router.v1.image.image import router as image_router
|
||||
from router.v1.index.index import router as index_router
|
||||
@@ -51,6 +52,7 @@ app.include_router(watch_router)
|
||||
app.include_router(image_router)
|
||||
app.include_router(seo_router)
|
||||
app.include_router(card_router)
|
||||
app.include_router(reel_router)
|
||||
|
||||
|
||||
class Res_Health(Res_WebPacketProtocol):
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from common.models.gmodel import Res_WebPacketProtocol, WebPacketProtocol
|
||||
|
||||
|
||||
class Req_ReelCreate(WebPacketProtocol):
|
||||
title: str = Field(max_length=80, description="인스타 캡션 첫 줄")
|
||||
caption: str = Field(default="", max_length=2000)
|
||||
hashtags: str = Field(default="", max_length=600, description="인스타 캡션 뒤에 붙는 해시태그")
|
||||
video: str = Field(description="mp4(H.264, 9:16), base64, 30MB 이하")
|
||||
cover: Optional[str] = Field(default=None, description="표지 JPEG, base64 (없으면 인스타가 첫 장면을 쓴다)")
|
||||
|
||||
|
||||
class Res_Reel(Res_WebPacketProtocol):
|
||||
reel_id: Optional[int] = None
|
||||
video_url: Optional[str] = None
|
||||
cover_url: Optional[str] = None
|
||||
ig_media_id: Optional[str] = None
|
||||
|
||||
|
||||
class ReelItem(WebPacketProtocol):
|
||||
reel_id: int
|
||||
title: str
|
||||
created_at: datetime
|
||||
video_url: str
|
||||
cover_url: Optional[str] = None
|
||||
ig_media_id: Optional[str] = None
|
||||
|
||||
|
||||
class Res_ReelList(Res_WebPacketProtocol):
|
||||
items: list[ReelItem] = []
|
||||
@@ -0,0 +1,135 @@
|
||||
import base64
|
||||
import binascii
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Path, Query, Request
|
||||
from fastapi.responses import Response
|
||||
|
||||
from common.auth import require_admin
|
||||
from common.database.db_session_manager import DB_SESSION_MNG
|
||||
from common.database.model.models import Reel
|
||||
from common.enums import ErrorType
|
||||
from common.logger import LOG
|
||||
from common.models.errors import error_info
|
||||
from common.utils.kma_time import KST
|
||||
from crud.reel_crud import ReelCRUD
|
||||
from router.v1.reel.protocol import ReelItem, Req_ReelCreate, Res_Reel, Res_ReelList
|
||||
from services.external import instagram
|
||||
|
||||
router = APIRouter(prefix="/v1/reel", tags=["reel"])
|
||||
|
||||
_MAX_VIDEO_BYTES = 30 * 1024 * 1024
|
||||
_MAX_COVER_BYTES = 5 * 1024 * 1024
|
||||
_crud = ReelCRUD()
|
||||
|
||||
|
||||
def video_url(reel_id: int) -> str:
|
||||
return f"/v1/reel/{reel_id}.mp4"
|
||||
|
||||
|
||||
def cover_url(reel_id: int) -> str:
|
||||
return f"/v1/reel/{reel_id}/cover.jpg"
|
||||
|
||||
|
||||
def _decode(b64: str, what: str) -> bytes:
|
||||
try:
|
||||
return base64.b64decode(b64.split(",", 1)[-1], validate=True)
|
||||
except (binascii.Error, ValueError) as e:
|
||||
raise HTTPException(status_code=400, detail=f"{what}: base64 아님") from e
|
||||
|
||||
|
||||
def _video(b64: str) -> bytes:
|
||||
data = _decode(b64, "video")
|
||||
# mp4 는 4바이트 크기 뒤에 'ftyp' 상자로 시작한다
|
||||
if data[4:8] != b"ftyp" or len(data) > _MAX_VIDEO_BYTES:
|
||||
raise HTTPException(status_code=400, detail="video: 30MB 이하 mp4 만")
|
||||
return data
|
||||
|
||||
|
||||
def _cover(b64: Optional[str]) -> Optional[bytes]:
|
||||
if not b64:
|
||||
return None
|
||||
data = _decode(b64, "cover")
|
||||
if not data.startswith(b"\xff\xd8") or len(data) > _MAX_COVER_BYTES:
|
||||
raise HTTPException(status_code=400, detail="cover: 5MB 이하 JPEG 만")
|
||||
return data
|
||||
|
||||
|
||||
def _res(reel: Reel) -> Res_Reel:
|
||||
return Res_Reel(reel_id=reel.reel_id, video_url=video_url(reel.reel_id), cover_url=cover_url(reel.reel_id) if reel.cover is not None else None, ig_media_id=reel.ig_media_id)
|
||||
|
||||
|
||||
@router.get("", response_model=Res_ReelList, response_model_exclude_none=True, summary="릴스 목록 (관리자)", dependencies=[Depends(require_admin)])
|
||||
async def list_reels(limit: int = Query(50, ge=1, le=200)) -> Res_ReelList:
|
||||
err, reels = await DB_SESSION_MNG.execute_lambda(lambda s: _crud.recent(s, limit))
|
||||
if err is not ErrorType.SUCCESS:
|
||||
return Res_ReelList(result=error_info(err))
|
||||
return Res_ReelList(items=[ReelItem(reel_id=r.reel_id, title=r.title, created_at=r.created_at.astimezone(KST), video_url=video_url(r.reel_id), cover_url=cover_url(r.reel_id), ig_media_id=r.ig_media_id) for r in reels or []])
|
||||
|
||||
|
||||
@router.post("", response_model=Res_Reel, response_model_exclude_none=True, summary="릴스 mp4 저장 (관리자). 공개 주소가 생기고, 인스타엔 따로 올린다", dependencies=[Depends(require_admin)])
|
||||
async def create_reel(req: Req_ReelCreate) -> Res_Reel:
|
||||
reel = Reel(title=req.title, caption=req.caption, hashtags=req.hashtags.strip() or None, video=_video(req.video), cover=_cover(req.cover))
|
||||
err, reel = await DB_SESSION_MNG.execute_lambda_write(lambda s: _crud.create(s, reel))
|
||||
if err is not ErrorType.SUCCESS:
|
||||
return Res_Reel(result=error_info(err))
|
||||
LOG.info(f"[reel] saved {reel.reel_id} ({len(reel.video)} bytes)")
|
||||
return _res(reel)
|
||||
|
||||
|
||||
@router.post("/{reel_id}/instagram", response_model=Res_Reel, response_model_exclude_none=True, summary="릴스를 인스타그램에 올리기 (관리자). 같은 릴스는 한 번만", dependencies=[Depends(require_admin)])
|
||||
async def publish_instagram(reel_id: int = Path(...)) -> Res_Reel:
|
||||
if not instagram.configured():
|
||||
return Res_Reel(result=error_info(ErrorType.INVALID_INPUT), msg="INSTAGRAM_ACCESS_TOKEN / INSTAGRAM_USER_ID 가 설정되지 않았어요")
|
||||
err, reel = await DB_SESSION_MNG.execute_lambda(lambda s: _crud.get(s, reel_id))
|
||||
if err is not ErrorType.SUCCESS:
|
||||
return Res_Reel(result=error_info(err))
|
||||
if reel is None:
|
||||
return Res_Reel(result=error_info(ErrorType.NOT_FOUND))
|
||||
if reel.ig_media_id:
|
||||
return _res(reel)
|
||||
caption = "\n\n".join(part for part in (reel.title, reel.caption, reel.hashtags) if part)
|
||||
cover = instagram.public_image_url(cover_url(reel_id)) if reel.cover is not None else None
|
||||
try:
|
||||
media_id = await instagram.publish_reel(instagram.public_image_url(video_url(reel_id)), caption, cover_url=cover)
|
||||
except instagram.InstagramError as e:
|
||||
LOG.error(f"[reel] instagram {reel_id}: {e}")
|
||||
return Res_Reel(result=error_info(ErrorType.EXTERNAL_API_ERROR), msg=str(e), reel_id=reel_id)
|
||||
|
||||
async def save(s):
|
||||
r = await _crud.get(s, reel_id)
|
||||
if r is not None:
|
||||
r.ig_media_id = media_id
|
||||
return r
|
||||
|
||||
err, saved = await DB_SESSION_MNG.execute_lambda_write(save)
|
||||
if err is not ErrorType.SUCCESS or saved is None:
|
||||
return Res_Reel(result=error_info(err if err is not ErrorType.SUCCESS else ErrorType.NOT_FOUND), msg=f"인스타엔 올라갔지만({media_id}) 저장 실패")
|
||||
return _res(saved)
|
||||
|
||||
|
||||
# 영상·표지는 바이트 자체를 돌려주므로 실패는 HTTP 상태 코드로 알린다
|
||||
@router.get("/{reel_id}.mp4", summary="릴스 영상 (인스타가 받아 가는 공개 주소, Range 지원)", responses={200: {"content": {"video/mp4": {}}}, 206: {}, 404: {}})
|
||||
async def get_reel_video(request: Request, reel_id: int = Path(...)) -> Response:
|
||||
err, data = await DB_SESSION_MNG.execute_lambda(lambda s: _crud.video(s, reel_id))
|
||||
if err is not ErrorType.SUCCESS or data is None:
|
||||
raise HTTPException(status_code=404, detail="not found")
|
||||
headers = {"Accept-Ranges": "bytes", "Cache-Control": "public, max-age=31536000, immutable", "X-Content-Type-Options": "nosniff"}
|
||||
rng = request.headers.get("range", "")
|
||||
if rng.startswith("bytes="):
|
||||
start_s, _, end_s = rng[6:].partition("-")
|
||||
start = int(start_s or 0)
|
||||
end = min(int(end_s) if end_s else len(data) - 1, len(data) - 1)
|
||||
if start > end:
|
||||
raise HTTPException(status_code=416, detail="range")
|
||||
chunk = data[start : end + 1]
|
||||
return Response(content=chunk, status_code=206, media_type="video/mp4", headers={**headers, "Content-Range": f"bytes {start}-{end}/{len(data)}"})
|
||||
return Response(content=data, media_type="video/mp4", headers=headers)
|
||||
|
||||
|
||||
@router.get("/{reel_id}/cover.jpg", summary="릴스 표지", responses={200: {"content": {"image/jpeg": {}}}, 404: {}})
|
||||
async def get_reel_cover(reel_id: int = Path(...)) -> Response:
|
||||
err, data = await DB_SESSION_MNG.execute_lambda(lambda s: _crud.cover(s, reel_id))
|
||||
if err is not ErrorType.SUCCESS or data is None:
|
||||
raise HTTPException(status_code=404, detail="not found")
|
||||
return Response(content=data, media_type="image/jpeg", headers={"Cache-Control": "public, max-age=31536000, immutable", "X-Content-Type-Options": "nosniff"})
|
||||
@@ -17,6 +17,9 @@ MAX_ITEMS = 20
|
||||
# 캐러셀 컨테이너가 FINISHED 가 될 때까지 (문서: 1분에 한 번, 5분까지)
|
||||
STATUS_TRIES = 10
|
||||
STATUS_WAIT_SEC = 6.0
|
||||
# 릴스는 인스타가 영상을 변환하느라 더 오래 걸린다 (5초 간격 5분)
|
||||
VIDEO_STATUS_TRIES = 60
|
||||
VIDEO_STATUS_WAIT_SEC = 5.0
|
||||
|
||||
|
||||
class InstagramError(Exception):
|
||||
@@ -65,15 +68,7 @@ async def publish_carousel(image_urls: list[str], caption: str, client: Optional
|
||||
container = (await _post(client, f"{user}/media", {"image_url": image_urls[0], "caption": caption}))["id"]
|
||||
else:
|
||||
container = (await _post(client, f"{user}/media", {"media_type": "CAROUSEL", "children": ",".join(children), "caption": caption}))["id"]
|
||||
for _ in range(STATUS_TRIES):
|
||||
status = await _status(client, container)
|
||||
if status == "FINISHED":
|
||||
break
|
||||
if status in ("ERROR", "EXPIRED"):
|
||||
raise InstagramError(f"컨테이너 상태 {status}")
|
||||
await asyncio.sleep(wait_sec)
|
||||
else:
|
||||
raise InstagramError("컨테이너가 제때 준비되지 않았다")
|
||||
await _wait_finished(client, container, STATUS_TRIES, wait_sec)
|
||||
media_id = (await _post(client, f"{user}/media_publish", {"creation_id": container}))["id"]
|
||||
LOG.info(f"[instagram] published media {media_id} ({len(image_urls)} images)")
|
||||
return media_id
|
||||
@@ -82,3 +77,37 @@ async def publish_carousel(image_urls: list[str], caption: str, client: Optional
|
||||
finally:
|
||||
if own:
|
||||
await client.aclose()
|
||||
|
||||
|
||||
async def _wait_finished(client: httpx.AsyncClient, container: str, tries: int, wait_sec: float) -> None:
|
||||
for _ in range(tries):
|
||||
status = await _status(client, container)
|
||||
if status == "FINISHED":
|
||||
return
|
||||
if status in ("ERROR", "EXPIRED"):
|
||||
raise InstagramError(f"컨테이너 상태 {status}")
|
||||
await asyncio.sleep(wait_sec)
|
||||
raise InstagramError("컨테이너가 제때 준비되지 않았다")
|
||||
|
||||
|
||||
async def publish_reel(video_url: str, caption: str, cover_url: Optional[str] = None, client: Optional[httpx.AsyncClient] = None, wait_sec: float = VIDEO_STATUS_WAIT_SEC) -> str:
|
||||
"""공개 mp4 주소를 릴스로 올리고(피드에도 보이게) 인스타 미디어 id 를 돌려준다."""
|
||||
if not configured():
|
||||
raise InstagramError("INSTAGRAM_ACCESS_TOKEN / INSTAGRAM_USER_ID 가 비어 있다")
|
||||
user = settings.instagram_user_id.strip()
|
||||
own = client is None
|
||||
client = client or httpx.AsyncClient(timeout=TIMEOUT_SEC)
|
||||
try:
|
||||
data = {"media_type": "REELS", "video_url": video_url, "caption": caption, "share_to_feed": "true"}
|
||||
if cover_url:
|
||||
data["cover_url"] = cover_url
|
||||
container = (await _post(client, f"{user}/media", data))["id"]
|
||||
await _wait_finished(client, container, VIDEO_STATUS_TRIES, wait_sec)
|
||||
media_id = (await _post(client, f"{user}/media_publish", {"creation_id": container}))["id"]
|
||||
LOG.info(f"[instagram] published reel {media_id}")
|
||||
return media_id
|
||||
except httpx.HTTPError as e:
|
||||
raise InstagramError(f"{type(e).__name__}") from e
|
||||
finally:
|
||||
if own:
|
||||
await client.aclose()
|
||||
@@ -43,7 +43,7 @@ def anyio_backend():
|
||||
|
||||
_VOLATILE = (
|
||||
"weather_hourly", "weather_daily", "cloud_hourly", "openmeteo_hourly", "air_station", "air_quality", "weather_warning", "sun_time",
|
||||
"sky_score", "index_score", "post", "post_like", "post_like_anon", "post_save", "comment", "comment_like", "comment_like_anon", "holiday", "solar_term", "users", "card_set", "card_image",
|
||||
"sky_score", "index_score", "post", "post_like", "post_like_anon", "post_save", "comment", "comment_like", "comment_like_anon", "holiday", "solar_term", "users", "card_set", "card_image", "reel",
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
import base64
|
||||
|
||||
import pytest
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
|
||||
from config.settings import settings
|
||||
from router.router import app
|
||||
|
||||
KEY = "test-admin-key"
|
||||
# 가장 작은 mp4 머리 (서버는 'ftyp' 상자만 본다)
|
||||
MP4_BYTES = b"\x00\x00\x00\x18ftypisom" + b"0" * 200
|
||||
MP4 = base64.b64encode(MP4_BYTES).decode()
|
||||
JPEG = base64.b64encode(b"\xff\xd8\xff\xe0" + b"0" * 64).decode()
|
||||
|
||||
|
||||
def client():
|
||||
return AsyncClient(transport=ASGITransport(app=app), base_url="http://test")
|
||||
|
||||
|
||||
def body(**kw):
|
||||
return {"title": "날씨각이 뭐예요?", "caption": "오늘 날씨에 맞는 할 일을 점수로", "hashtags": "#날씨각 #릴스", "video": MP4, **kw}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def admin_key(monkeypatch):
|
||||
monkeypatch.setattr(settings, "admin_api_key", KEY)
|
||||
return {"X-Admin-Key": KEY}
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_reel_needs_key_and_mp4(admin_key):
|
||||
async with client() as c:
|
||||
assert (await c.post("/v1/reel", json=body())).status_code == 401
|
||||
bad = await c.post("/v1/reel", json=body(video=JPEG), headers=admin_key)
|
||||
assert bad.status_code == 400
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_reel_saved_and_served_with_range(admin_key):
|
||||
async with client() as c:
|
||||
made = (await c.post("/v1/reel", json=body(cover=JPEG), headers=admin_key)).json()
|
||||
assert made["result"]["success"] and made["video_url"] == f"/v1/reel/{made['reel_id']}.mp4" and made["cover_url"].endswith("/cover.jpg")
|
||||
full = await c.get(made["video_url"])
|
||||
assert full.status_code == 200 and full.headers["content-type"] == "video/mp4" and full.content == MP4_BYTES
|
||||
part = await c.get(made["video_url"], headers={"Range": "bytes=4-7"})
|
||||
assert part.status_code == 206 and part.content == b"ftyp" and part.headers["content-range"] == f"bytes 4-7/{len(MP4_BYTES)}"
|
||||
cover = await c.get(made["cover_url"])
|
||||
assert cover.status_code == 200 and cover.headers["content-type"] == "image/jpeg"
|
||||
listed = (await c.get("/v1/reel", headers=admin_key)).json()["items"]
|
||||
assert listed[0]["reel_id"] == made["reel_id"] and "video" not in listed[0]
|
||||
assert (await c.get("/v1/reel/999999.mp4")).status_code == 404
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_reel_instagram_publish_and_store_media_id(admin_key, monkeypatch):
|
||||
import httpx
|
||||
|
||||
from services.external import instagram
|
||||
|
||||
monkeypatch.setattr(settings, "instagram_access_token", "tok")
|
||||
monkeypatch.setattr(settings, "instagram_user_id", "1789")
|
||||
monkeypatch.setattr(settings, "public_base_url", "https://weather.example")
|
||||
monkeypatch.setattr(instagram, "VIDEO_STATUS_WAIT_SEC", 0.0)
|
||||
calls: list[tuple[str, dict]] = []
|
||||
polls = {"n": 0}
|
||||
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
data = dict(httpx.QueryParams(request.content.decode())) if request.method == "POST" else dict(request.url.params)
|
||||
calls.append((request.url.path, data))
|
||||
assert data["access_token"] == "tok"
|
||||
if request.url.path.endswith("/1789/media"):
|
||||
assert data["media_type"] == "REELS" and data["share_to_feed"] == "true"
|
||||
assert data["video_url"].startswith("https://weather.example/v1/reel/") and data["video_url"].endswith(".mp4")
|
||||
assert data["cover_url"].endswith("/cover.jpg")
|
||||
assert data["caption"] == "날씨각이 뭐예요?\n\n오늘 날씨에 맞는 할 일을 점수로\n\n#날씨각 #릴스"
|
||||
return httpx.Response(200, json={"id": "vid"})
|
||||
if request.url.path.endswith("/vid"):
|
||||
polls["n"] += 1
|
||||
return httpx.Response(200, json={"status_code": "IN_PROGRESS" if polls["n"] < 3 else "FINISHED"})
|
||||
if request.url.path.endswith("/media_publish"):
|
||||
assert data["creation_id"] == "vid"
|
||||
return httpx.Response(200, json={"id": "reel77"})
|
||||
return httpx.Response(404, json={"error": {"message": "no"}})
|
||||
|
||||
real = httpx.AsyncClient
|
||||
monkeypatch.setattr(instagram.httpx, "AsyncClient", lambda **kw: real(transport=httpx.MockTransport(handler)))
|
||||
async with client() as c:
|
||||
made = (await c.post("/v1/reel", json=body(cover=JPEG), headers=admin_key)).json()
|
||||
res = (await c.post(f"/v1/reel/{made['reel_id']}/instagram", headers=admin_key)).json()
|
||||
again = (await c.post(f"/v1/reel/{made['reel_id']}/instagram", headers=admin_key)).json()
|
||||
listed = (await c.get("/v1/reel", headers=admin_key)).json()["items"][0]
|
||||
assert res["result"]["success"] and res["ig_media_id"] == "reel77" and polls["n"] == 3
|
||||
assert again["ig_media_id"] == "reel77" and len([p for p, _ in calls if p.endswith("/media_publish")]) == 1
|
||||
assert listed["ig_media_id"] == "reel77"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_reel_instagram_requires_token(admin_key, monkeypatch):
|
||||
monkeypatch.setattr(settings, "instagram_access_token", "")
|
||||
async with client() as c:
|
||||
made = (await c.post("/v1/reel", json=body(), headers=admin_key)).json()
|
||||
res = (await c.post(f"/v1/reel/{made['reel_id']}/instagram", headers=admin_key)).json()
|
||||
assert res["result"]["success"] is False and "INSTAGRAM" in res["msg"]
|
||||
@@ -26,6 +26,17 @@ server {
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# 인스타 올리기는 백엔드가 인스타 쪽 처리(캐러셀 컨테이너·영상 변환)를 기다리느라 1분을 넘길 수 있다 (기본 60s 면 504)
|
||||
location ~ ^/v1/(card|reel)/[0-9]+/instagram$ {
|
||||
resolver 127.0.0.11 valid=10s ipv6=off;
|
||||
set $api http://backend:9800;
|
||||
proxy_pass $api;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# API 는 같은 주소로 받아 backend 컨테이너로 넘긴다
|
||||
location /v1/ {
|
||||
# 카드뉴스 올리기(/v1/card)는 1080×1350 JPEG 최대 20장을 base64 로 한 번에 보낸다 (기본 1m 로는 413)
|
||||
|
||||