feat(statusline): honor user-configured location over IP geolocation (#843)#1309
feat(statusline): honor user-configured location over IP geolocation (#843)#1309rpriven wants to merge 1 commit into
Conversation
…anielmiessler#843) The statusline determined location/weather purely via ip-api.com IP geolocation, returning the wrong city for VPN/proxy/corporate-network users whose exit node differs from their actual location — and falling back to hardcoded San Francisco coords. settings.json already has a `.location` object (city/regionName/lat/lon) but the statusline ignored it. This makes settings.json `.location` authoritative when present: - Location display uses the configured city/region - Weather uses the configured lat/lon - Optional `.location.countryCode` drives the flag emoji (falls back to 🌐) - ip-api.com is skipped entirely when location is configured (correctness for VPN users + one fewer third-party request exposing the user's IP) - IP geolocation remains the fallback for unconfigured users The `.location.*` reads are guarded with `?` so a malformed user-edited location can't break the rest of the settings cache. Tested end-to-end on Debian 13 / PAI v5.0.0: configured (with + without countryCode), unconfigured ip-api fallback, partial (city-only → weather falls back gracefully), and malformed-location paths.
|
Thanks @rpriven, your fix is already live in source and credited inline (upstream PR #1309): user-configured settings.json location is authoritative and ip-api is only the fallback. The repo is generated from our source tree, so we port and close rather than merge. Please pull the latest. Appreciated! |
|
Thanks Daniel — appreciate the credit, and the port-and-close model makes sense now that the repo's generated. One heads-up from checking the shipped payload after your note: as of today, main's Easy to reproduce the state: the GitHub blob SHAs for all five relevant files ( All four look like one mechanism rather than four separate misses: whatever generates the public payload from your source tree may be dropping some ported fixes. Figured one pointer to the pattern was more useful than four bug reports. Happy to re-verify any of these against the next release cut. |
Problem
The statusline determines location and weather purely via
ip-api.comIP 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.jsonalready has a.locationobject (city,regionName,lat,lon) but the statusline ignores it for both display and weather.Fix
Make
settings.json.locationauthoritative when present:city/regionNamelat/lon.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 IPThe
.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:
countryCode→ shows configured city + flag, skips ip-apicountryCode→ shows city + 🌐 fallback, skips ip-apicountryCodepopulated from ip-api)cityonly, no coords) → city displays, weather falls back gracefully (no crash).location→ guarded;TEMP_UNIT/ counts / rest of settings cache intactCloses #843. Thanks to @DAESA24 for the original analysis and workaround.