fix(cafe24): 앞 커밋에서 누락된 디자인파일 일반화 변경분 포함
config.py(Cafe24FtpConfig 일반화 + DESIGN_FILE_SPECS)·db.py(add/list_design_
revision)·router.py(design_files_router 연결)·_nav.html(탭 3개)·테스트·
.env.example·문서가 앞 커밋(8c2a9c4)에 함께 올라갔어야 하는데 스테이징 누락.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -118,7 +118,8 @@ def load_config(*, scopes: tuple[str, ...] = DEFAULT_SCOPES) -> Cafe24Config:
|
||||
|
||||
|
||||
# ════════════════════════════════════════════════════════════
|
||||
# 디자인 보관함 FTP — 모바일 스와이프(product-swiper.js) 편집용
|
||||
# 디자인 보관함 FTP — 상품 API 로 못 건드리는 스킨 파일 편집용
|
||||
# (모바일 스와이프 product-swiper.js, PC/모바일 상품상세 템플릿 detail.html 등)
|
||||
# ════════════════════════════════════════════════════════════
|
||||
# Admin API(OAuth)로는 스킨 파일을 읽거나 쓸 수 없다(위 설명 참고). 카페24가
|
||||
# 스킨 파일에 제공하는 유일한 프로그램적 접근은 "디자인 보관함" FTP 계정이다
|
||||
@@ -133,12 +134,10 @@ class Cafe24FtpConfig:
|
||||
port: int
|
||||
user: str
|
||||
password: str
|
||||
# 편집 대상 파일의 절대 경로(디자인 보관함 기준). 스킨 번호가 바뀌면 함께 바뀐다.
|
||||
swiper_path: str
|
||||
|
||||
@property
|
||||
def configured(self) -> bool:
|
||||
return bool(self.host and self.user and self.password and self.swiper_path)
|
||||
return bool(self.host and self.user and self.password)
|
||||
|
||||
@property
|
||||
def missing(self) -> list[str]:
|
||||
@@ -146,7 +145,6 @@ class Cafe24FtpConfig:
|
||||
("CAFE24_FTP_HOST", self.host),
|
||||
("CAFE24_FTP_USER", self.user),
|
||||
("CAFE24_FTP_PASSWORD", self.password),
|
||||
("CAFE24_SWIPER_FTP_PATH", self.swiper_path),
|
||||
)
|
||||
return [name for name, value in pairs if not value]
|
||||
|
||||
@@ -166,9 +164,35 @@ def load_ftp_config(*, mall_id: str = "") -> Cafe24FtpConfig:
|
||||
port=port,
|
||||
user=_env("CAFE24_FTP_USER"),
|
||||
password=_env("CAFE24_FTP_PASSWORD"),
|
||||
# 실물 확인된 기본 경로(미라스키친 mobile11 스킨). 스킨을 바꾸면
|
||||
# CAFE24_SWIPER_FTP_PATH 로 덮어쓴다.
|
||||
swiper_path=_env(
|
||||
"CAFE24_SWIPER_FTP_PATH", "/sde_design/mobile11/product-swiper/product-swiper.js"
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
# FTP 로 편집하는 디자인 파일들 — key: (표시 이름, 경로 환경변수 이름, 기본 경로).
|
||||
# 기본 경로는 실물 확인된 값(미라스키친: 모바일 mobile11 / PC skin11 스킨)이다.
|
||||
# 스킨을 바꾸면 각 CAFE24_*_FTP_PATH 로 덮어쓴다.
|
||||
DESIGN_FILE_SPECS: dict[str, tuple[str, str, str]] = {
|
||||
"swiper": (
|
||||
"모바일 스와이프",
|
||||
"CAFE24_SWIPER_FTP_PATH",
|
||||
"/sde_design/mobile11/product-swiper/product-swiper.js",
|
||||
),
|
||||
"mobile_detail": (
|
||||
"모바일 상품상세",
|
||||
"CAFE24_MOBILE_DETAIL_FTP_PATH",
|
||||
"/sde_design/mobile11/product/detail.html",
|
||||
),
|
||||
"pc_detail": (
|
||||
"PC 상품상세",
|
||||
"CAFE24_PC_DETAIL_FTP_PATH",
|
||||
"/sde_design/skin11/product/detail.html",
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def design_file_label(key: str) -> str:
|
||||
return DESIGN_FILE_SPECS[key][0]
|
||||
|
||||
|
||||
def design_file_path(key: str) -> str:
|
||||
_, env_name, default = DESIGN_FILE_SPECS[key]
|
||||
return _env(env_name, default)
|
||||
|
||||
Reference in New Issue
Block a user