Skip to content

feat: add local-first stateless template storage and sharing - #83

Open
Turtle-Hwan wants to merge 13 commits into
mainfrom
feat/indexeddb-local-first
Open

feat: add local-first stateless template storage and sharing#83
Turtle-Hwan wants to merge 13 commits into
mainfrom
feat/indexeddb-local-first

Conversation

@Turtle-Hwan

Copy link
Copy Markdown
Owner

요약

서버가 내려가 있어도 개인 템플릿 기능이 브라우저 안에서 완결되도록 stateless 기반을 분리합니다.

  • 개인 템플릿, draft, 사용자 아이콘을 IndexedDB에 저장
  • 기존 localStorage 템플릿을 1회 안전하게 이관
  • 개인 템플릿 생성/조회/수정/삭제에서 backend 의존 제거
  • 작은 템플릿은 URL fragment, 큰 템플릿은 .linku.json 파일로 공유
  • GitHub Pages에서 fragment 기반 미리보기와 extension 가져오기 요청 제공
  • 외부 아이콘 요청, 실행 가능한 SVG, 비정상 URL/grid/payload 크기를 제한
  • Pages 가져오기 요청은 service worker queue를 거쳐 popup에서 IndexedDB에 저장

의도적으로 제외한 범위

다음 기능은 이어지는 Cloudflare stateful PR에서 추가합니다.

  • Google 로그인과 계정별 namespace
  • 여러 기기 동기화 및 durable outbox
  • cloud share, 게시, 커뮤니티 데이터
  • Worker/R2 배포 설정과 secrets

검증

  • pnpm run test:feedback (3 passed)
  • pnpm run test:forms (3 passed)
  • pnpm run test:todo (4 passed)
  • pnpm run test:timetable (10 passed)
  • pnpm run test:template-share (5 passed)
  • pnpm run build:local
  • pnpm run build:gh-pages
  • pnpm run lint
  • 로컬 Pages 런타임에서 landing, 정상 fragment, 손상 fragment, hash 변경, console error 부재 확인

검증 제한

자동화 브라우저의 보안 정책으로 chrome://extensions 접근이 차단되어 이번 세션에서는 빌드된 unpacked extension을 직접 로드하지 못했습니다. 실제 extension runtime의 OAuth/storage/service-worker 통합 검증은 후속 수동 확인 항목입니다.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44b3b91d50

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +64 to +67
return {
iconId: -Math.floor(Math.random() * Number.MAX_SAFE_INTEGER),
iconName: icon.name,
iconUrl: icon.dataUrl,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Persist imported data icons with editable IDs

When a shared template contains an embedded PNG/JPEG/WebP icon, this assigns it a negative ID without registering it in the IndexedDB asset repository. The editor initializes its icon selector from that negative ID, but linkFormSchema rejects non-positive IDs and ItemPropertiesPanel can only resolve icons from the bundled/asset lists, so users cannot save name, URL, position, or size changes for the imported item unless they replace its icon. Persist the embedded icon as an asset or preserve it as a valid editable selection.

Useful? React with 👍 / 👎.

Comment on lines +108 to +109
Number(position.x) + Number(size.width) > 6 ||
Number(position.y) + Number(size.height) > 6

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate item bounds against the declared template height

For an imported file or untrusted fragment whose template.height is less than 6, an item can pass validation while lying below the template—for example, height: 1 with an item at y: 5. Template cards and the share viewer size their preview from template.height and clip overflow, so such accepted items disappear from the preview and produce an inconsistent imported layout. Pass the declared height into item validation and require position.y + size.height <= template.height rather than only checking the global six-row maximum.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant