[feat] solution/backend,postgres-init: 발행 썸네일 저장 + 공개 쇼케이스 목록 — 랜딩이 실물을 걸 자리
랜딩의 "이렇게 나옵니다" 섹션이 걸 그림이 없었다. 발행은 되는데 그 사이트가 어떻게 생겼는지 밖에서 알 방법이 payload 안에만 있었다. ★ 스크린샷이 아니라 그 사이트의 대표 사진(og:image)이다. 헤드리스 브라우저는 봇 탐지 우회 우려로 영구 금지돼 있고(DECISIONS 1-1), 워커(python:slim)· 프리렌더(node:alpine) 어디에도 Chromium 이 없다. - site_thumbnail: 대표 사진을 받아 <prefix>/thumbs/<slug>.<ext> 로 올린다. s/<slug>/ 안에 두지 않는 이유 — _remove_stale_site_files 가 매 발행마다 그 경로를 프리렌더 산출물로 통째로 교체해 조용히 지운다 - site_payload: primary_media()·publish_origin()·region_label() 공개. isPrimary 계산을 한 곳으로 모아 og:image 와 썸네일이 갈릴 수 없게 했다 - build_service: azure publish 직후·IndexNow 전에 저장. 실패해도 발행은 그대로 (payload 와 같은 원칙). thumbnail_url 은 발행 상태 전이 UPDATE 에 합쳐 1회 - GET /v1/showcase: 인증 없음. 발행된 사이트만, place_id·전화·상세주소는 안 나간다 - conftest: fake_renderer 가 늘 ok=True 라 NO_UNIQUE_CONTENT 되짚기 경로가 통째로 안 돌고 있었다(기존에 깨져 있던 테스트 4건 포함 수정) 전체 562 passed
This commit is contained in:
1 parent
5ef3e5a7de
commit
e8cda02a4b
16 files changed
+692
-17
No files matched your search
@@ -549,6 +549,33 @@ def publish_slug(place, site) -> str:
|
||||
return _publish_target(site, str(_get(place, "place_id") or ""), _text(_get(place, "name")))["slug"]
|
||||
|
||||
|
||||
def publish_origin() -> str:
|
||||
"""발행본이 사는 오리진. 썸네일 URL 도 여기서 나온다 —
|
||||
호스트를 새 env 로 또 두면 canonical 과 갈릴 수 있다(CLAUDE.md '발행 호스트는 두 곳')."""
|
||||
return f"https://{DEFAULT_HOST}"
|
||||
|
||||
|
||||
def primary_media(snapshot: dict) -> dict | None:
|
||||
"""대표 사진(og:image) — 객실·메뉴 전용이 아닌 첫 장. 없으면 None.
|
||||
|
||||
★ 썸네일도 이 함수를 쓴다. 규칙을 복제하면 검색 결과에 뜨는 그림과
|
||||
쇼케이스 카드가 다른 사진이 되고, 그건 아무도 눈치채지 못한다."""
|
||||
for row in (snapshot or {}).get("media") or []:
|
||||
if not row.get("unit_id"):
|
||||
return row
|
||||
return None
|
||||
|
||||
|
||||
def region_label(*addresses: str | None) -> str | None:
|
||||
""""강원특별자치도 양양군" — 시·도 + 시·군·구까지만.
|
||||
|
||||
★ 상세 주소는 붙이지 않는다. 로그인 없이 읽히는 목록(쇼케이스)에 쓰이므로
|
||||
'어느 동네인지' 를 넘어서면 안 된다."""
|
||||
parts = _parse_address_parts(*addresses)
|
||||
label = " ".join(p for p in (parts.get("addressRegion"), parts.get("addressLocality")) if p)
|
||||
return label or None
|
||||
|
||||
|
||||
# ── payload 조립 ──────────────────────────────────────────────────────────
|
||||
def to_site_payload(place, snapshot: dict, site, version, links) -> dict:
|
||||
"""스냅샷 + 사이트/버전 행 + 채널 링크 → SitePayload(dict).
|
||||
@@ -577,12 +604,10 @@ def to_site_payload(place, snapshot: dict, site, version, links) -> dict:
|
||||
# ★ sourceType/originUrl 을 반드시 싣는다 — 크롤링 이미지 재게시 권리가 미결이라(DECISIONS 1-2)
|
||||
# 결론이 나면 출처로 걸러낼 수 있어야 한다. 출처를 버리면 그때 다시 수집해야 한다.
|
||||
media = []
|
||||
primary_done = False
|
||||
primary_row = primary_media(snapshot)
|
||||
for index, row in enumerate(snapshot.get("media") or []):
|
||||
unit_id = row.get("unit_id")
|
||||
# 대표 이미지(og:image)는 객실 전용 사진이 아닌 첫 장으로 한다.
|
||||
is_primary = not unit_id and not primary_done
|
||||
primary_done = primary_done or is_primary
|
||||
is_primary = row is primary_row
|
||||
media.append({
|
||||
"mediaId": str(row.get("media_id") or f"m-{index}"),
|
||||
"url": row.get("url"),
|
||||
|
||||
Reference in new issue
Block a user