dongsik22 Claude Opus 4.7 (1M context) commited on
Commit
4dbda08
·
1 Parent(s): 606747d

fix(tvchak): stale 탭 정규식 좁힘 — 사용자 cf challenge 탭 보호

Browse files

증상: cf_clearance 만료 시 사용자가 CDP Chrome에 tvchak207.com/ 탭을
열어 cf challenge 통과하려 해도, server.js의 ensureCdpPage가 매번
findLiveDomain 호출 때마다 그 탭을 stale로 판단하고 close → cf 통과
불가 → 재생 영구 403.

원인: 이전 stale 정규식이 `^https://(tvchak\d+\.com|tvchak\.org)` 로
host 전체를 매치 → 사용자가 직접 띄운 일반 페이지(/, /vod/... 등)도
포함 → 모두 close 대상.

수정: stale 정규식을 `/robots.txt` 경로에 한정. server.js가 자기 용도로
띄운 탭만 정리하고, 사용자가 다른 경로로 열어둔 탭은 절대 안 건드림.

검증: 사용자가 tvchak207.com/ 탭 띄움 → cf challenge 자동 통과(이전
cf_clearance 살아있던 케이스) → 재생 복구 확인.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. server.js +4 -2
server.js CHANGED
@@ -736,7 +736,8 @@ function ensureCdpPage(domain) {
736
  } catch {}
737
  }
738
 
739
- // 다른 도메인 robots.txt 탭이 있다면 닫아서 정리 (탭 누적 방지). tvchak\d+ + tvchak.org 둘 다.
 
740
  const stalePages = [];
741
  for (const pg of _cdpCtx.pages()) {
742
  try {
@@ -750,7 +751,8 @@ function ensureCdpPage(domain) {
750
  _cdpPageDomain = domain;
751
  return _cdpPage;
752
  }
753
- if (/^https:\/\/(tvchak\d+\.com|tvchak\.org)/.test(u) && pg !== _cdpPage) stalePages.push(pg);
 
754
  } catch {}
755
  }
756
 
 
736
  } catch {}
737
  }
738
 
739
+ // 다른 도메인 robots.txt 탭이 있다면 닫아서 정리 (탭 누적 방지).
740
+ // ⚠️ robots.txt 경로로만 좁힘 — 사용자가 직접 열어둔 일반 탭(cf challenge용 등)은 절대 닫지 않음.
741
  const stalePages = [];
742
  for (const pg of _cdpCtx.pages()) {
743
  try {
 
751
  _cdpPageDomain = domain;
752
  return _cdpPage;
753
  }
754
+ // robots.txt 경로인 탭만 stale 후보 (사용자가 cf challenge용으로 띄운 일반 페이지는 보존)
755
+ if (/^https:\/\/(tvchak\d+\.com|tvchak\.org)\/robots\.txt/.test(u) && pg !== _cdpPage) stalePages.push(pg);
756
  } catch {}
757
  }
758