$ show Yu9191/wloc
This repository provides a tool for spoofing Apple's network-based location service (WLOC) on iOS devices. It intercepts HTTP requests to `gs-loc.apple.com` via proxy tools (Surge, Quantumult X, Loon, Stash, Shadowrocket) and modifies the response to return user-defined coordinates. The system includes a Cloudflare Worker that serves a web-based map interface for selecting locations and an API for parsing map links from various services (Apple Maps, Google Maps, Amap, Baidu) with automatic coordinate system conversion (GCJ-02, BD-09, WGS84). The architecture is client-server: the proxy tool runs on the iOS device, while the Worker is stateless and handles the UI and link parsing. The codebase is well-structured, with clean separation between the Worker application, proxy scripts, and configuration modules. The coordinate parsing and conversion logic is particularly sophisticated, handling edge cases like Hong Kong boundary detection and Baidu's non-standard Mercator projection. The repository includes comprehensive regression tests and detailed documentation.
The LLM identified 3 files worth highlighting for reuse:
Self-contained module for extracting coordinates from various map service URLs (Apple, Google, Amap, Baidu) and converting between coordinate systems (WGS84, GCJ-02, BD-09). Includes BD09MC to BD09 conversion using polynomial coefficients, Hong Kong boundary polygon for WGS84 bypass, and iterative GCJ-02 to WGS84 conversion. Highly reusable for any project needing map link parsing or coordinate transformation.
String-embedded browser-side GCJ-02 conversion functions, mirroring the server implementation. Uses string literal to avoid minification renaming, ensuring the injected code works correctly in the browser context. Demonstrates a robust pattern for sharing coordinate logic between server and client without duplication.
Comprehensive regression test suite for coordinate parsing and conversion. Tests edge cases like Hong Kong boundary, BD09MC conversion, and ensures server and browser implementations stay in sync. Each test case corresponds to a real bug that was fixed, making it a valuable asset for maintaining correctness.