64 lines
2.6 KiB
Markdown
64 lines
2.6 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Project Overview
|
|
|
|
This is a WeChat Mini Program called "徵象" (emblem-scanner) for QR code scanning and processing. The app connects to the Themblem service for QR code verification and includes camera functionality with device-specific optimizations.
|
|
|
|
## Architecture
|
|
|
|
**Main App Structure:**
|
|
- `app.js` - Main application entry point with global data and worker initialization
|
|
- `utils.js` - Utility functions for camera rules, device detection, and QR code extraction
|
|
- `pages/` - WeChat Mini Program pages (index, camera, debug, webview, etc.)
|
|
- `components/` - Reusable UI components (scanguide, tooltips, modals, etc.)
|
|
- `worker/` - WebAssembly worker thread for QR code processing using qrtool library
|
|
- `static/` - Static assets and resources
|
|
|
|
**Key Components:**
|
|
- Camera system with device-specific zoom rules fetched from API
|
|
- WebAssembly-based QR processing in worker thread for performance
|
|
- New emblemscanner (`pages/emblemscanner/`) for unified QR scanning experience
|
|
- Legacy camera page (`pages/camera/`) kept for reference to worker integration
|
|
- Upload and verification system connecting to themblem.com API
|
|
|
|
**Global Data:**
|
|
- `server_url`: 'https://themblem.com' - main API endpoint
|
|
- `session_id`: Generated unique session identifier
|
|
- `real_ip`: User's IP address fetched from external service
|
|
- `worker`: WebAssembly worker for QR processing
|
|
|
|
## Development Commands
|
|
|
|
This is a WeChat Mini Program project. Development is done through WeChat Developer Tools IDE.
|
|
|
|
**Linting:**
|
|
```bash
|
|
# ESLint configuration available but no npm scripts defined
|
|
# Lint manually using WeChat Developer Tools or external ESLint
|
|
```
|
|
|
|
**No test framework or build scripts are configured in package.json**
|
|
|
|
## Key Files
|
|
|
|
- `project.config.json` - WeChat Mini Program configuration
|
|
- `app.json` - App pages, window settings, and worker configuration
|
|
- `utils.js` - Core utility functions for camera and QR code handling
|
|
- `worker/index.js` - WebAssembly QR code processing worker
|
|
- `precheck.js` - QR code frame validation logic
|
|
- `upload.js` - Image upload and verification functions
|
|
|
|
## Dependencies
|
|
|
|
- `lottie-miniprogram` - Lottie animations support
|
|
- WebAssembly qrtool library (`qrtool.wx.js`) - QR code processing
|
|
|
|
## External APIs
|
|
|
|
- `https://themblem.com/api/v1/camera-rules/` - Device-specific camera settings
|
|
- `https://themblem.com/api/v1/check-auto-torch/` - Auto torch functionality
|
|
- `https://whatsmyip.themblem.com` - IP address detection
|
|
- `https://research.themblem.com/event/` - Event tracking endpoint
|