Cloudflare Pages 이전 + 같은 오리진 익명 집계 - #6
Merged
Merged
Conversation
사이트를 GitHub Pages 에서 Cloudflare Pages(cachehit.pages.dev)로 옮기고, 같은 오리진의 Pages Functions 로 익명 집계를 붙인다. - functions/collect.js — POST /collect. 카운터 증가만 저장(IP·UA·식별자 없음). qid 형식·보기 인덱스·확신도 값을 검증하고 cross-site 요청은 403. - functions/stats.js — 집계 전문 공개(GET /stats). AUTHORING §7(선택률 5% 미만 오답 = 죽은 보기, 확신도×정답 교차표)의 데이터 원천이다. - tools/analytics-schema.sql — D1 스키마. 적용 완료(cachehit-analytics). - tools/pack.mjs — dist/ 조립. 루트에는 저작 도구가 섞여 있어 그대로 배포하지 않는다. - assets/app.js — track()/trackPageview(). 배포 호스트에서만 전송하고 (ANALYTICS_HOSTS), pageview 는 localStorage 로 브라우저당 하루 한 번. - tools/e2e.mjs — 테스트 호스트에서 비컨 0건 단언(FAIL-first 확인: 게이트에 cachehit.test 를 넣자 24건 검출), SITE_MARK 갱신. - index.html·make-og.py·og.png·README — URL 을 cachehit.pages.dev 로. 옛 주소는 gh-pages 브랜치의 리다이렉트가 받는다(og.png 는 남겨 기존 트윗 카드 보존). 배포 실측: 사이트 200 / 유효 answer ok / 불량 qid 400 / cross-site 403 / /stats 반영 확인 후 테스트 행 삭제. 커스텀 도메인(cachehit.midagedev.com)은 Pages 에 등록만 해 둠 — DNS CNAME 은 계정 대시보드 권한이 필요해 보류. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
무엇을
호스팅을 GitHub Pages → Cloudflare Pages (https://cachehit.pages.dev) 로 옮기고, 같은 오리진의 Pages Functions로 익명 집계를 붙입니다. 옛 주소는
gh-pages브랜치의 리다이렉트가 받습니다(이미 공유된 트윗 카드가 깨지지 않도록assets/og.png는 옛 주소에 남깁니다).집계 설계
tools/analytics-schema.sql)가 수집 항목의 전부입니다./stats로 공개 — 개인 정보가 없으니 숨길 이유가 없고, 무엇을 세는지의 증명이기도 합니다.ANALYTICS_HOSTS게이트). E2E가 이것을 단언하고, FAIL-first로 확인했습니다(게이트에cachehit.test를 넣자 24건 검출).배포 실측 (이미 프로덕션에 적용됨)
/stats빈 집계 → 유효 answer{"ok":true}→ 반영 확인 → 테스트 행 삭제cachehit-analytics스키마 적용 완료남은 것
gh-pages브랜치로 전환(리다이렉트 활성화)cachehit.midagedev.com은 Pages에 등록만 됨 — DNS CNAME은 보류(대시보드 권한)🤖 Generated with Claude Code