Merge branch 'feature/social-post'

This commit is contained in:
skkim committed 2026-09-18 09:00:07 +09:00
commit 46171b4f24
55 files changed
+2872 -7

No files matched your search

+15
View File
@@ -131,6 +131,21 @@ export function sanitizePayloadForPublish(payload: SitePayload): SitePayload {
// 대체 텍스트 없는 이미지는 어차피 렌더하지 않는다 — 목록에서도 뺀다.
media: payload.media.filter((item) => item.alt?.trim()),
// 재생 주소가 없는 곡은 버튼만 있고 소리가 없다. 목록에서 뺀다.
// 생성 결과를 고유 콘텐츠로 세면 우리 출력으로 발행 게이트를 우회하게 된다.
// 명시적 허용 필드만 복사해 승인 토큰이 하이드레이션 블롭에 끼어들지 못하게 한다.
socialPosts: (payload.socialPosts ?? []).filter((post) => post.body?.trim() && Number.isFinite(Date.parse(post.postedAt))).slice(0, 3).map((post) => ({
postId: post.postId, provider: post.provider, body: post.body, postedAt: post.postedAt,
permalink: safeSocialPermalink(post.permalink),
})),
songs: (payload.songs ?? []).filter((song) => song.audioUrl?.trim()),
};
}
function safeSocialPermalink(value?: string | null): string | undefined {
if (!value) return undefined;
try {
const url = new URL(value);
if (url.protocol === 'https:' && ['threads.net', 'www.threads.net', 'threads.com', 'www.threads.com'].includes(url.hostname) && !url.username && !url.password) return url.href;
} catch { /* 손으로 만든 payload도 공개 링크 경계를 지켜야 한다. */ }
return undefined;
}
+10
View File
@@ -49,6 +49,8 @@ export interface SitePayload {
* 렌더러는 비면 플레이어를 아예 그리지 않는다.
*/
songs: SongTrack[];
/** 같은 원고의 발행된 사본. 고유 콘텐츠·SEO 메타의 근거로 세지 않는다. */
socialPosts?: SocialPostItem[];
/** LLM 이 쓴 문장(allow_llm=true 필드). 사실이 아니라 문장이라 fact 와 분리한다. */
narrative: Narrative;
@@ -450,3 +452,11 @@ export interface SectionSetting {
*/
data?: string;
}
export interface SocialPostItem {
postId: string;
provider: number;
body: string;
postedAt: string;
permalink?: string | null;
}