Compare commits

...
Author SHA1 Message Date
Haewon KamandClaude Opus 5.5 ba206322b7 fix: 문의 함수 허용 출처에 www.o2osolution.ai·o2osolution.ai 를 추가한다
AIO2O 사이트를 o2osolution.ai 로 전환하면 문의 폼이 이 주소에서 webforai.kr/api/lead 를 부른다.
목록에 없으면 사전 요청이 403 으로 끊겨 전환 즉시 문의가 막힌다. aio2o.webforai.kr 은 301 전환 전까지 유지한다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 09:52:22 +09:00
haewonkam 998d609fd8 Merge pull request '모프로의원 허브 영문 홈에 원장 인터뷰 섹션 추가' (#5) from feat/mopro-en-interview into main 2026-10-19 07:06:26 +00:00
Haewon KamandClaude Opus 5.5 21340e767e feat: 모프로의원 허브 영문 홈에도 원장 인터뷰 섹션을 넣는다
- 영문 홈 Clinic Facts 아래 Interview 섹션: 인터뷰 영상과 인터뷰 글·공식 블로그·인스타그램 카드, 한국어 콘텐츠는 제목에 '(in Korean)'
- VideoLite 가 lang='en' 이면 재생 버튼 설명·썸네일 대체 문구·게시일 표기를 영어로 낸다(한국어 화면 변화 없음)
- 영문 값은 clinic.json interview 의 *En(Claude 번역 초안)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:59:37 +09:00
haewonkam 29f798f3c7 Merge pull request '모프로의원 AI 공식답변허브페이지 추가와 근거 수집기 본문 소실 버그 수정' (#3) from 모프로 into main
Reviewed-on: #3
2026-10-19 06:56:13 +00:00
Haewon KamandClaude Opus 5.5 b7f97ecfa6 feat: 모프로의원 허브 홈에 원장 인터뷰 섹션과 푸터 채널 아이콘을 추가한다
- 홈 'Doctors Explain' 아래 Interview 섹션: 라스트닥터 인터뷰 영상(외부 채널 출처 표시), 밀착인터뷰 글(제목·링크만), 공식 블로그 moprohair, 인스타그램 카드
- VideoLite 캡션에 channel 을 받아 외부 채널 영상의 출처를 병원 핸들 대신 표시한다
- 푸터에 유튜브·인스타그램·네이버 블로그·카카오톡 채널·네이버 플레이스·강남언니·바비톡 아이콘 링크를 넣고, 겹치던 유튜브·강남언니 글자 링크를 뺀다
- 값은 clinic.json(interview, footerChannels), 적용은 patch_site.py 가 빌드마다 다시 한다

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:49:08 +09:00
haewonkam 6d2cefac91 Merge pull request '문의 함수 허용 출처에 infinith.webforai.kr 추가' (#4) from fix/lead-origin-infinith-subdomain into main 2026-10-19 01:41:06 +00:00
Haewon KamandClaude Opus 5.5 1125f42324 fix: 문의 함수 허용 출처에 infinith.webforai.kr 을 추가한다
infinith.webforai.kr 을 infinith-discovery 에 붙였는데 api/lead.js 허용 목록에 없어
그 주소에서 보낸 문의가 403 으로 거절됐다. 같은 출처 POST 에도 브라우저가 Origin 을 붙이기 때문이다.
기존 webforai.kr·www·aio2o 는 그대로 둔다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 10:26:15 +09:00
Haewon KamandClaude Opus 5.5 5ff4633926 fix: 모프로의원 허브 영문 페이지에 한글이 나오던 것을 고친다
- 영문 팩트 시트(병원명·주소·원장 영문명)를 공식 영문 페이지 표기로 채우고, 영문 사이트 이름·소개 문구·운영 고지·부작용 고지 영문 초안을 넣는다(고지 문구는 병원 확인 대기)
- 영문 화면의 빈 값 문구를 'To be confirmed'로, 헤더·플래너 기준점 상호를 영문으로 바꾼다
- 사진 없는 장소 이름 칸이 괄호 속 한글을 고르던 것을 영문 이름으로, 영문 주소가 없는 관광 항목은 주소 줄을 비운다
- 대표자 자동 수집값 '블로그'를 홈페이지 푸터 표기 '문건학'으로 정정한다

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 09:58:01 +09:00
Haewon KamandClaude Opus 5.5 847f67060a feat: 모프로의원 AI 공식답변허브페이지 기획과 빌드 후처리를 추가한다
- supporters/briefs/mopro: 병원 고정값(화면 이름 '모프로의원 공식 답변 안내', 전후사진 2장 제외), 정보형 질문 8편 기획, 빌드 후처리 스크립트
- patch_site.py: 템플릿 화면 문구의 '서포터즈'를 이 병원 빌드에서만 바꾸고, 제외 이미지 파일을 지우고, 사이트 주소와 공유 이미지를 정식 주소로 다시 만든다
- make_share_assets.py: 공유 이미지 상단 문구를 --eyebrow 로 받는다(기본값은 기존 문구 그대로)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 08:58:55 +09:00
Haewon KamandClaude Opus 5.5 5893461fa9 fix: 본문 블록에 widget 클래스를 쓰는 사이트에서 근거 본문이 비는 문제를 고친다
Elementor 계열 페이지 빌더는 본문 블록마다 widget 클래스를 달아, 사이드바 위젯용 노이즈 규칙이 본문 전체를 지웠다(모프로의원 남성 모발이식 페이지 48,239자 → 0자).
노이즈 제거 뒤 본문이 80% 넘게 사라지면 widget 규칙만 빼고 다시 추출하고, 이때도 푸터 위젯(사업자 정보·저작권 줄)은 지운다.
회귀 비교(12쪽 표본): 뷰성형외과 변화 없음, 오라클피부과 0자였던 6쪽이 본문을 얻음.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 08:58:54 +09:00
haewonkam a97a6391d0 Merge pull request '데모 DB 조회·쓰기를 서버 함수로 옮기고 익명 정책 정리' (#2) from feat/demo-writes-server-only into main 2026-10-07 08:15:48 +00:00
Haewon KamandClaude Opus 5.5 0d1fdd3430 docs: 익명 키 정책 정리 SQL 을 쓰기 정책까지 포함한 실행본으로 바꾼다
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 16:12:34 +09:00
Haewon KamandClaude Opus 5.5 0be730f0f9 fix: 데모 화면의 DB 조회·쓰기를 서버 함수로 옮긴다
브라우저가 공개 키로 테이블을 직접 읽고 쓰던 구조를 없앤다.
- api/db.js: 정해진 작업만 서비스 키로 실행 (임의 쿼리·열 지정 불가)
- api/_origin.js: 서버 함수 공용 출처 검사, 공개 배포에서는 404
- src/lib/db.ts: 화면용 호출 함수, 반환 형태 { data, error } 유지
- 빌드 큐에 바로 넣던 예전 진단 신청 모달 삭제

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 16:09:29 +09:00
haewonkam dd11173d81 Merge pull request 'webforai.kr 공개 전 정리, API 키 서버 이전, 번들 검사 추가' (#1) from feat/webforai-feature-flags into main
Reviewed-on: #1
2026-10-07 06:51:05 +00:00
28 changed files with 1291 additions and 394 deletions

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
/**
* 서버 함수 공용 출처 검사 (Vercel 서버 함수 전용, '_' 로 시작해 주소로 열리지 않는다).
*
* infinith-demo 와 그 미리보기, 로컬 개발에서 온 요청만 받는다. 데모는 Vercel 배포 보호(팀원 로그인) 뒤에 있어
* 서버 함수도 로그인한 팀원만 부를 수 있다. 공개 배포(webforai.kr, VITE_SITE=discovery)에서는 내부 함수를 열지 않는다.
*/
const ALLOWED_ORIGINS = [
'https://infinith-demo.vercel.app',
'http://localhost:3000',
'http://127.0.0.1:3000',
];
/** 이 프로젝트의 미리보기 배포 주소. 미리보기는 Vercel 로그인(배포 보호) 뒤에 있어 팀원만 연다. */
const PREVIEW_ORIGIN = /^https:\/\/infinith-demo-[a-z0-9]+-o2odev-5530s-projects\.vercel\.app$/;
const isAllowedOrigin = (o) => ALLOWED_ORIGINS.includes(o) || PREVIEW_ORIGIN.test(o);
/**
* CORS·메서드·출처를 확인한다. 통과하면 null, 아니면 이미 응답을 보낸 뒤 true 를 돌려준다.
* @param {string[]} methods 허용 메서드
*/
export function guard(req, res, methods) {
if (process.env.VITE_SITE === 'discovery') {
res.status(404).json({ ok: false, error: 'not found' });
return true;
}
const origin = req.headers.origin || '';
const allowed = isAllowedOrigin(origin);
if (allowed) {
res.setHeader('Access-Control-Allow-Origin', origin);
res.setHeader('Vary', 'Origin');
res.setHeader('Access-Control-Allow-Methods', [...methods, 'OPTIONS'].join(', '));
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
}
if (req.method === 'OPTIONS') {
res.status(allowed ? 204 : 403).end();
return true;
}
if (!methods.includes(req.method)) {
res.status(405).json({ ok: false, error: 'method not allowed' });
return true;
}
// 같은 출처 GET 은 브라우저가 Origin 을 붙이지 않을 수 있어 Referer 로도 확인한다.
const referer = req.headers.referer || '';
const refOrigin = (referer.match(/^https?:\/\/[^/]+/) || [''])[0];
if (!allowed && !isAllowedOrigin(refOrigin)) {
res.status(403).json({ ok: false, error: 'forbidden origin' });
return true;
}
return null;
}
export function safeParse(s) {
try {
return JSON.parse(s);
} catch {
return null;
}
}
+4 -51
View File
@@ -10,6 +10,10 @@
* 채널·포맷 목록은 src/types/studio.ts 의 CHANNEL_OPTIONS 와 같아야 한다 (서버 함수는 src 의 TS 를 불러올 수 없다). * 채널·포맷 목록은 src/types/studio.ts 의 CHANNEL_OPTIONS 와 같아야 한다 (서버 함수는 src 의 TS 를 불러올 수 없다).
*/ */
import { safeParse } from './_origin.js';
export { guard } from './_origin.js';
export const CHANNELS = { export const CHANNELS = {
youtube: { label: 'YouTube', formats: { shorts: ['Shorts', '9:16'], long_form: ['Long-form', '16:9'] } }, youtube: { label: 'YouTube', formats: { shorts: ['Shorts', '9:16'], long_form: ['Long-form', '16:9'] } },
instagram: { instagram: {
@@ -23,49 +27,6 @@ export const CHANNELS = {
export const PILLARS = ['safety', 'expertise', 'results', 'care']; export const PILLARS = ['safety', 'expertise', 'results', 'care'];
/** 이 주소들에서 온 요청만 받는다. 키를 쓰는 유료 API 라 Origin 이 없는 요청(브라우저 밖 호출)도 받지 않는다. */
const ALLOWED_ORIGINS = [
'https://infinith-demo.vercel.app',
'http://localhost:3000',
'http://127.0.0.1:3000',
];
/** 이 프로젝트의 미리보기 배포 주소. 미리보기는 Vercel 로그인(배포 보호) 뒤에 있어 팀원만 연다. */
const PREVIEW_ORIGIN = /^https:\/\/infinith-demo-[a-z0-9]+-o2odev-5530s-projects\.vercel\.app$/;
const isAllowedOrigin = (o) => ALLOWED_ORIGINS.includes(o) || PREVIEW_ORIGIN.test(o);
/**
* CORS·메서드·출처를 확인한다. 통과하면 null, 아니면 이미 응답을 보낸 뒤 true 를 돌려준다.
* @param {string[]} methods 허용 메서드
*/
export function guard(req, res, methods) {
const origin = req.headers.origin || '';
const allowed = isAllowedOrigin(origin);
if (allowed) {
res.setHeader('Access-Control-Allow-Origin', origin);
res.setHeader('Vary', 'Origin');
res.setHeader('Access-Control-Allow-Methods', [...methods, 'OPTIONS'].join(', '));
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
}
if (req.method === 'OPTIONS') {
res.status(allowed ? 204 : 403).end();
return true;
}
if (!methods.includes(req.method)) {
res.status(405).json({ ok: false, error: 'method not allowed' });
return true;
}
// 같은 출처 GET 은 브라우저가 Origin 을 붙이지 않을 수 있어 Referer 로도 확인한다.
const referer = req.headers.referer || '';
const refOrigin = (referer.match(/^https?:\/\/[^/]+/) || [''])[0];
const sameSite = isAllowedOrigin(refOrigin);
if (!allowed && !sameSite) {
res.status(403).json({ ok: false, error: 'forbidden origin' });
return true;
}
return null;
}
/** /**
* 브라우저가 보낸 선택값을 목록과 대조한다. 목록 밖이면 null. * 브라우저가 보낸 선택값을 목록과 대조한다. 목록 밖이면 null.
* @returns {{ channel: string, channelLabel: string, format: string, formatLabel: string, aspectRatio: string, pillarId: string | null } | null} * @returns {{ channel: string, channelLabel: string, format: string, formatLabel: string, aspectRatio: string, pillarId: string | null } | null}
@@ -79,11 +40,3 @@ export function readSelection(body) {
if (pillarId !== null && !PILLARS.includes(pillarId)) return null; if (pillarId !== null && !PILLARS.includes(pillarId)) return null;
return { channel: b.channel, channelLabel: ch.label, format: b.format, formatLabel: fmt[0], aspectRatio: fmt[1], pillarId }; return { channel: b.channel, channelLabel: ch.label, format: b.format, formatLabel: fmt[0], aspectRatio: fmt[1], pillarId };
} }
export function safeParse(s) {
try {
return JSON.parse(s);
} catch {
return null;
}
}
+130
View File
@@ -0,0 +1,130 @@
/**
* 데모 화면의 데이터베이스 조회·쓰기 (Vercel 서버 함수). POST { op, params } → { data, error }
*
* 왜 두는가
* 브라우저가 공개 키(anon)로 테이블을 직접 읽고 쓰던 구조라, 공개 키를 가진 누구나 병원 리포트를 내려받고
* 빌드 큐·병원 입력값을 쓸 수 있었다 (2026-10-07 확인). 조회·쓰기를 이 함수로 옮기고 익명 규칙(RLS)을 지운다.
* docs/security/2026-10-07_rls_anon_lockdown.sql
*
* 원칙
* - 서비스 키(SUPABASE_SERVICE_ROLE_KEY)는 서버 환경변수에만 둔다.
* - 임의 쿼리를 받지 않는다. 아래 OPS 에 적힌 작업만, 정해진 열·조건으로 실행한다.
* - 출처 검사(api/_origin.js): infinith-demo·미리보기·localhost 만. 데모는 Vercel 배포 보호 뒤에 있다.
*/
import { createClient } from '@supabase/supabase-js';
import { guard, safeParse } from './_origin.js';
const ID = /^[A-Za-z0-9_-]{1,80}$/;
const INPUT_KEYS = new Set([
'author', 'editor', 'sponsorship', 'quote_items', 'recovery', 'diet_guide', 'revision_policy', 'discrepancy',
'specialty_doctors', 'domain', 'post_review', 'post_approval', 'report_approval', 'image_review',
]);
const MAX_VALUE_BYTES = 50_000;
/** 화면마다 읽는 빌드 열. 브라우저가 열 이름을 정하지 않는다. */
const BUILD_FIELDS = {
status: 'status',
inputs: 'id,status,phase,preview_url,posts,report,updated_at',
image: 'id,status,preview_url,report,updated_at',
site: 'id,clinic_id,clinic_name,status,phase,phases,posts,preview_url,error,updated_at',
};
class BadRequest extends Error {}
const need = (cond, msg) => { if (!cond) throw new BadRequest(msg); };
const id = (v, name = 'id') => { need(typeof v === 'string' && ID.test(v), `bad ${name}`); return v; };
const uuidish = (v, name = 'id') => { need(typeof v === 'string' && /^[0-9a-f-]{8,64}$/i.test(v), `bad ${name}`); return v; };
const obj = (v, name) => {
need(v && typeof v === 'object' && !Array.isArray(v), `bad ${name}`);
need(JSON.stringify(v).length <= MAX_VALUE_BYTES, `${name} too large`);
return v;
};
/** 작업 목록. 각 작업은 supabase 결과({ data, error })를 돌려준다. */
const OPS = {
// 리포트 (src/lib/supabase.ts)
'report.byId': (sb, p) => sb.from('marketing_reports').select('*').eq('id', uuidish(p.id)).single(),
'report.status': (sb, p) => sb.from('marketing_reports').select('id, status, clinic_name, channel_data, report').eq('id', uuidish(p.id)).single(),
// 마케팅 플랜 (src/hooks/useMarketingPlan.ts, src/lib/supabase.ts)
'run.clinicId': (sb, p) => sb.from('analysis_runs').select('clinic_id').eq('id', uuidish(p.id)).single(),
'clinic.byId': (sb, p) => sb.from('clinics').select('name, name_en, url').eq('id', uuidish(p.id)).single(),
'plan.active': (sb, p) => sb.from('content_plans').select('*').eq('clinic_id', uuidish(p.clinicId, 'clinicId'))
.eq('is_active', true).order('created_at', { ascending: false }).limit(1).single(),
'plan.updateEntry': async (sb, p) => {
const planId = uuidish(p.planId, 'planId');
need(typeof p.entryId === 'string' && p.entryId.length <= 120, 'bad entryId');
const updates = obj(p.updates, 'updates');
const { data: plan, error } = await sb.from('content_plans').select('calendar').eq('id', planId).single();
if (error || !plan) return { data: null, error: error ?? { message: 'plan not found' } };
for (const week of plan.calendar?.weeks ?? []) {
for (let i = 0; i < (week.entries ?? []).length; i++) {
if (week.entries[i].id === p.entryId) week.entries[i] = { ...week.entries[i], ...updates, isManualEdit: true };
}
}
return sb.from('content_plans').update({ calendar: plan.calendar }).eq('id', planId);
},
// 전략 조정 (src/components/plan/StrategyAdjustmentSection.tsx)
'perf.latest': (sb, p) => sb.from('performance_metrics').select('kpi_progress, strategy_suggestions')
.eq('clinic_id', uuidish(p.clinicId, 'clinicId')).order('created_at', { ascending: false }).limit(1).single(),
'adjustments.list': (sb, p) => sb.from('strategy_adjustments').select('id, adjustment_type, description, reason, created_at')
.eq('clinic_id', uuidish(p.clinicId, 'clinicId')).order('created_at', { ascending: false }).limit(10),
// 서포터즈 빌드·병원 입력 (discovery 화면들)
'builds.latest': (sb, p) => {
const fields = BUILD_FIELDS[p.fields];
need(fields, 'bad fields');
return sb.from('supporter_builds').select(fields).eq('clinic_id', id(p.clinicId, 'clinicId'))
.order('created_at', { ascending: false }).limit(1);
},
'builds.queue': (sb, p) => {
need(typeof p.url === 'string' && /^https?:\/\/[^\s]{3,500}$/.test(p.url), 'bad url');
need(p.clinicName == null || (typeof p.clinicName === 'string' && p.clinicName.length <= 200), 'bad clinicName');
return sb.from('supporter_builds').insert({ clinic_id: id(p.clinicId, 'clinicId'), clinic_name: p.clinicName ?? null, url: p.url, status: 'queued' });
},
'inputs.list': (sb, p) => {
const clinicId = id(p.clinicId, 'clinicId');
if (p.key != null) {
need(INPUT_KEYS.has(p.key), 'bad key');
return sb.from('supporter_inputs').select('value,input_by,created_at').eq('clinic_id', clinicId).eq('key', p.key)
.order('created_at', { ascending: true });
}
return sb.from('supporter_inputs').select('key,post_id,value,input_by,created_at').eq('clinic_id', clinicId)
.order('created_at', { ascending: true });
},
'inputs.add': (sb, p) => {
need(INPUT_KEYS.has(p.key), 'bad key');
need(p.postId == null || (typeof p.postId === 'string' && p.postId.length <= 200), 'bad postId');
need(p.inputBy == null || (typeof p.inputBy === 'string' && p.inputBy.length <= 100), 'bad inputBy');
return sb.from('supporter_inputs').insert({
clinic_id: id(p.clinicId, 'clinicId'), key: p.key, post_id: p.postId ?? null, value: obj(p.value, 'value'), input_by: p.inputBy || null,
});
},
};
export default async function handler(req, res) {
if (guard(req, res, ['POST'])) return;
const url = process.env.SUPABASE_URL ?? process.env.VITE_SUPABASE_URL;
const key = process.env.SUPABASE_SERVICE_ROLE_KEY;
if (!url || !key) {
console.error('[api/db] SUPABASE_URL 또는 SUPABASE_SERVICE_ROLE_KEY 가 설정되지 않았습니다.');
return res.status(500).json({ data: null, error: { message: 'unconfigured' } });
}
const body = typeof req.body === 'string' ? safeParse(req.body) : req.body ?? {};
const op = OPS[body?.op];
if (!op) return res.status(400).json({ data: null, error: { message: 'unknown op' } });
try {
const sb = createClient(url, key, { auth: { persistSession: false, autoRefreshToken: false } });
const { data, error } = await op(sb, body.params ?? {});
// 조회 실패·행 없음은 화면이 지금처럼 처리하도록 그대로 넘긴다. 상세 원인은 서버 로그에만 남긴다.
if (error) console.error(`[api/db] ${body.op} 실패`, error.code ?? '', error.message ?? '');
return res.status(200).json({ data: data ?? null, error: error ? { message: error.message ?? 'error', code: error.code ?? null } : null });
} catch (e) {
if (e instanceof BadRequest) return res.status(400).json({ data: null, error: { message: e.message } });
console.error(`[api/db] ${body.op} 예외`, e);
return res.status(500).json({ data: null, error: { message: 'server error' } });
}
}
+3
View File
@@ -20,7 +20,10 @@
const ALLOWED_ORIGINS = [ const ALLOWED_ORIGINS = [
'https://webforai.kr', 'https://webforai.kr',
'https://www.webforai.kr', 'https://www.webforai.kr',
'https://infinith.webforai.kr',
'https://aio2o.webforai.kr', 'https://aio2o.webforai.kr',
'https://www.o2osolution.ai',
'https://o2osolution.ai',
]; ];
export default async function handler(req, res) { export default async function handler(req, res) {
+2 -2
View File
@@ -40,6 +40,6 @@ infinith-demo 배포(VITE_SITE 없음)는 모든 화면이 그대로 열린다.
공개 배포에서 열려면 아래가 먼저 끝나야 한다. 스위치를 만들지 않은 이유다. 공개 배포에서 열려면 아래가 먼저 끝나야 한다. 스위치를 만들지 않은 이유다.
1. 로그인(Supabase Auth)과 병원별 접근 권한 1. 로그인(Supabase Auth)과 병원별 접근 권한
2. 데이터베이스 익명 읽기 정리: `docs/security/2026-10-07_rls_anon_read_DRAFT.sql` (infinith-demo 화면 영향 확인 후 실행) 2. 데이터베이스 익명 읽기·쓰기 정리: 2026-10-07 실행 (`docs/security/2026-10-07_rls_anon_lockdown.sql`). 데모 화면은 서버 함수 `api/db.js` 로 조회한다
3. `src/lib/supabase.ts` 가 공개 번들에 들어가게 되므로 번들 검사 `secrets` 의 Supabase 항목을 어떻게 다룰지 결정 3. `src/lib/supabase.ts` 가 공개 번들에 들어가게 되므로 번들 검사 `secrets` 의 Supabase 항목을 어떻게 다룰지 결정
4. 진단 신청 모달(`DiscoveryLeadModal.tsx`, 현재 미사용)은 신청마다 자동 빌드 큐(`supporter_builds`)에 넣는다. 공개 폼에 다시 붙이려면 사람 승인 단계를 먼저 둔다. 4. 예전 진단 신청 모달(신청마다 자동 빌드 큐 `supporter_builds` 에 넣던 것)은 2026-10-07 삭제했다. 빌드 큐 쓰기는 이제 서버 함수(`api/db.js` 의 `builds.queue`)만 할 수 있다. 공개 폼에서 빌드를 받으려면 사람 승인 단계를 먼저 둔다.
@@ -1,18 +1,16 @@
-- ════════════════════════════════════════════════════════════════════════ -- ════════════════════════════════════════════════════════════════════════
-- 초안 (실행하지 않음) · 2026-10-07 -- 익명(anon) 키로 테이블을 읽고 쓰던 RLS 정책 정리 · 2026-10-07
-- 익명(anon) 키로 실제 병원 데이터를 읽을 수 있는 RLS 정책 정리
-- --
-- 확인한 사실 (2026-10-07, anon 키로 행 수만 조회): -- 확인한 사실 (2026-10-07, anon 키로 행 수만 조회):
-- marketing_reports 103 · clinics 12 · channel_snapshots 189 · analysis_runs 53 -- marketing_reports 103 · clinics 12 · analysis_runs 53 · channel_snapshots 189 · screenshots 112
-- supporter_builds 3 · supporter_inputs 2 행이 anon 키로 읽힌다. -- content_plans 6 · supporter_builds 3 · supporter_inputs 2 행이 anon 키로 읽혔다.
-- anon 키는 infinith-demo 번들에 공개로 들어 있다 (webforai.kr 번들에서는 2026-10-07 c2e7d5a 로 제거). -- anon 키는 webforai.kr 번들(2026-10-07 c2e7d5a 로 제거)과 infinith-demo 번들에 공개로 들어 있었다.
-- --
-- 실행 전 확인할 것 (haewon 결정 필요): -- 선행 조건 (2026-10-07 완료):
-- 1. infinith-demo 의 리포트·플랜·스튜디오·병원 확인 화면(/report, /plan, /clinic, /supporters, /build)은 -- infinith-demo 화면의 조회·쓰기를 서버 함수 api/db.js(service role)로 옮겼다.
-- anon 키로 이 테이블을 읽는다. 아래를 실행하면 그 화면들이 빈 화면이 된다. -- 워커(workers/supporters-build), Edge Function, scripts/* 는 service role 키를 쓴다. 이 SQL 의 영향을 받지 않는다.
-- 대안: 로그인(Supabase Auth) 도입 후 authenticated 로 바꾸거나, 읽기를 Edge Function(service role) 뒤로 옮긴다. --
-- 2. 운영 DB 변경이다. 실행 전에 영향 범위를 확인받고, Supabase 대시보드 SQL 편집기에서 실행한다. -- 되돌리기: 각 정책을 아래 주석의 마이그레이션 파일에 있는 CREATE POLICY 문으로 다시 만든다.
-- 3. 되돌리기: 각 정책을 원래 마이그레이션의 CREATE POLICY 문으로 다시 만들면 된다 (파일명은 아래 주석).
-- ════════════════════════════════════════════════════════════════════════ -- ════════════════════════════════════════════════════════════════════════
begin; begin;
@@ -36,6 +34,13 @@ drop policy if exists "public_read_registry" on public.clinic_registry;
-- 20260907_supporter_builds.sql -- 20260907_supporter_builds.sql
drop policy if exists "anon can read builds" on public.supporter_builds; drop policy if exists "anon can read builds" on public.supporter_builds;
drop policy if exists "anon can read inputs" on public.supporter_inputs; drop policy if exists "anon can read inputs" on public.supporter_inputs;
drop policy if exists "anon can insert inputs" on public.supporter_inputs;
-- 20260907_supporter_builds_queue.sql (익명 빌드 큐 등록: 등록되면 워커가 빌드·배포를 시작한다)
drop policy if exists "anon can queue builds" on public.supporter_builds;
-- 20260831_discovery_leads.sql (예전 진단 신청 폼. 지금은 쓰는 코드가 없다)
drop policy if exists "anon can insert discovery leads" on public.discovery_leads;
-- 스토리지 버킷의 공개 읽기(20260407_screenshots_storage.sql "public_read_screenshots")는 -- 스토리지 버킷의 공개 읽기(20260407_screenshots_storage.sql "public_read_screenshots")는
-- 병원 채널 스크린샷 이미지다. 버킷 공개 여부와 함께 별도로 결정한다. -- 병원 채널 스크린샷 이미지다. 버킷 공개 여부와 함께 별도로 결정한다.
+4 -3
View File
@@ -132,7 +132,7 @@ def playfair(size: int) -> ImageFont.FreeTypeFont:
return font("ExtraBold", size) return font("ExtraBold", size)
def supporters(site: Path): def supporters(site: Path, eyebrow: str = "SUPPORTERS · FOR INTERNATIONAL PATIENTS"):
"""해외 환자가 받는 링크라 영어로 낸다. 병원 영문 표기는 site.json shareNameEn(병원 공식 영문 표기, briefs 에서 전달)만 쓴다. """해외 환자가 받는 링크라 영어로 낸다. 병원 영문 표기는 site.json shareNameEn(병원 공식 영문 표기, briefs 에서 전달)만 쓴다.
값이 없으면 한국어 상호를 그대로 쓴다. 영문 이름을 지어내지 않는다.""" 값이 없으면 한국어 상호를 그대로 쓴다. 영문 이름을 지어내지 않는다."""
data = site / "src/data" data = site / "src/data"
@@ -163,7 +163,7 @@ def supporters(site: Path):
img.paste(ph, (panel_w, 0)) img.paste(ph, (panel_w, 0))
d = ImageDraw.Draw(img) d = ImageDraw.Draw(img)
x, max_w = 72, panel_w - 72 * 2 x, max_w = 72, panel_w - 72 * 2
d.text((x, 78), "SUPPORTERS · FOR INTERNATIONAL PATIENTS", font=font("SemiBold", 24), fill=LAVENDER) d.text((x, 78), eyebrow, font=font("SemiBold", 24), fill=LAVENDER)
name_f = playfair(72) name_f = playfair(72)
while max(d.textlength(w, font=name_f) for w in name.split(" ")) > max_w and name_f.size > 44: while max(d.textlength(w, font=name_f) for w in name.split(" ")) > max_w and name_f.size > 44:
name_f = playfair(name_f.size - 4) name_f = playfair(name_f.size - 4)
@@ -196,12 +196,13 @@ def main():
sub = ap.add_subparsers(dest="mode", required=True) sub = ap.add_subparsers(dest="mode", required=True)
a = sub.add_parser("discovery"); a.add_argument("--out", default="public") a = sub.add_parser("discovery"); a.add_argument("--out", default="public")
b = sub.add_parser("supporters"); b.add_argument("--site", required=True) b = sub.add_parser("supporters"); b.add_argument("--site", required=True)
b.add_argument("--eyebrow", default="SUPPORTERS · FOR INTERNATIONAL PATIENTS", help="이미지 상단 문구 (병원별 사이트 명칭이 다를 때)")
args = ap.parse_args() args = ap.parse_args()
if args.mode == "discovery": if args.mode == "discovery":
out = Path(args.out); out.mkdir(parents=True, exist_ok=True) out = Path(args.out); out.mkdir(parents=True, exist_ok=True)
files = discovery(out) files = discovery(out)
else: else:
files = supporters(Path(args.site).expanduser()) files = supporters(Path(args.site).expanduser(), args.eyebrow)
print("공유 이미지·파비콘: " + ", ".join(files)) print("공유 이미지·파비콘: " + ", ".join(files))
+1 -3
View File
@@ -3,9 +3,7 @@
* *
* - 이름·회사·전화·이메일·문의내용 → Apps Script 웹앱 → 구글시트 적재 + 알림 메일 * - 이름·회사·전화·이메일·문의내용 → Apps Script 웹앱 → 구글시트 적재 + 알림 메일
* - 전송 실패 시 성공한 척하지 않고 mailto 폴백을 보여준다 (정직성 규약). * - 전송 실패 시 성공한 척하지 않고 mailto 폴백을 보여준다 (정직성 규약).
* DiscoveryLeadModal 과 같은 규칙이다. * - 공개 사이트의 문의·진단 요청은 모두 이 모달 하나로 받는다 (예전 진단 신청 모달은 2026-10-07 삭제).
* - 화면 구조·색·버튼은 DiscoveryLeadModal 을 그대로 따른다. 같은 사이트에서 모달이
* 두 종류로 보이지 않게 하기 위해서다.
*/ */
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { createPortal } from 'react-dom'; import { createPortal } from 'react-dom';
@@ -11,7 +11,7 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router'; import { useNavigate } from 'react-router';
import { motion } from 'motion/react'; import { motion } from 'motion/react';
import { supabase } from '../../lib/supabase'; import { db } from '../../lib/db';
import { STATE_LABEL } from '../../lib/buildPhases'; import { STATE_LABEL } from '../../lib/buildPhases';
import type { BuildState } from '../../lib/buildPhases'; import type { BuildState } from '../../lib/buildPhases';
import { weakSpots } from '../../lib/buildCoverage'; import { weakSpots } from '../../lib/buildCoverage';
@@ -39,8 +39,7 @@ export function BuildPlanSection({ result, overall, summary }: Props) {
useEffect(() => { useEffect(() => {
let alive = true; let alive = true;
void (async () => { void (async () => {
const { data } = await supabase.from('supporter_builds').select('status') const { data } = await db<Array<{ status: string }>>('builds.latest', { clinicId: result.id, fields: 'status' });
.eq('clinic_id', result.id).order('created_at', { ascending: false }).limit(1);
if (!alive) return; if (!alive) return;
setExisting((data?.[0]?.status as BuildState) ?? null); setExisting((data?.[0]?.status as BuildState) ?? null);
setChecking(false); setChecking(false);
@@ -50,13 +49,11 @@ export function BuildPlanSection({ result, overall, summary }: Props) {
async function approve() { async function approve() {
setBusy(true); setError(null); setBusy(true); setError(null);
await supabase.from('supporter_inputs').insert({ await db('inputs.add', {
clinic_id: result.id, key: 'report_approval', clinicId: result.id, key: 'report_approval',
value: { ...summary, weakSpots: weak.map((w) => w.id), approvedAt: new Date().toISOString() }, value: { ...summary, weakSpots: weak.map((w) => w.id), approvedAt: new Date().toISOString() },
}); });
const { error: e } = await supabase.from('supporter_builds').insert({ const { error: e } = await db('builds.queue', { clinicId: result.id, clinicName: result.clinicName, url: result.url });
clinic_id: result.id, clinic_name: result.clinicName, url: result.url, status: 'queued',
});
setBusy(false); setBusy(false);
if (e) { setError(e.message); return; } if (e) { setError(e.message); return; }
navigate(`/build/${result.id}`); navigate(`/build/${result.id}`);
@@ -7,7 +7,7 @@
* - 의학 검토·게시 승인은 사람 게이트다(§3-7). 후보만 보여주고 확정은 병원이 입력한다. * - 의학 검토·게시 승인은 사람 게이트다(§3-7). 후보만 보여주고 확정은 병원이 입력한다.
*/ */
import { useEffect, useMemo, useState } from 'react'; import { useEffect, useMemo, useState } from 'react';
import { supabase } from '../../lib/supabase'; import { db } from '../../lib/db';
type Build = { type Build = {
id: string; id: string;
@@ -61,8 +61,8 @@ export function ClinicInputsPanel({ clinicId }: { clinicId: string }) {
let alive = true; let alive = true;
(async () => { (async () => {
const [b, i] = await Promise.all([ const [b, i] = await Promise.all([
supabase.from('supporter_builds').select('id,status,phase,preview_url,posts,report,updated_at').eq('clinic_id', clinicId).order('created_at', { ascending: false }).limit(1), db<Build[]>('builds.latest', { clinicId, fields: 'inputs' }),
supabase.from('supporter_inputs').select('key,post_id,value,input_by,created_at').eq('clinic_id', clinicId).order('created_at', { ascending: true }), db<InputRow[]>('inputs.list', { clinicId }),
]); ]);
if (!alive) return; if (!alive) return;
if (b.error || i.error) { setLoadError((b.error ?? i.error)?.message ?? '불러오기 실패'); return; } if (b.error || i.error) { setLoadError((b.error ?? i.error)?.message ?? '불러오기 실패'); return; }
@@ -82,7 +82,7 @@ export function ClinicInputsPanel({ clinicId }: { clinicId: string }) {
async function save(key: string, value: Record<string, unknown>, postId?: string) { async function save(key: string, value: Record<string, unknown>, postId?: string) {
setBusy(`${key}|${postId ?? ''}`); setMsg(null); setBusy(`${key}|${postId ?? ''}`); setMsg(null);
const { error } = await supabase.from('supporter_inputs').insert({ clinic_id: clinicId, key, post_id: postId ?? null, value, input_by: inputBy || null }); const { error } = await db('inputs.add', { clinicId, key, postId: postId ?? null, value, inputBy: inputBy || null });
setBusy(null); setBusy(null);
if (error) { setMsg(`저장 실패: ${error.message}`); return; } if (error) { setMsg(`저장 실패: ${error.message}`); return; }
setRows((prev) => [...prev, { key, post_id: postId ?? null, value, input_by: inputBy || null, created_at: new Date().toISOString() }]); setRows((prev) => [...prev, { key, post_id: postId ?? null, value, input_by: inputBy || null, created_at: new Date().toISOString() }]);
@@ -1,227 +0,0 @@
/**
* "URL 입력으로 시작하기" 진단 신청 모달.
*
* - 병원 URL(필수) + 회신 연락처(필수) + 상호(선택) → Supabase discovery_leads insert
* - RLS는 anon insert만 허용 (조회는 service_role 전용)
* - 저장 실패 시 성공한 척하지 않고 mailto 폴백을 보여준다 (정직성 규약)
*/
import { useEffect, useState } from 'react';
import { AnimatePresence, motion } from 'motion/react';
import { ArrowRight } from 'lucide-react';
import { supabase } from '../../lib/supabase';
import { DISCOVERY_CONTACT_EMAIL } from './discoveryContact';
interface DiscoveryLeadModalProps {
open: boolean;
onClose: () => void;
}
type SubmitState = 'idle' | 'submitting' | 'done' | 'error';
/** 스킴이 없으면 https://를 붙이고, 호스트에 점이 있어야 유효로 본다 */
const normalizeUrl = (raw: string): string | null => {
const trimmed = raw.trim();
if (!trimmed) return null;
const withScheme = /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
try {
const u = new URL(withScheme);
if (!u.hostname.includes('.')) return null;
return u.toString();
} catch {
return null;
}
};
export default function DiscoveryLeadModal({ open, onClose }: DiscoveryLeadModalProps) {
const [url, setUrl] = useState('');
const [clinicName, setClinicName] = useState('');
const [contact, setContact] = useState('');
const [state, setState] = useState<SubmitState>('idle');
const [fieldError, setFieldError] = useState<string | null>(null);
useEffect(() => {
if (!open) return;
const onKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') onClose();
};
window.addEventListener('keydown', onKey);
return () => window.removeEventListener('keydown', onKey);
}, [open, onClose]);
// @types/react 미설치 프로젝트 방침이라 React.FormEvent 대신 구조적 타입 사용
const handleSubmit = async (e: { preventDefault: () => void }) => {
e.preventDefault();
const normalized = normalizeUrl(url);
if (!normalized) {
setFieldError('URL 형식을 확인해 주세요. 예: viewclinic.com');
return;
}
if (!contact.trim()) {
setFieldError('진단 결과를 받을 이메일 또는 전화번호를 입력해 주세요.');
return;
}
setFieldError(null);
setState('submitting');
// discovery_leads 는 anon 조회 정책이 없어 insert 반환값을 읽지 않는다.
const { error } = await supabase.from('discovery_leads').insert({
url: normalized,
clinic_name: clinicName.trim() || null,
contact: contact.trim(),
source: 'discovery_landing',
});
// 서포터즈 자동 빌드 큐(supporter_builds, status=queued). 워커(workers/supporters-build/poll.mjs)가 집어 간다.
// clinic_id 는 홈페이지 호스트에서 만든다 (www.k-wonjin.co.kr → k-wonjin). 큐 삽입이 실패해도 신청 자체는 접수된 것으로 본다.
if (!error) {
const host = (() => { try { return new URL(normalized).host; } catch { return normalized; } })();
const clinicId = host.replace(/^www\./, '').split('.')[0].toLowerCase().replace(/[^a-z0-9-]/g, '') || 'clinic';
await supabase.from('supporter_builds').insert({ clinic_id: clinicId, url: normalized, status: 'queued', clinic_name: clinicName.trim() || null });
}
setState(error ? 'error' : 'done');
};
const fallbackMailto = () => {
const body = `병원/업체 URL: ${url}\n상호: ${clinicName || '-'}\n회신 연락처: ${contact}`;
return `mailto:${DISCOVERY_CONTACT_EMAIL}?subject=${encodeURIComponent(
'[INFINITH AI Discovery] 무료 진단 신청',
)}&body=${encodeURIComponent(body)}`;
};
return (
<AnimatePresence>
{open && (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="on-dark fixed inset-0 z-50 flex items-center justify-center px-6 bg-[#0A1128]/60 backdrop-blur-sm"
onClick={onClose}
data-no-print
>
<motion.div
initial={{ opacity: 0, y: 24, scale: 0.98 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={{ opacity: 0, y: 24, scale: 0.98 }}
transition={{ duration: 0.25 }}
className="on-light relative w-full max-w-md bg-white rounded-2xl shadow-2xl p-8"
onClick={(e) => e.stopPropagation()}
role="dialog"
aria-modal="true"
aria-label="무료 AEO/GEO 진단 신청"
>
{/* 닫기 (커스텀 filled SVG — 라인 아이콘 금지 규칙) */}
<button
type="button"
onClick={onClose}
aria-label="닫기"
className="absolute top-4 right-4 w-8 h-8 flex items-center justify-center rounded-full bg-slate-100 hover:bg-slate-200 transition-colors"
>
<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true">
<path
d="M2.3 0.9 6 4.6 9.7 0.9a1 1 0 0 1 1.4 1.4L7.4 6l3.7 3.7a1 1 0 0 1-1.4 1.4L6 7.4 2.3 11.1a1 1 0 0 1-1.4-1.4L4.6 6 0.9 2.3A1 1 0 0 1 2.3 0.9Z"
fill="#0A1128"
/>
</svg>
</button>
{state === 'done' ? (
<div className="flex flex-col items-center text-center py-4">
<div className="w-14 h-14 rounded-full bg-[#F3F0FF] flex items-center justify-center mb-5">
<svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true">
<path
d="M9.6 16.2 4.8 11.4a1.2 1.2 0 0 1 1.7-1.7l3.1 3.1 7.9-7.9a1.2 1.2 0 0 1 1.7 1.7l-8.8 8.8a1.2 1.2 0 0 1-1.7 0Z"
fill="#6C5CE7"
/>
</svg>
</div>
<h3 className="text-lg font-bold text-primary-900 mb-2">신청이 접수되었습니다</h3>
<p className="ui-body mb-6">
입력하신 URL을 실측 진단한 뒤, 남겨주신 연락처로 리포트를 안내드립니다.
<br />
문의: {DISCOVERY_CONTACT_EMAIL}
</p>
<button
type="button"
onClick={onClose}
className="inline-flex items-center h-11 px-8 bg-gradient-to-r from-[#4F1DA1] to-[#021341] rounded-full text-sm font-bold text-white hover:opacity-90 transition-opacity"
>
확인
</button>
</div>
) : (
<form onSubmit={handleSubmit}>
<h3 className="text-xl font-bold text-primary-900 mb-1.5">URL 입력으로 시작하기</h3>
<p className="ui-body mb-6">
병원 홈페이지 URL만 입력하면 AI 검색 인용 가능성을 실측 진단합니다. 진단은
무료입니다.
</p>
<label className="block text-xs font-semibold text-slate-500 mb-1.5">
병원/업체 홈페이지 URL <span className="text-[#7C3A4B]">*</span>
</label>
<input
type="text"
value={url}
onChange={(e) => setUrl(e.target.value)}
placeholder="viewclinic.com"
autoFocus
className="w-full h-12 px-4 mb-4 rounded-xl border border-slate-200 bg-[linear-gradient(to_right,#fff3eb,#e4cfff,#f5f9ff)] text-[15px] text-primary-900 placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-[#6C5CE7]/40"
/>
<label className="block text-xs font-semibold text-slate-500 mb-1.5">
상호 <span className="text-slate-400 font-normal">(선택)</span>
</label>
<input
type="text"
value={clinicName}
onChange={(e) => setClinicName(e.target.value)}
placeholder="뷰성형외과"
className="on-light w-full h-12 px-4 mb-4 rounded-xl border border-slate-200 bg-white text-[15px] text-primary-900 placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-[#6C5CE7]/40"
/>
<label className="block text-xs font-semibold text-slate-500 mb-1.5">
진단 결과 받을 이메일/전화 <span className="text-[#7C3A4B]">*</span>
</label>
<input
type="text"
value={contact}
onChange={(e) => setContact(e.target.value)}
placeholder="marketing@clinic.com"
className="on-light w-full h-12 px-4 mb-4 rounded-xl border border-slate-200 bg-white text-[15px] text-primary-900 placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-[#6C5CE7]/40"
/>
{fieldError && (
<p className="text-[13px] text-[#7C3A4B] bg-[#FFF0F0] border border-[#F5D5DC] rounded-lg px-3.5 py-2.5 mb-4">
{fieldError}
</p>
)}
{state === 'error' && (
<p className="text-[13px] leading-relaxed text-[#7C5C3A] bg-[#FFF6ED] border border-[#F5E0C5] rounded-lg px-3.5 py-2.5 mb-4">
저장에 실패했습니다. 아래 이메일로 직접 신청해 주세요.
<br />
<a href={fallbackMailto()} className="font-semibold underline">
{DISCOVERY_CONTACT_EMAIL}로 신청 메일 보내기
</a>
</p>
)}
<button
type="submit"
disabled={state === 'submitting'}
className="w-full inline-flex items-center justify-center gap-2 h-[52px] bg-gradient-to-r from-[#4F1DA1] to-[#021341] rounded-full text-base font-bold text-white hover:opacity-90 transition-opacity disabled:opacity-60"
>
{state === 'submitting' ? '접수 중…' : '무료 진단 신청'}
{state !== 'submitting' && <ArrowRight className="w-5 h-5" />}
</button>
<p className="text-xs text-slate-400 text-center mt-4">
입력 정보는 진단 회신 용도로만 사용합니다.
</p>
</form>
)}
</motion.div>
</motion.div>
)}
</AnimatePresence>
);
}
@@ -7,7 +7,7 @@
*/ */
import { useEffect, useMemo, useState } from 'react'; import { useEffect, useMemo, useState } from 'react';
import { motion, AnimatePresence } from 'motion/react'; import { motion, AnimatePresence } from 'motion/react';
import { supabase } from '../../lib/supabase'; import { db } from '../../lib/db';
import { CheckFilled, CrossFilled, EyeFilled, WarningFilled, LinkExternalFilled } from '../icons/FilledIcons'; import { CheckFilled, CrossFilled, EyeFilled, WarningFilled, LinkExternalFilled } from '../icons/FilledIcons';
type Role = 'hero' | 'used' | 'stored'; type Role = 'hero' | 'used' | 'stored';
@@ -67,8 +67,8 @@ export function ImageReviewPanel({ clinicId }: { clinicId: string }) {
let alive = true; let alive = true;
void (async () => { void (async () => {
const [b, inputs] = await Promise.all([ const [b, inputs] = await Promise.all([
supabase.from('supporter_builds').select('id,status,preview_url,report,updated_at').eq('clinic_id', clinicId).order('created_at', { ascending: false }).limit(1), db<Build[]>('builds.latest', { clinicId, fields: 'image' }),
supabase.from('supporter_inputs').select('value,input_by,created_at').eq('clinic_id', clinicId).eq('key', 'image_review').order('created_at', { ascending: true }), db<Array<{ value: Record<string, unknown>; input_by: string | null; created_at: string }>>('inputs.list', { clinicId, key: 'image_review' }),
]); ]);
if (!alive) return; if (!alive) return;
if (b.error) setLoadError(b.error.message); if (b.error) setLoadError(b.error.message);
@@ -103,11 +103,11 @@ export function ImageReviewPanel({ clinicId }: { clinicId: string }) {
async function save() { async function save() {
setSaving(true); setSaving(true);
setSaveError(null); setSaveError(null);
const { error } = await supabase.from('supporter_inputs').insert({ const { error } = await db('inputs.add', {
clinic_id: clinicId, clinicId,
key: 'image_review', key: 'image_review',
value: { decisions, excludeImages: excluded.map((i) => i.id), total: items.length, decidedAt: new Date().toISOString() }, value: { decisions, excludeImages: excluded.map((i) => i.id), total: items.length, decidedAt: new Date().toISOString() },
input_by: inputBy.trim() || null, inputBy: inputBy.trim() || null,
}); });
setSaving(false); setSaving(false);
if (error) { setSaveError(error.message); return; } if (error) { setSaveError(error.message); return; }
@@ -2,7 +2,8 @@ import { useState, useEffect } from 'react';
import { motion } from 'motion/react'; import { motion } from 'motion/react';
import { SectionWrapper } from '../report/ui/SectionWrapper'; import { SectionWrapper } from '../report/ui/SectionWrapper';
import { MegaphoneFilled } from '../icons/FilledIcons'; import { MegaphoneFilled } from '../icons/FilledIcons';
import { supabase, triggerStrategyAdjustment } from '../../lib/supabase'; import { triggerStrategyAdjustment } from '../../lib/supabase';
import { db } from '../../lib/db';
interface StrategyAdjustmentSectionProps { interface StrategyAdjustmentSectionProps {
clinicId: string | null; clinicId: string | null;
@@ -68,13 +69,7 @@ export default function StrategyAdjustmentSection({ clinicId, planId }: Strategy
setIsLoading(true); setIsLoading(true);
try { try {
// Load latest performance metrics // Load latest performance metrics
const { data: perf } = await supabase const { data: perf } = await db<{ kpi_progress: unknown; strategy_suggestions: unknown }>('perf.latest', { clinicId: clinicId! });
.from('performance_metrics')
.select('kpi_progress, strategy_suggestions')
.eq('clinic_id', clinicId!)
.order('created_at', { ascending: false })
.limit(1)
.single();
if (perf) { if (perf) {
setKpiProgress((perf.kpi_progress as KpiProgress[]) || []); setKpiProgress((perf.kpi_progress as KpiProgress[]) || []);
@@ -83,12 +78,7 @@ export default function StrategyAdjustmentSection({ clinicId, planId }: Strategy
} }
// Load adjustment history // Load adjustment history
const { data: adj } = await supabase const { data: adj } = await db<AdjustmentHistoryItem[]>('adjustments.list', { clinicId: clinicId! });
.from('strategy_adjustments')
.select('id, adjustment_type, description, reason, created_at')
.eq('clinic_id', clinicId!)
.order('created_at', { ascending: false })
.limit(10);
if (adj) setHistory(adj); if (adj) setHistory(adj);
} catch { } catch {
+4 -11
View File
@@ -1,7 +1,8 @@
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { useLocation } from 'react-router'; import { useLocation } from 'react-router';
import type { MarketingPlan, ChannelStrategyCard, CalendarData, ContentStrategyData } from '../types/plan'; import type { MarketingPlan, ChannelStrategyCard, CalendarData, ContentStrategyData } from '../types/plan';
import { fetchReportById, fetchActiveContentPlan, supabase } from '../lib/supabase'; import { fetchReportById, fetchActiveContentPlan } from '../lib/supabase';
import { db } from '../lib/db';
import { transformReportToPlan } from '../lib/transformPlan'; import { transformReportToPlan } from '../lib/transformPlan';
import { mockPlan } from '../data/mockPlan'; import { mockPlan } from '../data/mockPlan';
import { mockPlanBanobagi } from '../data/mockPlan_banobagi'; import { mockPlanBanobagi } from '../data/mockPlan_banobagi';
@@ -125,21 +126,13 @@ export function useMarketingPlan(id: string | undefined): UseMarketingPlanResult
if (!clinicId) { if (!clinicId) {
// Try to find clinicId from analysis_runs by run/report ID // Try to find clinicId from analysis_runs by run/report ID
const { data: run } = await supabase const { data: run } = await db<{ clinic_id: string }>('run.clinicId', { id });
.from('analysis_runs')
.select('clinic_id')
.eq('id', id)
.single();
if (run) clinicId = run.clinic_id; if (run) clinicId = run.clinic_id;
} }
if (clinicId) { if (clinicId) {
// Fetch clinic info for plan metadata // Fetch clinic info for plan metadata
const { data: clinic } = await supabase const { data: clinic } = await db<{ name: string | null; name_en: string | null; url: string | null }>('clinic.byId', { id: clinicId });
.from('clinics')
.select('name, name_en, url')
.eq('id', clinicId)
.single();
if (clinic) { if (clinic) {
clinicName = clinic.name || ''; clinicName = clinic.name || '';
clinicNameEn = clinic.name_en || ''; clinicNameEn = clinic.name_en || '';
+31
View File
@@ -0,0 +1,31 @@
/**
* 데이터베이스 조회·쓰기. 브라우저는 테이블에 직접 접근하지 않고 서버 함수(api/db.js)의 정해진 작업만 부른다.
* 공개 키로 테이블을 읽고 쓰던 구조를 없애기 위한 것이다 (2026-10-07). 반환 형태는 Supabase 클라이언트와 같은 { data, error }.
*/
export type DbOp =
| 'report.byId' | 'report.status'
| 'run.clinicId' | 'clinic.byId' | 'plan.active' | 'plan.updateEntry'
| 'perf.latest' | 'adjustments.list'
| 'builds.latest' | 'builds.queue' | 'inputs.list' | 'inputs.add';
export interface DbResult<T> {
data: T | null;
error: { message: string; code?: string | null } | null;
}
export async function db<T = unknown>(op: DbOp, params: Record<string, unknown> = {}): Promise<DbResult<T>> {
try {
const res = await fetch('/api/db', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ op, params }),
});
const body = (await res.json().catch(() => null)) as DbResult<T> | null;
if (!body) return { data: null, error: { message: `서버 응답 오류 (${res.status})` } };
return body;
} catch (e) {
console.error(`[db] ${op} 연결 실패`, e);
return { data: null, error: { message: '서버에 연결할 수 없습니다' } };
}
}
+12 -45
View File
@@ -1,9 +1,10 @@
import { createClient } from "@supabase/supabase-js"; import { db } from "./db";
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL; const supabaseUrl = import.meta.env.VITE_SUPABASE_URL;
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY; const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY;
export const supabase = createClient(supabaseUrl, supabaseAnonKey); // 테이블 조회·쓰기는 서버 함수(api/db.js)를 거친다 (src/lib/db.ts). 브라우저에는 테이블 권한이 없다.
// 아래 주소와 공개 키는 Edge Function 호출(fnHeaders)에만 쓴다.
/** Common headers for Edge Function calls (includes JWT auth) */ /** Common headers for Edge Function calls (includes JWT auth) */
const fnHeaders = () => ({ const fnHeaders = () => ({
@@ -29,11 +30,8 @@ export async function generateMarketingReport(url: string, clinicName?: string)
} }
export async function fetchReportById(reportId: string) { export async function fetchReportById(reportId: string) {
const { data, error } = await supabase // 예전 Supabase 클라이언트처럼 행 형태를 호출하는 쪽이 정한다.
.from("marketing_reports") const { data, error } = await db<any>("report.byId", { id: reportId });
.select("*")
.eq("id", reportId)
.single();
if (error) throw new Error(`Failed to fetch report: ${error.message}`); if (error) throw new Error(`Failed to fetch report: ${error.message}`);
return data; return data;
@@ -54,11 +52,10 @@ export interface PipelineStatus {
} }
export async function fetchPipelineStatus(reportId: string): Promise<PipelineStatus> { export async function fetchPipelineStatus(reportId: string): Promise<PipelineStatus> {
const { data, error } = await supabase const { data, error } = await db<{
.from("marketing_reports") id: string; status: string | null; clinic_name?: string;
.select("id, status, clinic_name, channel_data, report") channel_data: Record<string, unknown> | null; report: Record<string, unknown> | null;
.eq("id", reportId) }>("report.status", { id: reportId });
.single();
if (error || !data) throw new Error(`Report not found: ${error?.message}`); if (error || !data) throw new Error(`Report not found: ${error?.message}`);
@@ -240,14 +237,7 @@ export async function generateContentPlan(reportId: string, clinicId?: string, r
* Returns the most recent is_active=true plan with all JSONB columns. * Returns the most recent is_active=true plan with all JSONB columns.
*/ */
export async function fetchActiveContentPlan(clinicId: string) { export async function fetchActiveContentPlan(clinicId: string) {
const { data, error } = await supabase const { data, error } = await db<any>("plan.active", { clinicId });
.from("content_plans")
.select("*")
.eq("clinic_id", clinicId)
.eq("is_active", true)
.order("created_at", { ascending: false })
.limit(1)
.single();
if (error) return null; if (error) return null;
return data; return data;
@@ -262,31 +252,8 @@ export async function updateCalendarEntry(
entryId: string, entryId: string,
updates: Record<string, unknown>, updates: Record<string, unknown>,
) { ) {
// Read current calendar // 읽기·수정·저장을 서버 함수가 한 번에 한다.
const { data: plan, error: readErr } = await supabase const { error: writeErr } = await db("plan.updateEntry", { planId, entryId, updates });
.from("content_plans")
.select("calendar")
.eq("id", planId)
.single();
if (readErr || !plan) throw new Error(`Plan not found: ${readErr?.message}`);
const calendar = plan.calendar as { weeks: { entries: Record<string, unknown>[] }[] };
// Find and update entry
for (const week of calendar.weeks) {
for (let i = 0; i < week.entries.length; i++) {
if (week.entries[i].id === entryId) {
week.entries[i] = { ...week.entries[i], ...updates, isManualEdit: true };
break;
}
}
}
const { error: writeErr } = await supabase
.from("content_plans")
.update({ calendar })
.eq("id", planId);
if (writeErr) throw new Error(`Update failed: ${writeErr.message}`); if (writeErr) throw new Error(`Update failed: ${writeErr.message}`);
} }
+2 -7
View File
@@ -8,7 +8,7 @@
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import { useParams, Link } from 'react-router'; import { useParams, Link } from 'react-router';
import { motion } from 'motion/react'; import { motion } from 'motion/react';
import { supabase } from '../lib/supabase'; import { db } from '../lib/db';
import { BUILD_STEPS, STATE_LABEL, progressOf, stepStates, warningsOf } from '../lib/buildPhases'; import { BUILD_STEPS, STATE_LABEL, progressOf, stepStates, warningsOf } from '../lib/buildPhases';
import type { BuildState, PhaseRow } from '../lib/buildPhases'; import type { BuildState, PhaseRow } from '../lib/buildPhases';
import { CheckFilled, WarningFilled, EyeFilled, PrismFilled } from '../components/icons/FilledIcons'; import { CheckFilled, WarningFilled, EyeFilled, PrismFilled } from '../components/icons/FilledIcons';
@@ -40,12 +40,7 @@ export default function SiteBuildPage() {
let alive = true; let alive = true;
async function tick() { async function tick() {
const { data, error } = await supabase const { data, error } = await db<Build[]>('builds.latest', { clinicId: id, fields: 'site' });
.from('supporter_builds')
.select('id,clinic_id,clinic_name,status,phase,phases,posts,preview_url,error,updated_at')
.eq('clinic_id', id)
.order('created_at', { ascending: false })
.limit(1);
if (!alive) return; if (!alive) return;
if (error) setLoadError(error.message); if (error) setLoadError(error.message);
const row = (data?.[0] as Build) ?? null; const row = (data?.[0] as Build) ?? null;
+510
View File
@@ -0,0 +1,510 @@
{
"_comment": "모프로의원 AI 공식답변허브페이지 첫 배치 8편. 2026-10-08 Claude 작성(haewon 확인 전). 진단(docs/reports/mopro)에서 4개 AI 표면 모두 병원명 언급 0이었던 정보형 질문 중심. 노션 인터뷰는 출처 링크를 노출하지 않도록 sources 를 직접 준다.",
"clinic": "mopro",
"posts": [
{
"id": "graft-survival",
"title": "모발이식 생착률은 보통 얼마이고, 무엇이 생착률을 좌우하나요?",
"category": "D",
"categoryLabel": "시술 정보",
"qbIds": [],
"intent": "생착률을 병원이 홍보하는 숫자로 쓰지 않는다. 생착에 영향을 주는 요인(채취·보관·식모·두피 상태·수술 후 관리)을 근거 페이지 범위에서 정리하고, 모프로의원 페이지의 '95% 이상 생착률 지향'은 '병원이 목표로 밝힌 값이며 개인차가 있다'로만 다룬다. 측정 기준이 공개돼 있지 않다는 점을 적는다.",
"mustCover": [
"생착에 영향을 주는 요인 표",
"수술 후 관리 중 생착과 관련된 항목",
"상담에서 확인할 것 3개"
],
"avoid": [
"전후 사진",
"환자 개별 사례·후기·실명",
"금액",
"다른 병원 비교·순위",
"효과 보장·생착률 보장",
"'최초'·'1호'·'최고' 같은 최상급 표현"
],
"evidence": {
"pages": [
"https://mopro.co.kr/hair-transplant/man/",
"https://mopro.co.kr/hair-transplant/woman/",
"https://mopro.co.kr/hair-transplant/method/",
"https://mopro.co.kr/hair-transplant/revision/",
"https://mopro.co.kr/%ec%9e%90%ec%a3%bc-%eb%ac%bb%eb%8a%94-%ec%a7%88%eb%ac%b8/",
"https://app.notion.com/p/3ef0af2241ae80faae8df171529fc31b"
],
"shorts": [],
"news": [],
"regulation": [],
"platform": false
},
"sources": [
{
"label": "모프로의원 홈페이지 · 남성 모발이식",
"url": "https://mopro.co.kr/hair-transplant/man/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 여성 모발이식·헤어라인 교정",
"url": "https://mopro.co.kr/hair-transplant/woman/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 절개·비절개 모발이식 비교",
"url": "https://mopro.co.kr/hair-transplant/method/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 모발이식 재수술",
"url": "https://mopro.co.kr/hair-transplant/revision/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 모발이식 자주 묻는 질문",
"url": "https://mopro.co.kr/%ec%9e%90%ec%a3%bc-%eb%ac%bb%eb%8a%94-%ec%a7%88%eb%ac%b8/",
"type": "clinic"
},
{
"label": "문건학 원장 인터뷰 초안 (병원 제공 자료, 게재 전 확인 대기)",
"url": "",
"type": "clinic"
}
],
"videos": [],
"gallery": []
},
{
"id": "graft-count",
"title": "모발이식은 몇 모를 심어야 하나요? 모수를 정하는 기준",
"category": "C",
"categoryLabel": "선택 기준",
"qbIds": [],
"intent": "모수는 탈모 범위만이 아니라 후두부 공여부 여유, 앞으로의 탈모 진행, 얼굴형·헤어라인 디자인으로 정한다는 점을 근거 범위에서 설명한다. 인터뷰의 '후두부 모낭은 무한하지 않다, 앞으로의 변화까지 방어할 여백을 남긴다'는 원장 설명으로 인용 표시한다. 특정 모수 숫자를 권하지 않는다.",
"mustCover": [
"모수를 정하는 기준 목록",
"공여부를 아껴야 하는 이유",
"상담에서 확인할 것"
],
"avoid": [
"전후 사진",
"환자 개별 사례·후기·실명",
"금액",
"다른 병원 비교·순위",
"효과 보장·생착률 보장",
"'최초'·'1호'·'최고' 같은 최상급 표현"
],
"evidence": {
"pages": [
"https://mopro.co.kr/hair-transplant/man/",
"https://mopro.co.kr/hair-transplant/woman/",
"https://mopro.co.kr/%ea%b0%95%eb%82%a8%eb%aa%a8%eb%b0%9c%ec%9d%b4%ec%8b%9d-30%eb%8c%80-%eb%82%a8%ec%84%b1-m%ec%9e%90-%ed%97%a4%ec%96%b4%eb%9d%bc%ec%9d%b8-%ea%b5%90%ec%a0%95-%ec%a0%84-%ed%99%95%ec%9d%b8%ed%95%b4%ec%95%bc/",
"https://mopro.co.kr/%ec%97%ac%ec%9e%90-%eb%aa%a8%eb%b0%9c%ec%9d%b4%ec%8b%9d-%ec%97%ac%ec%9e%90-%ed%97%a4%ec%96%b4%eb%9d%bc%ec%9d%b8-%eb%94%94%ec%9e%90%ec%9d%b8%ec%9d%80-%ec%88%98%ec%88%a0-%ec%a0%84-%eb%ac%b4%ec%97%87/",
"https://mopro.co.kr/%ec%9e%90%ec%a3%bc-%eb%ac%bb%eb%8a%94-%ec%a7%88%eb%ac%b8/",
"https://app.notion.com/p/3ef0af2241ae80faae8df171529fc31b"
],
"shorts": [],
"news": [],
"regulation": [],
"platform": false
},
"sources": [
{
"label": "모프로의원 홈페이지 · 남성 모발이식",
"url": "https://mopro.co.kr/hair-transplant/man/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 여성 모발이식·헤어라인 교정",
"url": "https://mopro.co.kr/hair-transplant/woman/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 강남모발이식, 30대 남성 M자 헤어라인 교정 전 확인해야 할 부분",
"url": "https://mopro.co.kr/%ea%b0%95%eb%82%a8%eb%aa%a8%eb%b0%9c%ec%9d%b4%ec%8b%9d-30%eb%8c%80-%eb%82%a8%ec%84%b1-m%ec%9e%90-%ed%97%a4%ec%96%b4%eb%9d%bc%ec%9d%b8-%ea%b5%90%ec%a0%95-%ec%a0%84-%ed%99%95%ec%9d%b8%ed%95%b4%ec%95%bc/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 여자 모발이식, 여자 헤어라인 디자인은 수술 전 무엇을 봐야 할까?",
"url": "https://mopro.co.kr/%ec%97%ac%ec%9e%90-%eb%aa%a8%eb%b0%9c%ec%9d%b4%ec%8b%9d-%ec%97%ac%ec%9e%90-%ed%97%a4%ec%96%b4%eb%9d%bc%ec%9d%b8-%eb%94%94%ec%9e%90%ec%9d%b8%ec%9d%80-%ec%88%98%ec%88%a0-%ec%a0%84-%eb%ac%b4%ec%97%87/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 모발이식 자주 묻는 질문",
"url": "https://mopro.co.kr/%ec%9e%90%ec%a3%bc-%eb%ac%bb%eb%8a%94-%ec%a7%88%eb%ac%b8/",
"type": "clinic"
},
{
"label": "문건학 원장 인터뷰 초안 (병원 제공 자료, 게재 전 확인 대기)",
"url": "",
"type": "clinic"
}
],
"videos": [],
"gallery": []
},
{
"id": "shedding-timeline",
"title": "모발이식 후 쉐딩(일시적 탈락)은 언제 시작해 언제까지 가나요?",
"category": "D",
"categoryLabel": "시술 정보",
"qbIds": [],
"intent": "수술 후 시기별 변화(탈락·새 모발 성장·변화 체감·완성)를 근거 페이지에 적힌 시점만으로 표로 정리한다. 탈락은 일시적이라는 근거 문장을 쓰고, 개인차와 병원 확인이 필요한 경우(예상과 다른 탈락)를 적는다.",
"mustCover": [
"시기별 경과 표",
"이 시기에 지킬 관리",
"병원에 연락할 상황"
],
"avoid": [
"전후 사진",
"환자 개별 사례·후기·실명",
"금액",
"다른 병원 비교·순위",
"효과 보장·생착률 보장",
"'최초'·'1호'·'최고' 같은 최상급 표현"
],
"evidence": {
"pages": [
"https://mopro.co.kr/%ec%9e%90%ec%a3%bc-%eb%ac%bb%eb%8a%94-%ec%a7%88%eb%ac%b8/",
"https://mopro.co.kr/hair-transplant/man/",
"https://mopro.co.kr/hair-transplant/woman/",
"https://app.notion.com/p/3ef0af2241ae80faae8df171529fc31b"
],
"shorts": [],
"news": [],
"regulation": [],
"platform": false
},
"sources": [
{
"label": "모프로의원 홈페이지 · 모발이식 자주 묻는 질문",
"url": "https://mopro.co.kr/%ec%9e%90%ec%a3%bc-%eb%ac%bb%eb%8a%94-%ec%a7%88%eb%ac%b8/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 남성 모발이식",
"url": "https://mopro.co.kr/hair-transplant/man/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 여성 모발이식·헤어라인 교정",
"url": "https://mopro.co.kr/hair-transplant/woman/",
"type": "clinic"
},
{
"label": "문건학 원장 인터뷰 초안 (병원 제공 자료, 게재 전 확인 대기)",
"url": "",
"type": "clinic"
}
],
"videos": [],
"gallery": []
},
{
"id": "postpartum-hair-loss",
"title": "산후탈모, 모발이식을 해야 하나요, 기다려야 하나요?",
"category": "D",
"categoryLabel": "시술 정보",
"qbIds": [],
"intent": "산후탈모처럼 호르몬 변화로 생기는 일시적 탈모는 자연 회복을 먼저 지켜보는 경우가 있다는 인터뷰 설명과, 탈모 종류·약물치료 근거 페이지를 연결한다. 모발이식이 필요한 경우와 기다리는 경우를 근거 범위에서 나누고, 진단은 진료에서 정한다고 닫는다. 인터뷰 속 환자·배우 이름은 쓰지 않는다.",
"mustCover": [
"일시적 탈모와 진행성 탈모의 차이",
"기다리는 동안 할 수 있는 것",
"진료가 필요한 신호"
],
"avoid": [
"전후 사진",
"환자 개별 사례·후기·실명",
"금액",
"다른 병원 비교·순위",
"효과 보장·생착률 보장",
"'최초'·'1호'·'최고' 같은 최상급 표현"
],
"evidence": {
"pages": [
"https://mopro.co.kr/hair-loss/",
"https://mopro.co.kr/%ed%83%88%eb%aa%a8%ec%a2%85%eb%a5%98-%ec%a0%9c%eb%8c%80%eb%a1%9c-%ec%95%8c%ec%95%84%ec%95%bc-%ec%b9%98%eb%a3%8c%eb%90%9c%eb%8b%a4-%ec%b2%9c%eb%a7%8c%eb%aa%85-%ec%8b%9c%eb%8c%80-%ed%95%b5%ec%8b%ac/",
"https://mopro.co.kr/%ed%97%a4%ec%96%b4%eb%9d%bc%ec%9d%b8-%ed%83%88%eb%aa%a8-%ec%95%bd%eb%ac%bc%ec%b9%98%eb%a3%8c%eb%a7%8c%ec%9c%bc%eb%a1%9c-%ec%96%b4%eb%a0%a4%ec%9a%b4-%ea%b2%bd%ec%9a%b0%ec%99%80-%eb%aa%a8%eb%b0%9c/",
"https://mopro.co.kr/%ea%b0%95%eb%82%a8%ed%83%88%eb%aa%a8%eb%b3%91%ec%9b%90-%eb%aa%a8%ed%94%84%eb%a1%9c%ec%9d%98%ec%9b%90-%eb%aa%85%ec%9d%98%eb%b3%b4%ea%b0%90-%ec%b6%9c%ec%97%b0-%ed%83%88%eb%aa%a8-%ec%9b%90%ec%9d%b8/",
"https://app.notion.com/p/3ef0af2241ae80faae8df171529fc31b"
],
"shorts": [],
"news": [],
"regulation": [],
"platform": false
},
"sources": [
{
"label": "모프로의원 홈페이지 · 탈모 치료",
"url": "https://mopro.co.kr/hair-loss/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 탈모종류 제대로 알아야 치료된다 천만명 시대 핵심 정리",
"url": "https://mopro.co.kr/%ed%83%88%eb%aa%a8%ec%a2%85%eb%a5%98-%ec%a0%9c%eb%8c%80%eb%a1%9c-%ec%95%8c%ec%95%84%ec%95%bc-%ec%b9%98%eb%a3%8c%eb%90%9c%eb%8b%a4-%ec%b2%9c%eb%a7%8c%eb%aa%85-%ec%8b%9c%eb%8c%80-%ed%95%b5%ec%8b%ac/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 헤어라인 탈모, 약물치료만으로 어려운 경우와 모발이식 과정",
"url": "https://mopro.co.kr/%ed%97%a4%ec%96%b4%eb%9d%bc%ec%9d%b8-%ed%83%88%eb%aa%a8-%ec%95%bd%eb%ac%bc%ec%b9%98%eb%a3%8c%eb%a7%8c%ec%9c%bc%eb%a1%9c-%ec%96%b4%eb%a0%a4%ec%9a%b4-%ea%b2%bd%ec%9a%b0%ec%99%80-%eb%aa%a8%eb%b0%9c/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 강남탈모병원 모프로의원 명의보감 출연",
"url": "https://mopro.co.kr/%ea%b0%95%eb%82%a8%ed%83%88%eb%aa%a8%eb%b3%91%ec%9b%90-%eb%aa%a8%ed%94%84%eb%a1%9c%ec%9d%98%ec%9b%90-%eb%aa%85%ec%9d%98%eb%b3%b4%ea%b0%90-%ec%b6%9c%ec%97%b0-%ed%83%88%eb%aa%a8-%ec%9b%90%ec%9d%b8/",
"type": "clinic"
},
{
"label": "문건학 원장 인터뷰 초안 (병원 제공 자료, 게재 전 확인 대기)",
"url": "",
"type": "clinic"
}
],
"videos": [],
"gallery": []
},
{
"id": "cost-factors",
"title": "모발이식 3000모 비용은 무엇에 따라 달라지나요?",
"category": "F",
"categoryLabel": "비용·이벤트",
"qbIds": [],
"intent": "금액은 쓰지 않는다. 비용을 정하는 요인(방식 절개·비절개, 이식 모수, 부위, 두피 상태, 재수술 여부)을 근거 페이지로 설명하고, 금액은 의료법에 따른 비급여 진료비용 고지 페이지에서 확인할 수 있다고 안내한다. '모수만 비교하지 말 것'의 이유를 근거 범위에서 쓴다.",
"mustCover": [
"비용을 정하는 요인 목록",
"비급여 고지 페이지 안내",
"견적을 비교할 때 확인할 것"
],
"avoid": [
"전후 사진",
"환자 개별 사례·후기·실명",
"금액",
"다른 병원 비교·순위",
"효과 보장·생착률 보장",
"'최초'·'1호'·'최고' 같은 최상급 표현"
],
"evidence": {
"pages": [
"https://mopro.co.kr/%EB%B9%84%EA%B8%89%EC%97%AC%ED%95%AD%EB%AA%A9/",
"https://mopro.co.kr/hair-transplant/method/",
"https://mopro.co.kr/%ec%9e%90%ec%a3%bc-%eb%ac%bb%eb%8a%94-%ec%a7%88%eb%ac%b8/",
"https://mopro.co.kr/hair-transplant/revision/"
],
"shorts": [],
"news": [],
"regulation": [],
"platform": false
},
"sources": [
{
"label": "모프로의원 홈페이지 · 비급여 진료비용 안내",
"url": "https://mopro.co.kr/%EB%B9%84%EA%B8%89%EC%97%AC%ED%95%AD%EB%AA%A9/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 절개·비절개 모발이식 비교",
"url": "https://mopro.co.kr/hair-transplant/method/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 모발이식 자주 묻는 질문",
"url": "https://mopro.co.kr/%ec%9e%90%ec%a3%bc-%eb%ac%bb%eb%8a%94-%ec%a7%88%eb%ac%b8/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 모발이식 재수술",
"url": "https://mopro.co.kr/hair-transplant/revision/",
"type": "clinic"
}
],
"videos": [],
"gallery": []
},
{
"id": "choosing-clinic",
"title": "모발이식 병원을 고를 때 무엇을 확인해야 하나요?",
"category": "C",
"categoryLabel": "선택 기준",
"qbIds": [],
"intent": "누가 상담·디자인·채취·식모를 하는지, 공여부를 어떻게 계획하는지, 장기 탈모 진행을 어떻게 보는지, 수술 후 관리와 재수술 대응을 확인하는 체크리스트로 쓴다. 모프로의원이 공개한 원칙은 '모프로의원 기준'으로 표시하고 다른 병원과 비교하지 않는다.",
"mustCover": [
"상담 체크리스트 8~10개(- [ ] 형식)",
"항목마다 왜 묻는지 한 줄",
"모프로의원이 공개한 진료 원칙"
],
"avoid": [
"전후 사진",
"환자 개별 사례·후기·실명",
"금액",
"다른 병원 비교·순위",
"효과 보장·생착률 보장",
"'최초'·'1호'·'최고' 같은 최상급 표현"
],
"evidence": {
"pages": [
"https://mopro.co.kr/intro/special/",
"https://mopro.co.kr/intro/doctor/",
"https://mopro.co.kr/hair-transplant/method/",
"https://mopro.co.kr/hair-transplant/revision/",
"https://mopro.co.kr/%ec%9e%90%ec%a3%bc-%eb%ac%bb%eb%8a%94-%ec%a7%88%eb%ac%b8/",
"https://app.notion.com/p/3ef0af2241ae80faae8df171529fc31b"
],
"shorts": [],
"news": [],
"regulation": [],
"platform": false
},
"sources": [
{
"label": "모프로의원 홈페이지 · 모프로의 진료철학",
"url": "https://mopro.co.kr/intro/special/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 문건학 대표원장 소개",
"url": "https://mopro.co.kr/intro/doctor/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 절개·비절개 모발이식 비교",
"url": "https://mopro.co.kr/hair-transplant/method/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 모발이식 재수술",
"url": "https://mopro.co.kr/hair-transplant/revision/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 모발이식 자주 묻는 질문",
"url": "https://mopro.co.kr/%ec%9e%90%ec%a3%bc-%eb%ac%bb%eb%8a%94-%ec%a7%88%eb%ac%b8/",
"type": "clinic"
},
{
"label": "문건학 원장 인터뷰 초안 (병원 제공 자료, 게재 전 확인 대기)",
"url": "",
"type": "clinic"
}
],
"videos": [],
"gallery": []
},
{
"id": "design-consult",
"title": "모프로의원은 모발이식 상담에서 무엇을 먼저 보나요?",
"category": "A",
"categoryLabel": "병원 소개",
"qbIds": [],
"intent": "인터뷰와 헤어라인 디자인 글을 근거로, 상담에서 탈모 부위보다 먼저 보는 것(이마 높이, 관자놀이 흐름, 모발 방향·굵기, 10년 뒤 변화)을 정리한다. 원장 발언은 인터뷰 초안 인용으로 표시한다. 수식어와 은유는 옮기지 않고 확인 가능한 절차만 쓴다.",
"mustCover": [
"상담에서 보는 항목 목록",
"헤어라인 디자인 기준",
"상담 전에 준비하면 좋은 것"
],
"avoid": [
"전후 사진",
"환자 개별 사례·후기·실명",
"금액",
"다른 병원 비교·순위",
"효과 보장·생착률 보장",
"'최초'·'1호'·'최고' 같은 최상급 표현"
],
"evidence": {
"pages": [
"https://app.notion.com/p/3ef0af2241ae80faae8df171529fc31b",
"https://mopro.co.kr/%ec%97%ac%ec%9e%90-%eb%aa%a8%eb%b0%9c%ec%9d%b4%ec%8b%9d-%ec%97%ac%ec%9e%90-%ed%97%a4%ec%96%b4%eb%9d%bc%ec%9d%b8-%eb%94%94%ec%9e%90%ec%9d%b8%ec%9d%80-%ec%88%98%ec%88%a0-%ec%a0%84-%eb%ac%b4%ec%97%87/",
"https://mopro.co.kr/%ea%b0%95%eb%82%a8%eb%aa%a8%eb%b0%9c%ec%9d%b4%ec%8b%9d-30%eb%8c%80-%eb%82%a8%ec%84%b1-m%ec%9e%90-%ed%97%a4%ec%96%b4%eb%9d%bc%ec%9d%b8-%ea%b5%90%ec%a0%95-%ec%a0%84-%ed%99%95%ec%9d%b8%ed%95%b4%ec%95%bc/",
"https://mopro.co.kr/intro/special/",
"https://mopro.co.kr/intro/doctor/"
],
"shorts": [],
"news": [],
"regulation": [],
"platform": false
},
"sources": [
{
"label": "문건학 원장 인터뷰 초안 (병원 제공 자료, 게재 전 확인 대기)",
"url": "",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 여자 모발이식, 여자 헤어라인 디자인은 수술 전 무엇을 봐야 할까?",
"url": "https://mopro.co.kr/%ec%97%ac%ec%9e%90-%eb%aa%a8%eb%b0%9c%ec%9d%b4%ec%8b%9d-%ec%97%ac%ec%9e%90-%ed%97%a4%ec%96%b4%eb%9d%bc%ec%9d%b8-%eb%94%94%ec%9e%90%ec%9d%b8%ec%9d%80-%ec%88%98%ec%88%a0-%ec%a0%84-%eb%ac%b4%ec%97%87/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 강남모발이식, 30대 남성 M자 헤어라인 교정 전 확인해야 할 부분",
"url": "https://mopro.co.kr/%ea%b0%95%eb%82%a8%eb%aa%a8%eb%b0%9c%ec%9d%b4%ec%8b%9d-30%eb%8c%80-%eb%82%a8%ec%84%b1-m%ec%9e%90-%ed%97%a4%ec%96%b4%eb%9d%bc%ec%9d%b8-%ea%b5%90%ec%a0%95-%ec%a0%84-%ed%99%95%ec%9d%b8%ed%95%b4%ec%95%bc/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 모프로의 진료철학",
"url": "https://mopro.co.kr/intro/special/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 문건학 대표원장 소개",
"url": "https://mopro.co.kr/intro/doctor/",
"type": "clinic"
}
],
"videos": [],
"gallery": []
},
{
"id": "incision-vs-fue",
"title": "절개와 비절개 모발이식은 어떻게 다르고, 무엇으로 고르나요?",
"category": "D",
"categoryLabel": "시술 정보",
"qbIds": [],
"intent": "절개·비절개의 채취 방식, 흉터, 삭발 여부, 회복, 적합한 경우를 근거 페이지의 비교 표 범위에서 조건 표로 정리한다. 한 방식이 항상 낫다고 쓰지 않고, 방식 선택은 진료에서 정한다고 닫는다. 같은 페이지 안에서 실밥 제거 시점이 다르게 적힌 부분은 '병원 확인 대기'로 둔다.",
"mustCover": [
"방식 비교 표(채취·흉터·삭발·회복·적합한 경우)",
"수술 당일 과정",
"상담에서 확인할 것"
],
"avoid": [
"전후 사진",
"환자 개별 사례·후기·실명",
"금액",
"다른 병원 비교·순위",
"효과 보장·생착률 보장",
"'최초'·'1호'·'최고' 같은 최상급 표현"
],
"evidence": {
"pages": [
"https://mopro.co.kr/hair-transplant/method/",
"https://mopro.co.kr/hair-transplant/man/",
"https://mopro.co.kr/hair-transplant/woman/",
"https://mopro.co.kr/%ec%9e%90%ec%a3%bc-%eb%ac%bb%eb%8a%94-%ec%a7%88%eb%ac%b8/"
],
"shorts": [],
"news": [],
"regulation": [],
"platform": false
},
"sources": [
{
"label": "모프로의원 홈페이지 · 절개·비절개 모발이식 비교",
"url": "https://mopro.co.kr/hair-transplant/method/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 남성 모발이식",
"url": "https://mopro.co.kr/hair-transplant/man/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 여성 모발이식·헤어라인 교정",
"url": "https://mopro.co.kr/hair-transplant/woman/",
"type": "clinic"
},
{
"label": "모프로의원 홈페이지 · 모발이식 자주 묻는 질문",
"url": "https://mopro.co.kr/%ec%9e%90%ec%a3%bc-%eb%ac%bb%eb%8a%94-%ec%a7%88%eb%ac%b8/",
"type": "clinic"
}
],
"videos": [],
"gallery": []
}
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#E4405F" d="M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077"/></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#3C1E1E" d="M22.125 0H1.875C.8394 0 0 .8394 0 1.875v20.25C0 23.1606.8394 24 1.875 24h20.25C23.1606 24 24 23.1606 24 22.125V1.875C24 .8394 23.1606 0 22.125 0zM12 18.75c-.591 0-1.1697-.0413-1.7317-.1209-.5626.3965-3.813 2.6797-4.1198 2.7225 0 0-.1258.0489-.2328-.0141s-.0876-.2282-.0876-.2282c.0322-.2198.8426-3.0183.992-3.5333-2.7452-1.36-4.5701-3.7686-4.5701-6.5135C2.25 6.8168 6.6152 3.375 12 3.375s9.75 3.4418 9.75 7.6875c0 4.2457-4.3652 7.6875-9.75 7.6875zM8.0496 9.8672h-.8777v3.3417c0 .2963-.2523.5372-.5625.5372s-.5625-.2409-.5625-.5372V9.8672h-.8777c-.3044 0-.552-.2471-.552-.5508s.2477-.5508.552-.5508h2.8804c.3044 0 .552.2471.552.5508s-.2477.5508-.552.5508zm10.9879 2.9566a.558.558 0 0 1 .108.4167.5588.5588 0 0 1-.2183.371.5572.5572 0 0 1-.3383.1135.558.558 0 0 1-.4493-.2236l-1.3192-1.7479-.1952.1952v1.2273a.5635.5635 0 0 1-.5627.5628.563.563 0 0 1-.5625-.5625V9.3281c0-.3102.2523-.5625.5625-.5625s.5625.2523.5625.5625v1.209l1.5694-1.5694c.0807-.0807.1916-.1252.312-.1252.1404 0 .2814.0606.3871.1661.0985.0984.1573.2251.1654.3566.0082.1327-.036.2542-.1241.3425l-1.2818 1.2817 1.3845 1.8344zm-8.3502-3.5023c-.095-.2699-.3829-.5475-.7503-.5557-.3663.0083-.6542.2858-.749.5551l-1.3455 3.5415c-.1708.5305-.0217.7272.1333.7988a.8568.8568 0 0 0 .3576.0776c.2346 0 .4139-.0952.4678-.2481l.2787-.7297 1.7152.0001.2785.7292c.0541.1532.2335.2484.4681.2484a.8601.8601 0 0 0 .3576-.0775c.1551-.0713.3041-.2681.1329-.7999l-1.3449-3.5398zm-1.3116 2.4433l.5618-1.5961.5618 1.5961H9.3757zm5.9056 1.3836c0 .2843-.2418.5156-.5391.5156h-1.8047c-.2973 0-.5391-.2314-.5391-.5156V9.3281c0-.3102.2576-.5625.5742-.5625s.5742.2523.5742.5625v3.3047h1.1953c.2974 0 .5392.2314.5392.5156z"/></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#03C75A" d="M16.273 12.845 7.376 0H0v24h7.726V11.156L16.624 24H24V0h-7.727v12.845Z"/></svg>

After

Width:  |  Height:  |  Size: 174 B

@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#03C75A" d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7Zm0 9.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5Z"/></svg>

After

Width:  |  Height:  |  Size: 207 B

@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#FF0000" d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/></svg>

After

Width:  |  Height:  |  Size: 452 B

+153
View File
@@ -0,0 +1,153 @@
{
"_comment": "모프로의원 AI 공식답변허브페이지 고정값. 2026-10-08 Claude 작성(haewon 확인 전). 파트너십 제안용 로컬 초안이며 배포하지 않는다. 채널 값은 docs/reports/mopro/data/offsite.md 실측(2026-10-08). 원장 경력(10년/15년)·전문과목·대표전화(02/0507)는 채널마다 달라 병원 확인 전까지 팩트 시트에 넣지 않는다.",
"youtube": "UCn-Ej3_S-Hvrs2bbCXssiVw",
"youtubeHandle": "@moproclinic",
"instagram": "@moproclinic",
"naverBlog": "https://blog.naver.com/moprohair",
"gangnamunni": "https://www.gangnamunni.com/hospitals/5447",
"factSheet": {
"kind": "탈모·모발이식 의원",
"areaLabel": "서울 강남 신사",
"name": "모프로의원",
"shortName": "모프로의원",
"representative": "문건학",
"nameEn": "MOPRO Clinic",
"shortNameEn": "MOPRO Clinic",
"urlEn": "https://mopro.co.kr/en/home/",
"sideEffectNoticeEn": "Inflammation, bleeding, nerve damage or other side effects may occur after surgery, and they vary from person to person."
},
"site": {
"siteName": "모프로의원 공식 답변 안내",
"siteNameEn": "OFFICIAL ANSWER GUIDE",
"tagline": "모발이식과 탈모 치료를 알아보는 분들의 질문에 모프로의원 공개 자료를 근거로 답합니다",
"shareNameEn": "MOPRO Clinic",
"siteTitleEn": "MOPRO Clinic Official Answer Guide",
"taglineEn": "Answers to common questions about hair transplants and hair loss treatment, based on MOPRO Clinic's public materials",
"sponsorNoticeEn": "This guide is run by the INFINITH editorial team with support from MOPRO Clinic. Medical content is marked as reviewed only after the clinic's attending physician has checked it; until then it is labeled \"medical review pending.\""
},
"_siteNameNote": "환자에게 보이는 이름은 AI를 넣지 않는다(전역 규칙). '모프로의원 공식 답변 안내'는 haewon 결정(2026-10-08). 내부 상품명은 AI 공식답변허브페이지.",
"_evidenceNote": "근거 = 홈페이지(robots 허용) + 홈페이지 일반 정보 글 5편 + 노션 인터뷰 초안(사업본부 전달). 네이버 블로그는 robots.txt가 AI·RAG 목적 봇 접근을 금지해 수집하지 않는다. 블로그 원문은 병원 제공 파일로 받아 추가한다. 외부 작가의 성공원형 진단 글은 '영리적 사용 불가·변경 불가' 라이선스라 쓰지 않는다.",
"excludeImages": [
"2_-EC-88-98-EC-88-A0_-EC-83-81-EB-8B-B4_",
"5_1-EB-85-84-ED-9B-84_2_251229"
],
"_excludeNote": "2026-10-12 Claude가 images.json 의 alt 문구로 확인: 시술 이미지 2장이 환자 전후사진('30대 초/ 남성/ 비절개 2988모 수술 전·후', 출처 /hair-transplant/eyebrow/)이라 제외(의료법 제56조, 허브페이지 전후사진 미게재 원칙). 워커는 img/clinic 파일만 지우므로 patch_site.py 가 img/procedure 파일도 지운다. 나머지 이미지는 육안 게이트로 확인한다.",
"factSheetPatch": {
"address": {
"fullEn": "3F, Sinung Tower 2, 157 Dosan-daero, Gangnam-gu, Seoul, Republic of Korea (06037)"
},
"surfaces": {
"gangnamunni": {
"label": "강남언니",
"url": "https://www.gangnamunni.com/hospitals/5447",
"rating": "9.8",
"reviews": "442",
"checked": "2026-10-08"
}
}
},
"factSheetEn": {
"name": "MOPRO Clinic",
"shortName": "MOPRO Clinic",
"kind": "Hair transplant and hair loss clinic",
"areaLabel": "Sinsa, Gangnam, Seoul",
"representative": "Kunhak Moon",
"address": {
"full": "3F, Sinung Tower 2, 157 Dosan-daero, Gangnam-gu, Seoul, Republic of Korea (06037)",
"mapQuery": "MOPRO Clinic 157 Dosan-daero Gangnam-gu Seoul"
}
},
"_enNote": "2026-10-12 영문 값. 병원명·주소·원장 영문명은 공식 영문 페이지(mopro.co.kr/en/home/)와 홈페이지 구조화 데이터(employee 'Kunhak Moon') 표기. 대표자 '문건학'은 홈페이지 푸터 '대표자 : 문건학'(자동 수집값 '블로그'는 오류). sponsorNoticeEn·sideEffectNoticeEn·taglineEn 은 Claude 번역 초안으로 병원 확인 대기(haewon 결정 2026-10-12: 템플릿 규칙과 달리 영문 초안으로 교체). 강남언니 수치는 docs/reports/mopro/data/offsite.md 실측(2026-10-08). factSheetPatch·factSheetEn 은 워커가 읽지 않으므로 patch_site.py 가 적용한다.",
"interview": {
"video": {
"id": "lzx2z4cWJt0",
"title": "[라스트닥터 3주년 인터뷰] 매출보다 직원행복 챙겼더니 일어난 3가지 변화",
"published": "2026-10-10",
"channel": "유튜브 @the_lastdoctor",
"titleEn": "Third-anniversary interview: what changed after putting staff before revenue (in Korean)",
"channelEn": "YouTube @the_lastdoctor"
},
"links": [
{
"cat": "밀착 인터뷰 · 네이버 블로그",
"title": "모발설계자 문건학 원장 밀착인터뷰 _ 보이는 것 너머, 시간을 설계하다",
"desc": "문건학 원장 인터뷰 원문을 블로그에서 읽을 수 있습니다.",
"url": "https://blog.naver.com/all_artist/224436053883",
"foot": "2026-10-09 게시 · blog.naver.com/all_artist",
"catEn": "Interview · Naver Blog",
"titleEn": "In-depth interview with Dr. Kunhak Moon (in Korean)",
"descEn": "Read the full interview with Dr. Kunhak Moon on the original blog.",
"footEn": "Published 2026-10-09 · blog.naver.com/all_artist"
},
{
"cat": "공식 블로그",
"title": "모프로의원 네이버 블로그",
"desc": "모발이식·탈모 치료 정보를 모프로의원이 직접 올리는 블로그입니다.",
"url": "https://blog.naver.com/moprohair",
"foot": "blog.naver.com/moprohair",
"catEn": "Official Blog",
"titleEn": "MOPRO Clinic Naver Blog (in Korean)",
"descEn": "Hair transplant and hair loss treatment information posted by the clinic.",
"footEn": "blog.naver.com/moprohair"
},
{
"cat": "인스타그램",
"title": "모프로의원 인스타그램",
"desc": "모프로의원 공식 인스타그램 계정입니다.",
"url": "https://www.instagram.com/moproclinic/",
"foot": "@moproclinic",
"catEn": "Instagram",
"titleEn": "MOPRO Clinic Instagram",
"descEn": "The clinic's official Instagram account.",
"footEn": "@moproclinic"
}
]
},
"_interviewNote": "2026-10-19 haewon 지시로 홈 'Interview' 섹션에 싣는다. 영상은 외부 채널(@the_lastdoctor) 인터뷰라 캡션에 그 채널을 밝힌다. 밀착인터뷰는 외부 에이전시 블로그(all_artist) 글이라 제목·링크만 싣고 본문은 옮기지 않는다(haewon 결정 2026-10-19). 게시일은 유튜브 uploadDate(2026-10-09 PDT)·블로그 게시 표기 실측. patch_site.py 가 src/data/interview.json 으로 쓴다. 2026-10-19 영문 홈에도 싣는다(haewon 지시). *En 값은 Claude 번역 초안이며, 한국어 콘텐츠는 제목에 '(in Korean)'을 붙인다.",
"footerChannels": [
{
"label": "유튜브",
"labelEn": "YouTube",
"url": "https://www.youtube.com/@moproclinic",
"icon": "youtube.svg"
},
{
"label": "인스타그램",
"labelEn": "Instagram",
"url": "https://www.instagram.com/moproclinic/",
"icon": "instagram.svg"
},
{
"label": "네이버 블로그",
"labelEn": "Naver Blog",
"url": "https://blog.naver.com/moprohair",
"icon": "naverblog.svg"
},
{
"label": "카카오톡 채널",
"labelEn": "KakaoTalk Channel",
"url": "https://pf.kakao.com/_rjAVG",
"icon": "kakaotalk.svg",
"bg": "#FEE500"
},
{
"label": "네이버 플레이스",
"labelEn": "Naver Place",
"url": "https://m.place.naver.com/hospital/1821744096/home",
"icon": "naverplace.svg"
},
{
"label": "강남언니",
"labelEn": "Gangnam Unni",
"url": "https://www.gangnamunni.com/hospitals/5447",
"icon": "gangnamunni.png"
},
{
"label": "바비톡",
"labelEn": "Babitalk",
"url": "https://babitalk.com/hospitals/4372",
"icon": "babitalk.png"
}
],
"_footerChannelsNote": "2026-10-19 haewon 지시로 푸터에 채널 아이콘을 싣는다. URL은 docs/reports/mopro/data/offsite.md 실측(2026-10-08). 블로그는 haewon이 '콘텐츠 메인'으로 준 moprohair(팩트 시트 자동 수집값 moproclinic은 기존 사례연구 블로그). Facebook 2개(팔로워 5·25, 홈페이지 링크 없음)·TikTok(팔로워 0)은 넣지 않았다. 아이콘: 유튜브·인스타그램·네이버·카카오톡은 simple-icons(CC0), 강남언니·바비톡은 각 사이트 파비콘, 플레이스는 지도 핀. patch_site.py 가 channel-icons/ 를 public/img/channels/ 로 복사한다."
}
+326
View File
@@ -0,0 +1,326 @@
#!/usr/bin/env python3
"""모프로의원 AI 공식답변허브페이지 빌드 폴더 후처리.
공유 템플릿(templates/supporters-astro)의 화면 문구에는 '서포터즈'가 들어 있다. haewon 결정(2026-10-08)으로
템플릿은 그대로 두고 이 병원 빌드에서만 문구를 바꾼다. 워커(run.mjs)는 build 단계마다 템플릿 코드를 다시 덮으므로
워커를 돌린 뒤 매번 이 스크립트를 실행하고 다시 빌드한다.
python3 supporters/briefs/mopro/patch_site.py [~/supporters-builds/mopro/site]
하는 일
1. 화면 문구의 '서포터즈'·'Supporters'를 '공식 답변 안내'·'편집팀'·'Official Answer Guide'로 바꾼다
2. 회복 일정 캘린더 파일 정보(PRODID·UID)에 남은 다른 병원 이름을 INFINITH·모프로로 바꾼다
3. clinic.json excludeImages 에 해당하는 파일을 public/img 전체에서 지운다(워커는 img/clinic 만 지운다)
3b. 영문 화면의 한글 노출을 정리한다(영문 사이트 이름·대표자·빈 값 문구, 팩트 시트 영문 값, 사진 없는 장소 이름 칸)
3c. 한국어·영문 홈에 'Interview' 섹션(원장 인터뷰 영상·인터뷰 글·공식 블로그·인스타그램)을 넣는다(clinic.json interview)
3d. 푸터에 채널 아이콘 줄(유튜브·인스타그램·블로그·카카오톡·플레이스·강남언니·바비톡)을 넣는다(clinic.json footerChannels)
4. vercel.json 사이트 주소를 정식 주소로 넣고, 공유 이미지(og.jpg)를 '서포터즈' 없는 상단 문구로 다시 그린다
5. src 에 화면용 '서포터즈'가 남아 있으면 실패로 끝낸다
"""
import json
import os
import re
import shutil
import subprocess
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(os.path.join(HERE, "..", "..", ".."))
SITE = os.path.expanduser(sys.argv[1] if len(sys.argv) > 1 else "~/supporters-builds/mopro/site")
SITE_URL = "https://mopro.webforai.kr" # haewon 지시 2026-10-12
OG_EYEBROW = "OFFICIAL ANSWER GUIDE"
# (파일, 바꿀 문구, 새 문구). 이미 바뀐 파일에 다시 돌려도 되도록 원문이 없으면 건너뛴다
REPLACEMENTS = [
("src/lib.ts", "서포터즈`;", "공식 답변 안내`;"),
("src/lib.ts", "질문에 먼저 답하는 서포터즈 매체", "질문에 먼저 답하는 공식 답변 안내"),
("src/components/ReviewBox.astro", "서포터즈는 의학적 판단을 하지 않습니다.", "이 안내 페이지는 의학적 판단을 하지 않습니다."),
("src/components/Video.astro", "영상 발화를 서포터즈가 글로 재구성한", "영상 발화를 편집팀이 글로 재구성한"),
("src/lib/i18n.ts", "brand: '서포터즈',", "brand: '공식 답변 안내',"),
("src/lib/i18n.ts", "이 매체는 {clinic}의 지원을 받아 서포터즈가 운영합니다.", "이 안내 페이지는 {clinic}의 지원을 받아 INFINITH 편집팀이 운영합니다."),
("src/lib/i18n.ts", "brand: 'Supporters',", "brand: 'Official Answer Guide',"),
("src/lib/i18n.ts", "This site is run by supporters with support from {clinic}.", "This guide is run by the INFINITH editorial team with support from {clinic}."),
("src/lib/plan.ts", "@view-supporters", "@mopro-answer-guide"),
("src/lib/plan.ts", "-//View Supporters//Recovery Planner//KO", "-//INFINITH//Recovery Planner//KO"),
("src/layouts/Base.astro", "`${nameEn} Supporters`", "`${nameEn} Official Answer Guide`"),
("src/data/authors.json", "\"서포터즈 편집 책임\"", "\"편집 책임\""),
("src/pages/videos.astro", "영상마다 서포터즈가 답을", "영상마다 편집팀이 답을"),
("src/pages/videos.astro", "짧은 영상에는 서포터즈가 답을", "짧은 영상에는 편집팀이 답을"),
("src/pages/videos.astro", "서포터즈가 답을 글로도 정리했습니다", "편집팀이 답을 글로도 정리했습니다"),
("src/pages/videos.astro", ">서포터즈 답<", ">정리한 답<"),
("src/pages/en/index.astro", "'Supporters (English)'", "'Official Answer Guide (English)'"),
("src/pages/en/index.astro", "This site is run by supporters who answer", "This site is run by an editorial team that answers"),
("src/pages/editorial.astro", "병원 담당자, 서포터즈, INFINITH 운영진이", "병원 담당자, 편집팀, INFINITH 운영진이"),
("src/pages/editorial.astro", "<td>서포터즈. 확정 후", "<td>편집팀. 확정 후"),
]
def patch_copy():
changed = 0
for rel, old, new in REPLACEMENTS:
path = os.path.join(SITE, rel)
text = open(path, encoding="utf-8").read()
if old in text:
open(path, "w", encoding="utf-8").write(text.replace(old, new))
changed += 1
return changed
# 영문 화면의 한글 노출 정리 (haewon 지시 2026-10-12). 템플릿은 영문 값이 없으면 한국어 값·'확인 대기'를 그대로 그린다
EN_PENDING = "To be confirmed"
EN_REPLACEMENTS = [
# 탭 제목·푸터 사이트 이름: 영문 페이지는 site.siteTitleEn·taglineEn
("src/layouts/Base.astro", "<title>{title} | {SITE_NAME}</title>",
"<title>{title} | {lang === 'en' ? ((S as any).siteTitleEn || SITE_NAME) : SITE_NAME}</title>"),
("src/layouts/Base.astro", "<p><strong>{SITE_NAME}</strong> · {SITE_TAGLINE}</p>",
"<p><strong>{lang === 'en' ? ((S as any).siteTitleEn || SITE_NAME) : SITE_NAME}</strong> · {lang === 'en' ? ((S as any).taglineEn || SITE_TAGLINE) : SITE_TAGLINE}</p>"),
# 푸터 연락처: 빈 값은 영문 화면에서 'To be confirmed', 대표자는 영문 이름
("src/layouts/Base.astro", "{u.foot_phone} {v(f.phone)} · {u.foot_fax} {v(f.fax)}<br />{u.foot_rep} {v(f.representative)} · {u.foot_biz} {v(f.businessNo)}",
"{u.foot_phone} {v(f.phone, lang === 'en' ? '" + EN_PENDING + "' : undefined)} · {u.foot_fax} {v(f.fax, lang === 'en' ? '" + EN_PENDING + "' : undefined)}<br />{u.foot_rep} {lang === 'en' ? v((EN as any).representative, '" + EN_PENDING + "') : v(f.representative)} · {u.foot_biz} {v(f.businessNo, lang === 'en' ? '" + EN_PENDING + "' : undefined)}"),
# 로고 이미지가 없을 때 헤더에 글자로 나오는 상호
("src/layouts/Base.astro", "<span class=\"brand-logo brand-name\">{v(f.shortName, '병원')}</span>",
"<span class=\"brand-logo brand-name\">{lang === 'en' ? ((EN as any).shortName || v(f.shortName, '병원')) : v(f.shortName, '병원')}</span>"),
# 관광 데이터에 영문 주소가 없는 항목(한글만)은 영문 페이지에서 주소 줄을 비운다
("src/pages/en/stay.astro", "<p class=\"addr\">{p.address}</p>",
"<p class=\"addr\">{/[A-Za-z]/.test(p.address || '') ? p.address : ''}</p>"),
("src/pages/en/stay.astro", "<p class=\"addr\">{e.address}</p>",
"<p class=\"addr\">{/[A-Za-z]/.test(e.address || '') ? e.address : ''}</p>"),
# 사진 없는 장소의 이름 칸: 괄호 안이 한글이면 앞쪽 영문 이름을 쓴다
("src/pages/en/stay.astro", " const m = t.match(/\\(([^)]+)\\)\\s*$/);\n return (m ? m[1] : t).replace(/\\s*\\[.*\\]\\s*/g, '').trim();",
" const m = t.match(/^(.*?)\\s*\\(([^)]+)\\)\\s*$/);\n return (m ? (/[가-힣]/.test(m[2]) ? m[1] : m[2]) : t).replace(/\\s*\\[.*\\]\\s*/g, '').trim();"),
]
def patch_english():
clinic = json.load(open(os.path.join(HERE, "clinic.json"), encoding="utf-8"))
changed = 0
for rel, old, new in EN_REPLACEMENTS:
path = os.path.join(SITE, rel)
text = open(path, encoding="utf-8").read()
if old in text:
open(path, "w", encoding="utf-8").write(text.replace(old, new))
changed += 1
# 영문 홈: 빈 값 기본 문구를 영어로 (v() 기본값은 '확인 대기')
path = os.path.join(SITE, "src/pages/en/index.astro")
text = open(path, encoding="utf-8").read()
if "const vEn" not in text:
text = re.sub(r"(?<![A-Za-z0-9_.])v\(", "vEn(", text)
text = text.replace("const f = fact as Record<string, any>;",
"const f = fact as Record<string, any>;\nconst vEn = (x: unknown) => v(x, '" + EN_PENDING + "');", 1)
open(path, "w", encoding="utf-8").write(text)
changed += 1
# 팩트 시트: 워커가 얕게 병합하므로 중첩 값(주소 영문·강남언니 수치)은 여기서 깊게 병합한다
fp = os.path.join(SITE, "src/data/factSheet.json")
fact = json.load(open(fp, encoding="utf-8"))
def deep(dst, src):
for k, v in src.items():
if isinstance(v, dict) and isinstance(dst.get(k), dict):
deep(dst[k], v)
else:
dst[k] = v
deep(fact, clinic.get("factSheetPatch", {}))
json.dump(fact, open(fp, "w", encoding="utf-8"), ensure_ascii=False, indent=2)
ep = os.path.join(SITE, "src/data/factSheetEn.json")
en = json.load(open(ep, encoding="utf-8"))
deep(en, clinic.get("factSheetEn", {}))
json.dump(en, open(ep, "w", encoding="utf-8"), ensure_ascii=False, indent=2)
# 회복 일정 플래너 기준점 영문 이름(planner 단계가 inputs 단계보다 먼저 돌아 영문 상호를 못 받는다)
pp = os.path.join(SITE, "src/data/places.json")
if os.path.exists(pp) and en.get("shortName"):
places = json.load(open(pp, encoding="utf-8"))
places.setdefault("origin", {}).setdefault("label", {})["en"] = en["shortName"]
json.dump(places, open(pp, "w", encoding="utf-8"), ensure_ascii=False, indent=2)
return changed
# 홈 'Interview' 섹션 (haewon 지시 2026-10-19). 원장 인터뷰 영상(외부 채널)과 인터뷰 글·공식 블로그·인스타그램 링크 카드
INTERVIEW_ANCHOR = " <section class=\"section light\">\n <div class=\"wrap-wide\">\n <div class=\"sec-head\"><div class=\"eyebrow\">Inside</div>"
INTERVIEW_SECTION = """ <section class="section light">
<div class="wrap-wide">
<div class="sec-head"><div class="eyebrow">Interview</div><h2>Meet The Doctor</h2><p class="sub">문건학 원장 인터뷰와 {clinic} 공식 채널입니다.</p></div>
<div class="interview-grid">
{interview.video && <div class="interview-video"><VideoLite id={interview.video.id} title={interview.video.title} published={interview.video.published} channel={interview.video.channel} /></div>}
{interview.links.map((l) => (
<article class="card">
<div class="cat">{l.cat}</div>
<h3><a href={l.url} rel="noopener" target="_blank">{l.title}</a></h3>
<p>{l.desc}</p>
<div class="foot">{l.foot}</div>
</article>
))}
</div>
</div>
<style>
.interview-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; }
.interview-video { grid-row: span 3; align-self: start; }
.interview-video :global(figure) { margin: 0; }
@media (max-width: 860px) { .interview-grid { grid-template-columns: 1fr; } .interview-video { grid-row: auto; } }
</style>
</section>
"""
# VideoLite 캡션은 병원 유튜브 핸들을 고정으로 붙인다. 외부 채널 영상은 channel 로 바꿔 쓴다
VIDEOLITE_REPLACEMENTS = [
("note?: string; compact?: boolean }", "note?: string; compact?: boolean; channel?: string }"),
("const { id, title, speaker, published, note, compact = false } = Astro.props;",
"const { id, title, speaker, published, note, compact = false, channel } = Astro.props;"),
("{handle}{note ?", "{channel ?? handle}{note ?"),
# 영문 홈에서 쓸 수 있게 lang='en' 이면 재생 버튼 설명·썸네일 대체 문구·게시일 표기를 영어로 낸다
("channel?: string }", "channel?: string; lang?: string }"),
("compact = false, channel }", "compact = false, channel, lang }"),
("aria-label={`영상 재생: ${title}`}", "aria-label={lang === 'en' ? `Play video: ${title}` : `영상 재생: ${title}`}"),
("alt={`유튜브 영상 썸네일: ${title}`}", "alt={lang === 'en' ? `YouTube video thumbnail: ${title}` : `유튜브 영상 썸네일: ${title}`}"),
("{published ? `${published} 게시 · ` : ''}", "{published ? (lang === 'en' ? `Published ${published} · ` : `${published} 게시 · `) : ''}"),
]
# 영문 홈 Interview 섹션: Clinic Facts 아래, Principles 위. 값은 clinic.json interview 의 *En
INTERVIEW_EN_ANCHOR = " <section class=\"section dark\"><div class=\"wrap-wide\">\n <div class=\"sec-head\"><div class=\"eyebrow\" style=\"color:var(--purple-300)\">Principles</div>"
INTERVIEW_EN_SECTION = """ <section class="section light"><div class="wrap-wide">
<div class="sec-head"><div class="eyebrow">Interview</div><h2>Meet The Doctor</h2><p class="sub">Interviews with Dr. Kunhak Moon and the clinic's official channels.</p></div>
<div class="interview-grid">
{interview.video && <div class="interview-video"><VideoLite id={interview.video.id} title={interview.video.titleEn} published={interview.video.published} channel={interview.video.channelEn} lang="en" /></div>}
{interview.links.map((l) => (
<article class="card">
<div class="cat">{l.catEn}</div>
<h3><a href={l.url} rel="noopener" target="_blank">{l.titleEn}</a></h3>
<p>{l.descEn}</p>
<div class="foot">{l.footEn}</div>
</article>
))}
</div>
<style>
.interview-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; }
.interview-video { grid-row: span 3; align-self: start; }
.interview-video :global(figure) { margin: 0; }
@media (max-width: 860px) { .interview-grid { grid-template-columns: 1fr; } .interview-video { grid-row: auto; } }
</style>
</div></section>
"""
def patch_home_interview():
interview = json.load(open(os.path.join(HERE, "clinic.json"), encoding="utf-8")).get("interview")
if not interview:
return 0
json.dump(interview, open(os.path.join(SITE, "src/data/interview.json"), "w", encoding="utf-8"), ensure_ascii=False, indent=2)
vp = os.path.join(SITE, "src/components/VideoLite.astro")
text = open(vp, encoding="utf-8").read()
for old, new in VIDEOLITE_REPLACEMENTS:
text = text.replace(old, new)
open(vp, "w", encoding="utf-8").write(text)
changed = 0
ip = os.path.join(SITE, "src/pages/index.astro")
text = open(ip, encoding="utf-8").read()
if "data/interview.json" not in text:
if INTERVIEW_ANCHOR not in text:
sys.exit("index.astro 에서 Inside 섹션을 찾지 못해 Interview 섹션을 넣지 못함")
text = text.replace("import Gallery from '../components/Gallery.astro';",
"import Gallery from '../components/Gallery.astro';\nimport interview from '../data/interview.json';", 1)
text = text.replace(INTERVIEW_ANCHOR, INTERVIEW_SECTION + INTERVIEW_ANCHOR, 1)
open(ip, "w", encoding="utf-8").write(text)
changed += 1
ep = os.path.join(SITE, "src/pages/en/index.astro")
text = open(ep, encoding="utf-8").read()
if "data/interview.json" not in text:
if INTERVIEW_EN_ANCHOR not in text:
sys.exit("en/index.astro 에서 Principles 섹션을 찾지 못해 Interview 섹션을 넣지 못함")
text = text.replace("import VisitMap from '../../components/VisitMap.astro';",
"import VisitMap from '../../components/VisitMap.astro';\nimport VideoLite from '../../components/VideoLite.astro';\nimport interview from '../../data/interview.json';", 1)
text = text.replace(INTERVIEW_EN_ANCHOR, INTERVIEW_EN_SECTION + INTERVIEW_EN_ANCHOR, 1)
open(ep, "w", encoding="utf-8").write(text)
changed += 1
return changed
# 푸터 채널 아이콘 (haewon 지시 2026-10-19). 유튜브·강남언니 글자 링크는 아이콘 줄로 옮기고 홈페이지 링크만 남긴다
FOOTER_LINKS_OLD = "{has(surface('youtube').url) && <> · <a href={surface('youtube').url} rel=\"noopener\">{u.foot_youtube}</a></>}{has(surface('gangnamunni').url) && <> · <a href={surface('gangnamunni').url} rel=\"noopener\">{u.foot_gu}</a></>}</p>"
FOOTER_CHANNELS = """</p>
<ul class="foot-channels">
{footerChannels.map((c) => (
<li><a href={c.url} rel="noopener" target="_blank" title={lang === 'en' ? c.labelEn : c.label} style={c.bg ? `background:${c.bg}` : undefined}><img src={`/img/channels/${c.icon}`} alt={lang === 'en' ? c.labelEn : c.label} width="20" height="20" /></a></li>
))}
</ul>"""
FOOTER_CSS = """
/* 푸터 채널 아이콘 (patch_site.py 가 넣음) */
.site-footer .foot-channels { list-style: none; display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 0.9rem 0 0; padding: 0; }
.site-footer .foot-channels a { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; background: #fff; transition: transform .2s, box-shadow .2s; }
.site-footer .foot-channels a:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.site-footer .foot-channels img { width: 20px; height: 20px; display: block; }
"""
def patch_footer_channels():
channels = json.load(open(os.path.join(HERE, "clinic.json"), encoding="utf-8")).get("footerChannels")
if not channels:
return 0
dst = os.path.join(SITE, "public", "img", "channels")
os.makedirs(dst, exist_ok=True)
for c in channels:
shutil.copyfile(os.path.join(HERE, "channel-icons", c["icon"]), os.path.join(dst, c["icon"]))
json.dump(channels, open(os.path.join(SITE, "src/data/footerChannels.json"), "w", encoding="utf-8"), ensure_ascii=False, indent=2)
changed = 0
cp = os.path.join(SITE, "src/styles/global.css")
css = open(cp, encoding="utf-8").read()
if ".foot-channels" not in css:
open(cp, "w", encoding="utf-8").write(css.rstrip("\n") + "\n" + FOOTER_CSS)
changed += 1
bp = os.path.join(SITE, "src/layouts/Base.astro")
text = open(bp, encoding="utf-8").read()
if "data/footerChannels.json" not in text:
if FOOTER_LINKS_OLD not in text:
sys.exit("Base.astro 에서 푸터 유튜브·강남언니 링크 줄을 찾지 못해 채널 아이콘을 넣지 못함")
text = text.replace("import EN from '../data/factSheetEn.json';",
"import EN from '../data/factSheetEn.json';\nimport footerChannels from '../data/footerChannels.json';", 1)
text = text.replace(FOOTER_LINKS_OLD, FOOTER_CHANNELS, 1)
open(bp, "w", encoding="utf-8").write(text)
changed += 1
return changed
def remove_excluded_images():
prefixes = json.load(open(os.path.join(HERE, "clinic.json"), encoding="utf-8")).get("excludeImages", [])
removed = []
for root, _, files in os.walk(os.path.join(SITE, "public", "img")):
for f in files:
if any(f.startswith(p) for p in prefixes):
os.remove(os.path.join(root, f))
removed.append(f)
return removed
def set_site_url_and_share_image():
vp = os.path.join(SITE, "vercel.json")
vj = json.load(open(vp, encoding="utf-8"))
vj.setdefault("build", {}).setdefault("env", {})["SITE_URL"] = SITE_URL
json.dump(vj, open(vp, "w", encoding="utf-8"), ensure_ascii=False, indent=2)
subprocess.run([sys.executable, os.path.join(ROOT, "scripts", "make_share_assets.py"), "supporters", "--site", SITE, "--eyebrow", OG_EYEBROW], check=True)
def leftovers():
"""화면에 나갈 수 있는 '서포터즈'·'Supporters'. 주석·데이터 키(authors.supporters)·내부 규칙 경로는 뺀다."""
hits = []
for root, _, files in os.walk(os.path.join(SITE, "src")):
for f in files:
path = os.path.join(root, f)
for n, line in enumerate(open(path, encoding="utf-8", errors="ignore"), 1):
code = re.sub(r"//.*$", "", line)
code = code.replace("authors.supporters", "").replace("INFINITH_Supporters_Image_Rules", "")
if '"supporters"' in code or "_comment" in code:
continue
if re.search(r"서포터즈|Supporters", code):
hits.append(f"{os.path.relpath(path, SITE)}:{n}: {line.strip()[:120]}")
return hits
if __name__ == "__main__":
n = patch_copy()
n_en = patch_english()
print(f"영문 처리 {n_en}곳")
print(f"홈 인터뷰 섹션 {patch_home_interview()}곳")
print(f"푸터 채널 아이콘 {patch_footer_channels()}곳")
removed = remove_excluded_images()
set_site_url_and_share_image()
left = leftovers()
print(f"문구 교체 {n}곳 · 제외 이미지 삭제 {len(removed)}개 {removed}")
if left:
print("화면용 '서포터즈'가 남아 있음:\n " + "\n ".join(left))
sys.exit(1)
+10 -2
View File
@@ -205,7 +205,11 @@ function walk(el, items) {
} }
} }
function extract(html, url) { // 페이지 빌더(Elementor 등)는 본문 블록마다 "widget" 클래스를 단다(2026-10-08 모프로의원: 노이즈 제거로 본문 48,239자 → 0자).
// 노이즈 제거 뒤 본문이 80% 넘게 사라지면 widget 규칙만 빼고 다시 추출한다. 사이드바 위젯 사이트는 이 조건에 걸리지 않는다.
const NOISE_SELECTORS_KEEP_WIDGETS = NOISE_SELECTORS.split(',').filter((s) => s !== '[class*="widget"]').join(',');
function extract(html, url, keepWidgets = false) {
const root = parse(html, { blockTextElements: { script: true, style: true, noscript: true, pre: true } }); const root = parse(html, { blockTextElements: { script: true, style: true, noscript: true, pre: true } });
const title = clean(root.querySelector('title')?.text ?? ''); const title = clean(root.querySelector('title')?.text ?? '');
const metaDesc = root.querySelector('meta[name="description"]')?.getAttribute('content') ?? ''; const metaDesc = root.querySelector('meta[name="description"]')?.getAttribute('content') ?? '';
@@ -219,7 +223,11 @@ function extract(html, url) {
if (!main) { const found = MAIN_SELECTORS.map((sel) => body.querySelector(sel)).filter(Boolean); if (found.length) main = found.sort((a, b) => clean(b.text).length - clean(a.text).length)[0]; } if (!main) { const found = MAIN_SELECTORS.map((sel) => body.querySelector(sel)).filter(Boolean); if (found.length) main = found.sort((a, b) => clean(b.text).length - clean(a.text).length)[0]; }
main = main ?? body; main = main ?? body;
const mainSelector = main === body ? 'body' : MAIN_SELECTORS.find((s) => body.querySelector(s) === main); const mainSelector = main === body ? 'body' : MAIN_SELECTORS.find((s) => body.querySelector(s) === main);
main.querySelectorAll(NOISE_SELECTORS).forEach((e) => e.remove()); const beforeNoise = clean(main.text).length;
main.querySelectorAll(keepWidgets ? NOISE_SELECTORS_KEEP_WIDGETS : NOISE_SELECTORS).forEach((e) => e.remove());
if (!keepWidgets && beforeNoise > 100 && clean(main.text).length < beforeNoise * 0.2) return extract(html, url, true);
// 다시 추출할 때도 푸터 위젯(사업자 정보·저작권 줄만 담은 짧은 블록)은 지운다. 이미지뿐인 페이지에서 푸터가 본문으로 잡히는 것을 막는다
if (keepWidgets) main.querySelectorAll('[class*="widget"]').filter((e) => clean(e.text).length < 600 && /copyright|사업자\s*등록\s*번호/i.test(e.text)).forEach((e) => e.remove());
const items = []; walk(main, items); const items = []; walk(main, items);
const images = main.querySelectorAll('img').map((i) => ({ src: normalize(i.getAttribute('data-src') || i.getAttribute('src') || '', url), alt: clean(i.getAttribute('alt') ?? '') })).filter((i) => i.src && !/\.(svg|gif)$/i.test(i.src) && !/icon|logo|btn|button|arrow|blank|spacer|sns|share|1x1/i.test(i.src)); const images = main.querySelectorAll('img').map((i) => ({ src: normalize(i.getAttribute('data-src') || i.getAttribute('src') || '', url), alt: clean(i.getAttribute('alt') ?? '') })).filter((i) => i.src && !/\.(svg|gif)$/i.test(i.src) && !/icon|logo|btn|button|arrow|blank|spacer|sns|share|1x1/i.test(i.src));
const links = [...new Set(main.querySelectorAll('a[href]').map((a) => normalize(a.getAttribute('href'), url)).filter(Boolean))]; const links = [...new Set(main.querySelectorAll('a[href]').map((a) => normalize(a.getAttribute('href'), url)).filter(Boolean))];