How straymeteor3337/wechatrealfriends works
Project type and purpose
• This is a desktop/CLI tool with an embedded web-UI, written in Rust for the backend engine and using a small Node/JS-based front end for user interaction.
• Purpose: connect to the WeChat iPad protocol, detect one-way friend relationships, tag and export results for cleanup.
File structure
• Top level:
• Cargo.toml, src/main.rs → Rust backend (binary).
• web/ → front-end assets and code.
• web/ contains:
• package.json → Node tooling for bundling the front-end.
• index.html, main.html + JS/CSS assets → two entry points (login vs. main UI).
• WechatAPI.js → JavaScript wrapper for backend API calls.
• layui/ → UI component library.
• No separate database directories—data is held in memory or local files by the Rust service.
• No microservices; it’s a single Rust server that also serves static files and API.
README for technical stack and architecture notes
• Backend: Rust, using compiled iPad-protocol binary.
• Frontend: plain JS/CSS/HTML with layui.
• Communication: HTTP (or WebSocket) APIs between front-end and backend.
• External dependency: official WeChat iPad protocol server endpoints.
Main components and interactions (
a. Frontend (Browser)
• index.html/main.html, index.js/main.js, CSS, layui components.
• WechatAPI.js defines AJAX/WebSocket calls.
b. Backend (Rust Service)
• src/main.rs: HTTP server (serves static files + REST/WebSocket endpoints).
• Business logic: login via iPad protocol, friend list retrieval, one-way detection.
c. Protocol Library
• Pre‐compiled iPad protocol binary (imported by the Rust service).
d. External WeChat Servers
• Official endpoints for QR code login, data fetch.
e. Local Data Store (optional)
• In‐memory or local file (temporary session, tags).
Relationships and data flows
• User Browser ←→ Rust Service
• Step 1: load login page (/static files).
• Step 2: request QR code, scan with phone.
• Step 3: poll backend for login status via Protocol Library → WeChat servers.
• Step 4: fetch friend list → detect one-way friends.
• Step 5: return results to Browser for tagging and display.
• Rust Service ←→ WeChat Servers via Protocol Library
• Login handshake, data fetch, status updates.
Architectural patterns and principles
• Client‐Server: single backend serving static assets + API.
• Separation of concerns:
• UI layer (web folder) isolated from business logic (src/main.rs).
• Protocol implementation hidden in compiled binary, behind a library facade.
• Monolith: all functionality in a single deployable binary + static asset bundle.
Technologies and frameworks
• Backend: Rust (Cargo), HTTP framework (e.g., Actix or Rocket), FFI for protocol library.
• Frontend: Node/npm for package management, plain JS + layui CSS/JS.
• External: WeChat iPad protocol endpoints, Swagger UI for protocol exploration.
• Major flows (Login flow, Friend list fetch, Tagging flow).
• Technologies next to each component (Rust, JS, layui).
• Keep it simple: separate UI vs. backend vs. external services, then add details around protocol calls and data flow.