From 25ed36958399b2a12ffb6b8704862e7118763155 Mon Sep 17 00:00:00 2001 From: king Date: Fri, 14 Aug 2026 14:03:10 +0900 Subject: [PATCH] =?UTF-8?q?revert(cafe24):=20=EC=83=81=EB=8B=A8=20?= =?UTF-8?q?=EA=B3=B5=ED=86=B5=20=ED=99=8D=EB=B3=B4=20=EC=88=A8=EA=B8=B0?= =?UTF-8?q?=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 사용자 결정에 따라 없던 기능으로 되돌린다. 카페24 API 로 스킨 detail.html 의 상품번호 목록을 고칠 수 없다는 것이 확인된 뒤, 대안(상세설명 CSS 주입 / 스크립트 태그)을 모두 채택하지 않기로 정리했다. 제거 대상: store.py HIDE_PROMO_* 상수, has_hidden_promo, set_promo_hidden routes_products 편집기 컨텍스트의 promo 상태, hide_promo 폼 필드, 적용 시 블록 주입, 분리 상품 모바일 블록 동기화, 감사로그 표기 _editor.html 「상단 공통 홍보 숨기기」 체크박스 cafe24.css .cf24-check-inline tests promo 관련 4건 docs 2-3 절 적용 시 "변경 없음" 판정에 모바일 비교를 포함시킨 것은 남겼다. 공통 홍보와 무관하게 맞는 동작이다(PC 는 그대로여도 모바일이 PC 와 다르면 맞춰줘야 한다). 문서 정리도 함께 했다. 앞선 편집에서 3-1·2-2 절이 중복 삽입되고 절 순서가 뒤섞여 있던 것을 2 → 2-1 → 2-2 → 3 → 3-1 → 3-2 로 바로잡았다. 편집기 절에는 아직 이전 방식(크기 맞추기·sticky 줄번호)이 적혀 있었는데 실제 구현인 스크롤 동기화로 갱신하고, 크기 계산이 두 번 실패한 이유를 근거 수치와 함께 남겼다. ⚠️ 이미 이 기능으로 적용한 상품이 있다면 그 상품 상세설명에 " -) -_HIDE_PROMO_RE = re.compile( - r"[ \t]*]*\bid\s*=\s*[\"']%s[\"'][^>]*>.*?\s*" % re.escape(HIDE_PROMO_ID), - re.IGNORECASE | re.DOTALL, -) - - -def has_hidden_promo(html: str) -> bool: - """이 상품의 상세설명에 공통 홍보 숨김 블록이 들어 있는가.""" - return bool(_HIDE_PROMO_RE.search(html or "")) - - -def set_promo_hidden(html: str, hidden: bool) -> str: - """숨김 블록을 넣거나 뺀다. 여러 번 호출해도 결과가 같다(멱등). - - 넣을 때는 맨 앞에 둔다 — 찾기 쉽고, 상세설명 어디에 있어도 CSS 효과는 같다. - """ - stripped = _HIDE_PROMO_RE.sub("", html or "") - if not hidden: - return stripped - if not stripped.strip(): - return HIDE_PROMO_BLOCK - return HIDE_PROMO_BLOCK + "\n" + stripped.lstrip("\n") - - def fingerprint(html: str) -> str: """편집 시작 시점의 카페24 값 지문. 적용 직전 값과 비교해 충돌을 잡는다. diff --git a/app/modules/cafe24/templates/cafe24/_editor.html b/app/modules/cafe24/templates/cafe24/_editor.html index 91be241..5e71d05 100644 --- a/app/modules/cafe24/templates/cafe24/_editor.html +++ b/app/modules/cafe24/templates/cafe24/_editor.html @@ -55,17 +55,7 @@
- - PC 상세설명 HTML · {{ desc.description | length }}자 - - + PC 상세설명 HTML · {{ desc.description | length }}자 diff --git a/app/modules/cafe24/tests/test_cafe24.py b/app/modules/cafe24/tests/test_cafe24.py index 14f875b..48d4224 100644 --- a/app/modules/cafe24/tests/test_cafe24.py +++ b/app/modules/cafe24/tests/test_cafe24.py @@ -539,45 +539,6 @@ def test_format_then_encode_roundtrip(): assert saved == raw -# ════════════════════════════════════════════════════════════ -# 상단 공통 홍보 숨기기 (스킨 파일을 못 고치므로 상세설명 CSS 로 처리) -# ════════════════════════════════════════════════════════════ -def test_promo_hidden_add_and_remove(): - body = "
" - on = store.set_promo_hidden(body, True) - assert store.has_hidden_promo(on) is True - assert ".edb-img-tag-w{display:none !important}" in on - assert body in on # 원래 내용은 그대로 남는다 - - off = store.set_promo_hidden(on, False) - assert store.has_hidden_promo(off) is False - assert off.strip() == body - - -def test_promo_hidden_is_idempotent(): - body = "
x
" - once = store.set_promo_hidden(body, True) - assert store.set_promo_hidden(once, True) == once - twice_off = store.set_promo_hidden(store.set_promo_hidden(once, False), False) - assert twice_off.strip() == body - - -def test_promo_hidden_survives_formatting(): - """정리(포맷)를 거쳐도 숨김 상태가 유지되고 인식된다.""" - formatted = store.format_html(store.set_promo_hidden("

내용

", True)) - assert store.has_hidden_promo(formatted) is True - assert store.has_hidden_promo(store.format_html(store.set_promo_hidden(formatted, False))) is False - - -def test_promo_hidden_keeps_other_style_blocks(): - """사람이 쓴
x
" - on = store.set_promo_hidden(body, True) - off = store.set_promo_hidden(on, False) - assert ".v{max-width:100%}" in off - assert off.strip() == body - - def test_fingerprint_detects_change(): a = store.fingerprint("

