feat(statusline): honor user-configured location over IP geolocation (#843)
Problem
The statusline determines location and weather purely via ip-api.com IP geolocation, which returns the wrong city for users behind a VPN, proxy, or corporate network whose exit node is in a different city — then falls back to hardcoded San Francisco coordinates. settings.json already has a .location object (city, regionName, lat, lon) but the statusline ignores it for both display and weather.
Fix
Make settings.json .location authoritative when present:
- Location display uses the configured
city/regionName - Weather uses the configured
lat/lon - Optional
.location.countryCodedrives the flag emoji (falls back to 🌐 when unset) ip-api.comis skipped entirely when location is configured — correct for VPN/proxy users, and one fewer third-party request exposing the user's IP- IP geolocation remains the fallback for unconfigured users (no behavior change for them)
The .location.* reads are ?-guarded so a malformed user-edited .location (e.g. a string instead of an object) can't break the rest of the settings cache.
Testing
Tested end-to-end on Debian 13 / PAI v5.0.0:
- ✅ Configured location with
countryCode→ shows configured city + flag, skips ip-api - ✅ Configured location without
countryCode→ shows city + 🌐 fallback, skips ip-api - ✅ Unconfigured → ip-api fallback works exactly as before (verified
countryCodepopulated from ip-api) - ✅ Partial (
cityonly, no coords) → city displays, weather falls back gracefully (no crash) - ✅ Malformed
.location→ guarded;TEMP_UNIT/ counts / rest of settings cache intact
Closes #843. Thanks to @DAESA24 for the original analysis and workaround.