Compare commits

..
Author SHA1 Message Date
minaChoi ca6d55f0f9 Merge branch 'feat/weather-saju' — 검색 제목·설명에 날씨 사주 등 2026-10-29 09:00:22 +09:00
minaChoi fb82d7f7ae feat: 검색 제목·설명에 날씨 사주, 날씨 코디·타로·게임 추가 2026-10-29 09:00:21 +09:00
minaChoi 63b4fa74fe Merge remote-tracking branch 'origin/main' into sns 2026-10-29 08:52:40 +09:00
minaChoi c6c40191ae feat: 날씨 타로 표지를 주제 배지 + 큰 질문 두 줄로, 행운 포인트는 '시각 · 행운 아이템'(리딩 속 행동에 쓰는 물건)으로 2026-10-29 08:52:40 +09:00
minaChoi 56f71cdfbe feat: 이번주 코디 영상 스크립트·템플릿·모델 사진과 명령 파일 추가, 클립 동작은 후보에서 무작위로 고름 (손가락 모양 동작 제외), .sh·.py·.mjs 는 LF 로 받음 2026-10-29 08:52:40 +09:00
minaChoi 6c1d12d845 Merge branch 'feat/weather-saju' — TODO 사주 검수 남은 것 2026-10-28 17:27:04 +09:00
minaChoi 7d8911ed7d docs: TODO 날씨 사주 Codex 검수 중 반영 안 한 것 2026-10-28 17:27:03 +09:00
minaChoi dac9f7b8e0 Merge branch 'feat/weather-saju' — 내 레벨 창 스크롤 2026-10-28 17:22:53 +09:00
minaChoi 8ca1d12822 fix: 내 레벨·레벨업·오늘 타로 창이 길면 창 안에서 스크롤되게, 창 끝에서 뒤 페이지로 스크롤이 넘어가지 않게 2026-10-28 17:22:32 +09:00
minaChoi 1e9ddb4719 Merge branch 'feat/weather-saju' — 날씨 사주 검수 반영(문구·해석·궁합), 생년월일 계정 저장, 입력 폼 2026-10-28 17:17:58 +09:00
minaChoi c61d488794 Merge remote-tracking branch 'origin/main' into feat/weather-saju
# Conflicts:
#	shared/api/client/@tanstack/react-query.gen.ts
#	shared/api/client/index.ts
#	shared/api/client/sdk.gen.ts
2026-10-28 17:17:57 +09:00
minaChoi 41b09664eb fix: 날씨 사주 문구·해석 검수 반영, 생년월일 계정 저장, 입력 폼 다시 짜기
- 문구: 십성·이달·올해 제목을 자연스러운 말로('버티면 크는 날' → '책임이 무거운 날' 등), 근거 줄은 쉬운 말 + 괄호 용어, 숫자 대신 ↑↓
- 해석: 일간(나)과 일지(연인 자리) 구분, 조심할 것·좋은 흐름은 무게로 고르고 같은 자리에 둘 다 있으면 좋은 쪽을 뺌, 군겁쟁재는 일간 빼고 비겁 3개 이상 + 재성 있을 때만
- 궁합 점수를 두 방향 평균으로(누구를 먼저 넣어도 같음), 날씨 보완은 축마다 실제 비교, 같이 나가기 좋은 날은 비·눈 없고 둘 다 60점 이상일 때만
- 연애운: 연인 자리가 부딪히는 날은 좋은 날에서 빼고 눈 오는 날 문구 구분, 금전·일 날짜는 그날 점수로 고름
- 외출 시간은 체감 5~30°인 때에서만, 예보 없는 날 점수 체계 통일, 남은 달 중 잘 맞는 달
- 로그인하면 생년월일·시각·지역·성별을 계정에 저장 (GET·PUT·DELETE /v1/saju/birth), 내 정보에 '내 생년월일' 줄
- 입력 폼: 시각을 시·분 선택 칸으로, 칸 넘침 없게, 오류 문구 구체적으로, 취소·다시 시도, 성별 바꾸기
- 레벨업하면 사주 결과를 다시 받아 새로 열린 칸이 바로 보임, 레벨 창 문구 정리
2026-10-28 17:13:41 +09:00
minaChoi 4d79ec839c fix: 쇼츠 줄을 고정 영상 ID 대신 채널 쇼츠 RSS로 — API 키가 없어도 새 쇼츠가 자동으로 붙게, youtube_shorts 설정 삭제 2026-10-28 16:58:56 +09:00
minaChoi c8df1f5ef6 Merge branch 'feat/weather-game' — 구름 합치기 라운드 각(2각·하루 20), 전체 화면, 1분 제한 없앰 2026-10-28 16:49:32 +09:00
minaChoi 9e7bd54c7e Merge remote-tracking branch 'origin/main' into feat/weather-game
# Conflicts:
#	shared/api/client/@tanstack/react-query.gen.ts
#	shared/api/client/index.ts
#	shared/api/client/sdk.gen.ts
#	shared/api/client/types.gen.ts
2026-10-28 16:49:32 +09:00
minaChoi 3df3e0113b feat: 구름 합치기 라운드를 깰 때마다 2각(하루 20각), 탭바 없는 전체 화면, 1분 제한 없앰 — 판 시작 표(서명)로 남의 판·위조 거절, 레벨업 창은 판이 끝난 뒤 2026-10-28 16:44:57 +09:00
minaChoi 3da946382c Merge branch 'feat/weather-saju' — 날씨 사주(내 기운·오늘 점수·레벨로 이번 주/금전/연애/궁합/이달/올해), 날씨 게임 아이콘 연결 2026-10-28 16:07:26 +09:00
minaChoi cb013fcc9a feat: 사주 금전·일은 이번 주에 정할 날로, 올해 운에 잘 맞는 달, 레벨업 창에서 열린 칸으로 바로 가기
- 금전·일: 오늘 카드를 되풀이하지 않고 이번 주 중 결제·계약할 날, 돈 빌려주기 피할 날, 보고·면접 잡을 날
- 올해 운: 잘 맞는 달 3개, 11월부터는 다음 해 미리 보기
- 레벨업 창 '…보러 가기' → /saju#칸, 내 레벨 창의 각 모으는 일 줄을 누르면 그 화면으로
- 궁합 결과에 상대 생일과 다른 사람 보기
2026-10-28 16:06:01 +09:00
minaChoi e4834fd24e feat: 오늘 탭 아이콘 줄에 날씨 게임(/game) 연결, 오늘 코디 빼기, 오늘 타로는 잠시 숨김
- feat/weather-game(구름 합치기) 브랜치를 합쳐 아이콘에서 바로 열림
- 오늘 코디 아이콘·창과 그걸 위해 넣은 GET /v1/card/latest 를 걷어냄
- 오늘 타로는 features.ts HIDDEN 으로 숨김 (아이콘 줄·각 모으는 법에서 빠짐, 안내 문구에서도 타로를 뺌)
2026-10-28 15:55:00 +09:00
minaChoi 4cfcbcf7ea Merge branch 'feat/weather-game' into feat/weather-saju — 날씨 게임(/game)을 오늘 탭 아이콘 줄에 연결 2026-10-28 15:51:25 +09:00
minaChoi 4ef99e5f73 fix: 사주 잠금에서 로그인 창을 열면 글쓰기 안내 대신 각·레벨 안내 2026-10-28 15:45:26 +09:00
minaChoi 0399942fb1 feat: 날씨 사주 — 원국(만세력)·일진 해석·조후 날씨 궁합으로 오늘 점수와 할 일, 레벨로 이번 주·금전·연애·궁합·이달·올해
- 엔진(services/saju): 절입 시각을 천문 계산(KASI 대비 최대 41초), 지방평균시·서머타임 보정, 네 기둥, 십성·합충형파해원진·도화·홍염, 조후(한난조습)와 시간별 날씨 맞춤
- API: POST /v1/saju/reading, POST /v1/saju/match (레벨 5). 생년월일은 저장하지 않음, 레벨은 서버에서 잠금
- 화면(/saju): 오늘의 점수(사주+날씨 궁합)와 결정 카드(언제·할 것·조심할 것·좋은 흐름·입을 것·갈 곳), 내 기운(계절·날씨 장면 16종), 잠긴 것은 다음 하나와 남은 각
- 오늘 탭 아이콘 줄에 날씨 사주, 사주 보면 +10각
- GA4 saju_input·saju_view
2026-10-28 15:44:08 +09:00
minaChoi 7d097a05de Merge remote-tracking branch 'origin/main' into feat/weather-game
# Conflicts:
#	frontend/src/b/Sheets.tsx
#	frontend/src/b/sheetContext.ts
2026-10-28 15:37:45 +09:00
minaChoi 03ad57bcaa Merge branch 'docs/todo-after-merge' — TODO 병합 상태 2026-10-28 15:28:48 +09:00
minaChoi 8a18ddc515 docs: TODO 오늘 타로·계정 레벨 병합 상태, 옛 날씨 사주 행 정리 2026-10-28 15:28:48 +09:00
minaChoi ab6959ee0f Merge branch 'feat/today-card' — 오늘 한 장(타로·행운·체크인), 오늘 탭 아이콘 줄, 계정 레벨(각) 2026-10-28 15:28:07 +09:00
minaChoi 71974dcf42 feat: 계정 레벨 — 날씨각에서 한 일로 각을 모아 레벨업, 레벨로 새 콘텐츠가 열림
- 각: 출석 10, 오늘 타로 10, 날씨 사주 10, 좋아요·댓글 5씩(하루 10), 동네 이야기 글 20, 저녁 체크인 10, 공유 10, 7일 연속 50. 같은 날 같은 대상은 한 번 (point_log)
- 레벨: 모은 총량으로 이슬 0 → 햇살 30 → 산들바람 100 → 무지개 200 → 노을 400 → 은하수 700 → 별똥별 1000. 지금 있는 기능은 잠그지 않음
- API: GET /v1/level/me, POST /v1/level/attend, POST /v1/level/share
- 화면: 헤더 아바타 레벨 배지, 내 정보 레벨 카드, 내 레벨 창(오늘 받을 각·레벨별로 열리는 것), 레벨이 오르면 축하 창
- 로그인한 사람만 쌓임 (기기 기록은 조작할 수 있어 받지 않음)
2026-10-28 14:45:44 +09:00
minaChoi b2c46086a3 feat: 날씨게임 구름 합치기 (/game) — 같은 날씨끼리 합쳐 해까지, 오늘 우리 구 풍속만큼 옆으로 밀림, 60초 라운드·목표 점수, 게임 방법 창 2026-10-28 14:44:31 +09:00
minaChoi 92206d82f0 feat: 오늘 날씨 칸에 풍속(wind_ms) 추가 — 날씨게임 바람에 씀 2026-10-28 14:44:31 +09:00
minaChoi 045d8d6cf0 feat: 오늘 탭 아이콘 줄 — 오늘 타로·오늘 코디는 창으로, 단풍 지도·쇼츠·동네 이야기는 페이지로, 내 각은 그 줄로
- 오늘 한 장 칸을 오늘 타로 창으로 옮김. 안 뽑았으면 빨간 점, 뽑았으면 n일째 (로그인 안 하면 기기 기록으로 계산)
- 오늘 코디: 오늘 피드에 올린 코디 카드를 창으로 (GET /v1/card/latest?template=ootd), 오늘 처음 보면 빨간 점
- 단풍 지도 아이콘은 단풍철에만, 아이콘 4개 추가 (Fluent 3D)
- GA4 today_icon
2026-10-28 14:37:55 +09:00
minaChoi 44146888d3 Merge branch 'docs/saju-rules' — TODO 날씨 사주 해석 기준 2026-10-28 14:32:58 +09:00
minaChoi 13bb3d9a02 docs: TODO 날씨 사주 해석 기준(사용자 위임) 기록 2026-10-28 14:32:58 +09:00
minaChoi 0a46fd71c2 Merge branch 'docs/level-decision' — TODO 계정 레벨·날씨 사주 2026-10-28 14:29:59 +09:00
minaChoi cbee7cd807 docs: TODO 계정 레벨 결정(레벨 제도, 단위 각)과 날씨 사주 남은 결정 2026-10-28 14:29:59 +09:00
minaChoi c37773f48f feat: 오늘 한 장 — 하루 한 장 날씨 카드(22장)·실제 날씨 행운·연속 도장·저녁 체크인
- 로그인 안 하면 기기에, 로그인하면 계정에 남기고 로그인할 때 기기 기록을 옮긴다 (표 fortune_draw·day_log)
- 행운 시간은 오늘 남은 구간 중 날씨 점수가 가장 높은 때, 장소는 날씨 맞춤 데이트 명소, 1위 각은 지금 순위
- 체크인은 해 지기 2시간 전부터: 기분·다녀온 곳(명소·노을 명소·지금 하는 행사에서 찾거나 직접)·카드 맞았나
- GA4 fortune_draw·day_log
2026-10-28 13:22:55 +09:00
minaChoi 52a4830b08 Merge branch 'docs/fortune-decision' — TODO 오늘 한 장 결정 2026-10-28 11:50:01 +09:00
minaChoi e154242c32 docs: TODO '오늘 한 장' 결정 — 뽑기+행운+기록, 저녁 체크인 최소판 2026-10-28 11:50:01 +09:00
minaChoi 728b24a0c9 feat: 새 기능 GA4 이벤트 — 창 열기·좋아요·댓글·신고·차단·약관 동의·이야기 글쓰기·히어로 오늘/내일·쇼츠·단풍 지도·내 각·토스 인트로·설치 띠 닫기 2026-10-28 11:25:58 +09:00
minaChoi 1489030c5f Merge branch 'docs/weather-fortune-1028' — TODO 날씨 운세 행 2026-10-28 11:21:04 +09:00
minaChoi 430f97131b docs: TODO '오늘 한 장' 행에 날씨 운세 추천 구성과 정할 것 2026-10-28 11:21:04 +09:00
minaChoi 1d6bb1e630 Merge branch 'docs/market-review-1028' — TODO 시장성 진단 7줄 2026-10-28 11:05:22 +09:00
minaChoi 001e163b2a docs: TODO 에 10/28 시장성 진단 결정 5건·첫 화면 기온 어긋남·GA4 측정 2026-10-28 11:05:16 +09:00
minaChoi 1ec87a82c1 feat: 인스타 장기 토큰을 갱신해 .env 에 넣고 backend·worker 를 다시 만드는 스크립트 (킹서버 cron 매달 1·15일) 2026-10-28 10:51:37 +09:00
minaChoi 5a1d464196 docs: 10/28 연애 타로 행운 포인트 고쳐 다시 게시 기록 2026-10-28 10:29:03 +09:00
minaChoi 571ff84b0c Merge remote-tracking branch 'origin/main' into sns 2026-10-28 10:21:00 +09:00
minaChoi ab9674eaa2 docs: 10/28 연애 타로 게시 기록 2026-10-28 10:19:50 +09:00
minaChoi 685a65faa5 Merge branch 'feat/youtube-shorts' — TODO 4줄 2026-10-28 09:49:16 +09:00
minaChoi 6ed6c14adc Merge branch 'fix/boot-retry' — 로딩 화면 멈춤 재시도 2026-10-28 09:41:53 +09:00
minaChoi ac16b098ba fix: 예전 탭을 다시 열면 '날씨 불러오는 중'에서 멈추던 문제 — 한 번만 새로고침하던 것을 첫 화면이 남아 있는 동안 계속(파일 실패·12초마다·탭 다시 볼 때·망 복구 때, 10초 간격) 다시 시도, 개발 서버 main.tsx 실패도 감지 2026-10-28 09:41:53 +09:00
minaChoi 5ee25551ea docs: 10/28 철회한 코디 포스트 4903 삭제 기록 2026-10-28 09:38:08 +09:00
minaChoi 1ae81ac25c docs: 10/28 세미정장 코디 다시 게시 기록 2026-10-28 09:33:58 +09:00
minaChoi 1ca680f006 feat: 그날 코디 — 미리 확인받은 picks.json 이 있으면 스냅을 다시 고르지 않고 그 코디로 그린다 2026-10-28 09:31:46 +09:00
minaChoi 9544674e7f Merge remote-tracking branch 'origin/main' into sns 2026-10-28 09:22:14 +09:00
minaChoi 3c81976998 docs: 10/27 단풍 카드뉴스·10/28 세미정장 코디 게시 기록 2026-10-28 09:22:11 +09:00
minaChoi 8709bfba2a docs: TODO 에 쇼츠 멈춤 버튼·토스 ait 브랜치·행사 주소·순서 의존 테스트 2026-10-28 08:56:43 +09:00
minaChoi 7f5441a512 Merge branch 'feat/youtube-shorts' — 사파리 쇼츠 시작 영상 2026-10-27 20:03:27 +09:00
minaChoi 694ea85ed3 fix: 아이폰 사파리에서 쇼츠를 누르면 첫 영상부터 열리던 문제 — 시작 영상으로 옮긴 뒤 한 번 더 맞추고, 옮기기 전엔 보이는 칸 변화를 무시 2026-10-27 20:03:27 +09:00
minaChoi ef61a5bf73 Merge branch 'feat/youtube-shorts' — 쇼츠 멈춤 없앰 2026-10-27 19:56:06 +09:00
minaChoi 74805aa829 fix: 쇼츠에서 멈춤 명령을 없앰 — 앞뒤 영상은 소리 없이 계속 틀어 두고 넘어오면 처음부터, 톡 누르면 릴스처럼 소리 켜기·끄기 (멈췄다 틀면 유튜브가 재생·멈춤 버튼을 띄워서) 2026-10-27 19:56:06 +09:00
minaChoi 5f79df1973 Merge branch 'feat/youtube-shorts' — 쇼츠 줄 재생 버튼 숨김 2026-10-27 19:45:41 +09:00
minaChoi 942b652e56 fix: 오늘 화면 쇼츠 줄 첫 카드도 재생이 시작된 뒤에만 영상을 보임 — 자동재생이 막히면 유튜브 재생 버튼 대신 표지 2026-10-27 19:45:41 +09:00
minaChoi f24e790bd7 Merge branch 'feat/youtube-shorts' — 쇼츠 토스판과 같은 코드 2026-10-27 19:30:15 +09:00
minaChoi d38cfc7229 fix: 쇼츠 코드를 토스판과 같게 — 토스도 앞뒤 미리 받기·소리 없이 자동재생, 재생 신호가 안 오는 토스만 1초 뒤 영상을 보임 (웹 동작은 그대로) 2026-10-27 19:30:15 +09:00
minaChoi b346af7fef Merge branch 'feat/youtube-shorts' — 단풍 지도 포스트 맨 앞 2026-10-27 19:05:34 +09:00
minaChoi 340b30cc8b fix: 단풍 지도를 피드 맨 위가 아니라 포스트 맨 앞으로 — 쇼츠·글쓰기·오늘의 각은 원래 자리 2026-10-27 19:05:33 +09:00
minaChoi fd67c2b45f Merge branch 'feat/youtube-shorts' — 내 각 개편, 이야기 내 글·무한 스크롤, 공유 이미지 얇은 띠, 행사 주소 2026-10-27 18:55:43 +09:00
minaChoi ffe6153148 feat: 내 각 아이콘·상세, 이야기 내 글·무한 스크롤, 공유 이미지 얇은 띠, 행사 주소 수집
- 내 각: 아이콘 고르기(my_gak.icon), 카드는 아이콘·점수·아쉬운 조건만, 눌러서 상세(시간대·조건별 점수), 공유는 공통 공유 창
- 이야기: 오늘 쓴 내 글 묶음, '내 글' 칩·탭, 무한 스크롤, 사진 카메라 버튼, 지우기 확인, ⋯ 메뉴 하트 옆, 글 시간 서버 계산(1일 전)
- 공유 이미지: 1:1·4:5 는 아래 얇은 띠 한 줄로 카드를 크게
- 행사: 수집 때 주소 저장(event.address), 행사 포스트에 장소·주소·기간
- 히어로 말풍선 '오늘 낮은 / 내일 낮은', 내일을 볼 때 배경도 따라감, 달 보름 순간이 낮이면 뜨는 시각으로
- 단풍 지도 피드 맨 위, 행사·계절 띠 포스트 틀 되돌림, 쇼츠 홈 버튼 가림·닫기 버튼, 하단 여백, 회색 글자 대비
- 토스 앱에선 쇼츠 플레이어를 하나만 띄움
2026-10-27 18:55:42 +09:00
minaChoi 3a249c509d Merge branch 'feat/youtube-shorts' — 각 포스트 오늘·내일·주말 점수, 밤 화면 포스트 색, 동네 글 묶음 1개부터 (1557ba4)
겹친 곳: 히어로 아이콘 간격은 main 방식(버튼 좌우 5px) 하나로, 달 포스트는 밤하늘·행사는 사진 있을 때만 밤하늘, 토스에선 첫 이야기 카드 숨김 유지
2026-10-27 16:26:31 +09:00
minaChoi 55edc037fb Merge branch 'revert/write-login-once' — 쓰기 버튼 로그인 창 누를 때마다 2026-10-27 15:48:37 +09:00
minaChoi a17cef201d fix: 쓰기 버튼 로그인 창을 다시 누를 때마다 띄우기 — '한 번만 띄우고 안내 흔들기'(0bc8ca0)를 되돌림 2026-10-27 15:47:14 +09:00
minaChoi 0414160520 Merge branch 'fix/write-login-once' — 쓰기 버튼 로그인 창은 한 번만 2026-10-27 15:41:58 +09:00
minaChoi 0bc8ca02a4 fix: 쓰기 버튼(쓰기 칸·사진·올리기·첫 이야기 카드)으로 뜨는 로그인 창은 이번 방문에 한 번만 — 닫은 뒤엔 '로그인하면 쓸 수 있어요'만 흔들어 알림 2026-10-27 15:41:57 +09:00
minaChoi 1557ba42c4 fix: 각 포스트·밤 화면·히어로 아이콘·동네 글 묶음 손봄
- 각 포스트: 각마다 같던 근거 표·요약 줄을 빼고 오늘·내일·주말 점수 칸(각 상세와 같은 값), 작은 화면에서 점수·그림 줄임
- 밤 화면에서도 포스트 본문은 낮 색 그대로, 어두운 각 배경(캠핑·별보기·산책)과 행사 밤하늘 배경 뺌
- 히어로 좋아요·댓글·보내기 간격·높이 맞춤
- 동네 사람들 묶음을 글 1개부터 보이게 (3개 미만이면 자기 글도 안 보이던 문제)
- QA 체크리스트에 쇼츠·각 포스트 결과, TODO 에 쇼츠 공유 링크 빈 화면
2026-10-27 15:20:35 +09:00
minaChoi 9af3407546 Merge branch 'fix/sheet-slide' — 아래 창 열기·닫기 애니메이션 2026-10-27 15:08:40 +09:00
minaChoi 117de90c3e fix: 아래 창(로그인 등)이 열리고 닫힐 때 버벅여 보이던 것 — 반투명으로 40px만 올라와 뒤 탭 바가 비쳤고 닫힐 땐 툭 사라지며 쓰기 칸 테두리가 번쩍였음, 불투명하게 아래에서 끝까지 올라오고 내려가며 닫히게 2026-10-27 15:08:40 +09:00
minaChoi be60551f49 Merge branch 'fix/composer-login-no-keyboard' — 로그인 전 쓰기 칸은 키보드 없이 로그인 창 2026-10-27 14:55:46 +09:00
minaChoi dcf2fe5a53 fix: 로그인 안 한 채 쓰기 칸을 누르면 로그인 창이 버벅이던 것 — 칸에 포커스가 가며 키보드가 떴다 내려갔음, 로그인 전엔 읽기 전용으로 두고 누르면 로그인 창 2026-10-27 14:55:46 +09:00
minaChoi 132301dc28 Merge branch 'fix/google-button-skeleton' — 로그인 창 구글 버튼 스켈레톤 2026-10-27 14:49:42 +09:00
minaChoi dd133c9d52 fix: 로그인 창 구글 버튼 자리에 스켈레톤 — 빈칸에 버튼이 늦게 툭 튀어나와 버벅이는 것처럼 보이던 것, 다 그려지면 부드럽게 바꿔 보임 2026-10-27 14:49:41 +09:00
minaChoi 5459b97ba0 Merge branch 'fix/foliage-card-slide2' — 단풍 카드 2번째 장 가림, 히어로 아이콘 간격, 로그인 창 첫 열기 버벅임, 토스 글 종류 필터 되돌림 2026-10-27 14:40:33 +09:00
minaChoi 1908433e46 fix: 토스에서 가리던 글 종류(카드뉴스 등) 다시 보이게 — 토스 번들이 업데이트돼 d3d872b 필터를 되돌림 2026-10-27 14:40:33 +09:00
minaChoi 7dcd6c6a4c fix: 로그인 창을 처음 열 때 버벅이던 것 줄임 — 구글 로그인 스크립트는 한가할 때 미리 받고, 구글 버튼과 뒤 화면 멈추기는 창이 다 올라온 뒤에 2026-10-27 14:39:41 +09:00
minaChoi 7d84226105 fix: 히어로 하트·댓글·보내기 간격이 숫자가 붙으면 어긋나던 문제 — 버튼마다 좌우 여백을 같게 2026-10-27 14:39:41 +09:00
minaChoi c45940c358 fix: 피드 단풍 지도 카드 2번째 장(지금 가기 좋은 곳) 왼쪽이 가려지던 문제 — 가운데 맞추려 민 지도가 옆 장을 덮었음, 1번째 장 밖은 자름 2026-10-27 14:29:34 +09:00
minaChoi 09e8b4734a Merge branch 'feat/app-moon-bot' — 앱 히어로·달 포스트 실제 달 모양, 캐릭터 댓글 표시 2026-10-27 14:05:03 +09:00
minaChoi 694757b2fb feat: 서울 근교 단풍 TOP 10 카드뉴스 템플릿(foliage, 5장) — 관광공사 1유형 사진, 앱 단풍 지도 캡처, 날짜 대신 이번 주/다음 주 절정 2026-10-27 11:59:22 +09:00
223 changed files with 10172 additions and 475 deletions

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
---
description: 이번주 코디 숏폼 영상(여자 → 남자 → 날씨각 마무리, 15초)을 날씨각 가상 모델과 무신사 스냅으로 만들어 검토받고 인스타 릴스·YouTube Shorts에 올린다
argument-hint: "<나이대> 20·30·40 [스타일] minimal·casual·semi·formal·street (비우면 casual)"
---
이번주 코디 영상을 만들어 올린다. 인자: `$ARGUMENTS` — 첫 번째는 나이대(`20`·`30`·`40`, 필수), 두 번째는 코디 스타일(minimal=꾸안꾸, casual, semi=오피스, formal, street, 비우면 casual).
나이대별로 쓰는 것: `20`·`30` → 20대 모델(models.json age 20s)·무신사 20-30대 스냅(`f20`·`m20`)·타이틀 "20대"/"30대", `40` → 40대 모델(40s)·무신사 40대~ 스냅(`f40`·`m40`)·타이틀 "40대~"(`--age 40~`).
작업 폴더 `W` = `admin/nalssigak/runs/<오늘 날짜>-<나이대>/` (커밋하지 않는다). 스크립트는 `admin/nalssigak/scripts/`, 템플릿은 `admin/nalssigak/templates/`.
승인 지점(5·10번)에서는 반드시 멈추고 사용자 답을 기다린다. 업로드는 사용자가 "올려"라고 한 뒤에만 한다(올린 건 되돌릴 수 없다).
## 꼭 지킬 것
- 얼굴은 `admin/nalssigak/models/` 의 가상 모델만 쓴다. 연예인·유명인·남의 사진, 그 사람을 닮게 만든 이미지는 사용자가 친구·본인 사진이라고 해도 기준 이미지로 쓰지 않는다. 새 모델이 필요하면 `models/prompts/` 처럼 글로만 만들고("ORIGINAL FICTIONAL … must not resemble any real celebrity"), 시안을 보여 주고 고르게 한다.
- 올리는 문구(YouTube 제목·설명·태그, 인스타 캡션·해시태그, 말풍선)에 무신사 상품명·브랜드명·'무신사'·스냅 주소를 쓰지 않는다. 옷은 일반 이름(색·소재·종류)으로만 말한다. 예: `우먼즈 신세틱 스웨이드 블루종 재킷 [다크 브라운]` → `다크 브라운 스웨이드 블루종`, `BELLA QUILTED MARYJANES` → `블랙 메리제인 플랫`.
- 옷은 무신사 인기 스냅에 태그된 상품만 쓴다(`admin/scripts/snap.mjs`). 에이블리는 공개 API 가 없어 쓸 수 없다. 요청에 있어도 처음에 말하고 무신사로 만든다.
- 계절감: 아침 체감과 낮 최고 평균이 12도 미만(구간 chilly 이하)이면 두 사람 다 겉옷이 있어야 하고, 반팔 단독·미니·뮬·샌들은 안 된다(미니는 검은 스타킹과 롱부츠를 함께 신으면 된다). 여자 코디는 카고·백팩·등산화·바람막이 같은 고프코어를 피한다.
- 움직임: 춤추지 않는다. 원래 자세에서 바람에 머리·옷이 날리고 손인사·머리 넘기기·옷깃 만지기 같은 작은 동작 하나만(`templates/actions.json`). 손가락 모양 동작(하트·V·OK·엄지)은 영상에서 다른 손 모양이 되니 쓰지 않는다. 낙엽 떨어지는 효과는 넣지 않는다. 여자는 키가 커 보이지 않게(158cm 정도, 머리:몸 1:7, 눈높이 카메라).
- 화면: 프로필 그리드는 가운데 3:4(위 240 ~ 아래 1680), 피드는 4:5(위 285 ~ 아래 1635)만 보여 준다. 둥근 영상 창(132,240 · 816×1440)이 3:4 를 채우고 바깥은 같은 영상을 흐리게 깔아 빈 곳이 없게 한다. 칩·제목·자막은 창 왼쪽 아래, 4:5 안에 둔다. `templates/frame.html`·`title.html`·`bubble.html`·`scripts/compose.sh` 의 창 위치를 바꾸지 않는다.
- 킹서버: 영상은 날씨각 전용 컨테이너 `nalssigak-ltx`(GPU 0)로만 만든다. menusong 서비스·파일은 건드리지 않는다. `server.sh down` 이 끌 때 서버의 입력·결과 파일을 지운다.
- 비밀: OAuth·토큰은 `~/.config/nalssigak/`, 인스타 토큰은 `.env`. 값을 출력하거나 저장소에 넣지 않는다.
## 환경 점검 (1번에서 돌리고, 안 되면 해결 방법을 알려 준다)
| 점검 | 명령 | 안 될 때 |
|---|---|---|
| 기본 도구 | `python3 --version; node --version; ffmpeg -version; ls "/Applications/Google Chrome.app"` | 없는 것을 설치한다(`brew install ffmpeg` 등). 크롬은 앱으로 설치. |
| Codex(사진) | `codex --version` | Codex CLI 를 설치하고 `codex login`. 사용 한도 초과면 다음 날 다시. |
| 관리자 서버(인스타) | `curl -s http://localhost:5175/api/targets` 에 `king` | `admin/` 에서 `npm install` 후 `admin/AGENTS.md` '켜기'대로 백그라운드로 켠다(킹서버 키는 `ssh King_admin` 의 `~/proj/o2o-weather/.env` `ADMIN_API_KEY`, 값은 출력하지 않는다). |
| 킹서버 접속 | `ssh -o BatchMode=yes King_admin true` | `~/.ssh/config` 에 `Host King_admin`(HostName 172.30.1.36, User o2oadmin, ProxyJump Confluence)과 키가 있어야 한다. 사내망·키는 사용자가 확인. |
| 영상 서버 | `admin/nalssigak/scripts/server.sh status` | 이미지 `jw/comfyui-ltx:latest`·모델 `/mnt/data2/dir/jw_playground/LTX-2.5` 가 서버에 있어야 한다(없으면 서버 담당자에게). GPU 0 을 menusong 이 쓰면 기다리거나 `OOTD_GPU=1`. |
| YouTube 앱 | `ls ~/.config/nalssigak/client_secret.json` | Google Cloud 의 YouTube Data API v3 프로젝트에서 OAuth 클라이언트(데스크톱 앱) JSON 을 받아 그 경로에 두고 `chmod 600`. |
| YouTube 로그인 | `ls ~/.config/nalssigak/youtube_token.json` | `python3 admin/nalssigak/scripts/youtube.py auth` → 사용자가 채널 계정으로 로그인. 'access_denied' 면 Google 인증 플랫폼 → 대상 → 테스트 사용자에 그 계정을 추가. 업로드 때 `invalid_grant` 면 토큰 만료(테스트 앱은 7일)라 auth 를 다시 하고, 앱을 '프로덕션으로 게시'하길 권한다. |
| 인스타 토큰 | 킹서버 `.env` 의 `INSTAGRAM_ACCESS_TOKEN`·`INSTAGRAM_USER_ID` 가 있는지(값은 보지 않고 `grep -c`) | 없거나 만료면 `TODO.md` '인스타 연결' 행 순서대로 다시 발급해 킹서버 `.env` 에 넣는다(사용자 작업). |
## 순서
1. 준비 확인: 아래 '환경 점검' 명령을 모두 돌린다. 안 되는 항목이 있으면 그 항목의 해결 방법을 사용자에게 그대로 알려 주고, 사용자가 할 일(로그인·키 발급 등)이 아니면 직접 고친 뒤 다시 점검한다. 다 통과해야 2번으로 간다.
2. 날씨: `curl -s "https://weather.o2o.kr/v1/weather/today?region=1114000000"` 의 `slots` 중 6~21시로 아침(6시)·낮 최고 기온, 비(rain_type≠0 또는 rain_prob≥60), 하늘을 잡는다. 구간은 낮 최고로 hot≥28 · warm≥23 · mild≥17 · cool≥12 · chilly≥9 · cold≥5 · 그 아래 freezing. 배경 문장은 계절·날씨에 맞게 한 줄로(예: 맑은 가을이면 "a sunny clear late-October afternoon on a Seoul tree-lined sidewalk with golden ginkgo trees…", 비 오면 젖은 거리·우산).
3. 코디: `cd admin && node scripts/snap.mjs --band <구간> --style <스타일> --out nalssigak/runs/<W 이름>/snaps`. 20·30 은 `f20`·`m20`, 40 은 `f40`·`m40` 을 쓴다. `snaps/picks.json` 의 상품(outer·top·bottom·shoes·bag)을 보고 위 계절감 규칙에 맞는지 본다. 안 맞으면 `--pages 3` 등으로 다시 고른다.
4. 사진: `models/models.json` 에서 그 나이대(20·30 → 20s, 40 → 40s) 여자·남자를 하나씩 무작위로 고른다. `templates/photo_prompt.txt` 를 채워 `W/woman_photo.txt`·`W/man_photo.txt` 를 쓰고(옷은 태그된 상품을 색·소재·실루엣까지 영어로, 여자는 body_line 에 키 규칙), 둘을 동시에 만든다:
`python3 admin/nalssigak/scripts/codex_image.py --prompt-file W/woman_photo.txt --output W/woman_photo.png --image admin/nalssigak/models/<id>.jpg --image W/snaps/f20/snap.jpg --image W/snaps/f20/goods-<n>.jpg …` (남자도 같게, 1~2분).
5. 사진 검수 → **승인 대기**: 모델 기준 사진과 나란히 붙인 시트를 열어 보여 준다. 볼 것: 같은 얼굴인지, 태그된 옷이 다 있고 없는 옷이 없는지, 글자·워터마크, 전신(머리~신발, 신발 아래 여백), 손, 키 비율. 사용자가 고치라고 하면 그 사진만 다시 만든다.
6. 동작 설명: 동작은 사람마다 무작위로 두 개를 고른다 — `python3 admin/nalssigak/scripts/actions.py --who woman --has outer,bag` (그 사람에게 겉옷·가방이 있을 때만 `--has` 에 넣는다, 남자는 `--who man`). 출력 첫 줄을 `W/woman_a.txt`, 둘째 줄을 `W/woman_b.txt` 의 `{action}` 에 그대로 넣어 `templates/motion_prompt.txt` 를 채운다(남자는 `W/man_a.txt`·`W/man_b.txt`). 손가락 모양 동작을 따로 덧붙이지 않는다.
7. 클립: `admin/nalssigak/scripts/clips.sh W` (4초 4개, 하나에 4~5분, 총 20분 안팎). GPU 0 을 menusong 이 쓰고 있다며 시작하지 않으면 기다렸다 다시 하거나 비어 있으면 `OOTD_GPU=1` 로 한다.
8. 클립 검수: 클립마다 `ffmpeg -vf "select='eq(n\,12)+eq(n\,36)+eq(n\,60)+eq(n\,84)',tile=4x1"` 로 얼굴을 확대해 본다. 눈 감음·고개 젖힘·얼굴 바뀜·손가락 뭉개짐·카메라 움직임이 있으면 그 클립만 `clips.sh W woman_b` 처럼 다시 만든다(최대 2번).
9. 합성:
- 타이틀: `python3 admin/nalssigak/scripts/render.py title --age <20|30|40~> --who 여성 --label <코디|하객룩 …> --out W/title_woman.png` (남성도). 제목은 '이번주 20대 / 여성 하객룩' 두 줄로 창 왼쪽 아래에 얹힌다.
- 자막 4개: 그날 옷에서 한 줄로 짧게(20자 안팎, 옷 이름은 `*강조*`). 문구는 목록으로 먼저 확인받는다. 제목 아래 같은 자리(창 왼쪽, 발 바로 위 다리 높이)에 차례로 나오고, 창 오른쪽(948px)을 넘으면 문구를 줄인다. 자막·제목이 신발을 가리면 안 된다.
`python3 admin/nalssigak/scripts/render.py bubble --text "…" --out W/bubbles/w1.png`, `W/bubbles.txt` 에 `w1 0.8 3.0` · `w2 3.4 6.1` · `m1 7.1 9.4` · `m2 9.8 12.4`.
- 음악: `admin/nalssigak/music.json` 에서 직전 회차(`runs/*/publish.md` 의 Music 줄)와 다른 곡을 골라 `admin/nalssigak/runs/cache/music/<id>.mp3` 에 없으면 내려받는다. 새 곡은 Mixkit Stock Music Free License 곡을 후보로 영상에 입혀 들려 주고 사용자가 고른 것만 넣는다.
- `admin/nalssigak/scripts/compose.sh W admin/nalssigak/runs/cache/music/<id>.mp3` → `W/final.mp4` (15초).
- 확인: `admin/nalssigak/scripts/sheet.sh W/final.mp4 W/sheet.png 1.0 1.9 2.8 3.7 4.7 5.8 7.4 8.3 9.2 10.1 11.1 12.2 13.8` 로 자막·제목이 얼굴을 가리지 않는지 보고, `crop=1080:1440:0:240`(그리드)·`crop=1080:1350:0:285`(피드)로 잘라 칩·제목·자막·머리·신발이 다 보이는지 본다.
10. 문구 → **승인 대기**: `W/publish.md` 에 YouTube 제목(`이번주 <나이>대 <계절> 코디 🍂 여자·남자 데일리룩 | 날씨각 #Shorts` 꼴, 나이는 타이틀과 같게 `20대`·`30대`·`40대~` — 40 은 반드시 `40대~`. 제목·설명·인스타 캡션 첫 줄 모두 같다)·설명(사람별 옷 목록 — 옷 이름은 '다크 브라운 스웨이드 블루종'·'와이드 치노 팬츠'처럼 색·소재·종류로만 쓴다, weather.o2o.kr, "※ 영상 속 인물은 AI로 만든 가상 모델이에요." 와 음악 credit, 해시태그)·태그, 인스타 캡션(첫 줄이 제목, 프로필 링크 → weather.o2o.kr, 토스 '날씨각' 검색 안내, AI 표기, 해시태그)을 쓴다. 해시태그는 나이대·스타일·계절에 맞춘다. 영상을 열고 문구 전체를 보여 준 뒤 "올려" 를 기다린다.
11. 올리기(승인 후):
- 인스타: 1초 프레임을 `W/cover.jpg` 로 뽑고, `POST http://localhost:5175/api/reel?target=king` 에 `{title, caption, hashtags, video(mp4 base64, 30MB 이하), cover(JPEG base64)}` → `reel_id`, 이어서 `POST http://localhost:5175/api/reel/<reel_id>/instagram?target=king` (`--max-time 600`) → `ig_media_id`. 링크는 `GET https://graph.instagram.com/v24.0/<ig_media_id>?fields=permalink,media_product_type` (토큰은 `~/projects/o2o-weather/.env` 또는 킹서버 `~/proj/o2o-weather/.env` 의 `INSTAGRAM_ACCESS_TOKEN`, 출력하지 않는다). `Application request limit reached` 면 `me/media?fields=permalink,caption,timestamp&limit=1` 로 이미 올라갔는지 보고, 없을 때만 다시 올린다.
- YouTube: `W/youtube_meta.json` 에 `{title, description, tags, privacy}` 를 쓰고 `python3 admin/nalssigak/scripts/youtube.py upload W/final.mp4 W/youtube_meta.json`. 토큰이 없거나 만료면 `youtube.py auth` 로 사용자에게 채널 계정 로그인을 받는다(계정이 Google 인증 플랫폼 테스트 사용자여야 한다).
- privacy: `~/.config/nalssigak/youtube_public` 파일이 있으면 `"public"`(API 감사 통과 뒤), 없으면 `"private"`. 감사 전에는 절대 public 으로 보내지 않는다(비공개로 잠길 수 있다).
- 바로 반영: 비공개로 올렸으면 출력의 `studio` 주소를 `open` 으로 열고, 사용자에게 "공개 범위 → 공개 → 저장" 만 하면 된다고 알린다. 사용자가 공개로 바꿨다고 하면 `https://youtube.com/shorts/<id>` 링크를 다시 알려 주고 마친다.
- public 으로 보냈는데 출력에 경고(요청과 다른 공개 상태)가 나오면 감사가 풀린 게 아니므로 `youtube_public` 파일을 지우라고 알리고, 스튜디오에서 상태를 확인하게 한다.
- 감사 신청은 YouTube API Services 감사·할당량 양식(https://support.google.com/youtube/contact/yt_api_form)으로 사용자가 한다.
12. 보고(한국어, 짧게): 인스타·YouTube 링크, 쓴 모델·스냅 주소, 검수에서 다시 만든 것, 남은 일(YouTube 는 비공개로 올라가니 스튜디오에서 공개 전환, 인스타는 앱에서 'AI 정보' 라벨 켜기).
+1 -2
View File
@@ -14,10 +14,9 @@ INSTAGRAM_USER_ID=
PUBLIC_BASE_URL=https://weather.o2o.kr
IMAGE_PROXY_HOSTS=tong.visitkorea.or.kr,www.culture.go.kr,culture.seoul.go.kr
# 오늘 화면 쇼츠 줄 (YouTube Data API v3 키, console.cloud.google.com/apis/credentials 에서 발급·YouTube Data API v3 만 허용).
# 비우면 채널 쇼츠를 자동으로 못 받고 YOUTUBE_SHORTS(영상 ID, 쉼표로 구분, 최신순)만 보여 준다. 둘 다 비우면 기본값(영상 3개)
# 비우면 채널 쇼츠 RSS(키 없음, 최신 15개)로 받는다
YOUTUBE_API_KEY=
YOUTUBE_CHANNEL_ID=UCWdesmwvHFsnjMUWNcDaA9w
YOUTUBE_SHORTS=
# ── 백엔드: DB·Redis (네이티브 실행 기준. compose 안에서는 compose.yaml 이 host·port 를 덮어쓴다)
DB_HOST=localhost
+4
View File
@@ -0,0 +1,4 @@
# 셸·파이썬 스크립트는 윈도우에서 받아도 LF 로 둔다 (CRLF 면 Git Bash 가 $'\r' 오류를 낸다)
*.sh text eol=lf
*.py text eol=lf
*.mjs text eol=lf
+37 -1
View File
@@ -59,9 +59,14 @@
| [ ] | 단풍 지도 '첫 단풍'은 절정 14일 전부터로 추정(발표에 시작일 없음). 예측 지점이 아닌 명소 32곳은 가장 가까운 예측 지점 날짜를 빌림(예: 남산공원·창덕궁 ← 수리산). 실제 관측과 다를 수 있음 | 사용자 결정 10/21 | `frontend/seo/foliage_2026.json` |
| [ ] | 토스 미니앱 최신 버전 재등록 — 웹이 바뀌면 자동 반영 안 됨 | 10/21 회의 | |
| [ ] | 유튜브 숏폼 자동화 진행 방안 협의 (김성경, 10/22) | 10/21 회의 | |
| [ ] | 오늘 화면 쇼츠 줄 — YouTube Data API 키(`YOUTUBE_API_KEY`) 발급해 운영 .env 에 넣기. 없으면 `youtube_shorts`(영상 ID 3개 고정)만 나와 새 쇼츠가 자동으로 안 붙음 (https://console.cloud.google.com/apis/library/youtube.googleapis.com) | 채널 RSS가 404라 키 없이 채널 목록을 못 받음 | `backend/config/settings.py`, `backend/services/shorts_service.py` |
| [x] | 오늘 화면 쇼츠 줄 — 영상 ID 고정 목록(`youtube_shorts`) 없앰. API 키가 없으면 채널 쇼츠 RSS(`UUSH…` 재생목록, 키 없음)로 자동으로 받음. 키(`YOUTUBE_API_KEY`)를 운영 .env 에 넣으면 Data API 로 바뀌어 퍼가기·길이까지 거름 (https://console.cloud.google.com/apis/library/youtube.googleapis.com) | 10/28 운영에 키가 없어 고정 목록만 나와 새 쇼츠가 안 붙음. 채널 RSS가 다시 200 | `backend/services/external/youtube.py`, `backend/services/shorts_service.py` |
| [ ] | **[결정 필요]** 쇼츠 문구 검토: '소리 켜기'/'소리 끄기' (줄 제목은 없앰) | 화면 문구 규칙 | `frontend/src/b/Shorts.tsx` |
| [ ] | 쇼츠를 올린 직후 목록 갱신(`ShortsService.refresh`) 부르기 — 지금은 워커가 07·12·18시 10분에만 받아 18시 넘어 올리면 다음 날 아침에 뜸. 자동 업로드면 끝난 뒤 호출, 손으로 올리면 관리자 갱신 API | 올리는 방식 확인 필요 | `backend/services/shorts_service.py`, `backend/worker_main.py` |
| [ ] | 쇼츠 API 실패·빈 목록일 때 공유 링크로 들어오면 남색 빈 화면만 보임 — 그 영상 ID 하나라도 띄우거나 × 버튼·안내 문구 보이기 | 10/27 QA 실패 (`items` 가 비면 빈 div 만 그림) | `frontend/src/b/Shorts.tsx` |
| [ ] | **[결정 필요]** 쇼츠 폰에서 유튜브 멈춤(\|\|) 버튼이 계속 남음 — 유튜브 플레이어 자체 버튼이라 코드로 못 지움. 우리 쇼츠 원본 mp4를 저장소에 올려 <video>로 틀지, 폰 연결해 유튜브로 더 시도할지 | 10/27 실기기 보고, 크롬·WebKit 흉내에선 재현 안 됨 | `frontend/src/b/Shorts.tsx` |
| [ ] | 토스 ait 는 `feat/apps-in-toss` 브랜치(~/orca/workspaces/o2o-weather/main-3)에서 만들기 — main 에는 토스 로그인·웹뷰 자동재생·쇼츠 토스 처리가 없음. 최신 ait 20:03 콘솔 업로드 필요 | 10/27 main 에서 만든 ait 로 쇼츠가 멈춰 보임 | `~/orca/workspaces/o2o-weather/main-3/frontend/nalssigak.ait` |
| [ ] | 운영 행사 주소(event.address) 채우기 — 팝가가 연속 요청을 막아(429) 로컬도 206개 중 80개만. 간격 두고 다시 | 10/27 주소 수집 추가 | `backend/scheduler/jobs.py` `refresh_popups` |
| [ ] | `test_watch_summary_flags_thunder_within_2_hours` 가 전체로 돌릴 때만 실패(따로 돌리면 통과) — 순서 의존 원인 찾기 | 10/27 전체 테스트 | `backend/tests/test_watch.py` |
| [ ] | 쇼츠 자동재생 아이폰 사파리 실기기 확인 — 소리 꺼도 자동재생을 막는다는 보고 있음 | 헤드리스 크롬에서만 확인 | `frontend/src/b/Shorts.tsx` |
| [x] | 단풍 명소 `남이섬`이 두 번 들어감(절정 10-25·10-27) — 10-27(화목원) 쪽 지움, 67곳 | 10/27 전체 점검 | `frontend/seo/foliage_2026.json` |
| [x] | 날짜 따라 깨지던 테스트 2개 — 노을 칸은 그날 해 지는 시각으로, 방위각은 한 해 범위(240~300°)로 확인 | 10/27 전체 점검 | `backend/tests/test_weather_today.py`, `backend/tests/test_sky_api.py` |
@@ -79,6 +84,22 @@
| [ ] | 익명 댓글이 링크·하루 제한에 걸려도 '댓글을 올리지 못했어요'만 나옴 — 이유별 안내 | 익명 댓글 작업 중 발견 | `frontend/src/b/Sheets.tsx` |
| [ ] | 매일 대표에게 진행 보고 (미완료 포함) | 10/21 회의 결정 | |
## 10/28 시장성 진단 (보고서는 채팅 첨부, 근거: 운영 DB 집계·첫 화면 캡처·회의록)
| 상태 | 할 일 | 이유 | 관련 파일 |
|---|---|---|---|
| [ ] | **[결정 필요]** 타깃을 2030 직장인으로 좁히기 — 기능은 지우지 않고 첫 화면·각 순서만 이 사람 기준으로. 9/29 '타깃 정하지 않음'을 바꾸는 일이라 대표 결정 | 콘텐츠가 2030·4050·반려인·동네 주민으로 흩어져 누구에게도 1순위가 아님 | `frontend/src/b/TodayPage.tsx`, `backend/services/feed_service.py` |
| [ ] | 오늘 타로(오늘 한 장) — main 병합(10/28): 오늘 탭 아이콘 줄 → 오늘 타로 창. 타로 22장 하루 1장 + 행운(시간·장소·색·1위 각) + 연속 도장 + 저녁 체크인. 남은 것: 배포(운영 init.sql 로 표 fortune_draw·day_log·point_log, users.points 생김), 토스 ait(`feat/apps-in-toss`에 main 합친 뒤) | 10/28 사용자 결정 | `frontend/src/b/fortune.tsx`, `frontend/src/b/todayIcons.tsx` |
| [ ] | **[결정 필요]** 아침 7시 웹 푸시 — 안드로이드 크롬은 바로, 아이폰은 홈 화면에 추가한 사람만(iOS 16.4+). 앱 위젯(10/21 결정)은 계속 | 다시 부르는 장치가 없음(코드에 웹 푸시 없음) → DAU가 쌓이지 않음 | `frontend/public/sw.js`, `frontend/src/b/install.ts` |
| [ ] | **[결정 필요]** 좋아요·댓글 0이면 숫자 숨기기, 동네 이야기는 그날 글이 몇 개 넘을 때만 위에 | 첫 화면 '좋아요 0개'·동네 글 1개가 "아무도 안 쓴다"는 신호 | `frontend/src/b/TodayPage.tsx`, `frontend/src/b/talk.tsx` |
| [ ] | **[결정 필요]** 4주 새 기능 동결 목록 — 후보: 나만의 각 피드 올리기, 동네 이야기 사진, 캐시워크·통신사 위젯, 새 각 추가, 지역 페이지 추가 확장(10/21 '모든 지역 추가'와 충돌) | 2명이 기능 폭을 넓히는 중, 바깥 사용자 반응은 거의 없음(계정 7개 대부분 팀 추정) | |
| [ ] | 첫 화면에 '지금 10°'(시간대 줄)와 '오전 10시 5°'(히어로 문장·오늘의 각)가 함께 보임 — 원인 확인(체감온도인지). 오늘의 각 5줄 설명도 모두 같은 문장 | 10/28 11시 운영 캡처(마포구), 숫자 어긋나면 첫 방문자 신뢰 잃음 | `frontend/src/b/TodayPage.tsx` |
| [ ] | GA4 사내 IP 제외 필터 + 주간 지표 4개(신규 방문, 1일·7일 재방문, 공유→방문, 홈 화면 추가→알림 허용) | 바깥 사용자 수를 아무도 모름, 이게 없으면 진단이 가설로 남음 | `docs/이벤트_추적.md` |
| [ ] | 계정 레벨 — main 병합(10/28, 배포 남음). 사용자 결정 10/28: **레벨 제도**(포인트 소비형 아님). 단위는 '각'(출석 +10각 등 서비스 전체 행동으로 적립), 레벨은 모은 총량 기준이라 나중에 각을 쓰는 기능을 붙여도 안 내려감. 지금 있는 기능·캐릭터·색·기분은 잠그지 않고, 새로 생기는 것(날씨 사주 연애운·궁합 등, 새 캐릭터·테두리, 댓글 레벨 배지)만 레벨로 열림. 내 정보는 기존 화면에 레벨·각만 더함. 정할 것: 레벨 이름·단계·필요 각, 행동별 각·하루 한도, 해금 목록 | 기획서 '계정 레벨(각)·날씨 사주 UI 기획'(10/28 채팅 첨부) | `frontend/src/b/Sheets.tsx` `MeSheet` |
| [ ] | 날씨 사주 해석 기준 — 사용자가 맡김(10/28 "니 알아서 하라"), 바꿀 수 있게 기록: 날씨 접목은 조후(한난조습) · 연애운은 열 때 성별 선택 입력(남/여/선택 안 함, 안 하면 도화·배우자궁만으로 본다고 표시) · 도화는 연지·일지 삼합 둘 다 · 홍염은 일간표(甲乙午 丙寅 丁未 戊己辰 庚戌 辛酉 壬子 癸申, 이견 있음 표시) · 합충형파해원진은 원국 네 지지 모두, 일지에 걸리면 연애 가중 · 절입 시각은 천문 계산식으로 1900~2100 표를 만들고 천문연 값으로 검증(패키지 안 씀) · 진태양시(출생지 경도)·서머타임 반영, 자시는 자정 기준(설정으로 변경) · 음력은 다음 단계(천문연 API) | 사용자 위임 10/28 | |
| [ ] | **[결정 필요]** 날씨 사주 화면·문구 — '내 기운'(계절·날씨 장면 16종), 점수 → 사주 풀이 → 계절·날씨 한 스푼, 하루 풀이를 '오늘의 결정 카드'(언제·미룰 것·입을 것/갈 곳·이번 주 날짜)로 줄지, 규칙별 의미 사전·문구 검토, 기운 장면 그림 | 사용자 피드백 10/28 | 기획서 '날씨 사주 기획 v2', '계정 레벨·날씨 사주 UI 기획' |
| [ ] | **[결정 필요]** 날씨 사주 Codex 검수(10/28) 중 반영 안 한 것: ① 금전·일 날짜 추천("큰돈 쓰거나 계약할 일은 10/31(토)") — Codex는 운세로 계약·면접 날짜를 정해 주지 말고 점검 행동만 주라고 했으나, 사주 앱 장르상 날짜가 핵심이라 유지하고 그날 점수 60 이상일 때만 고르게 함 ② 점수를 '참고 점수'로 부를지 ③ 결과 위에 출생 정보 요약·칸 이동 메뉴, 사주 글자 표 접기 ④ 11월부터 올해 운 자리에 내년 미리 보기 — 올해·내년을 따로 고르게 할지 ⑤ 연애운 성별 기준(남 재성·여 관성)을 '전통 기준'이라고 더 밝힐지 | Codex 검수 `/tmp/sweep/codex-review.md` | `backend/services/saju_service.py`, `frontend/src/b/SajuPage.tsx` |
## 진행 순서
결정이 필요 없는 것부터, 사용자 눈에 틀린 정보가 보이는 것 → 기능 → 다듬기 순.
@@ -300,6 +321,10 @@
| [x] | 10/27 주식 타로(경제 전용 카드: 분할매수각·적금각·배당각) — 킹서버 카드 21→포스트 4591, 인스타 https://www.instagram.com/p/De-qodJAXp9/ | 사용자 요청 (10/27) | `admin/topics.json` |
| [x] | 10/27 스트릿 코디(철회: 겉옷 없는 사람 2명·남성적이라는 피드백, 포스트 4588 숨김 필요·인스타 앱에서 삭제 필요) — 킹서버 카드 16→포스트 4588, 인스타 https://www.instagram.com/p/De-hDoVge1N/. 참고 스냅 f20 https://www.musinsa.com/snap/1554718501896708736 · m20 https://www.musinsa.com/snap/1561558258020785611 · f40 https://www.musinsa.com/snap/1552178778683619999 · m40 https://www.musinsa.com/snap/1549383828670555308. 사용자 요청으로 옷은 스냅에 태그된 무신사 상품만(사진에만 보이는 f20 레드 니트집업·m40 백팩 뺌). 에이블리는 공개 API 없음. 카드 15(고치기 전)는 승인 대기로 남음. 인스타 게시 API가 'Application request limit reached'를 돌려줬지만 실제 게시는 됨 | 사용자 요청 (10/27) | `admin/scripts/outfit.mjs`, `snap.mjs` |
| [x] | 10/27 캐주얼 코디(스트릿 대체) — 킹서버 카드 19→포스트 4589, 인스타 https://www.instagram.com/p/De-oLGagZRB/. 참고 스냅 f20 https://www.musinsa.com/snap/1555508873710779888 · m20 https://www.musinsa.com/snap/1555156725005269012 · f40 https://www.musinsa.com/snap/1555157672544679299 · m40 https://www.musinsa.com/snap/1552193811640384198. 구간을 아침 체감·낮 최고 평균으로 정해 chilly, 쌀쌀한 날 겉옷 필수·미니·뮬/슬링백 제외, 여자 코디는 고프코어 감점. 카드 15·16·17·18은 버린 판 | 사용자 요청 (10/27) | `admin/scripts/snap.mjs`, `daily-ootd.mjs` |
| [x] | 10/27 서울 근교 단풍 TOP 10 카드뉴스(매주 목요일 시리즈 첫 회) — 킹서버 카드 22→포스트 4592, 인스타 https://www.instagram.com/p/De-1vM_gVN8/. 캡션 첫 줄에 제목이 두 번 나옴(서버가 제목을 붙이는데 캡션도 제목으로 시작), 인스타 API가 request limit을 돌려줘 ig_media_id 미기록 | 사용자 요청 (10/27) | `admin/src/cards/templates.tsx` |
| [x] | 10/28 세미정장 코디(철회: 20-30대 남자에 나팔바지라는 피드백, 포스트 4903 10/28 삭제함(deleted=true)·인스타 앱에서 삭제 필요) — 킹서버 카드 23→포스트 4903, 인스타 https://www.instagram.com/p/DfBIhUdAbbV/. 참고 스냅 f20 https://www.musinsa.com/snap/1560205304641814679 · m20 https://www.musinsa.com/snap/1551785083122597386 · f40 https://www.musinsa.com/snap/1551572173880406114 · m40 https://www.musinsa.com/snap/1556284432455808475. 4장 1:1 검수. 크롬이 2번째 장 렌더에서 멈춰 장마다 프로필을 따로 써서 다시 찍음, 인스타 API는 request limit을 돌려줬지만 실제 게시됨(ig_media_id 미기록) | 사용자 요청 (10/28) | `admin/scripts/card.mjs` |
| [x] | 10/28 세미정장 코디 다시(20-30대 남자만 교체: 오피서 코트·헨리넥 니트·다크 브라운 와이드 팬츠·헤비 부츠·토트백, 코디 구성을 먼저 확인받고 그림) — 킹서버 카드 24→포스트 4904, 인스타 https://www.instagram.com/p/DfBJ4SlAaok/. 참고 스냅 m20 https://www.musinsa.com/snap/1562338908609136514 (나머지 3명은 카드 23과 같음). 첫 그림은 상품 썸네일을 따라 바지가 베이지로 나와 스냅 색(브라운)으로 다시 그림 | 사용자 요청 (10/28) | `admin/scripts/daily-ootd.mjs` |
| [x] | 10/28 연애 타로(단풍각·데이트각·별보기각, 새 표지: 주제 배지 + 큰 질문) — 킹서버 카드 26→포스트 4906, 인스타 https://www.instagram.com/p/DfBQCW0ARgL/ (ig_media_id 17953447719320497). 처음 올린 카드 25→포스트 4905(인스타 DfBPIHJAR0m)는 행운 포인트가 날씨 정보뿐이라는 피드백으로 철회: 포스트 4905 deleted=true, 인스타 글은 앱에서 삭제됨. 행운 포인트를 "시각 · 행운 아이템"(리딩 속 행동에 쓰는 물건)으로 바꿔 다시 게시. 문구를 먼저 확인받음: 첫 기획의 행운 포인트(6시 1도·10시 바람)를 예보 slot 값으로 고치고, 연애와 관련 없는 카드(해돋이각·테니스각)를 데이트각·별보기각으로 바꿈. 5장 1:1 검수. 인스타 API는 두 번 다 request limit을 돌려줬지만 실제 게시됨(최신 글 확인 후 재시도 안 함) | 사용자 요청 (10/28) | `admin/src/cards/templates.tsx`, `admin/scripts/plan.mjs` |
| [x] | 각 카드 그림 미리 생성 — 가을에 나올 만한 28장(피크닉·캠핑·놀이공원·빨래·단풍·억새·테니스·골프·군고구마·붕어빵·군밤·사진산책·별보기·환기·세차·이불빨래·데이트·치맥·막걸리·파전·우산·넷플릭스·집콕·한강밤바람·멍뭉산책·센치·감성노래·낚시) + 기존 8 = 36/68. 여름·한겨울 전용 32장은 철 되면 생성 | 사용자 요청 (10/26) | `admin/src/assets/gak-card/` |
| [ ] | 카드 자동화 다음 단계 — ① 생성 직후 자동 검사(Claude 비전: 옷 개수·사람·글자·추가 옷, 불합격 1회 재생성) ② 승인 대기 카드 메일/Teams 알림 + 서명 토큰 승인 링크(`GET /v1/card/{id}/approve`) ③ 맥 launchd 매일 06:30 `claude -p "/daily-cards"` ④ 그림 세트가 차면 킹서버로 이전 | 사용자 요청 (10/26) | `backend/router/v1/card/card.py`, `admin/scripts/` |
| [ ] | 앱 헤더가 400~448px 폭에서 컨테이너를 넘쳐 로그인 버튼이 잘림(`frontend/src/b/BLayout.tsx` TopBar). 캡처는 456px로 찍어 피했지만 실제 폰(430·440px)에서도 잘릴 수 있음 | 10/24 캡처 중 발견 | `frontend/src/b/BLayout.tsx` |
@@ -350,3 +375,14 @@
| [x] | `mobile/` 템플릿 예제 화면·`.vscode`·`LICENSE`·README 지움, `AGENTS.md`·`.claude`는 둠 | 사용자 결정 | `mobile/` |
| [ ] | `frontend-dev` 개발 컨테이너 실제로 띄워 확인 (이미지 빌드만 확인, 5173이 사용 중이라 실행은 못 함) | 볼륨 경로 바뀜 | `compose.yaml` |
| [ ] | 운영 서버가 git pull 뒤 루트 `package-lock.json`으로 빌드되는지 배포 때 확인 | 빌드 대상이 `./frontend` → `.` | `deploy.sh`, `compose.yaml` |
## 날씨게임 — 구름 합치기 (10/28)
| 상태 | 할 일 | 이유 | 관련 파일 |
|---|---|---|---|
| [ ] | 바람 방향 — API에 풍향이 없어 날짜 홀짝으로 왼쪽/오른쪽을 정함. 실제 풍향(기상청 VEC)을 내려줄지 결정 | 첫 구현 (10/28) | `frontend/src/b/cloudMerge.ts` `windDir`, `backend/router/v1/weather/protocol.py` |
| [ ] | 오늘의 판(모두 같은 순서)·구별 순위·구 대항전·공유 카드·판 깨면 각 카드 열기 — 백엔드 필요, 재미 확인 뒤 | 기획 v2 DAU 장치 | — |
| [ ] | **[결정 필요]** 앱인토스에 넣으면 게임물 등급분류·게임 카테고리 재등록 대상인지 토스에 확인 | 앱인토스 8월 공지 | — |
| [ ] | 들어가는 길 — 지금은 `/game` 주소로만 열림. 피드 카드·메뉴 노출 여부 결정 | 사용자 선택 (10/28) | `frontend/src/App.tsx` |
| [ ] | 라운드 목표 점수(200 + 라운드마다 80) — 시간 제한은 없앰(사용자 10/28). 1초에 1번 아무 데나 떨어뜨리면 4~13라운드에서 넘침. 실제 사람 플레이 보고 조정 | 라운드 추가 (10/28) | `frontend/src/b/cloudMerge.ts` `roundTarget` |
| [x] | 라운드 각 — 라운드를 깰 때마다 2각, 하루 20각(사용자 결정 10/28). 로그인한 사람만, 판 시작 표(서명)로 남의 판·위조 거절, 라운드당 15초 안 지나면 거절. 레벨업 창은 판이 끝난 뒤에 | 계정 레벨과 연결 (10/28) | `backend/services/level_service.py` `game_token`, `frontend/src/b/CloudMergePage.tsx` `claimRound` |
+3
View File
@@ -28,3 +28,6 @@ out
# 그날 코디 그림 (scripts/daily-ootd.mjs 가 만들고 카드가 /daily/... 로 읽는다)
public/daily
# 날씨각 코디 영상 작업 폴더 (nalssigak/scripts 가 만든다)
nalssigak/runs
Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

+82
View File
@@ -0,0 +1,82 @@
{
"about": "날씨각 가상 모델(실존 인물을 닮지 않게 만든 얼굴). 20s 는 20-30대 코디(나이대 20·30), 40s 는 40대~ 코디(나이대 40)에 쓴다. 사진 프롬프트의 첫 참고 이미지로 쓰고, look 은 동작 설명에 넣는다. 만든 프롬프트는 prompts/",
"women": [
{
"id": "f1",
"age": "20s",
"look": "long straight black hair, a soft innocent face with a gentle closed-lip smile"
},
{
"id": "f2",
"age": "20s",
"look": "long wavy light brown hair, a bright cheerful face with a lively smile"
},
{
"id": "f3",
"age": "20s",
"look": "a chic chin-length black bob with blunt bangs, a cool calm expression"
},
{
"id": "f4",
"age": "20s",
"look": "long dark brown hair with see-through bangs, an elegant face with a soft smile"
},
{
"id": "f41",
"age": "40s",
"look": "long soft wavy brown hair, an elegant refined face with a gentle closed-lip smile"
},
{
"id": "f42",
"age": "40s",
"look": "a shoulder-length straight dark brown bob with a center part, a calm natural face"
},
{
"id": "f43",
"age": "40s",
"look": "medium-length tousled wavy black hair, a chic confident face with a warm smile"
}
],
"men": [
{
"id": "m2",
"age": "20s",
"look": "soft brown hair with fluffy bangs, a friendly face with a warm smile"
},
{
"id": "m3",
"age": "20s",
"look": "a short neat black two-block haircut, a clean composed face"
},
{
"id": "m5",
"age": "20s",
"look": "golden blond hair with soft bangs, a bright cheerful smile"
},
{
"id": "m6",
"age": "20s",
"look": "jaw-length layered jet black hair parted in the middle, calm sharp eyes"
},
{
"id": "m7",
"age": "20s",
"look": "short textured spiky jet black hair with piecey bangs, sharp eyes, a cool composed face"
},
{
"id": "m41",
"age": "40s",
"look": "short neat black hair with a slight side sweep, a gentle calm face with a soft smile"
},
{
"id": "m42",
"age": "40s",
"look": "well-groomed short side-parted black hair, thin black-rimmed glasses, a confident warm smile"
},
{
"id": "m43",
"age": "40s",
"look": "short slicked-back black hair, a sharp confident face with a composed expression"
}
]
}
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: long straight black hair past the shoulders, soft innocent face with a gentle closed-lip smile.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: long wavy light brown hair, bright cheerful face with a lively smile.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: chic chin-length black bob with blunt bangs, cool calm expression.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: long dark brown hair with see-through bangs, elegant graceful face with a soft smile.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early-to-mid 40s who must not resemble any real celebrity, actor, idol or public figure. Natural mature skin with subtle fine lines, healthy and well-groomed. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: long soft wavy brown hair past the shoulders, an elegant refined face with a gentle closed-lip smile.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early-to-mid 40s who must not resemble any real celebrity, actor, idol or public figure. Natural mature skin with subtle fine lines, healthy and well-groomed. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: shoulder-length straight dark brown bob with a center part, a calm natural face with a soft expression.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early-to-mid 40s who must not resemble any real celebrity, actor, idol or public figure. Natural mature skin with subtle fine lines, healthy and well-groomed. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: medium-length tousled wavy black hair, a chic confident face with a warm smile.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: soft brown hair with fluffy bangs, friendly puppy-like face with a warm smile.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: short neat black two-block haircut, clean dandy look, composed expression.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early-to-mid 40s who must not resemble any real celebrity, actor, idol or public figure. Natural mature skin with subtle fine lines, healthy and well-groomed. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: short neat black hair with a slight side sweep, a gentle calm face with a soft smile.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early-to-mid 40s who must not resemble any real celebrity, actor, idol or public figure. Natural mature skin with subtle fine lines, healthy and well-groomed. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: handsome and stylish, well-groomed short side-parted black hair, thin modern black-rimmed glasses, a defined jawline, clear skin, fit slim build, a confident warm smile, a refined smart office look.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early-to-mid 40s who must not resemble any real celebrity, actor, idol or public figure. Natural mature skin with subtle fine lines, healthy and well-groomed. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: short slicked-back black hair, a sharp confident face with a composed expression.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: golden blond hair with soft bangs, bright big cheerful smile showing a little teeth, friendly eyes.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: jaw-length layered jet black hair parted in the middle, sharp calm eyes, composed cool expression, slim tall build.
+1
View File
@@ -0,0 +1 @@
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man in his late 20s: short textured spiky jet black hair with piecey bangs, sharp narrow eyes, a defined jawline, a cool slightly serious expression.
+7
View File
@@ -0,0 +1,7 @@
{
"about": "배경음악은 상업 영상에 쓸 수 있고 출처 표기가 필요 없는 Mixkit Stock Music Free License 곡만 쓴다. 음원은 저장소에 넣지 않고 runs/cache/music 에 내려받는다. 사람이 들어 보고 고른 곡만 추가한다.",
"tracks": [
{"id": "mixkit-839", "title": "Tears of Joy", "artist": "Michael Ramir C.", "url": "https://assets.mixkit.co/music/839/839.mp3", "credit": "🎵 Music: Tears of Joy (Mixkit)"},
{"id": "mixkit-493", "title": "Beautiful Dream", "artist": "Diego Nava", "url": "https://assets.mixkit.co/music/493/493.mp3", "credit": "🎵 Music: Beautiful Dream (Mixkit)"}
]
}
+29
View File
@@ -0,0 +1,29 @@
"""클립 동작을 templates/actions.json 에서 무작위로 고른다. 한 사람의 a·b 클립이 같은 동작이 되지 않게 겹치지 않게 뽑는다.
python3 actions.py --who woman --has outer,bag # 두 줄 출력: a 클립 동작, b 클립 동작
"""
import argparse
import json
import random
from pathlib import Path
ACTIONS = Path(__file__).resolve().parent.parent / "templates" / "actions.json"
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--who", choices=["woman", "man"], required=True)
parser.add_argument("--has", default="", help="그 사람에게 있는 것 (outer, bag 을 쉼표로)")
parser.add_argument("--n", type=int, default=2)
args = parser.parse_args()
has = {h.strip() for h in args.has.split(",") if h.strip()}
pool = [a["text"] for a in json.loads(ACTIONS.read_text(encoding="utf-8"))[args.who] if set(a.get("needs", [])) <= has]
if len(pool) < args.n:
raise SystemExit(f"{args.who} 동작 후보가 {len(pool)}개라 {args.n}개를 고를 수 없어요")
print("\n".join(random.SystemRandom().sample(pool, args.n)))
if __name__ == "__main__":
main()
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
# usage: clips.sh <작업 폴더> [woman_a woman_b man_a man_b 중 다시 만들 것]
# 작업 폴더에 woman_photo.png·man_photo.png(코디 사진)와 woman_a.txt·woman_b.txt·man_a.txt·man_b.txt(동작 설명)를 두면
# 4초 클립 4개(woman_a.mp4 …)를 만든다. 이미 있는 클립은 건너뛰고, 이름을 주면 그 클립만 지우고 다시 만든다.
set -euo pipefail
HERE=$(cd "$(dirname "$0")" && pwd)
WORK=$(cd "$1" && pwd); shift
cd "$WORK"
for name in "$@"; do rm -f "$name.mp4" "$name.workflow.json"; done
trap '"$HERE/server.sh" down' EXIT
negative=$(cat "$HERE/../templates/negative.txt")
for who in woman man; do
[ -s ${who}_first.png ] || ffmpeg -hide_banner -loglevel error -y -i ${who}_photo.png \
-vf "scale=1088:1920:force_original_aspect_ratio=increase:flags=lanczos,crop=1088:1920" -frames:v 1 ${who}_first.png
done
for name in woman_a woman_b man_a man_b; do
[ -s "$name.mp4" ] && { echo "$name 이미 있음"; continue; }
echo "== $name 시작 $(date +%H:%M:%S)"
python3 "$HERE/generate.py" --image "${name%_*}_first.png" --prompt-file "$name.txt" --negative "$negative" \
--duration 4 --seed $((RANDOM % 9000 + 100)) --anchor-end --keep-running --output "$name.mp4"
echo "== $name 완료 $(date +%H:%M:%S)"
done
+55
View File
@@ -0,0 +1,55 @@
"""Codex CLI의 내장 이미지 생성 도구로 그림 한 장을 만들어 PNG로 저장한다 (날씨각 sns/admin codex-image.mjs와 같은 방식).
usage: python3 codex_image.py --prompt-file p.txt --output out.png [--image ref.jpg ...]
"""
import argparse
import os
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
# 도구 호출·저장만 하므로 중간 모델·낮은 추론으로 고정한다 (sns/admin과 같은 이유)
IMAGE_MODEL = os.environ.get("CODEX_IMAGE_MODEL", "gpt-6-sol")
def main():
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("--prompt-file", required=True)
parser.add_argument("--output", required=True)
parser.add_argument("--image", action="append", default=[], help="참고 이미지 (여러 번 줄 수 있다)")
args = parser.parse_args()
work = Path(tempfile.mkdtemp(prefix="codex-image-"))
task = "\n".join([
"내장 이미지 생성 도구로 아래 프롬프트대로 이미지를 만든다."
+ (" 첨부한 참고 이미지는 프롬프트가 말한 용도로만 따른다." if args.image else ""),
"만든 이미지를 직접 열어 확인한다: 프롬프트와 다르거나 손·얼굴이 일그러졌거나 글자·로고가 있으면 한 번만 다시 만든다 (최대 2장).",
"통과한 한 장만 이 폴더에 result.png 로 저장한다. 다른 파일은 만들지 않는다.",
"",
Path(args.prompt_file).read_text(encoding="utf-8").strip(),
])
command = ["codex", "exec", "--skip-git-repo-check", "-C", str(work), "-s", "workspace-write", "-m", IMAGE_MODEL,
"-c", 'model_reasoning_effort="low"']
for image in args.image:
command += ["-i", str(Path(image).resolve())]
try:
subprocess.run(command, input=task, text=True, stdout=subprocess.DEVNULL, check=True)
result = work / "result.png"
if not result.is_file():
pngs = sorted(work.glob("*.png"))
if not pngs:
sys.exit(f"Codex가 그림을 저장하지 않았어요: {work}")
result = pngs[0]
Path(args.output).parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(result, args.output)
print("saved", args.output)
except subprocess.CalledProcessError as error:
sys.exit(f"Codex 실행이 실패했어요 ({error}). 사용 한도나 로그인을 확인하세요.")
finally:
shutil.rmtree(work, ignore_errors=True)
if __name__ == "__main__":
main()
+58
View File
@@ -0,0 +1,58 @@
#!/bin/bash
# usage: compose.sh <작업 폴더> [음악 mp3]
# 여자(woman_a+woman_b) 6.7초 → 남자(man_a+man_b) 6.7초 → 날씨각 마무리 2.4초, 0.4초 크로스페이드로 15초 final.mp4 를 만든다.
# 작업 폴더에 title_woman.png·title_man.png(render.py title)와 bubbles.txt("이름 시작초 끝초" 줄, PNG는 bubbles/이름.png)가 있어야 한다.
# 두 클립 이음새의 멈춘 구간은 빨리 감아 잇는다. 영상 창은 프로필 그리드 3:4(위 240 ~ 아래 1680)를 채우고 바깥은 같은 영상을 흐리게 깔며, 글자는 피드 4:5(위 285 ~ 아래 1635) 안에 둔다.
set -euo pipefail
HERE=$(cd "$(dirname "$0")" && pwd)
WORK=$(cd "$1" && pwd)
MUSIC=${2:-}
cd "$WORK"
[ -s mask.png ] || python3 "$HERE/render.py" mask --out mask.png
[ -s frame.png ] || python3 "$HERE/render.py" frame --out frame.png
[ -s outro.png ] || python3 "$HERE/render.py" outro --out outro.png
part=6.7; outro=2.4; fade=0.4
o1=$(python3 -c "print($part - $fade)"); o2=$(python3 -c "print(2 * $part - 2 * $fade)")
card="scale=816:1440:flags=lanczos,format=rgba"
blur="scale=272:480,boxblur=10:2,scale=1088:1920,crop=1080:1920:4:0,eq=brightness=0.03:saturation=0.9,format=rgba"
join() { # 클립a 클립b 이름
echo "[$1:v]split[$3a1][$3a2];[$3a1]trim=end=3.25,setpts=PTS-STARTPTS[$3x0];[$3a2]trim=start=3.25,setpts=(PTS-STARTPTS)/3[$3x1];[$2:v]split[$3b1][$3b2];[$3b1]trim=end=0.25,setpts=(PTS-STARTPTS)/2[$3x2];[$3b2]trim=start=0.25,setpts=PTS-STARTPTS[$3x3];[$3x0][$3x1][$3x2][$3x3]concat=n=4:v=1:a=0,fps=24,trim=duration=$part,setpts=PTS-STARTPTS,split[$3s1][$3s2];[$3s1]$card[$3v];[$3s2]$blur[$3g];"
}
ffmpeg -hide_banner -loglevel error -y -i woman_a.mp4 -i woman_b.mp4 -i man_a.mp4 -i man_b.mp4 \
-loop 1 -framerate 24 -i title_woman.png -loop 1 -framerate 24 -i title_man.png -loop 1 -framerate 24 -i mask.png \
-loop 1 -framerate 24 -i outro.png -loop 1 -framerate 24 -i frame.png -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -filter_complex "\
$(join 0 1 w)$(join 2 3 m)\
[6:v]format=rgba,alphaextract,split[k1][k2];[wv][k1]alphamerge[wr];[mv][k2]alphamerge[mr];\
[4:v]trim=duration=$part,format=rgba[wb];[5:v]trim=duration=$part,format=rgba[mb];\
[8:v]trim=duration=$part,format=rgba,split[fw][fm];\
[wg][fw]overlay=0:0[wbg];[wbg][wr]overlay=132:240[wf];[wf][wb]overlay=0:0,format=yuv420p,setpts=PTS-STARTPTS[a];\
[mg][fm]overlay=0:0[mbg];[mbg][mr]overlay=132:240[mf];[mf][mb]overlay=0:0,format=yuv420p,setpts=PTS-STARTPTS[b];\
[7:v]trim=duration=$outro,format=yuv420p,setpts=PTS-STARTPTS[c];\
[a][b]xfade=transition=fade:duration=$fade:offset=$o1[ab];[ab][c]xfade=transition=fade:duration=$fade:offset=$o2,format=yuv420p[out]" \
-map "[out]" -map 9:a -t 15 -r 24 -c:v libx264 -preset slow -crf 18 -profile:v high -pix_fmt yuv420p \
-c:a aac -b:a 128k -ar 44100 -movflags +faststart base.mp4
# 자막: 0.2초 페이드 + 살짝 올라오며 등장
inputs=(); chain=""; prev="0:v"; k=1
while read -r name start end; do
[ -n "${name:-}" ] || continue
inputs+=(-loop 1 -framerate 24 -t 15 -i "bubbles/$name.png")
fo=$(python3 -c "print(round($end - 0.2, 2))")
chain+="[$k:v]format=rgba,fade=in:st=$start:d=0.2:alpha=1,fade=out:st=$fo:d=0.2:alpha=1[b$k];"
chain+="[$prev][b$k]overlay=x=0:y='max(0\,20*(1-(t-$start)/0.2))':enable='between(t,$start,$end)'[v$k];"
prev="v$k"; k=$((k+1))
done < bubbles.txt
if [ $k -eq 1 ]; then cp base.mp4 bubbles.mp4; else
ffmpeg -hide_banner -loglevel error -y -i base.mp4 "${inputs[@]}" -filter_complex "${chain%;}" -map "[$prev]" -map 0:a \
-c:v libx264 -preset slow -crf 17 -profile:v high -pix_fmt yuv420p -c:a copy -movflags +faststart bubbles.mp4
fi
if [ -n "$MUSIC" ]; then
ffmpeg -hide_banner -loglevel error -y -i bubbles.mp4 -i "$MUSIC" -filter_complex \
"[1:a]atrim=start=0.3:end=15.3,asetpts=PTS-STARTPTS,afade=t=in:st=0:d=0.2,afade=t=out:st=14.0:d=1.0,loudnorm=I=-14:TP=-1.5:LRA=11,aresample=44100[a]" \
-map 0:v -map "[a]" -c:v copy -c:a aac -b:a 192k -ar 44100 -ac 2 -t 15 -movflags +faststart final.mp4
else
mv bubbles.mp4 final.mp4
fi
rm -f base.mp4 bubbles.mp4
ffprobe -v error -show_entries format=duration:stream=codec_name,width,height -of compact final.mp4
+208
View File
@@ -0,0 +1,208 @@
"""사진 한 장으로 LTX 춤 영상을 만든다. 전용 컨테이너(server.sh)에 SSH 터널로 그래프를 보낸다.
menusong 그래프(ltx_graph.json)와 달리 고화질 단계에서도 원본 사진을 첫 프레임에 다시 고정한다.
usage: python3 generate.py --image first.png --prompt-file prompt.txt --output clip.mp4 [--duration 6 --width 1088 --height 1920]
"""
import argparse
import json
import math
import os
import socket
import subprocess
import sys
import time
import urllib.error
import urllib.parse
import urllib.request
import uuid
from pathlib import Path
HERE = Path(__file__).resolve().parent
DEFAULT_NEGATIVE = "distorted anatomy, extra limbs, flicker, blurry, watermark, text"
UNUSED_NODES = ("409", "405:380", "405:381", "405:382", "405:383", "405:393")
def call(method, url, body=None, headers=None, timeout=60):
request = urllib.request.Request(url, data=body, method=method, headers=headers or {})
try:
with urllib.request.urlopen(request, timeout=timeout) as response:
return response.status, response.read()
except urllib.error.HTTPError as error:
return error.code, error.read()
def upload_image(base, path):
boundary = uuid.uuid4().hex
data = Path(path).read_bytes()
body = (f"--{boundary}\r\nContent-Disposition: form-data; name=\"image\"; filename=\"{Path(path).name}\"\r\n"
f"Content-Type: image/png\r\n\r\n").encode() + data + f"\r\n--{boundary}--\r\n".encode()
status, raw = call("POST", base + "/upload/image", body, {"Content-Type": f"multipart/form-data; boundary={boundary}"})
if status != 200:
sys.exit(f"이미지 업로드 실패 {status}: {raw[:200]!r}")
uploaded = json.loads(raw)
return "/".join(filter(None, (uploaded.get("subfolder", ""), uploaded["name"])))
def build_graph(base, args, image_name):
graph = json.loads((HERE / "ltx_graph.json").read_text(encoding="utf-8"))
graph["405:376"]["inputs"]["value"] = Path(args.prompt_file).read_text(encoding="utf-8").strip()
graph["405:373"]["inputs"]["text"] = args.negative
for node in ("405:338", "405:339"):
graph[node]["inputs"]["noise_seed"] = args.seed
graph["405:361"]["inputs"]["value"] = 24
graph["405:362"]["inputs"]["value"] = math.ceil(args.duration)
graph["405:372"]["inputs"]["value"] = args.width
graph["405:360"]["inputs"]["value"] = args.height
graph["405:364"]["inputs"]["text"] = ["405:376", 0]
for unused in UNUSED_NODES:
graph.pop(unused, None)
if args.refine_sigmas:
graph["405:395"]["inputs"]["sigmas"] = args.refine_sigmas
save = graph["75"]["inputs"]
save.update({"filename_prefix": "nalssigak/ootd", "format": "mp4", "codec": "h264",
"format.codec": "h264", "format.codec.encoding": "auto", "codec.encoding": "auto"})
status, raw = call("GET", base + "/object_info/SaveVideo")
allowed = json.loads(raw)["SaveVideo"]["input"]["required"] if status == 200 else {}
for field in ("format", "codec"):
choices = allowed.get(field, [None])[0]
if isinstance(choices, list) and save[field] not in choices:
save[field] = "auto"
# 저해상도 단계: menusong과 같은 방식으로 첫 프레임 가이드를 붙였다가 업스케일 전에 떼어낸다.
graph["_img_load"] = {"class_type": "LoadImage", "inputs": {"image": image_name}}
graph["_img_guide"] = {"class_type": "LTXVAddGuide", "inputs": {
"positive": ["405:365", 0], "negative": ["405:365", 1], "vae": ["405:385", 0],
"latent": ["405:356", 0], "image": ["_img_load", 0], "frame_idx": 0, "strength": 1.0}}
# 처음 말고도 가운데·마지막 프레임을 원본 사진으로 잡아 움직이는 동안 얼굴이 멀어지는 것을 막는다.
frames = 24 * math.ceil(args.duration)
anchors = [round(frames * k / (args.anchor_mid + 1) / 8) * 8 for k in range(1, args.anchor_mid + 1)]
if args.anchor_end:
anchors.append(-1)
def chain(prefix, source, latent):
for number, frame in enumerate(anchors):
name = f"{prefix}{number}"
graph[name] = {"class_type": "LTXVAddGuide", "inputs": {
"positive": [source, 0], "negative": [source, 1], "vae": ["405:385", 0], "latent": latent,
"image": ["_img_load", 0], "frame_idx": frame, "strength": args.end_strength}}
source, latent = name, [name, 2]
return source, latent
low, low_latent = chain("_img_anchor", "_img_guide", ["_img_guide", 2])
graph["405:377"]["inputs"]["video_latent"] = low_latent
graph["405:388"]["inputs"].update(positive=[low, 0], negative=[low, 1])
graph["_crop_guides"] = {"class_type": "LTXVCropGuides", "inputs": {
"positive": [low, 0], "negative": [low, 1], "latent": ["405:367", 0]}}
graph["405:348"]["inputs"]["samples"] = ["_crop_guides", 2]
graph["405:391"]["inputs"].update(positive=["_crop_guides", 0], negative=["_crop_guides", 1])
# 고화질 단계: 업스케일한 latent의 첫 프레임을 원본 사진으로 다시 고정한다.
graph["_hd_inplace"] = {"class_type": "LTXVImgToVideoInplace", "inputs": {
"vae": ["405:385", 0], "image": ["_img_load", 0], "latent": ["405:348", 0],
"strength": args.hd_strength, "bypass": False}}
graph["405:340"]["inputs"]["video_latent"] = ["_hd_inplace", 0]
if anchors:
high, high_latent = chain("_hd_anchor", "_crop_guides", ["_hd_inplace", 0])
graph["405:340"]["inputs"]["video_latent"] = high_latent
graph["405:391"]["inputs"].update(positive=[high, 0], negative=[high, 1])
graph["_hd_crop"] = {"class_type": "LTXVCropGuides", "inputs": {
"positive": [high, 0], "negative": [high, 1], "latent": ["405:369", 0]}}
graph["405:374"]["inputs"]["samples"] = ["_hd_crop", 2]
return graph
def wait_result(base, prompt_id, timeout):
deadline = time.monotonic() + timeout
started = time.monotonic()
while time.monotonic() < deadline:
status, raw = call("GET", base + "/history/" + prompt_id)
entry = json.loads(raw).get(prompt_id) if status == 200 else None
if entry:
state = entry.get("status", {})
if state.get("status_str") == "error":
sys.exit("생성 실패: " + json.dumps(state.get("messages", []), ensure_ascii=False)[:2000])
for items in entry.get("outputs", {}).get("75", {}).values():
for item in items if isinstance(items, list) else []:
if isinstance(item, dict) and str(item.get("filename", "")).endswith(".mp4"):
print(f"생성 완료 {time.monotonic() - started:.0f}s", flush=True)
return item
if state.get("completed"):
sys.exit("완료됐지만 MP4가 없습니다")
time.sleep(5)
sys.exit("시간 초과: 서버에서 계속 생성 중일 수 있습니다. server.sh status로 확인하세요")
def main():
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("--image", required=True, help="첫 프레임 PNG (width×height와 같은 비율)")
parser.add_argument("--prompt-file", required=True)
parser.add_argument("--output", required=True)
parser.add_argument("--negative", default=DEFAULT_NEGATIVE)
parser.add_argument("--duration", type=int, default=6)
parser.add_argument("--seed", type=int, default=42)
parser.add_argument("--width", type=int, default=1088)
parser.add_argument("--height", type=int, default=1920)
parser.add_argument("--hd-strength", type=float, default=1.0, help="고화질 단계 첫 프레임 고정 강도 0~1")
parser.add_argument("--anchor-end", action="store_true", help="마지막 프레임도 원본 사진으로 고정 (처음·끝 자세가 같아진다)")
parser.add_argument("--anchor-mid", type=int, default=0, help="중간에 원본 사진으로 고정할 프레임 수 (고르게 나눔)")
parser.add_argument("--end-strength", type=float, default=1.0, help="중간·마지막 프레임 고정 강도")
parser.add_argument("--refine-sigmas", default="", help="고화질 단계 sigma 목록. 비우면 menusong 기본값")
parser.add_argument("--timeout", type=int, default=1800)
parser.add_argument("--keep-running", action="store_true", help="끝난 뒤 컨테이너를 내리지 않는다")
args = parser.parse_args()
for side in (args.width, args.height):
if side % 64 or not 256 <= side <= 2048:
sys.exit("width와 height는 256~2048 사이 64의 배수여야 합니다")
server = [str(HERE / "server.sh")]
if subprocess.run(server + ["up"]).returncode != 0:
sys.exit("전용 컨테이너를 시작하지 못했습니다")
with socket.socket() as sock:
sock.bind(("127.0.0.1", 0))
port = sock.getsockname()[1]
remote_port = int(os.environ.get("OOTD_SERVER_PORT", "32681"))
host = os.environ.get("OOTD_SERVER_HOST", "King_admin")
tunnel = subprocess.Popen(["ssh", "-N", "-T", "-o", "BatchMode=yes", "-o", "ExitOnForwardFailure=yes",
"-o", "ServerAliveInterval=15", "-L", f"127.0.0.1:{port}:127.0.0.1:{remote_port}", host],
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
base = f"http://127.0.0.1:{port}"
finished = False
try:
for _ in range(100):
try:
if call("GET", base + "/system_stats", timeout=2)[0] == 200:
break
except OSError:
time.sleep(0.3)
else:
sys.exit("SSH 터널 연결 실패")
graph = build_graph(base, args, upload_image(base, args.image))
Path(args.output).with_suffix(".workflow.json").write_text(json.dumps(graph, ensure_ascii=False, indent=1), encoding="utf-8")
status, raw = call("POST", base + "/prompt", json.dumps({"prompt": graph, "client_id": uuid.uuid4().hex}).encode(),
{"Content-Type": "application/json"})
if status != 200:
sys.exit(f"그래프 제출 실패 {status}: {raw[:1500].decode(errors='replace')}")
prompt_id = json.loads(raw)["prompt_id"]
print("prompt", prompt_id, flush=True)
item = wait_result(base, prompt_id, args.timeout)
query = urllib.parse.urlencode({k: item[k] for k in ("filename", "subfolder", "type") if k in item})
status, data = call("GET", base + "/view?" + query, timeout=300)
if status != 200 or not data:
sys.exit(f"결과 다운로드 실패 {status}")
Path(args.output).write_bytes(data)
print("saved", args.output, flush=True)
finished = True
finally:
tunnel.terminate()
tunnel.wait(timeout=5)
# 실패·중단 때도 GPU를 놓아주도록 컨테이너를 멈춘다.
if not args.keep_running:
subprocess.run(server + ["down"])
if not finished:
print("중단됨: 결과를 받지 못했습니다", file=sys.stderr)
if __name__ == "__main__":
main()
+641
View File
@@ -0,0 +1,641 @@
{
"75": {
"inputs": {
"filename_prefix": "menusong/clip",
"format": "auto",
"format.codec": "auto",
"codec": "auto",
"video": [
"405:370",
0
]
},
"class_type": "SaveVideo",
"_meta": {
"title": "비디오 저장"
}
},
"409": {
"inputs": {
"aspect_ratio": "16:9 (Widescreen)",
"megapixels": 0.9,
"multiple": 32
},
"class_type": "ResolutionSelector",
"_meta": {
"title": "해상도 선택기"
}
},
"405:370": {
"inputs": {
"fps": [
"405:359",
0
],
"bit_depth": 8,
"images": [
"405:374",
0
],
"audio": [
"405:358",
0
]
},
"class_type": "CreateVideo",
"_meta": {
"title": "비디오 생성"
}
},
"405:340": {
"inputs": {
"video_latent": [
"405:348",
0
],
"audio_latent": [
"405:367",
1
]
},
"class_type": "LTXVConcatAVLatent",
"_meta": {
"title": "LTXVConcatAVLatent"
}
},
"405:395": {
"inputs": {
"sigmas": "0.85, 0.7250, 0.4219, 0.0"
},
"class_type": "ManualSigmas",
"_meta": {
"title": "ManualSigmas"
}
},
"405:348": {
"inputs": {
"samples": [
"405:367",
0
],
"upscale_model": [
"405:371",
0
],
"vae": [
"405:385",
0
]
},
"class_type": "LTXVLatentUpsampler",
"_meta": {
"title": "LTXVLatentUpsampler"
}
},
"405:358": {
"inputs": {
"samples": [
"405:369",
1
],
"audio_vae": [
"405:386",
0
]
},
"class_type": "LTXVAudioVAEDecode",
"_meta": {
"title": "LTXV 오디오 VAE 디코드"
}
},
"405:341": {
"inputs": {
"sampler_name": "euler_ancestral"
},
"class_type": "KSamplerSelect",
"_meta": {
"title": "KSampler (선택)"
}
},
"405:391": {
"inputs": {
"video_cfg": 1.0,
"audio_cfg": 1.0,
"model": [
"405:384",
0
],
"positive": [
"405:365",
0
],
"negative": [
"405:365",
1
]
},
"class_type": "LTXVDualCFGGuider",
"_meta": {
"title": "LTXV Dual CFG Guider"
}
},
"405:368": {
"inputs": {
"noise": [
"405:338",
0
],
"guider": [
"405:391",
0
],
"sampler": [
"405:341",
0
],
"sigmas": [
"405:395",
0
],
"latent_image": [
"405:340",
0
]
},
"class_type": "SamplerCustomAdvanced",
"_meta": {
"title": "고급 사용자 정의 샘플러"
}
},
"405:338": {
"inputs": {
"noise_seed": 42
},
"class_type": "RandomNoise",
"_meta": {
"title": "무작위 노이즈"
}
},
"405:367": {
"inputs": {
"av_latent": [
"405:344",
0
]
},
"class_type": "LTXVSeparateAVLatent",
"_meta": {
"title": "LTXVSeparateAVLatent"
}
},
"405:369": {
"inputs": {
"av_latent": [
"405:368",
0
]
},
"class_type": "LTXVSeparateAVLatent",
"_meta": {
"title": "LTXVSeparateAVLatent"
}
},
"405:374": {
"inputs": {
"tile_size": 512,
"overlap": 64,
"temporal_size": 64,
"temporal_overlap": 16,
"samples": [
"405:369",
0
],
"vae": [
"405:385",
0
]
},
"class_type": "VAEDecodeTiled",
"_meta": {
"title": "VAE 디코드 (타일)"
}
},
"405:344": {
"inputs": {
"noise": [
"405:339",
0
],
"guider": [
"405:388",
0
],
"sampler": [
"405:352",
0
],
"sigmas": [
"405:404",
0
],
"latent_image": [
"405:377",
0
]
},
"class_type": "SamplerCustomAdvanced",
"_meta": {
"title": "고급 사용자 정의 샘플러"
}
},
"405:404": {
"inputs": {
"sigmas": "1.0, 0.99375, 0.9875, 0.98125, 0.975, 0.909375, 0.725, 0.421875, 0.0"
},
"class_type": "ManualSigmas",
"_meta": {
"title": "ManualSigmas"
}
},
"405:388": {
"inputs": {
"video_cfg": 1.0,
"audio_cfg": 1.0,
"model": [
"405:384",
0
],
"positive": [
"405:365",
0
],
"negative": [
"405:365",
1
]
},
"class_type": "LTXVDualCFGGuider",
"_meta": {
"title": "LTXV Dual CFG Guider"
}
},
"405:352": {
"inputs": {
"sampler_name": "euler_ancestral"
},
"class_type": "KSamplerSelect",
"_meta": {
"title": "KSampler (선택)"
}
},
"405:339": {
"inputs": {
"noise_seed": 903463531924076
},
"class_type": "RandomNoise",
"_meta": {
"title": "무작위 노이즈"
}
},
"405:365": {
"inputs": {
"frame_rate": [
"405:359",
0
],
"positive": [
"405:364",
0
],
"negative": [
"405:373",
0
]
},
"class_type": "LTXVConditioning",
"_meta": {
"title": "LTXV 조건 설정"
}
},
"405:377": {
"inputs": {
"video_latent": [
"405:356",
0
],
"audio_latent": [
"405:366",
0
]
},
"class_type": "LTXVConcatAVLatent",
"_meta": {
"title": "LTXVConcatAVLatent"
}
},
"405:373": {
"inputs": {
"text": "distorted anatomy, extra limbs, flicker, blurry, watermark, text",
"clip": [
"405:387",
0
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP 텍스트 인코딩 (프롬프트)"
}
},
"405:356": {
"inputs": {
"width": [
"405:353",
1
],
"height": [
"405:355",
1
],
"length": [
"405:378",
1
],
"batch_size": 1
},
"class_type": "EmptyLTXVLatentVideo",
"_meta": {
"title": "빈 잠재 비디오 (LTXV)"
}
},
"405:366": {
"inputs": {
"frames_number": [
"405:378",
1
],
"frame_rate": [
"405:359",
1
],
"batch_size": 1,
"audio_vae": [
"405:386",
0
]
},
"class_type": "LTXVEmptyLatentAudio",
"_meta": {
"title": "LTXV 빈 latent 오디오"
}
},
"405:381": {
"inputs": {
"source": [
"405:382",
0
]
},
"class_type": "PreviewAny",
"_meta": {
"title": "미리보기 아무거나"
}
},
"405:382": {
"inputs": {
"switch": [
"405:383",
0
],
"on_false": [
"405:376",
0
],
"on_true": [
"405:380",
0
]
},
"class_type": "ComfySwitchNode",
"_meta": {
"title": "스위치"
}
},
"405:371": {
"inputs": {
"model_name": "ltx-2.5-latent-spatial-upscaler-x2-bf16-1.0.safetensors"
},
"class_type": "LatentUpscaleModelLoader",
"_meta": {
"title": "Latent 업스케일 모델 불러오기"
}
},
"405:384": {
"inputs": {
"unet_name": "ltx-2.5-22b-distilled-transformer-comfy-int8-convrot.safetensors",
"weight_dtype": "default"
},
"class_type": "UNETLoader",
"_meta": {
"title": "확산 모델 로드"
}
},
"405:385": {
"inputs": {
"vae_name": "ltx-2.5-video-vae-bf16.safetensors"
},
"class_type": "VAELoader",
"_meta": {
"title": "VAE 로드"
}
},
"405:386": {
"inputs": {
"vae_name": "ltx-2.5-audio-vae-bf16.safetensors"
},
"class_type": "VAELoader",
"_meta": {
"title": "VAE 로드"
}
},
"405:387": {
"inputs": {
"clip_name": "gemma4-12b-with-proj-ltx-2.5-comfy-int8-convrot.safetensors",
"type": "ltxv",
"device": "default"
},
"class_type": "CLIPLoader",
"_meta": {
"title": "CLIP 로드"
}
},
"405:380": {
"inputs": {
"prompt": [
"405:376",
0
],
"max_length": 600,
"sampling_mode": "on",
"sampling_mode.temperature": 0.7,
"sampling_mode.top_k": 64,
"sampling_mode.top_p": 0.95,
"sampling_mode.min_p": 0.05,
"sampling_mode.repetition_penalty": 1.15,
"sampling_mode.seed": 0,
"sampling_mode.presence_penalty": 0.0,
"thinking": false,
"use_default_template": true,
"clip": [
"405:393",
0
]
},
"class_type": "TextGenerateLTX2Prompt",
"_meta": {
"title": "TextGenerateLTX2Prompt"
}
},
"405:378": {
"inputs": {
"expression": "a * b + 1",
"values.a": [
"405:362",
0
],
"values.b": [
"405:361",
0
]
},
"class_type": "ComfyMathExpression",
"_meta": {
"title": "Math Expression (length)"
}
},
"405:353": {
"inputs": {
"expression": "a/2",
"values.a": [
"405:372",
0
]
},
"class_type": "ComfyMathExpression",
"_meta": {
"title": "수학식"
}
},
"405:355": {
"inputs": {
"expression": "a/2",
"values.a": [
"405:360",
0
]
},
"class_type": "ComfyMathExpression",
"_meta": {
"title": "수학식"
}
},
"405:359": {
"inputs": {
"expression": "a",
"values.a": [
"405:361",
0
]
},
"class_type": "ComfyMathExpression",
"_meta": {
"title": "Math Expression (fps)"
}
},
"405:360": {
"inputs": {
"value": [
"409",
1
]
},
"class_type": "PrimitiveInt",
"_meta": {
"title": "Height"
}
},
"405:361": {
"inputs": {
"value": 24
},
"class_type": "PrimitiveInt",
"_meta": {
"title": "Frame Rate"
}
},
"405:362": {
"inputs": {
"value": 5
},
"class_type": "PrimitiveInt",
"_meta": {
"title": "Duration"
}
},
"405:372": {
"inputs": {
"value": [
"409",
0
]
},
"class_type": "PrimitiveInt",
"_meta": {
"title": "Width"
}
},
"405:376": {
"inputs": {
"value": "A single cute rounded rice-cake mascot waves hello on a colorful stage, gentle toy-like 3D animation, warm soft lighting, stable camera."
},
"class_type": "PrimitiveStringMultiline",
"_meta": {
"title": "Prompt"
}
},
"405:393": {
"inputs": {
"clip_name": "gemma4-12b-with-proj-ltx-2.5-comfy-int8-convrot.safetensors",
"type": "ltxv",
"device": "default"
},
"class_type": "CLIPLoader",
"_meta": {
"title": "CLIP 로드"
}
},
"405:383": {
"inputs": {
"value": false
},
"class_type": "PrimitiveBoolean",
"_meta": {
"title": "Boolean (Enable Prompt Enhance)"
}
},
"405:364": {
"inputs": {
"text": [
"405:382",
0
],
"clip": [
"405:387",
0
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP 텍스트 인코딩 (프롬프트)"
}
}
}
+76
View File
@@ -0,0 +1,76 @@
"""templates/ 의 HTML을 헤드리스 크롬으로 PNG로 찍는다.
usage:
python3 render.py title --age 30 --who 여성 --label 하객룩 --out title_woman.png
python3 render.py bubble --text "*크롭 재킷*으로 시크하게" --out bubbles/w1.png
python3 render.py frame --out frame.png
python3 render.py outro --out outro.png
python3 render.py mask --out mask.png
자막: *단어* 는 주황 강조, | 는 띄어쓰기로 바뀐다(한 줄). title·bubble 은 영상 위에 얹는 투명 PNG, frame 은 흐린 배경과 영상 사이의 창 그림자.
"""
import argparse
import os
import shutil
import subprocess
import sys
import tempfile
import urllib.parse
from pathlib import Path
TEMPLATES = Path(__file__).resolve().parent.parent / "templates"
CHROME = os.environ.get("CHROME_BIN", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
# compose.sh 의 영상 창 크기와 같아야 한다
CARD = (816, 1440)
def shoot(url, out, size=(1080, 1920), transparent=False):
profile = tempfile.mkdtemp(prefix="render-")
command = [CHROME, "--headless=new", "--disable-gpu", "--hide-scrollbars", f"--user-data-dir={profile}",
"--force-device-scale-factor=1", f"--window-size={size[0]},{size[1]}", "--virtual-time-budget=6000",
f"--screenshot={Path(out).resolve()}", url]
if transparent:
command.insert(-1, "--default-background-color=00000000")
Path(out).parent.mkdir(parents=True, exist_ok=True)
Path(out).unlink(missing_ok=True)
try:
# 크롬이 가끔 멈추므로 40초에서 끊는다
subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=40)
except subprocess.TimeoutExpired:
pass
finally:
shutil.rmtree(profile, ignore_errors=True)
if not Path(out).is_file():
sys.exit(f"찍지 못했어요: {out}")
print("saved", out)
def page(name, **query):
return (TEMPLATES / name).as_uri() + ("?" + urllib.parse.urlencode(query) if query else "")
def main():
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("kind", choices=["title", "bubble", "frame", "outro", "mask"])
parser.add_argument("--out", required=True)
parser.add_argument("--age", default="20")
parser.add_argument("--who", default="여성")
parser.add_argument("--label", default="코디")
parser.add_argument("--text")
args = parser.parse_args()
if args.kind == "title":
shoot(page("title.html", age=args.age, who=args.who, label=args.label), args.out, transparent=True)
elif args.kind == "bubble":
if args.text is None:
sys.exit("bubble 은 --text 가 필요해요")
shoot(page("bubble.html", t=args.text), args.out, transparent=True)
elif args.kind == "frame":
shoot(page("frame.html"), args.out, transparent=True)
elif args.kind == "outro":
shoot(page("outro.html"), args.out)
else:
html = f"<body style='margin:0;background:transparent'><div style='width:{CARD[0]}px;height:{CARD[1]}px;border-radius:40px;background:white'></div></body>"
shoot("data:text/html," + urllib.parse.quote(html), args.out, size=CARD, transparent=True)
if __name__ == "__main__":
main()
+79
View File
@@ -0,0 +1,79 @@
#!/bin/bash
# King_admin에 날씨각 코디 영상 전용 ComfyUI(LTX) 컨테이너를 띄우고 내린다. menusong 서비스·파일은 건드리지 않는다.
# usage: server.sh up | down | status | remove
set -euo pipefail
HOST=${OOTD_SERVER_HOST:-King_admin}
PORT=${OOTD_SERVER_PORT:-32681}
NAME=nalssigak-ltx
ROOT=/mnt/data2/nalssigak
MODELS=/mnt/data2/dir/jw_playground/LTX-2.5
IMAGE=jw/comfyui-ltx:latest
GPU=${OOTD_GPU:-0}
remote() { ssh -o BatchMode=yes -o ConnectTimeout=15 "$HOST" "$@"; }
up() {
remote "NAME=$NAME ROOT=$ROOT MODELS=$MODELS IMAGE=$IMAGE GPU=$GPU PORT=$PORT bash -s" <<'EOF'
set -euo pipefail
running() { docker inspect -f '{{.State.Running}}' "$1" 2>/dev/null | tr -d '[:space:]' || true; }
state=$(running "$NAME"); state=${state:-missing}
if [ "$state" != true ]; then
# menusong은 GPU 0에 qwen·image·tts, GPU 1에 video·music을 띄운다.
if [ "$GPU" = 0 ]; then busy="menusong-qwen menusong-image menusong-tts"; else busy="menusong-video menusong-music"; fi
for other in $busy; do
if [ "$(running "$other")" = true ]; then
echo "$other 가 GPU $GPU 를 쓰는 중이라 시작하지 않습니다. 끝난 뒤 다시 실행하세요." >&2; exit 3
fi
done
used=$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i "$GPU" | tr -d ' ')
if [ "$used" -gt 2000 ]; then
echo "GPU $GPU 사용 중(${used}MiB)이라 시작하지 않습니다." >&2; exit 3
fi
# 멈춘 컨테이너는 GPU 설정이 다를 수 있어 새로 만든다.
docker rm "$NAME" >/dev/null 2>&1 || true
mkdir -p "$ROOT"/comfy/{input,output,temp,user}
docker run -d --name "$NAME" --init --gpus "device=$GPU" --shm-size 2g \
-p "127.0.0.1:$PORT:8188" --label nalssigak.ootd=true \
-e HF_HUB_OFFLINE=1 -e TRANSFORMERS_OFFLINE=1 -e PYTHONUNBUFFERED=1 \
-v "$MODELS/vae:/app/models/vae:ro" -v "$MODELS/model_patches:/app/models/model_patches:ro" \
-v "$MODELS/latent_upscale_models:/app/models/latent_upscale_models:ro" \
-v "$MODELS/diffusion_models:/app/models/diffusion_models:ro" -v "$MODELS/text_encoders:/app/models/text_encoders:ro" \
-v "$ROOT/comfy/input:/app/input" -v "$ROOT/comfy/output:/app/output" \
-v "$ROOT/comfy/temp:/app/temp" -v "$ROOT/comfy/user:/app/user" \
--entrypoint python "$IMAGE" main.py --listen 0.0.0.0 --port 8188 --lowvram >/dev/null
fi
for _ in $(seq 1 150); do
curl -sf "http://127.0.0.1:$PORT/system_stats" >/dev/null && { echo ready; exit 0; }
[ "$(running "$NAME")" = true ] || { docker logs --tail 30 "$NAME" >&2; exit 1; }
sleep 2
done
echo "$NAME 이(가) 5분 안에 준비되지 않았습니다." >&2; exit 1
EOF
}
# 결과는 PC로 내려받았으므로 끌 때 서버의 입력·결과 파일을 지운다 (컨테이너가 root로 써서 같은 이미지로 지운다).
down() {
remote "docker stop -t 30 $NAME >/dev/null 2>&1 && echo stopped || echo 'not running'; \
[ -d $ROOT/comfy ] && docker run --rm -v $ROOT/comfy:/c --entrypoint sh $IMAGE -c 'rm -rf /c/input/* /c/output/* /c/temp/*' || true"
}
status() {
remote "docker ps -a --filter name=^/$NAME\$ --format '{{.Names}} {{.Status}}'; \
nvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader -i $GPU; du -sh $ROOT 2>/dev/null || true"
}
remove() {
# 컨테이너가 root로 쓴 파일이 있어 같은 이미지로 지운다.
remote "docker rm -f $NAME nalssigak-music >/dev/null 2>&1 || true; \
if [ -d $ROOT ]; then docker run --rm -v $ROOT:/target --entrypoint sh $IMAGE -c 'rm -rf /target/* /target/.[!.]*' && rmdir $ROOT; fi; \
echo removed"
}
case "${1:-}" in
up) up ;;
down) down ;;
status) status ;;
remove) remove ;;
*) echo "usage: $0 up|down|status|remove" >&2; exit 2 ;;
esac
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
# usage: sheet.sh <영상> <출력.png> <초> [초 ...] — 그 시각 프레임을 가로로 붙인 확인용 시트
set -euo pipefail
video=$1; out=$2; shift 2
tmp=$(mktemp -d); inputs=(); n=0
for t in "$@"; do ffmpeg -hide_banner -loglevel error -y -ss "$t" -i "$video" -frames:v 1 -vf scale=270:480 "$tmp/$n.png"; inputs+=(-i "$tmp/$n.png"); n=$((n+1)); done
ffmpeg -hide_banner -loglevel error -y "${inputs[@]}" -filter_complex "hstack=inputs=$n" "$out"
rm -rf "$tmp"; echo "saved $out"
+140
View File
@@ -0,0 +1,140 @@
"""YouTube Shorts 업로드. 표준 라이브러리만 쓴다 (OAuth 데스크톱 앱 + resumable upload).
usage:
python3 youtube.py auth # 채널 계정으로 한 번 로그인해 refresh token을 저장
python3 youtube.py upload video.mp4 meta.json # meta: {title, description, tags[], privacy}
비밀 파일은 저장소 밖 ~/.config/nalssigak/ 에 둔다 (client_secret.json, youtube_token.json).
감사를 통과해 공개로 올릴 수 있게 되면 ~/.config/nalssigak/youtube_public 파일을 만든다(스킬이 privacy 를 public 으로 쓴다).
"""
import base64
import hashlib
import http.server
import json
import os
import secrets
import socket
import sys
import threading
import urllib.error
import urllib.parse
import urllib.request
import webbrowser
from pathlib import Path
CONFIG = Path(os.environ.get("NALSSIGAK_CONFIG", Path.home() / ".config" / "nalssigak"))
CLIENT = CONFIG / "client_secret.json"
TOKEN = CONFIG / "youtube_token.json"
SCOPE = "https://www.googleapis.com/auth/youtube.upload"
TOKEN_URL = "https://oauth2.googleapis.com/token"
def client():
data = json.loads(CLIENT.read_text(encoding="utf-8"))
return data.get("installed") or data["web"]
def post_form(url, fields):
body = urllib.parse.urlencode(fields).encode()
request = urllib.request.Request(url, data=body, headers={"Content-Type": "application/x-www-form-urlencoded"})
try:
with urllib.request.urlopen(request, timeout=30) as response:
return json.loads(response.read())
except urllib.error.HTTPError as error:
sys.exit(f"토큰 요청 실패 {error.code}: {error.read()[:300].decode(errors='replace')}")
def auth():
c = client()
verifier = secrets.token_urlsafe(64)
challenge = base64.urlsafe_b64encode(hashlib.sha256(verifier.encode()).digest()).rstrip(b"=").decode()
state = secrets.token_urlsafe(16)
with socket.socket() as sock:
sock.bind(("127.0.0.1", 0))
port = sock.getsockname()[1]
redirect = f"http://127.0.0.1:{port}"
result = {}
class Handler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
query = urllib.parse.parse_qs(urllib.parse.urlparse(self.path).query)
if query.get("state", [""])[0] == state:
result.update({k: v[0] for k, v in query.items()})
self.send_response(200)
self.send_header("Content-Type", "text/html; charset=utf-8")
self.end_headers()
self.wfile.write("로그인 완료. 이 창은 닫아도 돼요.".encode())
def log_message(self, *_):
pass
server = http.server.HTTPServer(("127.0.0.1", port), Handler)
url = c["auth_uri"] + "?" + urllib.parse.urlencode({
"client_id": c["client_id"], "redirect_uri": redirect, "response_type": "code", "scope": SCOPE,
"access_type": "offline", "prompt": "consent", "state": state,
"code_challenge": challenge, "code_challenge_method": "S256"})
print("브라우저에서 채널 계정으로 로그인하세요:\n" + url, flush=True)
webbrowser.open(url)
thread = threading.Thread(target=server.handle_request)
thread.start()
thread.join(timeout=600)
server.server_close()
if "code" not in result:
sys.exit(f"로그인이 끝나지 않았어요: {result.get('error', '시간 초과')}")
token = post_form(c["token_uri"], {"client_id": c["client_id"], "client_secret": c["client_secret"], "code": result["code"],
"code_verifier": verifier, "grant_type": "authorization_code", "redirect_uri": redirect})
if "refresh_token" not in token:
sys.exit("refresh token을 받지 못했어요. 다시 auth를 실행하세요.")
CONFIG.mkdir(parents=True, exist_ok=True)
TOKEN.write_text(json.dumps({"refresh_token": token["refresh_token"], "scope": token.get("scope")}), encoding="utf-8")
TOKEN.chmod(0o600)
print("저장했어요:", TOKEN)
def access_token():
if not TOKEN.is_file():
sys.exit("먼저 python3 youtube.py auth 로 로그인하세요.")
c = client()
refresh = json.loads(TOKEN.read_text(encoding="utf-8"))["refresh_token"]
return post_form(TOKEN_URL, {"client_id": c["client_id"], "client_secret": c["client_secret"],
"refresh_token": refresh, "grant_type": "refresh_token"})["access_token"]
def upload(video_path, meta_path):
meta = json.loads(Path(meta_path).read_text(encoding="utf-8"))
video = Path(video_path).read_bytes()
body = {
"snippet": {"title": meta["title"], "description": meta["description"], "tags": meta.get("tags", []),
"categoryId": meta.get("category", "26"), "defaultLanguage": "ko", "defaultAudioLanguage": "ko"},
"status": {"privacyStatus": meta.get("privacy", "private"), "selfDeclaredMadeForKids": False,
"containsSyntheticMedia": True},
}
token = access_token()
start = urllib.request.Request(
"https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=snippet,status",
data=json.dumps(body).encode(), method="POST",
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json; charset=UTF-8",
"X-Upload-Content-Type": "video/mp4", "X-Upload-Content-Length": str(len(video))})
try:
with urllib.request.urlopen(start, timeout=60) as response:
location = response.headers["Location"]
put = urllib.request.Request(location, data=video, method="PUT",
headers={"Authorization": f"Bearer {token}", "Content-Type": "video/mp4"})
with urllib.request.urlopen(put, timeout=600) as response:
result = json.loads(response.read())
except urllib.error.HTTPError as error:
sys.exit(f"업로드 실패 {error.code}: {error.read()[:600].decode(errors='replace')}")
asked, got = body["status"]["privacyStatus"], result["status"]["privacyStatus"]
print(json.dumps({"id": result["id"], "privacy": got, "url": f"https://youtube.com/shorts/{result['id']}",
"studio": f"https://studio.youtube.com/video/{result['id']}/edit"}, ensure_ascii=False))
if asked != got:
# 감사 전 API 프로젝트는 공개 요청도 비공개로 바뀐다
print(f"경고: {asked} 로 요청했지만 {got} 로 올라갔어요. API 감사가 필요해요.", file=sys.stderr)
if __name__ == "__main__":
if len(sys.argv) >= 2 and sys.argv[1] == "auth":
auth()
elif len(sys.argv) == 4 and sys.argv[1] == "upload":
upload(sys.argv[2], sys.argv[3])
else:
sys.exit(__doc__)
+21
View File
@@ -0,0 +1,21 @@
{
"about": "클립 동작 후보. scripts/actions.py 가 사람마다 겹치지 않게 무작위로 고른다. 손가락 모양(하트·V·OK·엄지)은 영상 모델이 다른 손 모양으로 그려서 넣지 않는다. needs 는 그 옷·가방이 있어야 쓸 수 있는 동작",
"woman": [
{ "text": "She smiles brightly and gives a cute little wave to the camera with her free hand at shoulder height, then lowers her hand back to her starting pose." },
{ "text": "She smiles and slowly tucks a strand of hair behind her ear with her free hand without looking away from the camera, then lowers her hand back to her starting pose." },
{ "text": "She smiles and lightly brushes her hair back from her face with her free hand, keeping her whole face visible, then lowers her hand back to her starting pose." },
{ "text": "She smiles and with her free hand gently draws the front of her open outer layer a little closed at chest height without looking down, then lets go and lowers her hand back to her starting pose.", "needs": ["outer"] },
{ "text": "She smiles and lifts her free hand to lightly touch the collar of her outer layer near her neck, then lowers her hand back to her starting pose.", "needs": ["outer"] },
{ "text": "She smiles and with her free hand lightly adjusts the strap of her bag on her shoulder without looking at it, then lowers her hand back to her starting pose.", "needs": ["bag"] },
{ "text": "She smiles and shifts her weight gently onto one leg with a small relaxed shoulder shrug, then settles back into her starting pose." }
],
"man": [
{ "text": "He smiles and gives a friendly small wave to the camera with his free hand at shoulder height, then lowers his hand back to his starting pose." },
{ "text": "He gives a slight confident smile and with his free hand at waist level lightly tugs the bottom front edge of his outer layer once to straighten it without looking at it, then lowers his hand back to his starting pose.", "needs": ["outer"] },
{ "text": "He gives a slight confident smile and with his free hand straightens the collar of his outer layer near his neck without looking down, then lowers his hand back to his starting pose.", "needs": ["outer"] },
{ "text": "He gives a slight confident smile and slowly runs his free hand through the side of his hair, keeping his whole face visible, then lowers his hand back to his starting pose." },
{ "text": "He gives a slight confident smile and with his free hand slowly adjusts the cuff of his other sleeve at waist height without looking at it, then lowers his hand back to his starting pose." },
{ "text": "He gives a slight confident smile and with his free hand lightly adjusts the strap of his bag on his shoulder without looking at it, then lowers his hand back to his starting pose.", "needs": ["bag"] },
{ "text": "He gives a relaxed half-smile and slides his free hand into his trouser pocket in one easy motion, keeping it there until the end." }
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

+15
View File
@@ -0,0 +1,15 @@
<!doctype html><html lang="ko"><head><meta charset="utf-8">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css">
<style>
/* 제목(title.html) 바로 아래 한 줄 자막. 창 오른쪽(948px) 안에서 끝나야 한다 */
* { margin: 0; box-sizing: border-box; }
html, body { width: 1080px; height: 1920px; background: transparent; overflow: hidden; }
.t { position: absolute; left: 176px; top: 1397px; max-width: 748px; padding: 14px 24px; border-radius: 22px; background: rgb(255 255 255 / .92);
color: #28304a; font: 600 32px/1.3 'Pretendard Variable', Pretendard, sans-serif; letter-spacing: -.5px; white-space: nowrap; }
.t em { font-style: normal; color: #d4552a; }
</style></head><body>
<div class="t" id="t"></div>
<script>
const q = new URLSearchParams(location.search);
document.getElementById('t').innerHTML = q.get('t').replace(/\*([^*]+)\*/g, '<em>$1</em>').split('|').join(' ');
</script></body></html>
+10
View File
@@ -0,0 +1,10 @@
<!doctype html>
<html lang="ko"><head><meta charset="utf-8">
<style>
/* 흐린 영상 배경 위에 얹는 투명 레이어(영상 창 그림자). 창은 프로필 그리드 3:4(위 240 ~ 아래 1680)를 채우고, 위치는 compose.sh 와 같아야 한다 */
* { margin: 0; box-sizing: border-box; }
html, body { width: 1080px; height: 1920px; overflow: hidden; }
body { position: relative; background: transparent; }
.win { position: absolute; left: 132px; top: 240px; width: 816px; height: 1440px; border-radius: 40px; background: #dfeaf6; box-shadow: 0 24px 60px rgb(20 30 60 / .35); }
</style></head>
<body><div class="win"></div></body></html>
@@ -0,0 +1 @@
A static tripod shot of {a_person} with {look} standing in {pronoun} pose in {scene}. {Pronoun} wears {outfit}. {action} A steady breeze clearly blows {pronoun} hair and makes {pronoun} clothes move lightly. {Pronoun} head stays upright facing the camera and {pronoun} eyes stay open with the same smile. The camera is completely still on a tripod at the same full-body framing, and {pronoun} face, outfit and proportions stay identical to the first frame.
+1
View File
@@ -0,0 +1 @@
falling leaves, dancing, walking, turning, big movement, camera movement, dolly in, zoom in, close-up, closed eyes, head tilt, long neck, stretched neck, different face, changing face, changing outfit, distorted anatomy, extra limbs, extra fingers, morphing, flicker, blurry, watermark, text, subtitles
+15
View File
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="ko"><head><meta charset="utf-8">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Jua&display=swap">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css">
<style>
* { margin: 0; box-sizing: border-box; }
html, body { width: 1080px; height: 1920px; overflow: hidden; }
body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 44px; color: #1f2d3d;
font-family: 'Pretendard Variable', Pretendard, sans-serif;
background: radial-gradient(circle at 10% 4%, #dcebff 0, transparent 34%), radial-gradient(circle at 92% 97%, #d6e7fd 0, transparent 36%), #f4f9ff; }
img { width: 340px; height: 340px; border-radius: 80px; box-shadow: 0 22px 48px rgba(43, 108, 184, .25); }
.name { font: 120px/1 Jua, sans-serif; letter-spacing: -2px; }
.url { padding: 18px 44px 16px; border-radius: 999px; background: #4f97e3; color: #fff; font: 700 54px/1 'Pretendard Variable', Pretendard, sans-serif; box-shadow: 0 6px 0 #2b6cb8; }
</style></head>
<body><img src="app_icon.png" alt=""><div class="name">날씨각</div><div class="url">weather.o2o.kr</div></body></html>
@@ -0,0 +1,5 @@
Make a photo of the {person} from the first reference image wearing today's outfit in {scene}.
Outfit: {outfit}
{hair_line}
{body_line}
Rules: keep the person's face, hairstyle and body exactly like the FIRST reference image (same person). Copy the outfit items, colors, materials and silhouettes from the other reference images (outfit snap and product photos), but do NOT copy the face of the person in the outfit snap and do NOT copy any text, logo, watermark or "AI" badge. Photorealistic vertical 9:16 full-body fashion photo, the person stands facing the camera in a relaxed natural pose, whole body from head to shoes in frame with some space above the head, both hands visible and natural, eyes open, gentle expression. No text, no logo, no watermark anywhere.
+23
View File
@@ -0,0 +1,23 @@
<!doctype html>
<html lang="ko"><head><meta charset="utf-8">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Jua&display=swap">
<style>
/* 영상 위에 얹는 투명 레이어. 창(132,240 · 816×1440) 왼쪽 아래, 신발이 보이도록 발 위(다리 높이)에 칩·제목을 두고, 그 아래 1397px 줄은 자막(bubble.html) 자리 */
:root { --main: #4f97e3; --deep: #2b6cb8; --ink: #28304a; }
* { margin: 0; box-sizing: border-box; }
html, body { width: 1080px; height: 1920px; overflow: hidden; background: transparent; }
.win { position: absolute; left: 132px; top: 240px; width: 816px; height: 1440px; border-radius: 40px; overflow: hidden; }
.shade { position: absolute; left: 0; right: 0; bottom: 0; height: 700px; background: linear-gradient(transparent, rgb(40 48 74 / .45) 55%, rgb(40 48 74 / .2)); }
.title { position: absolute; left: 176px; bottom: 543px; }
.chip { display: inline-block; padding: 9px 22px 7px; border-radius: 999px; background: var(--main); color: #fff; font: 30px/1.1 Jua, sans-serif; box-shadow: 0 4px 0 var(--deep); }
.headline { margin-top: 16px; font: 66px/1.12 Jua, sans-serif; color: #fff; letter-spacing: -1px; text-shadow: 0 3px 16px rgb(40 48 74 / .35); }
</style></head>
<body>
<div class="win"><div class="shade"></div></div>
<div class="title"><div class="chip">날씨각</div><div class="headline" id="h"></div></div>
<script>
const q = new URLSearchParams(location.search);
const age = q.get('age'); // 40~ 이면 '40대~'
document.getElementById('h').innerHTML = `이번주 ${age.replace(/~$/, '')}대${age.endsWith('~') ? '~' : ''}<br>${q.get('who')} ${q.get('label') || '코디'}`;
</script>
</body></html>
+1 -1
View File
@@ -9,7 +9,7 @@ import { execFileSync } from 'node:child_process'
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { resolve } from 'node:path'
const SLIDES = { tarot: 5, ootd: 4, intro: 8 }
const SLIDES = { tarot: 5, ootd: 4, intro: 8, foliage: 5 }
// 기본 문구가 서비스 데이터 그대로라 Claude 기획이 꼭 필요한 템플릿 (src/cards/templates.tsx autoPlan)
const AUTO_PLAN = ['tarot']
// src/cards/themes.ts THEMES 의 id
+4 -2
View File
@@ -1,6 +1,6 @@
// 그날 코디: 오늘 예보 → 무신사 인기 스냅에서 사람별 코디 선정 → Claude 가 옷 목록 추출 → Codex 가 참고 사진대로 플랫레이 그림 → 카드용 copy.
// 사용: node scripts/daily-ootd.mjs [--out out/<날짜>] (npm run card -- ootd --daily 가 부른다)
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import { join, resolve } from 'node:path'
import { drawWithCodex } from './codex-image.mjs'
import { extractOutfit } from './outfit.mjs'
@@ -63,7 +63,9 @@ export async function runDailyOotd({ outDir, style = 'minimal', log = console.lo
const weather = await weatherToday()
log(`오늘 ${weather.day}: 아침 ${weather.morningC}° · 낮 ${weather.maxC}° → 구간 ${weather.band} · 스타일 ${styleLabel}`)
mkdirSync(outDir, { recursive: true })
const picks = await pickSnaps({ band: weather.band, style, outDir: join(outDir, 'snaps'), log })
// 사용자가 먼저 확인한 코디(snap.mjs 가 쓴 picks.json)가 있으면 다시 고르지 않고 그대로 그린다
const picksFile = join(outDir, 'snaps', 'picks.json')
const picks = existsSync(picksFile) ? JSON.parse(readFileSync(picksFile, 'utf8')) : await pickSnaps({ band: weather.band, style, outDir: join(outDir, 'snaps'), log })
const dailyDir = resolve('public/daily')
mkdirSync(dailyDir, { recursive: true })
const outfits = []
+2 -2
View File
@@ -70,7 +70,7 @@ const TAROT_TONE = [
'하지 않는 것: "~이면 ~해요/~하면 ~돼요" 공식, 모든 문장이 같은 어미("~해요"만 세 번), "~할 수 있어요/~일 수 있어요" 두 번 이상, "~것이 중요합니다", "도움이 되길", 명사 나열형 조언, 설명조("이 카드는 ~을 뜻해요"는 세 장 통틀어 한 번만), 이모지, 느낌표 두 개 이상, 리딩 본문에 기온·시각 숫자(숫자는 행운 포인트에만), 뻔한 덕담("기대해도 좋은 하루").',
'좋은 예: "오늘 그 사람, 님 생각보다 가까이 와 있어요. 겉으론 평소랑 똑같이 굴어도 말 걸 타이밍만 재는 중이거든요. 해 지고 선선해질 때 \'잠깐 걸을래?\' 한마디면 돼요."',
'나쁜 예(쓰지 말 것): "커피 한 잔이면 말문이 열려요. 아침 인사부터 먼저 건네요." / "걷다 보면 거리가 가까워져요. 저녁 산책을 먼저 제안해요."',
'키워드(k)는 4~8자 명사구("같이 걷는 시간", "먼저 보내는 한 줄"). 행운 포인트(l)는 시간·날씨·행동 한 줄 22자 이내("저녁 8시, 17도로 걷기 딱 좋아요").',
'키워드(k)는 4~8자 명사구("같이 걷는 시간", "먼저 보내는 한 줄"). 행운 포인트(l)는 "시각 · 행운 아이템" 한 줄 18자 이내("밤 9시 · 무릎 덮을 담요"). 시각은 예보 시각 그대로, 아이템은 리딩에서 권한 행동에 쓰거나 그 장면에 있는, 그 시각 날씨에 맞는 물건 하나(단풍 사진을 보내라는 리딩이면 "빨간 단풍잎 한 장"). 기온 숫자·날씨 설명은 쓰지 않는다.',
]
/** 오늘 고를 수 있는 각: 최근 7일에 쓴 각은 뺀다 (관리자가 고정한 카드는 남긴다). 경제 카드는 10장뿐이라 날씨로만 고른다 */
@@ -103,7 +103,7 @@ function moneySection(topic) {
'',
'## 경제 카드 (이 목록에서만 고른다. card1·card2·card3에 서로 다른 code)',
`표지 질문(question)은 이것을 쓴다(피드백이 바꾸라고 하면 바꾼다): ${questionOf(topic)}`,
'제목(title) 첫 줄은 질문의 쉼표 앞부분을 그대로 쓴다(예: "오늘 내 주식"). 계좌·지갑처럼 돌려 말하지 않는다.',
'표지 배지(title)는 "주식 타로", 표지 큰 질문(headline) 첫 줄은 질문의 쉼표 앞부분을 그대로 쓴다(예: "오늘 내 주식, ⏎ 어떤 마음으로 볼까요?"). 계좌·지갑처럼 돌려 말하지 않는다.',
'각 카드의 "어울리는 날씨"가 오늘 날씨 데이터와 맞는 카드만 고른다. 맞는 카드가 많으면 더 잘 맞는 것, 아침·낮·저녁으로 이어지는 것을 고른다. 날씨와 안 맞는 카드는 고르지 않는다.',
'리딩은 카드 이름(불장·존버·분할매수·익절·손절·관망·물타기·배당·적금·텅장)의 뜻을 주식·돈 관리 이야기로 직접 풀고, 오늘 날씨를 그 근거로 든다. 산책·꽃구경 같은 날씨 활동 이야기로 새지 않는다. 종목 추천·수익 단정은 하지 않는다.',
...TAROT_TONE,
Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

@@ -0,0 +1,125 @@
{
"source": "한국관광공사 관광사진(공공누리 제1유형, 출처표시)",
"spots": [
{
"file": "yongmunsa",
"name": "용문사 은행나무",
"region": "경기 양평",
"kind": "ginkgo",
"peak": "2026-10-29",
"photo": {
"title": "양평 용문사",
"by": "한국관광공사 김지호",
"shot": "2012.10"
}
},
{
"file": "namiseom",
"name": "남이섬",
"region": "강원 춘천",
"kind": "ginkgo",
"peak": "2026-10-27",
"photo": {
"title": "남이섬",
"by": "김효서",
"shot": "2023.11"
}
},
{
"file": "myeongnyundang",
"name": "성균관 명륜당",
"region": "서울 종로",
"kind": "ginkgo",
"peak": "2026-10-31",
"photo": {
"title": "성균관",
"by": "한국관광공사 박성근",
"shot": "2011.10"
}
},
{
"file": "gyeongbokgung",
"name": "경복궁",
"region": "서울 종로",
"kind": "maple",
"peak": "2026-11-02",
"photo": {
"title": "경복궁",
"by": "라이브스튜디오",
"shot": "2020.11"
}
},
{
"file": "namsan",
"name": "남산공원",
"region": "서울 중구",
"kind": "maple",
"peak": "2026-11-02",
"photo": {
"title": "남산성곽길",
"by": "한국관광공사 이범수",
"shot": "2011.11"
}
},
{
"file": "childrenpark",
"name": "어린이대공원",
"region": "서울 광진",
"kind": "maple",
"peak": "2026-11-02",
"photo": {
"title": "서울 어린이대공원",
"by": "최민희",
"shot": "2023.11"
}
},
{
"file": "changdeokgung",
"name": "창덕궁",
"region": "서울 종로",
"kind": "maple",
"peak": "2026-11-02",
"photo": {
"title": "창덕궁",
"by": "최린",
"shot": "2023.11"
}
},
{
"file": "deoksugung",
"name": "덕수궁 돌담길",
"region": "서울 중구",
"kind": "ginkgo",
"peak": "2026-11-04",
"photo": {
"title": "덕수궁",
"by": "한국관광공사 이범수",
"shot": "2019.11"
}
},
{
"file": "seoulforest",
"name": "서울숲",
"region": "서울 성동",
"kind": "ginkgo",
"peak": "2026-11-04",
"photo": {
"title": "서울숲",
"by": "임태원",
"shot": "2023.11"
}
},
{
"file": "mulhyanggi",
"name": "물향기수목원",
"region": "경기 오산",
"kind": "ginkgo",
"peak": "2026-11-06",
"photo": {
"title": "물향기수목원",
"by": "박아름",
"shot": "2025.10"
}
}
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 438 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 KiB

+75
View File
@@ -222,6 +222,33 @@
color: var(--rust);
text-shadow: 0 6px 0 var(--soft);
}
/* 날씨 타로 표지: 주제 배지 + 큰 질문 두 줄 */
.slide .cover-chip {
position: absolute;
top: 160px;
left: 50%;
transform: translateX(-50%);
padding: 8px 30px 12px;
border-radius: 99px;
background: var(--rust);
color: #fff;
font: 54px/1.07 Jua, sans-serif;
letter-spacing: -2px;
white-space: nowrap;
z-index: 3;
}
.cover-headline {
position: absolute;
top: 262px;
left: 100px;
width: 880px;
text-align: center;
font: 86px/1.12 Jua, sans-serif;
letter-spacing: -4px;
text-shadow: 0 5px 0 var(--soft);
white-space: nowrap;
z-index: 3;
}
/* 타로 질문: 이 질문에 카드가 답한다 */
.slide .cover-question {
position: absolute;
@@ -668,3 +695,51 @@
.intro-cta .intro-sub { top: 470px; font-size: 48px; color: var(--rust); }
.intro-cta .intro-note { left: 240px; right: 240px; text-align: center; }
.intro-cta .intro-note { top: 1250px; font-size: 36px; text-align: center; }
/* 서울 근교 단풍 TOP 10 */
.slide.foliage { background: #fff8eb; color: #322d32; }
.foliage .foliage-meta { position: absolute; top: 174px; left: 80px; color: #94694e; font-size: 32px; font-weight: 700; }
.foliage .foliage-title,
.foliage .foliage-list-title,
.foliage .foliage-cta-title { position: absolute; left: 80px; right: 80px; font-family: Jua, sans-serif; letter-spacing: -2px; }
.foliage .foliage-title { top: 222px; max-width: 920px; color: #b43e29; font-size: 96px; line-height: 1.04; }
.foliage .foliage-subtitle { position: absolute; top: 330px; left: 84px; right: 80px; color: #69584d; font-size: 38px; font-weight: 700; letter-spacing: -1px; }
.foliage-cover-panel,
.foliage-cta-panel { position: absolute; background: linear-gradient(140deg, #fbd0a0, #f5a96d 54%, #dd7657); border-radius: 64px; }
.foliage-cover-panel { left: 80px; right: 80px; top: 410px; bottom: 70px; }
.foliage .foliage-phone { position: absolute; overflow: hidden; box-sizing: content-box; width: 338px; aspect-ratio: 47 / 100; border: 15px solid #242327; border-radius: 53px; background: #fff; box-shadow: 0 28px 52px #59331c61, inset 0 0 0 2px #555; z-index: 2; }
.foliage .foliage-phone img { display: block; width: 100%; height: 100%; object-fit: contain; }
.foliage-cover .foliage-phone { top: 436px; left: 340px; width: 370px; transform: rotate(-4deg); }
.foliage .foliage-leaf { position: absolute; width: 110px; height: 110px; object-fit: contain; z-index: 1; filter: drop-shadow(0 12px 10px #963c2929); }
.foliage .foliage-leaf-a { top: 585px; left: 145px; transform: rotate(-21deg); }
.foliage .foliage-leaf-b { top: 725px; right: 150px; transform: rotate(18deg); }
.foliage .foliage-leaf-c { bottom: 132px; left: 165px; transform: rotate(15deg); }
.foliage .foliage-list-title { top: 229px; font-size: 80px; line-height: 1.05; }
.foliage .foliage-list-title em { font-style: normal; color: #c6462b; }
.foliage .foliage-board { position: absolute; left: 80px; right: 80px; top: 350px; bottom: 160px; display: grid; gap: 22px; }
.foliage-duo .foliage-board { grid-template-rows: repeat(2, minmax(0, 1fr)); }
.foliage-grid .foliage-board { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.foliage .foliage-tile { position: relative; overflow: hidden; min-width: 0; border-radius: 38px; background: #aa7254; box-shadow: 0 12px 28px #5c382b26; }
.foliage .foliage-tile::after { content: ''; position: absolute; inset: 20% 0 0; background: linear-gradient(transparent 18%, #1c1719c4 76%, #120f11e8); }
.foliage .foliage-photo { display: block; width: 100%; height: 100%; object-fit: cover; }
.foliage .foliage-rank { position: absolute; top: 22px; left: 23px; z-index: 2; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; background: #fff9ec; color: #b43e29; font: 64px/1 Jua, sans-serif; box-shadow: 0 5px 15px #0003; }
.foliage .foliage-tile-copy { position: absolute; left: 28px; right: 20px; bottom: 24px; z-index: 2; color: #fff; }
.foliage .foliage-name { display: block; overflow: hidden; color: #fff; font: 72px/1.08 Jua, sans-serif; letter-spacing: -1.7px; white-space: nowrap; text-overflow: clip; }
.foliage-grid .foliage-name { font-size: 49px; letter-spacing: -2px; }
.foliage .foliage-facts { display: flex; align-items: center; gap: 12px; margin-top: 10px; color: #fff; font-size: 29px; font-weight: 750; white-space: nowrap; }
.foliage-grid .foliage-facts { gap: 7px; font-size: 22px; letter-spacing: -1px; }
.foliage .foliage-facts > span:not(:first-child)::before { content: '·'; margin-right: 12px; opacity: .8; }
.foliage-grid .foliage-facts > span:not(:first-child)::before { margin-right: 7px; }
.foliage .foliage-kind { display: inline-flex; align-items: center; gap: 3px; }
.foliage .foliage-kind img { width: 30px; height: 30px; object-fit: contain; }
.foliage-grid .foliage-kind img { width: 23px; height: 23px; }
.foliage .foliage-line { margin-top: 6px; color: #fff8ed; font-size: 30px; font-weight: 650; white-space: nowrap; }
.foliage .foliage-credit { position: absolute; left: 80px; right: 80px; bottom: 70px; color: #795e4d; font-size: 23px; font-weight: 600; line-height: 1.3; }
.foliage .foliage-cta-title { top: 220px; color: #b43e29; font-size: 82px; line-height: 1.1; }
.foliage .foliage-cta-body { position: absolute; left: 84px; right: 80px; top: 330px; color: #69584d; font-size: 36px; font-weight: 700; }
.foliage-cta-panel { left: 80px; right: 80px; top: 410px; bottom: 105px; }
.foliage-cta .foliage-phone { top: 440px; left: 124px; width: 330px; transform: rotate(-4deg); }
.foliage .foliage-actions { position: absolute; top: 790px; left: 460px; right: 112px; z-index: 3; display: flex; flex-direction: column; gap: 20px; }
.foliage .foliage-actions span { display: block; padding: 24px 18px; border-radius: 25px; background: #fffaf0; color: #a8402d; font-size: 31px; font-weight: 800; text-align: center; box-shadow: 0 8px 18px #703c252b; white-space: nowrap; }
.foliage .foliage-actions span + span { background: #a8402d; color: #fff; }
.foliage .foliage-source { position: absolute; left: 80px; right: 80px; bottom: 51px; color: #795e4d; font-size: 21px; font-weight: 600; }
+134 -12
View File
@@ -10,6 +10,7 @@ import { Frame, Lines } from './Frame'
import { tidy } from './text'
import { DEFAULT_STYLE, dailyOutfits, needsOuter, ootdBand, ootdOutfits, styleLabel } from './ootd'
import { gakArt, gakByCode } from './gaks'
import foliageData from '../assets/foliage/seoul-2026-10-29.json'
// 대주제(skin)마다 한 번 만든 배경 그림 (npm run gen-image -- tarot-bg <skin>). 없으면 민무늬 배경
const TAROT_BG = import.meta.glob<string>('../assets/tarot-bg/*.webp', { eager: true, import: 'default' })
@@ -39,6 +40,17 @@ export const hasTarotBg = (skin?: string) => !!tarotBg(skin)
import { iconUrl } from './icons'
import { toneVars } from './themes'
const FOLIAGE_IMAGES = import.meta.glob<string>('../assets/foliage/*.webp', { eager: true, import: 'default' })
const foliageImage = (file: string) => FOLIAGE_IMAGES[`../assets/foliage/${file}.webp`]
// 카드에 날짜 숫자는 쓰지 않는다: 오늘이 든 주(월~일) 안이면 '이번 주 절정', 그 뒤면 '다음 주 절정'
const foliagePeak = (date: string) => {
const today = new Date()
const sunday = new Date(today.getFullYear(), today.getMonth(), today.getDate() + ((7 - today.getDay()) % 7))
return new Date(`${date}T00:00:00`) <= sunday ? '이번 주 절정' : '다음 주 절정'
}
const foliageCredit = (spots: typeof foliageData.spots, firstRank: number) =>
`사진: 한국관광공사 · ${spots.map((spot, i) => `${firstRank + i}위 ${spot.photo.by.replace(/^한국관광공사\s*/, '')}`).join(' · ')}`
export type Copy = Record<string, string>
export type Field = { key: string; label: string }
@@ -132,7 +144,7 @@ const ootd: Template = {
const tarot: Template = {
id: 'tarot',
post: (_d, c) => ({
title: c.title.replaceAll('\n', ' ').replaceAll('*', ''),
title: `오늘의 ${c.title.replaceAll('\n', ' ').replaceAll('*', '')}`,
caption: `Q. ${c.question} 1·2·3 중 한 장을 골라 보세요`,
hashtags: tags(SKIN_TAGS[c.skin ?? ''] ?? [], [c.n1, c.n2, c.n3].map((n) => (n ? `#${n.replace(/각$/, '').replace(/\s/g, '')}` : undefined)), ['#날씨각', '#날씨타로', '#타로', '#오늘의타로', '#오늘의운세', '#오늘날씨']),
}),
@@ -142,17 +154,19 @@ const tarot: Template = {
how: [
'카드는 날씨각의 각 카드다(산책각·빨래각·치맥각… 53장). 타로 덱(컵·펜타클 등)은 쓰지 않는다.',
'표지 질문(question)에 1·2·3번 각 카드로 답한다. 소주제마다 질문이 정해져 있다(topics.json questions).',
'표지 배지(title)는 "주식 타로"·"썸 타로"처럼 "<소주제> 타로" 한 줄. 표지 큰 질문(headline)은 질문(question)을 뜻은 그대로 두 줄로 줄인 것, 줄마다 공백 포함 11자 이내(예: "오늘 내 주식, ⏎ 어떤 마음으로 볼까요?").',
'카드는 오늘 서울(중구) 예보로 점수가 높은 각, 즉 오늘 실제로 하기 좋은 각 가운데 질문과 엮을 수 있는 것을 고른다. 세 장은 서로 다른 각.',
'리딩(r)은 진짜 타로 리더 말투로 3문장(70~95자): 그 사람의 겉과 속 → 한 번 꺾기(다만) → 오늘 할 행동 하나(각 카드의 활동). 질문자는 "님", 상대는 "그 사람". 규칙과 좋은·나쁜 예는 scripts/plan.mjs TAROT_TONE.',
'행운 포인트(l)는 한 줄: 그 각이 좋은 오늘의 시간·기온·날씨 사실.',
'행운 포인트(l)는 한 줄 "<시각> · <행운 아이템>": 시각은 그 각이 좋은 오늘 예보 시각 그대로, 아이템은 리딩에서 권한 행동에 쓰거나 그 장면에 있는, 그 시각 날씨에 맞는 손에 잡히는 물건 하나(예: 단풍 사진을 보내라는 리딩이면 "낮 12시 · 빨간 단풍잎 한 장"). 기온 숫자·날씨 설명은 쓰지 않는다.',
'카드 그림은 Codex가 그린 각 카드 그림(그날 뽑힌 카드만 그리고 다시 씀, 없으면 각 아이콘), 카드 이름은 각 이름 그대로.',
'질문·카드·리딩은 각각 관리자가 직접 정하거나 Claude에게 맡길 수 있다. 카드를 직접 고르면 Claude는 그 카드로 리딩만 한다.',
'지켜야 할 것: 투자 권유(종목·매수·매도·수익)·건강 단정·사고·재난·정치는 쓰지 않는다. 마지막 장에 "재미로"를 남긴다.',
'관리자가 주제를 고르고 만들기를 눌러야 만들어진다(화면을 열 때 자동으로 만들지 않는다). 색은 만들 때마다 6가지 테마 중 무작위, 고를 수도 있다.',
],
fields: [
{ key: 'title', label: '표지 제목' },
{ key: 'title', label: '표지 배지 (○○ 타로)' },
{ key: 'question', label: '질문 (카드가 답할 질문)' },
{ key: 'headline', label: '표지 큰 질문 (두 줄)' },
{ key: 'prompt', label: '표지 안내' },
...[1, 2, 3].flatMap((n) => [
{ key: `n${n}`, label: `${n}번 각 카드` },
@@ -167,7 +181,7 @@ const tarot: Template = {
// 카드 3장은 Claude가 기획해야 채워진다 (autoPlan). 기획 전에는 비워 두고 화면이 가린다
// 예시: 연애·썸 (각 카드 그림은 Codex로 미리 그림)
example: {
title: '오늘의\n썸 타로', question: '지금 썸 타는 그 사람과 오늘 한 발 가까워질까요?', topic: '연애 썸', skin: 'heart', theme: 'berry',
title: '썸 타로', question: '지금 썸 타는 그 사람과 오늘 한 발 가까워질까요?', headline: '썸 타는 그 사람과\n한 발 가까워질까요?', topic: '연애 썸', skin: 'heart', theme: 'berry',
c1: 'iced_hot', n1: '뜨아각', i1: 'iced_hot', k1: '커피 사진 한 장',
r1: '아침부터 그 사람 생각났죠. 상대도 비슷해요. 다만 마음이 식어서가 아니라 하루 시작이 바빠서 조용한 거예요. 오늘은 커피 사진 한 장만 보내세요. 그 이상은 저녁에.', l1: '아침 8시, 따뜻한 커피가 당기는 날씨',
c2: 'walk', n2: '산책각', i2: 'walk', k2: '잠깐 걸을래?',
@@ -177,8 +191,9 @@ const tarot: Template = {
},
// 만들기 전 빈 카드. 관리자가 주제를 고르고 만들면 Claude가 채운다
defaults: () => ({
title: '오늘의\n날씨 타로',
title: '날씨 타로',
question: '오늘 나에게 좋은 일이 생길까요?',
headline: '오늘 나에게\n좋은 일이 생길까요?',
prompt: '1·2·3 중 한 장을 골라 보세요',
...Object.fromEntries([1, 2, 3].flatMap((n) => [[`c${n}`, ''], [`n${n}`, ''], [`i${n}`, 'sun'], [`k${n}`, ''], [`r${n}`, ''], [`l${n}`, '']])),
ask: '몇 번 골랐어요?\n*댓글로 알려 주세요*',
@@ -201,13 +216,10 @@ const tarot: Template = {
<i className="sparkle a" />
<i className="sparkle b" />
<i className="sparkle c" />
<h1 className="cover-title">
<Lines text={c.title} />
<p className="cover-chip">{c.title.replaceAll('\n', ' ')}</p>
<h1 className="cover-headline">
<Lines text={c.headline || c.question} />
</h1>
<p className="cover-question">
<b>Q.</b>
{c.question}
</p>
<div className="cover-stage" aria-hidden="true" />
{backs('big')}
<img className="rabbit" src="/icons/rabbit.png" alt="" />
@@ -266,6 +278,116 @@ const tarot: Template = {
const INTRO_GAK_CODES = ['walk', 'camping', 'fishing', 'chimaek', 'jjamppong', 'carwash', 'laundry', 'vent', 'stars', 'hiking', 'date', 'golf']
const foliage: Template = {
id: 'foliage',
name: '서울 근교 단풍 TOP 10',
about: '2026.10.29 기준 서울 근교 단풍 명소 10곳 · 사진 순위 5장',
how: [
'src/assets/foliage/seoul-2026-10-29.json의 순서가 1~10위다. 이름·지역·단풍 종류·절정 날짜와 사진 촬영자도 그 파일에서 가져온다.',
'1장은 앱 단풍 지도, 2~4장은 명소 사진 10장(1~2위는 크게, 3~10위는 4곳씩), 5장은 앱 명소 화면을 쓴다. 날씨 예보나 Claude 기획은 쓰지 않는다.',
'절정 날짜는 산림청 2026 단풍절정 예측 기준이다. 명소 사진은 한국관광공사 관광사진 공공누리 제1유형이므로 2~4장 아래에 촬영자와 함께 출처를 적는다.',
'모든 문구는 관리자 화면에서 직접 고칠 수 있다. 앱 안내는 토스 검색과 weather.o2o.kr을 함께 보여 준다.',
],
fields: [
{ key: 'date', label: '1장 날짜 줄' },
{ key: 'title', label: '1장 제목' },
{ key: 'subtitle', label: '1장 부제' },
{ key: 'heading2', label: '2장 제목' },
{ key: 'heading3', label: '3장 제목' },
{ key: 'heading4', label: '4장 제목' },
...foliageData.spots.flatMap((_, i) => {
const n = i + 1
return [
{ key: `name${n}`, label: `${n}위 이름` },
{ key: `region${n}`, label: `${n}위 지역` },
{ key: `kind${n}`, label: `${n}위 단풍/은행` },
{ key: `peak${n}`, label: `${n}위 절정 시기` },
]
}),
{ key: 'line1', label: '1위 한 줄' },
{ key: 'line2', label: '2위 한 줄' },
{ key: 'credit2', label: '2장 사진 출처' },
{ key: 'credit3', label: '3장 사진 출처' },
{ key: 'credit4', label: '4장 사진 출처' },
{ key: 'ctaTitle', label: '5장 제목' },
{ key: 'ctaBody', label: '5장 본문' },
{ key: 'button1', label: '5장 버튼 1' },
{ key: 'button2', label: '5장 버튼 2' },
{ key: 'source', label: '5장 출처' },
],
defaults: () => ({
date: '이번 주 단풍',
title: '서울 근교 단풍 TOP 10',
subtitle: '멀리 안 가도 돼요, 이번 주말 가볍게',
heading2: '1~2위', heading3: '3~6위', heading4: '7~10위',
...Object.fromEntries(foliageData.spots.flatMap((spot, i) => {
const n = i + 1
return [[`name${n}`, spot.name], [`region${n}`, spot.region], [`kind${n}`, spot.kind === 'ginkgo' ? '은행' : '단풍'], [`peak${n}`, foliagePeak(spot.peak)]]
})),
line1: '절 마당을 덮는 천연기념물 은행나무',
line2: '노란 잎이 깔린 메타세쿼이아·은행나무길',
credit2: foliageCredit(foliageData.spots.slice(0, 2), 1),
credit3: foliageCredit(foliageData.spots.slice(2, 6), 3),
credit4: foliageCredit(foliageData.spots.slice(6, 10), 7),
ctaTitle: '우리 동네 단풍은 지금 어디쯤?',
ctaBody: '전국 단풍 명소 68곳, 절정 날짜를 지도로 한눈에',
button1: "토스에서 '날씨각' 검색",
button2: 'weather.o2o.kr',
source: '절정 날짜: 산림청 2026 단풍절정 예측 · 사진: 한국관광공사',
}),
post: (_d, c) => ({
title: c.title,
caption: `${c.title} 🍁\n멀리 안 가도 돼요. 이번 주말 가볍게 다녀올 곳, 절정 시기 보고 골라요.\n\n전국 68곳 단풍 지도는 토스에서 '날씨각' 검색, 또는 weather.o2o.kr\n\n${c.source}\n${c.credit2}\n${c.credit3}\n${c.credit4}`,
hashtags: '#날씨각 #서울단풍 #단풍명소 #서울근교 #가을나들이 #단풍절정 #은행나무 #주말나들이',
}),
slides: (_d, c) => {
const frame = (page: number, className: string, children: ReactNode) =>
<Frame page={page} total={5} theme="sunset" className={`foliage foliage-${className}`} key={page}>{children}</Frame>
const phone = (file: string) => <div className="foliage-phone"><img src={foliageImage(file)} alt="날씨각 앱 단풍 지도 화면" /></div>
const tile = (i: number) => {
const spot = foliageData.spots[i]
const n = i + 1
const kind = c[`kind${n}`]
return <div className="foliage-tile" key={spot.file}>
<img className="foliage-photo" src={foliageImage(spot.file)} alt={c[`name${n}`]} />
<span className="foliage-rank">{n}</span>
<div className="foliage-tile-copy">
<strong className="foliage-name">{c[`name${n}`]}</strong>
<div className="foliage-facts"><span>{c[`region${n}`]}</span><span className="foliage-kind"><img src={iconUrl(kind === '은행' ? 'ginkgo' : 'maple')} alt="" />{kind}</span><span>{c[`peak${n}`]}</span></div>
{i < 2 && <p className="foliage-line">{c[`line${n}`]}</p>}
</div>
</div>
}
return [
frame(0, 'cover', <>
<p className="foliage-meta">{c.date}</p>
<h1 className="foliage-title">{c.title}</h1>
<p className="foliage-subtitle">{c.subtitle}</p>
<div className="foliage-cover-panel" />
{phone('app-map')}
<img className="foliage-leaf foliage-leaf-a" src={iconUrl('maple')} alt="" />
<img className="foliage-leaf foliage-leaf-b" src={iconUrl('ginkgo')} alt="" />
<img className="foliage-leaf foliage-leaf-c" src={iconUrl('fallen_leaf')} alt="" />
</>),
...[[0, 1], [2, 3, 4, 5], [6, 7, 8, 9]].map((indices, j) => frame(j + 1, j === 0 ? 'duo' : 'grid', <>
<p className="foliage-meta">{c.date}</p>
<h1 className="foliage-list-title">서울 근교 단풍 <em>{c[`heading${j + 2}`]}</em></h1>
<div className="foliage-board">{indices.map(tile)}</div>
<p className="foliage-credit">{c[`credit${j + 2}`]}</p>
</>)),
frame(4, 'cta', <>
<p className="foliage-meta">{c.date}</p>
<h1 className="foliage-cta-title">{c.ctaTitle}</h1>
<p className="foliage-cta-body">{c.ctaBody}</p>
<div className="foliage-cta-panel" />
{phone('app-spot')}
<div className="foliage-actions"><span>{c.button1}</span><span>{c.button2}</span></div>
<p className="foliage-source">{c.source}</p>
</>),
]
},
}
const intro: Template = {
id: 'intro',
name: '날씨각 소개',
@@ -381,6 +503,6 @@ const intro: Template = {
},
}
export const TEMPLATES: Template[] = [tarot, ootd, intro]
export const TEMPLATES: Template[] = [tarot, ootd, intro, foliage]
export const templateById = (id: string) => TEMPLATES.find((t) => t.id === id)
+44 -2
View File
@@ -1,9 +1,9 @@
import uuid
from datetime import date, datetime
from datetime import date, datetime, time
from decimal import Decimal
from typing import Optional
from sqlalchemy import BigInteger, Boolean, Date, DateTime, ForeignKey, Integer, LargeBinary, Numeric, SmallInteger, String, Text, func
from sqlalchemy import BigInteger, Boolean, Date, DateTime, ForeignKey, Integer, LargeBinary, Numeric, SmallInteger, String, Text, Time, func
from sqlalchemy.dialects.postgresql import JSONB, UUID
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
@@ -246,6 +246,7 @@ class Event(Base):
area: Mapped[Optional[str]] = mapped_column(String(20), nullable=True)
name: Mapped[str] = mapped_column(String(60))
place_name: Mapped[str] = mapped_column(String(60))
address: Mapped[Optional[str]] = mapped_column(String(120), nullable=True)
icon: Mapped[str] = mapped_column(String(30), default="fireworks")
start_date: Mapped[date] = mapped_column(Date)
end_date: Mapped[date] = mapped_column(Date)
@@ -362,6 +363,11 @@ class User(Base):
status: Mapped[int] = mapped_column(SmallInteger, default=1)
terms_agreed_at: Mapped[Optional[datetime]] = mapped_column(DateTime(timezone=True), nullable=True)
token_version: Mapped[int] = mapped_column(SmallInteger, default=1)
points: Mapped[int] = mapped_column(Integer, default=0)
birth_date: Mapped[Optional[date]] = mapped_column(Date, nullable=True)
birth_time: Mapped[Optional[time]] = mapped_column(Time, nullable=True)
birth_place: Mapped[Optional[str]] = mapped_column(String(20), nullable=True)
gender: Mapped[Optional[str]] = mapped_column(String(10), nullable=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
deleted: Mapped[bool] = mapped_column(Boolean, default=False)
@@ -447,10 +453,46 @@ class MyGak(Base):
my_gak_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True))
name: Mapped[str] = mapped_column(String(12))
icon: Mapped[Optional[str]] = mapped_column(String(32), nullable=True)
rule: Mapped[dict] = mapped_column(JSONB)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class PointLog(Base):
__tablename__ = "point_log"
point_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True))
day: Mapped[date] = mapped_column(Date)
action: Mapped[str] = mapped_column(String(20))
ref: Mapped[str] = mapped_column(String(40), default="")
points: Mapped[int] = mapped_column(SmallInteger)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class FortuneDraw(Base):
__tablename__ = "fortune_draw"
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True)
day: Mapped[date] = mapped_column(Date, primary_key=True)
card_code: Mapped[str] = mapped_column(String(32))
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class DayLog(Base):
__tablename__ = "day_log"
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True)
day: Mapped[date] = mapped_column(Date, primary_key=True)
mood: Mapped[int] = mapped_column(SmallInteger)
went_out: Mapped[bool] = mapped_column(Boolean)
place_name: Mapped[Optional[str]] = mapped_column(String(40), nullable=True)
place_ref: Mapped[Optional[str]] = mapped_column(String(40), nullable=True)
card_hit: Mapped[Optional[bool]] = mapped_column(Boolean, nullable=True)
region_code: Mapped[str] = mapped_column(String(10))
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class Talk(Base):
__tablename__ = "talk"
+1
View File
@@ -26,6 +26,7 @@ class ErrorType(Enum):
AUTH_DUPLICATE_ID = 4003
AUTH_TOKEN_INVALID = 4004
TERMS_REQUIRED = 4005
LEVEL_REQUIRED = 4006 # 계정 레벨이 모자라 아직 열리지 않음
class Sky(CodeEnum):
+1 -2
View File
@@ -51,10 +51,9 @@ class Settings(BaseSettings):
azure_blob_base_url: str = ""
azure_blob_sas_token: str = ""
# 오늘 화면 쇼츠 줄. API 키가 있으면 채널의 쇼츠를 받고, 없으면 youtube_shorts(영상 ID, 쉼표로 구분, 최신순)를 보여 준다
# 오늘 화면 쇼츠 줄. API 키가 있으면 Data API 로(공개·퍼가기 허용·3분 이하), 없으면 채널 쇼츠 RSS 로 받는다
youtube_api_key: str = ""
youtube_channel_id: str = "UCWdesmwvHFsnjMUWNcDaA9w"
youtube_shorts: str = "kpp6WFEi4Nk,Wdv-e_DdQFY,WmbOEhi91IM"
# 구글 로그인 OAuth 클라이언트 ID (공개값). 비면 구글 로그인을 받지 않는다
google_client_id: str = ""
+52
View File
@@ -0,0 +1,52 @@
import uuid
from datetime import date
from typing import Optional
from sqlalchemy import case, func, select
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.ext.asyncio import AsyncSession
from common.database.model.models import DayLog, Event, FortuneDraw, Place, SunsetSpot
def _near(region_col, sido: str):
return case((region_col.startswith(sido), 0), else_=1)
class FortuneCRUD:
async def draw_of(self, s: AsyncSession, user_id: uuid.UUID, day: date) -> Optional[FortuneDraw]:
return await s.get(FortuneDraw, (user_id, day))
async def add_draw(self, s: AsyncSession, user_id: uuid.UUID, day: date, card_code: str) -> FortuneDraw:
"""그날 이미 뽑았으면 그 카드를 그대로 돌려준다 (폰과 PC 에서 동시에 뽑아도 처음 카드 하나로)"""
await s.execute(insert(FortuneDraw).values(user_id=user_id, day=day, card_code=card_code).on_conflict_do_nothing())
return await s.scalar(select(FortuneDraw).where(FortuneDraw.user_id == user_id, FortuneDraw.day == day))
async def draw_days(self, s: AsyncSession, user_id: uuid.UUID, since: date) -> list[date]:
return list((await s.scalars(select(FortuneDraw.day).where(FortuneDraw.user_id == user_id, FortuneDraw.day >= since))).all())
async def log_of(self, s: AsyncSession, user_id: uuid.UUID, day: date) -> Optional[DayLog]:
return await s.get(DayLog, (user_id, day))
async def save_log(self, s: AsyncSession, user_id: uuid.UUID, day: date, values: dict) -> DayLog:
stmt = insert(DayLog).values(user_id=user_id, day=day, **values)
await s.execute(stmt.on_conflict_do_update(index_elements=[DayLog.user_id, DayLog.day], set_={**values, "updated_at": func.now()}))
return await s.scalar(select(DayLog).where(DayLog.user_id == user_id, DayLog.day == day).execution_options(populate_existing=True))
async def import_rows(self, s: AsyncSession, user_id: uuid.UUID, draws: list[tuple[date, str]], logs: list[tuple[date, dict]]) -> None:
"""기기에 있던 기록을 계정으로. 계정에 이미 있는 날은 계정 쪽을 둔다"""
if draws:
await s.execute(insert(FortuneDraw).values([{"user_id": user_id, "day": d, "card_code": c} for d, c in draws]).on_conflict_do_nothing())
if logs:
await s.execute(insert(DayLog).values([{"user_id": user_id, "day": d, **v} for d, v in logs]).on_conflict_do_nothing())
async def search_places(self, s: AsyncSession, q: str, sido: str, today: date, limit: int) -> list[tuple[str, str]]:
"""이름에 q 가 들어간 데이트 명소·노을 명소·지금 하는 행사. 같은 시도를 앞에. (place_ref, 이름)"""
like = "%" + q.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_") + "%"
places = (await s.execute(select(Place.place_id, Place.name).where(Place.name.ilike(like, escape="\\")).order_by(_near(Place.region_code, sido), Place.name).limit(limit))).all()
spots = (await s.execute(select(SunsetSpot.spot_id, SunsetSpot.name).where(SunsetSpot.name.ilike(like, escape="\\")).order_by(_near(SunsetSpot.region_code, sido), SunsetSpot.name).limit(limit))).all()
events = (await s.execute(
select(Event.event_id, Event.name).where(Event.name.ilike(like, escape="\\"), Event.start_date <= today, Event.end_date >= today)
.order_by(case((Event.sido_code == sido, 0), else_=1), Event.name).limit(limit)
)).all()
return [(f"place:{i}", n) for i, n in places] + [(f"spot:{i}", n) for i, n in spots] + [(f"event:{i}", n) for i, n in events]
+30
View File
@@ -0,0 +1,30 @@
import uuid
from datetime import date
from sqlalchemy import func, select, update
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.ext.asyncio import AsyncSession
from common.database.model.models import PointLog, User
class LevelCRUD:
async def earned(self, s: AsyncSession, user_id: uuid.UUID, day: date, action: str) -> int:
return await s.scalar(select(func.coalesce(func.sum(PointLog.points), 0)).where(PointLog.user_id == user_id, PointLog.day == day, PointLog.action == action))
async def add(self, s: AsyncSession, user_id: uuid.UUID, day: date, action: str, ref: str, points: int) -> int:
"""같은 날 같은 일·대상이면 넣지 않는다. 넣었으면 총량에 더하고 새 총량을 돌려준다 (안 넣었으면 0)"""
row = await s.scalar(insert(PointLog).values(user_id=user_id, day=day, action=action, ref=ref, points=points).on_conflict_do_nothing().returning(PointLog.point_id))
if row is None:
return 0
return await s.scalar(update(User).where(User.user_id == user_id).values(points=User.points + points).returning(User.points))
async def today(self, s: AsyncSession, user_id: uuid.UUID, day: date) -> dict[str, int]:
rows = (await s.execute(select(PointLog.action, func.sum(PointLog.points)).where(PointLog.user_id == user_id, PointLog.day == day).group_by(PointLog.action))).all()
return {a: int(p) for a, p in rows}
async def attend_days(self, s: AsyncSession, user_id: uuid.UUID, since: date) -> list[date]:
return list((await s.scalars(select(PointLog.day).where(PointLog.user_id == user_id, PointLog.action == "attend", PointLog.day >= since))).all())
async def points(self, s: AsyncSession, user_id: uuid.UUID) -> int:
return await s.scalar(select(User.points).where(User.user_id == user_id)) or 0
+3 -2
View File
@@ -1,4 +1,5 @@
import uuid
from typing import Optional
from sqlalchemy import delete, func, select
from sqlalchemy.ext.asyncio import AsyncSession
@@ -13,8 +14,8 @@ class MyGakCRUD:
async def count(self, s: AsyncSession, user_id: uuid.UUID) -> int:
return await s.scalar(select(func.count()).select_from(MyGak).where(MyGak.user_id == user_id))
async def add(self, s: AsyncSession, user_id: uuid.UUID, name: str, rule: dict) -> MyGak:
row = MyGak(user_id=user_id, name=name, rule=rule)
async def add(self, s: AsyncSession, user_id: uuid.UUID, name: str, rule: dict, icon: Optional[str] = None) -> MyGak:
row = MyGak(user_id=user_id, name=name, rule=rule, icon=icon)
s.add(row)
await s.flush()
return row
+3 -2
View File
@@ -48,11 +48,12 @@ class WeekCRUD:
if not rows:
return
# 출처마다 이름에 "&lt;" 같은 HTML 문자가 섞여 와서, 넣기 전에 푼다
rows = [{**r, "name": plain(r["name"]), "place_name": plain(r["place_name"])} for r in rows]
# 주소는 출처마다 있거나 없어서, 없는 행도 칸을 맞춰 넣는다
rows = [{**r, "name": plain(r["name"]), "place_name": plain(r["place_name"]), "address": r.get("address")} for r in rows]
stmt = insert(Event).values(rows)
await s.execute(stmt.on_conflict_do_update(
index_elements=["source_id"],
set_={k: stmt.excluded[k] for k in ("name", "place_name", "start_date", "end_date", "is_confirmed", "image_url", "lat", "lon", "kind", "icon")},
set_={k: stmt.excluded[k] for k in ("name", "place_name", "address", "start_date", "end_date", "is_confirmed", "image_url", "lat", "lon", "kind", "icon")},
))
async def replace_manual_events(self, s: AsyncSession, rows: list[dict]) -> None:
+43
View File
@@ -316,6 +316,48 @@ CREATE TABLE IF NOT EXISTS public.my_gak (
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS ix_my_gak_user ON public.my_gak (user_id);
ALTER TABLE public.my_gak ADD COLUMN IF NOT EXISTS icon VARCHAR(32) NULL; -- 고른 아이콘 (각 아이콘 이름, 없으면 기본)
-- 계정 레벨: 날씨각에서 한 일로 모은 각 (로그인한 사람만). 레벨은 모은 총량으로 정하고, 같은 날 같은 일·대상은 한 번만 준다
CREATE TABLE IF NOT EXISTS public.point_log (
point_id BIGSERIAL PRIMARY KEY,
user_id UUID NOT NULL,
day DATE NOT NULL,
action VARCHAR(20) NOT NULL, -- services/level_service.py ACTIONS
ref VARCHAR(40) NOT NULL DEFAULT '', -- 같은 날 같은 대상 중복 막기 (post:12 등)
points SMALLINT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE UNIQUE INDEX IF NOT EXISTS uq_point_log ON public.point_log (user_id, day, action, ref);
ALTER TABLE public.users ADD COLUMN IF NOT EXISTS points INTEGER NOT NULL DEFAULT 0; -- 모은 각 총량 (point_log 합)
-- 날씨 사주에 넣은 생년월일. 로그인한 사람만, 저장하면 어느 기기에서든 바로 본다. 탈퇴하면 계정과 함께 지워진다
ALTER TABLE public.users ADD COLUMN IF NOT EXISTS birth_date DATE NULL;
ALTER TABLE public.users ADD COLUMN IF NOT EXISTS birth_time TIME NULL; -- 모르면 NULL
ALTER TABLE public.users ADD COLUMN IF NOT EXISTS birth_place VARCHAR(20) NULL; -- 태어난 곳 키 (frontend sajuBirth.ts BIRTH_PLACES)
ALTER TABLE public.users ADD COLUMN IF NOT EXISTS gender VARCHAR(10) NULL; -- male·female. 연애운에서 이성 인연을 볼 때만 쓴다
-- 오늘 한 장: 로그인한 사람이 그날 뽑은 카드 (하루 한 장, 로그인 안 하면 기기에만 남는다)
CREATE TABLE IF NOT EXISTS public.fortune_draw (
user_id UUID NOT NULL,
day DATE NOT NULL,
card_code VARCHAR(32) NOT NULL, -- 각 코드 (services/fortune_deck.json)
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (user_id, day)
);
-- 저녁 체크인: 그날 기분·다녀온 곳·카드가 맞았는지 (본인만 본다)
CREATE TABLE IF NOT EXISTS public.day_log (
user_id UUID NOT NULL,
day DATE NOT NULL,
mood SMALLINT NOT NULL, -- 1(가장 좋음)~5
went_out BOOLEAN NOT NULL,
place_name VARCHAR(40) NULL, -- 다녀온 곳 이름 (목록에서 고르거나 직접 씀)
place_ref VARCHAR(40) NULL, -- 목록에서 고른 곳: place:<id> · spot:<id> · event:<id>
card_hit BOOLEAN NULL, -- 오늘 카드 맞았나 (안 고르면 NULL)
region_code VARCHAR(10) NOT NULL,
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (user_id, day)
);
-- 동네 이야기: 사용자가 쓴 짧은 글(전국에 보임). 쓸 때의 동네 날씨를 함께 남긴다
CREATE TABLE IF NOT EXISTS public.talk (
@@ -465,6 +507,7 @@ ALTER TABLE public.event ADD COLUMN IF NOT EXISTS image_url VARCHAR(500) NULL;
ALTER TABLE public.event ADD COLUMN IF NOT EXISTS lat NUMERIC(8,5) NULL;
ALTER TABLE public.event ADD COLUMN IF NOT EXISTS lon NUMERIC(8,5) NULL;
ALTER TABLE public.event ADD COLUMN IF NOT EXISTS kind SMALLINT NOT NULL DEFAULT 1;
ALTER TABLE public.event ADD COLUMN IF NOT EXISTS address VARCHAR(120) NULL; -- 도로명 주소 (출처에 있을 때만)
-- 공휴일 (주말·행사 탭의 "개천절").
CREATE TABLE IF NOT EXISTS public.holiday (
+6
View File
@@ -14,6 +14,9 @@ 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
from router.v1.my_gak.my_gak import router as my_gak_router
from router.v1.fortune.fortune import router as fortune_router
from router.v1.level.level import router as level_router
from router.v1.saju.saju import router as saju_router
from router.v1.reaction.reaction import router as reaction_router
from router.v1.region.region import router as region_router
from router.v1.season.season import router as season_router
@@ -48,6 +51,9 @@ app.include_router(feed_router)
app.include_router(auth_router)
app.include_router(reaction_router)
app.include_router(my_gak_router)
app.include_router(fortune_router)
app.include_router(level_router)
app.include_router(saju_router)
app.include_router(talk_router)
app.include_router(watch_router)
app.include_router(image_router)
+2 -13
View File
@@ -1,10 +1,10 @@
from typing import Optional
from fastapi import APIRouter, Depends, Path, Query, Request
from fastapi import APIRouter, Depends, Path, Query
from common.auth import optional_user
from common.database.model.models import User
from common.enums import ErrorType, PostType
from common.enums import ErrorType
from common.liker import Liker, liker
from common.models.errors import error_info
from router.v1.feed.protocol import Res_Feed, Res_Post
@@ -13,26 +13,15 @@ from services.reaction_service import ReactionService
router = APIRouter(prefix="/v1/feed", tags=["feed"])
# 토스에 올라간 10/13 번들은 UV 까지만 알아서, 그 뒤에 생긴 글 종류(카드뉴스 등)가 오면 흰 화면이 된다
TOSS_KNOWN_MAX = PostType.UV.value
def _from_toss(request: Request) -> bool:
ref = request.headers.get("origin") or request.headers.get("referer") or ""
return "AppsInToss" in request.headers.get("user-agent", "") or ".tossmini.com" in ref
@router.get("", response_model=Res_Feed, response_model_exclude_none=True, summary="메인 피드: 하늘 영역, 오늘의 각, 오늘 포스트 전부, 띠")
async def get_feed(
request: Request,
region: str = Query(..., description="구 행정코드"), user: Optional[User] = Depends(optional_user), who: Liker = Depends(liker),
service: FeedService = Depends(), reactions: ReactionService = Depends(),
) -> Res_Feed:
err, feed = await service.feed(region)
if err is not ErrorType.SUCCESS:
return Res_Feed(result=error_info(err))
if _from_toss(request):
feed = feed.model_copy(update={"posts": [p for p in feed.posts if p.post_type.value <= TOSS_KNOWN_MAX]})
pinned = [x for x in (feed.hero_post, feed.gak_post, feed.foliage_post, feed.events_post, feed.season_post) if x is not None]
ids = [p.post_id for p in feed.posts] + [x.post_id for x in pinned]
counts = await reactions.counts(ids)
+2 -1
View File
@@ -5,6 +5,7 @@ from pydantic import Field
from common.enums import PostType, SkySituation, SlotTone
from common.models.gmodel import Res_WebPacketProtocol, WebPacketProtocol
from router.v1.index.protocol import TrendPoint
class Row(WebPacketProtocol):
@@ -51,8 +52,8 @@ class GakSlide(WebPacketProtocol):
score: int
line: str
summary: str
rows: list[Row] = Field(default=[], description="점수 근거: 비중 큰 날씨 조건부터 네 개와 지금 값 (기온 · 체감 18°)")
say: Optional[str] = Field(default=None, description="점수 구간 설명 문장 (seed sentences)")
trend: list[TrendPoint] = Field(default=[], description="오늘 · 내일 · 이번 주말 점수 (각 상세 날짜 칸과 같은 값)")
class Cut(WebPacketProtocol):
Whitespace-only changes.
+61
View File
@@ -0,0 +1,61 @@
from typing import Optional
from fastapi import APIRouter, Depends, Query
from common.auth import current_user, optional_user
from common.database.model.models import DayLog, User
from common.enums import ErrorType
from common.models.errors import error_info
from common.models.gmodel import Res_WebPacketProtocol
from router.v1.fortune.protocol import (
DayLogData, FortuneCard, FortuneLuck, FortunePlace, Req_DayLog, Req_FortuneDraw, Req_FortuneImport, Res_DayLog, Res_FortunePlaces, Res_FortuneToday,
)
from services.fortune_service import FortuneService, Today
router = APIRouter(prefix="/v1/fortune", tags=["fortune"])
def _log(g: Optional[DayLog]) -> Optional[DayLogData]:
if g is None:
return None
return DayLogData(day=g.day, mood=g.mood, went_out=g.went_out, place_name=g.place_name, place_ref=g.place_ref, card_hit=g.card_hit)
def _today(t: Today) -> Res_FortuneToday:
return Res_FortuneToday(
day=t.day, streak=t.streak, checkin_open=t.checkin_open, log=_log(t.log),
card=FortuneCard(**t.card.__dict__) if t.card else None, luck=FortuneLuck(**t.luck.__dict__) if t.luck else None,
)
@router.get("/today", response_model=Res_FortuneToday, response_model_exclude_none=True, summary="오늘 한 장: 로그인했으면 오늘 뽑은 카드·행운·체크인·연속 기록 (안 뽑았으면 카드 없이)")
async def get_fortune_today(region: str = Query(..., min_length=10, max_length=10), user: Optional[User] = Depends(optional_user), service: FortuneService = Depends()) -> Res_FortuneToday:
err, t = await service.today(region, user)
return Res_FortuneToday(result=error_info(err)) if err is not ErrorType.SUCCESS or t is None else _today(t)
@router.post("/draw", response_model=Res_FortuneToday, response_model_exclude_none=True, summary="오늘 카드 뽑기 (하루 한 장). 로그인 안 했으면 기기에 있는 오늘 카드를 넘기면 그 카드로 행운만 계산")
async def draw_fortune(req: Req_FortuneDraw, user: Optional[User] = Depends(optional_user), service: FortuneService = Depends()) -> Res_FortuneToday:
err, t = await service.draw(req.region_code, user, req.card_code, req.days)
return Res_FortuneToday(result=error_info(err)) if err is not ErrorType.SUCCESS or t is None else _today(t)
@router.put("/log", response_model=Res_DayLog, response_model_exclude_none=True, summary="오늘 저녁 체크인 저장 (로그인). 다시 보내면 고친다")
async def save_day_log(req: Req_DayLog, user: User = Depends(current_user), service: FortuneService = Depends()) -> Res_DayLog:
err, g = await service.save_log(user, req.region_code, req.mood, req.went_out, req.place_name, req.place_ref, req.card_hit)
return Res_DayLog(result=error_info(err)) if err is not ErrorType.SUCCESS or g is None else Res_DayLog(log=_log(g))
@router.post("/import", response_model=Res_WebPacketProtocol, response_model_exclude_none=True, summary="로그인할 때 기기에 있던 뽑은 카드·체크인을 계정으로 (계정에 있는 날은 계정 쪽을 둔다)")
async def import_fortune(req: Req_FortuneImport, user: User = Depends(current_user), service: FortuneService = Depends()) -> Res_WebPacketProtocol:
draws = [(d.day, d.card_code) for d in req.draws]
logs = [(g.day, g.model_dump(exclude={"day"})) for g in req.logs]
return Res_WebPacketProtocol(result=error_info(await service.import_local(user, draws, logs)))
@router.get("/places", response_model=Res_FortunePlaces, response_model_exclude_none=True, summary="체크인에서 다녀온 곳 찾기: 이름에 q 가 들어간 데이트 명소·노을 명소·지금 하는 행사")
async def search_fortune_places(region: str = Query(..., min_length=10, max_length=10), q: str = Query(..., max_length=20), service: FortuneService = Depends()) -> Res_FortunePlaces:
err, rows = await service.places(region, q)
if err is not ErrorType.SUCCESS:
return Res_FortunePlaces(result=error_info(err))
return Res_FortunePlaces(items=[FortunePlace(ref=r, name=n) for r, n in rows])
+83
View File
@@ -0,0 +1,83 @@
from datetime import date
from typing import Optional
from pydantic import Field
from common.models.gmodel import Req_WebPacketProtocol, Res_WebPacketProtocol, WebPacketProtocol
class FortuneCard(WebPacketProtocol):
code: str = Field(description="각 코드 (카드 그림은 /fortune/<code>.webp)")
name: str
icon: str
reading: str = Field(description="리딩 한 문장")
color: str = Field(description="행운 색 이름")
hex: str = Field(description="행운 색 #rrggbb")
class FortuneLuck(WebPacketProtocol):
time: Optional[str] = Field(None, description="행운 시간: 오늘 남은 구간 중 날씨가 가장 좋은 때 (예: 오후 4~7시)")
place: Optional[str] = Field(None, description="행운 장소: 날씨 맞춤 데이트 명소")
place_id: Optional[int] = None
top_gak: Optional[str] = Field(None, description="지금 1위 각 이름")
top_icon: Optional[str] = None
class DayLogData(WebPacketProtocol):
day: date
mood: int = Field(ge=1, le=5, description="1(가장 좋음)~5")
went_out: bool
place_name: Optional[str] = None
place_ref: Optional[str] = Field(None, description="목록에서 고른 곳: place:<id> · spot:<id> · event:<id>")
card_hit: Optional[bool] = Field(None, description="오늘 카드 맞았나")
class Res_FortuneToday(Res_WebPacketProtocol):
day: Optional[date] = None
card: Optional[FortuneCard] = Field(None, description="오늘 뽑은 카드. 아직 안 뽑았으면 없음")
luck: Optional[FortuneLuck] = None
streak: int = Field(0, description="이어 뽑은 날 수 (7일에 한 번 쉬는 날은 봐준다)")
checkin_open: bool = Field(False, description="저녁(해 지기 2시간 전)부터 체크인")
log: Optional[DayLogData] = Field(None, description="오늘 체크인 (로그인했을 때)")
class Req_FortuneDraw(Req_WebPacketProtocol):
region_code: str = Field(min_length=10, max_length=10)
card_code: Optional[str] = Field(None, max_length=32, description="로그인 안 했을 때 기기에 있는 오늘 카드 (없으면 새로 뽑음)")
days: list[date] = Field(default=[], max_length=60, description="로그인 안 했을 때 기기에 남은 뽑은 날 (연속 기록용)")
class Req_DayLog(Req_WebPacketProtocol):
region_code: str = Field(min_length=10, max_length=10)
mood: int = Field(ge=1, le=5)
went_out: bool
place_name: Optional[str] = Field(None, max_length=40)
place_ref: Optional[str] = Field(None, max_length=40)
card_hit: Optional[bool] = None
class Res_DayLog(Res_WebPacketProtocol):
log: Optional[DayLogData] = None
class LocalDraw(WebPacketProtocol):
day: date
card_code: str = Field(max_length=32)
class LocalLog(Req_DayLog):
day: date
class Req_FortuneImport(Req_WebPacketProtocol):
draws: list[LocalDraw] = Field(default=[], max_length=60)
logs: list[LocalLog] = Field(default=[], max_length=60)
class FortunePlace(WebPacketProtocol):
ref: str = Field(description="place:<id> · spot:<id> · event:<id>")
name: str
class Res_FortunePlaces(Res_WebPacketProtocol):
items: list[FortunePlace] = []
View File
Whitespace-only changes.
+45
View File
@@ -0,0 +1,45 @@
from fastapi import APIRouter, Depends
from common.auth import current_user
from common.database.model.models import User
from common.enums import ErrorType
from common.models.errors import error_info
from router.v1.level.protocol import LevelAction, LevelStep, LevelUnlock, Req_GameRound, Res_GameStart, Res_Level
from services.level_service import LEVELS, LevelService, Status
router = APIRouter(prefix="/v1/level", tags=["level"])
def _res(err: ErrorType, st: Status | None) -> Res_Level:
if err is not ErrorType.SUCCESS or st is None:
return Res_Level(result=error_info(err))
return Res_Level(
points=st.points, level=st.level, name=st.name, floor=st.floor, next_points=st.next_points, next_name=st.next_name, streak=st.streak,
today=[LevelAction(**a.__dict__) for a in st.today], unlocks=[LevelUnlock(level=lv, key=k, name=n) for lv, k, n in st.unlocks],
levels=[LevelStep(level=i + 1, name=n, points=p) for i, (p, n) in enumerate(LEVELS)],
)
@router.get("/me", response_model=Res_Level, response_model_exclude_none=True, summary="내 레벨: 모은 각, 다음 레벨, 오늘 받은 각, 레벨로 열리는 것")
async def my_level(user: User = Depends(current_user), service: LevelService = Depends()) -> Res_Level:
return _res(*await service.status(user))
@router.post("/attend", response_model=Res_Level, response_model_exclude_none=True, summary="출석 (하루 한 번 각). 7일 이어지면 보너스")
async def attend(user: User = Depends(current_user), service: LevelService = Depends()) -> Res_Level:
return _res(*await service.attend(user))
@router.post("/share", response_model=Res_Level, response_model_exclude_none=True, summary="공유를 마쳤을 때 (하루 한 번 각)")
async def shared(user: User = Depends(current_user), service: LevelService = Depends()) -> Res_Level:
return _res(*await service.share(user))
@router.post("/game/start", response_model=Res_GameStart, response_model_exclude_none=True, summary="날씨게임 한 판 시작 (라운드 각을 받을 표)")
async def game_start(user: User = Depends(current_user), service: LevelService = Depends()) -> Res_GameStart:
return Res_GameStart(play=service.game_start(user))
@router.post("/game/round", response_model=Res_Level, response_model_exclude_none=True, summary="날씨게임 라운드를 깼을 때 (2각, 하루 20각)")
async def game_round(req: Req_GameRound, user: User = Depends(current_user), service: LevelService = Depends()) -> Res_Level:
return _res(*await service.game_round(user, req.play, req.round))
+47
View File
@@ -0,0 +1,47 @@
from typing import Optional
from pydantic import Field
from common.models.gmodel import Req_WebPacketProtocol, Res_WebPacketProtocol, WebPacketProtocol
class LevelAction(WebPacketProtocol):
action: str
name: str
points: int = Field(description="한 번에 주는 각")
cap: int = Field(description="하루 한도")
earned: int = Field(description="오늘 받은 각")
class LevelUnlock(WebPacketProtocol):
level: int
key: str
name: str
class LevelStep(WebPacketProtocol):
level: int
name: str
points: int = Field(description="이 레벨이 되는 각 총량")
class Res_Level(Res_WebPacketProtocol):
points: int = Field(0, description="모은 각 총량")
level: int = 1
name: Optional[str] = None
floor: int = Field(0, description="지금 레벨이 시작하는 각")
next_points: Optional[int] = Field(None, description="다음 레벨에 필요한 총량 (마지막 레벨이면 없음)")
next_name: Optional[str] = None
streak: int = Field(0, description="이어 출석한 날")
today: list[LevelAction] = []
unlocks: list[LevelUnlock] = []
levels: list[LevelStep] = Field([], description="레벨 전체 (이름·필요한 각)")
class Res_GameStart(Res_WebPacketProtocol):
play: Optional[str] = Field(None, description="판 시작 표. 라운드를 깰 때 그대로 보낸다")
class Req_GameRound(Req_WebPacketProtocol):
play: str = Field(max_length=40)
round: int = Field(description="방금 깬 라운드 (1부터)")
+2 -2
View File
@@ -14,7 +14,7 @@ router = APIRouter(prefix="/v1/my-gak", tags=["my-gak"])
def _data(g: MyGak) -> MyGakData:
return MyGakData(my_gak_id=g.my_gak_id, name=g.name, rule=MyGakRule(**g.rule))
return MyGakData(my_gak_id=g.my_gak_id, name=g.name, icon=g.icon, rule=MyGakRule(**g.rule))
@router.get("", response_model=Res_MyGakList, response_model_exclude_none=True, summary="내 각 목록 (로그인하지 않았으면 빈 목록)")
@@ -29,7 +29,7 @@ async def list_my_gak(user: Optional[User] = Depends(optional_user), service: My
@router.post("", response_model=Res_MyGak, response_model_exclude_none=True, summary="이름과 날씨 조건으로 내 각 만들기")
async def add_my_gak(req: Req_MyGak, user: User = Depends(current_user), service: MyGakService = Depends()) -> Res_MyGak:
err, g = await service.add(user, req.name, req.rule.model_dump(exclude_none=True))
err, g = await service.add(user, req.name, req.rule.model_dump(exclude_none=True), req.icon)
return Res_MyGak(result=error_info(err)) if err is not ErrorType.SUCCESS or g is None else Res_MyGak(item=_data(g))
+3
View File
@@ -29,11 +29,13 @@ class MyGakRule(WebPacketProtocol):
class MyGakData(WebPacketProtocol):
my_gak_id: int
name: str
icon: Optional[str] = Field(None, description="고른 아이콘 (각 아이콘 이름)")
rule: MyGakRule
class Req_MyGak(Req_WebPacketProtocol):
name: str = Field(min_length=1, max_length=12, description="내 각 이름 (끝에 '각'이 없으면 붙인다)")
icon: Optional[str] = Field(None, pattern=r"^[a-z_]{1,32}$", description="고른 아이콘 (각 아이콘 이름)")
rule: MyGakRule
@@ -66,6 +68,7 @@ class MyGakScore(WebPacketProtocol):
slot: Optional[Slot] = Field(None, description="score 가 어느 시간대 점수인지")
slots: dict[str, int] = Field(default={}, description="고른 시간대별 점수 (아침·낮·저녁·밤 순)")
reasons: list[str] = Field(default=[], description="score 근거: 조건마다 그 시간대 실제 값")
factors: dict[str, int] = Field(default={}, description="조건별 점수 0~100 (temp·rain·wind·air·humidity, reasons 와 같은 순서)")
class Res_MyGakScore(Res_WebPacketProtocol):
View File
Whitespace-only changes.
+149
View File
@@ -0,0 +1,149 @@
from datetime import date
from typing import Literal, Optional
from pydantic import Field
from common.models.gmodel import Req_WebPacketProtocol, Res_WebPacketProtocol, WebPacketProtocol
class Req_Saju(Req_WebPacketProtocol):
region_code: str = Field(min_length=10, max_length=10)
birth_date: date = Field(description="양력 생년월일 (1900-01-01 ~ 오늘)")
birth_time: Optional[str] = Field(None, pattern=r"^([01]\d|2[0-3]):[0-5]\d$", description="태어난 시각 HH:MM (모르면 없음)")
longitude: float = Field(126.98, ge=124, le=132, description="태어난 곳 경도 (시각 보정)")
gender: Optional[Literal["male", "female"]] = Field(None, description="연애운에서 이성 기운을 볼 때만")
class SajuSavedBirth(WebPacketProtocol):
birth_date: date
birth_time: Optional[str] = Field(None, pattern=r"^([01]\d|2[0-3]):[0-5]\d$", description="HH:MM (모르면 없음)")
place: Optional[str] = Field(None, pattern=r"^[a-z]{2,20}$", description="태어난 곳 키 (seoul 등)")
gender: Optional[Literal["male", "female"]] = None
class Req_SajuBirth(Req_WebPacketProtocol, SajuSavedBirth):
pass
class Res_SajuBirth(Res_WebPacketProtocol):
birth: Optional[SajuSavedBirth] = None
class SajuPillar(WebPacketProtocol):
position: str = Field(description="year·month·day·hour")
stem: str
branch: str
stem_ko: str
branch_ko: str
stem_element: str = Field(description="木火土金水")
branch_element: str
class SajuMe(WebPacketProtocol):
pillars: list[SajuPillar]
hour_known: bool
jeol_warning: bool = Field(description="시각을 모르는데 태어난 날 절이 들어 연·월주가 갈릴 수 있음")
scene: str = Field(description="내 기운 이름 (예: 봄비 기운)")
scene_desc: str
scene_icon: str
season: Optional[str] = None
climate: Optional[str] = Field(None, description="따뜻·마름 / 따뜻·촉촉 / 서늘·마름 / 서늘·촉촉")
need: list[str] = Field([], description="내 기운에 필요한 것 (따뜻함·마른 공기 등)")
class SajuCard(WebPacketProtocol):
kind: str = Field(description="when·do·avoid·good·wear")
title: str
body: str
sub: Optional[str] = None
class SajuToday(WebPacketProtocol):
day: date
pillar: str = Field(description="오늘 간지 한글 (을해)")
ten_god: str
title: str
score: int = Field(description="오늘 점수 = 사주 + 날씨 궁합")
saju_score: int
weather_points: Optional[int] = Field(None, description="날씨 궁합이 더하거나 뺀 점수")
why: list[str] = Field([], description="점수에 크게 작용한 사실")
cards: list[SajuCard]
class SajuDay(WebPacketProtocol):
day: date
weekday: str
icon: Optional[str] = None
word: Optional[str] = None
temp_min: Optional[int] = None
temp_max: Optional[int] = None
score: int
title: str
best: bool = False
class SajuLoveDay(WebPacketProtocol):
day: date
weekday: str
icon: Optional[str] = None
word: Optional[str] = None
temp_max: Optional[int] = None
body: str
why: str
class SajuLove(WebPacketProtocol):
good: Optional[SajuLoveDay] = None
caution: Optional[SajuLoveDay] = None
gender_known: bool
class SajuPeriod(WebPacketProtocol):
label: str = Field(description="이달 · 10/8 한로 ~ 11/7 / 2026년")
pillar: str
ten_god: str
title: str
body: str
notes: list[str] = []
months: list[int] = Field([], description="올해: 잘 맞는 달 (양력 달)")
class SajuLock(WebPacketProtocol):
key: str
name: str
level: int
unlocked: bool
class Res_Saju(Res_WebPacketProtocol):
me: Optional[SajuMe] = None
today: Optional[SajuToday] = None
week: Optional[list[SajuDay]] = Field(None, description="레벨 2부터")
money: Optional[list[str]] = Field(None, description="레벨 3부터: 이번 주 돈을 정할 날·피할 날")
work: Optional[list[str]] = None
love: Optional[SajuLove] = Field(None, description="레벨 4부터")
month: Optional[SajuPeriod] = Field(None, description="레벨 6부터")
year: Optional[SajuPeriod] = Field(None, description="레벨 7부터")
level: int = 1
logged_in: bool = False
locks: list[SajuLock] = []
class SajuBirth(WebPacketProtocol):
birth_date: date
birth_time: Optional[str] = Field(None, pattern=r"^([01]\d|2[0-3]):[0-5]\d$")
longitude: float = Field(126.98, ge=124, le=132)
class Req_SajuMatch(Req_WebPacketProtocol):
region_code: str = Field(min_length=10, max_length=10)
me: SajuBirth
friend: SajuBirth
class Res_SajuMatch(Res_WebPacketProtocol):
score: Optional[int] = None
title: Optional[str] = None
lines: list[str] = []
friend_scene: Optional[str] = Field(None, description="친구의 기운 이름")
day: Optional[SajuDay] = Field(None, description="이번 주 둘 다 좋은 날")
+98
View File
@@ -0,0 +1,98 @@
from datetime import time
from typing import Optional
from fastapi import APIRouter, Depends
from common.auth import current_user, optional_user
from common.database.model.models import User
from common.enums import ErrorType
from common.models.errors import error_info
from router.v1.saju.protocol import Req_Saju, Req_SajuBirth, Req_SajuMatch, Res_Saju, Res_SajuBirth, SajuSavedBirth, Res_SajuMatch, SajuBirth, SajuCard, SajuDay, SajuLock, SajuLove, SajuLoveDay, SajuMe, SajuPeriod, SajuPillar, SajuToday
from services import saju_text as T
from services.level_service import UNLOCKS
from services.saju.ganji import branch_element, ko, stem_element
from services.saju_service import Reading, SajuService, shown_saju, weather_points
router = APIRouter(prefix="/v1/saju", tags=["saju"])
_WEEKDAY = "월화수목금토일"
def _res(r: Reading) -> Res_Saju:
c = r.chart
pillars = [("year", c.year), ("month", c.month), ("day", c.day)] + ([("hour", c.hour)] if c.hour else [])
today = r.today
best = max(r.week, key=lambda d: d.score).day if r.week else None
return Res_Saju(
me=SajuMe(
pillars=[SajuPillar(position=pos, stem=p.stem, branch=p.branch, stem_ko=ko(p.stem), branch_ko=ko(p.branch), stem_element=stem_element(p.stem), branch_element=branch_element(p.branch)) for pos, p in pillars],
hour_known=c.hour is not None, jeol_warning=c.jeol_on_birth_day, scene=r.scene[0], scene_desc=r.scene[1], scene_icon=r.scene_icon, need=r.need,
),
today=SajuToday(
day=today.day, pillar=ko(today.facts.pillar.stem + today.facts.pillar.branch), ten_god=today.facts.stem_ten_god, title=T.TEN_GOD_TEXT[today.facts.stem_ten_god][0],
score=today.score, saju_score=shown_saju(today.facts.score), weather_points=weather_points(today.climate_score),
why=r.why, cards=[SajuCard(**x.__dict__) for x in r.cards],
),
week=[
SajuDay(day=d.day, weekday=_WEEKDAY[d.day.weekday()], icon=d.weather.icon if d.weather else None, word=d.weather.word if d.weather else None,
temp_min=d.weather.temp_min if d.weather else None, temp_max=d.weather.temp_max if d.weather else None,
score=d.score, title=T.TEN_GOD_TEXT[d.facts.stem_ten_god][0], best=d.day == best)
for d in r.week
] if r.week else None,
money=r.money, work=r.work,
love=SajuLove(good=SajuLoveDay(**r.love["good"]) if r.love.get("good") else None, caution=SajuLoveDay(**r.love["caution"]) if r.love.get("caution") else None,
gender_known=r.love.get("gender") is not None) if r.love else None,
month=SajuPeriod(label=f"이달 · {r.month['from']:%-m/%-d} {r.month['jeol']} ~ {r.month['until']:%-m/%-d}", **{k: r.month[k] for k in ("pillar", "ten_god", "title", "body", "notes")}) if r.month else None,
year=SajuPeriod(label=f"{r.year['year']}년" + (" 미리 보기" if r.year["preview"] else ""), months=r.year["months"], **{k: r.year[k] for k in ("pillar", "ten_god", "title", "body", "notes")}) if r.year else None,
level=r.level, logged_in=r.logged_in,
locks=[SajuLock(key=k, name=n, level=lv, unlocked=r.logged_in and r.level >= lv) for lv, items in UNLOCKS.items() for k, n in items],
)
@router.post("/reading", response_model=Res_Saju, response_model_exclude_none=True, summary="날씨 사주: 내 기운, 오늘 점수(사주+날씨 궁합)와 할 일, 레벨로 열리는 이번 주·금전·연애·이달·올해. 생년월일은 저장하지 않는다")
async def reading(req: Req_Saju, user: Optional[User] = Depends(optional_user), service: SajuService = Depends()) -> Res_Saju:
t = time(*map(int, req.birth_time.split(":"))) if req.birth_time else None
err, r = await service.reading(req.birth_date, t, req.longitude, req.gender, req.region_code, user)
return Res_Saju(result=error_info(err)) if err is not ErrorType.SUCCESS or r is None else _res(r)
def _saved(u: Optional[User]) -> Res_SajuBirth:
if u is None or u.birth_date is None:
return Res_SajuBirth()
t = f"{u.birth_time:%H:%M}" if u.birth_time else None
return Res_SajuBirth(birth=SajuSavedBirth(birth_date=u.birth_date, birth_time=t, place=u.birth_place, gender=u.gender))
@router.get("/birth", response_model=Res_SajuBirth, response_model_exclude_none=True, summary="계정에 저장한 내 생년월일 (없으면 birth 없음)")
async def get_birth(user: User = Depends(current_user)) -> Res_SajuBirth:
return _saved(user)
@router.put("/birth", response_model=Res_SajuBirth, response_model_exclude_none=True, summary="내 생년월일을 계정에 저장 (날씨 사주를 어느 기기에서든 바로 본다)")
async def put_birth(req: Req_SajuBirth, user: User = Depends(current_user), service: SajuService = Depends()) -> Res_SajuBirth:
t = time(*map(int, req.birth_time.split(":"))) if req.birth_time else None
err, u = await service.save_birth(user, req.birth_date, t, req.place, req.gender)
return Res_SajuBirth(result=error_info(err)) if err is not ErrorType.SUCCESS or u is None else _saved(u)
@router.delete("/birth", response_model=Res_SajuBirth, response_model_exclude_none=True, summary="계정에 저장한 내 생년월일 지우기")
async def delete_birth(user: User = Depends(current_user), service: SajuService = Depends()) -> Res_SajuBirth:
err, _ = await service.clear_birth(user)
return Res_SajuBirth(result=error_info(err))
def _birth(b: SajuBirth) -> tuple:
return b.birth_date, time(*map(int, b.birth_time.split(":"))) if b.birth_time else None, b.longitude
@router.post("/match", response_model=Res_SajuMatch, response_model_exclude_none=True, summary="궁합 (계정 레벨 5부터): 일간·일지·기운으로 본 사이, 이번 주 둘 다 좋은 날. 생년월일은 저장하지 않는다")
async def match(req: Req_SajuMatch, user: Optional[User] = Depends(optional_user), service: SajuService = Depends()) -> Res_SajuMatch:
err, m = await service.match(_birth(req.me), _birth(req.friend), req.region_code, user)
if err is not ErrorType.SUCCESS or m is None:
return Res_SajuMatch(result=error_info(err))
d = m.day
return Res_SajuMatch(
score=m.score, title=m.title, lines=m.lines, friend_scene=m.friend_scene,
day=SajuDay(day=d.day, weekday=_WEEKDAY[d.day.weekday()], icon=d.weather.icon if d.weather else None, word=d.weather.word if d.weather else None,
temp_min=d.weather.temp_min if d.weather else None, temp_max=d.weather.temp_max if d.weather else None, score=d.score,
title=T.TEN_GOD_TEXT[d.facts.stem_ten_god][0], best=True) if d else None,
)
+1
View File
@@ -22,6 +22,7 @@ class TalkData(WebPacketProtocol):
liked: bool
mine: bool
created_at: datetime
ago: str = Field(description="쓴 지 얼마나 됐는지 (방금 · 12분 전 · 3시간 전 · 1일 전 · 2주 전)")
class Req_Talk(Req_WebPacketProtocol):
+3 -2
View File
@@ -11,10 +11,10 @@ from common.enums import ErrorType, TalkTopic
from common.liker import Liker, liker
from common.models.errors import error_info
from common.models.gmodel import Res_WebPacketProtocol
from common.utils.kma_time import KST
from common.utils.kma_time import KST, now_kst
from router.v1.talk.protocol import Req_Talk, Req_TalkReport, Res_Talk, Res_TalkGroups, Res_TalkImage, Res_TalkLike, Res_TalkList, TalkData, TalkGroup
from services.talk_image import MAX_BYTES, URL_PREFIX, file_of, save
from services.talk_service import TalkService, TalkView
from services.talk_service import TalkService, TalkView, ago_text
router = APIRouter(prefix="/v1/talk", tags=["talk"])
@@ -24,6 +24,7 @@ def _data(v: TalkView) -> TalkData:
return TalkData(
talk_id=t.talk_id, nickname=u.nickname, character=u.character, color=u.color, mood=u.mood, region_name=v.region_name, weather=t.weather,
body=t.body, image=t.image, topic=TalkTopic(t.topic), like_count=t.like_count, liked=v.liked, mine=v.mine, created_at=t.created_at.astimezone(KST),
ago=ago_text(t.created_at, now_kst()),
)
+1
View File
@@ -14,6 +14,7 @@ class WeatherSlot(WebPacketProtocol):
rain_type: Optional[RainType] = None
rain_prob: Optional[int] = None
humidity: Optional[int] = None
wind_ms: Optional[float] = None
icon: str
tone: SlotTone
note: str
+1
View File
@@ -28,6 +28,7 @@ def _to_slot(s: Slot) -> WeatherSlot:
if s.row is not None:
data.temp_c, data.feels_c = float(s.row.temp_c), float(s.row.feels_c)
data.sky, data.rain_type, data.rain_prob, data.humidity = Sky(s.row.sky), RainType(s.row.rain_type), s.row.rain_prob, s.row.humidity
data.wind_ms = float(s.row.wind_ms) if s.row.wind_ms is not None else None
return data
Loaded 100 of 223 files, more files were not shown because too many files have changed in this diff. Show more