import { useEffect } from "react"; import { markViewed } from "../api"; import type { ScrapedPost } from "../types"; import styles from "./bbs.module.css"; // 외부 사이트 이미지는 Referer를 보고 차단하는 경우가 많음 → 안 보내기. 본문 링크는 새 탭으로 const prepare = (html: string) => html .replaceAll(" { if (post) markViewed(token, post.id).catch(() => {}); // 실패해도 읽기엔 지장 없음 }, [token, post]); if (!post) { return (
글을 찾을 수 없습니다. "L"로 목록을 다시 불러오세요.
); } return (
═ {post.siteName} {post.boardName} ═
제목 : {post.title}
글쓴이: {post.author ?? "-"} 날짜: {post.postedAt ?? "-"} 조회:{" "} {post.viewCount ?? "-"} 추천: {post.likeCount ?? "-"}

{post.content ? ( // content는 백엔드에서 Jsoup Safelist로 script·이벤트 속성을 제거한 HTML이라 그대로 렌더링
) : post.imageUrls.length > 0 ? ( post.imageUrls.map((src, i) => (
{/* eslint-disable-next-line @next/next/no-img-element -- 정적 export라 next/image 최적화 불가 */} {`첨부
[그림 {i + 1}]
)) ) : (
본문을 가져오지 못했습니다. 원문에서 확인하세요.
)}
원문 보기 ↗ {" "} · L=목록 · M=메인
); }