A

") assert a == store.fingerprint("

A

") diff --git a/app/static/cafe24.css b/app/static/cafe24.css index c89fa42..fdf3649 100644 --- a/app/static/cafe24.css +++ b/app/static/cafe24.css @@ -240,15 +240,6 @@ align-items: center; } -.cf24-check-inline { - display: inline-flex; - align-items: center; - gap: 4px; - margin-left: var(--sp-12, 12px); - cursor: pointer; - color: var(--color-rich-black, #0a0a0a); -} - .cf24-memo { width: 260px; padding: 6px var(--sp-10, 10px); diff --git a/docs/CAFE24_MODULE.md b/docs/CAFE24_MODULE.md index 371e733..6b48768 100644 --- a/docs/CAFE24_MODULE.md +++ b/docs/CAFE24_MODULE.md @@ -61,33 +61,6 @@ app/modules/cafe24/ ← 상품관리 모듈 --- -## 3. OAuth 흐름 - -``` -관리자 [카페24 연결] - ↓ state 생성 → 세션 저장 -GET /cafe24/system/oauth/start → 302 카페24 인증 페이지 - ↓ 사용자 승인 -GET /cafe24/oauth/callback?code=&state= - ↓ 세션 state 와 대조 (불일치 시 토큰 교환 거부 — CSRF 방어) -code → access/refresh token 교환 - ↓ Fernet 암호화 -cafe24_oauth_tokens 저장 -``` - -- scope 는 `app/integrations/cafe24/config.py` 의 `PRODUCT_SCOPES` = - `mall.read_product`, `mall.write_product`. - 주문관리 추가 시 `ORDER_SCOPES` 를 합쳐 넘기고, 카페24 개발자센터 앱에서도 - 권한을 추가한 뒤 **재인증**하면 된다. -- access token 은 만료 2분 전부터 자동 갱신된다. 갱신은 토큰 행을 - `SELECT ... FOR UPDATE` 로 잠근 채 수행 — web 컨테이너와 worker 컨테이너가 - 동시에 refresh 해서 한쪽 토큰이 무효화되는 것을 막는다(카페24는 refresh - token 을 회전시킨다). -- refresh token 이 만료되면 자동 복구가 불가능하므로 화면에 "재연결 필요"를 - 표시한다. - ---- - ### 2-1. 상품관리 화면 구성 (2분할) ``` @@ -121,6 +94,74 @@ cafe24_oauth_tokens 저장 --- +### 2-2. 편집기 (문법 강조 · 소스 정리) + +**문법 강조** — 색칠된 `
` 위에 **투명한 `