Make navigator.geolocation coordinates configurable (#272)

The geolocation shim returned a fixed Frankfurt position. With the timezone now
configurable, a deployment in another region would report a location that does
not match its exit IP or timezone, the mismatch issue #228 describes.

Set OBSCURA_GEOLOCATION="lat,lon" to override the reported coordinates; the
value is range-checked and falls back to the Frankfurt default when unset or
malformed. The existing positional jitter is preserved.
This commit is contained in:
SGavrl authored and GitHub committed 2026-06-08 21:40:38 +00:00
1 parent a23dad7cd9
commit 82b7a0baa8
3 files changed
+37 -4

No files matched your search

+4 -4
View File
@@ -2447,8 +2447,8 @@ globalThis.navigator = {
geolocation: {
getCurrentPosition(success, error) {
const coords = {
latitude: 50.1109 + (_fpRand(500) - 0.5) * 0.1,
longitude: 8.6821 + (_fpRand(501) - 0.5) * 0.1,
latitude: (globalThis.__obscura_geo_lat ?? 50.1109) + (_fpRand(500) - 0.5) * 0.1,
longitude: (globalThis.__obscura_geo_lon ?? 8.6821) + (_fpRand(501) - 0.5) * 0.1,
accuracy: 10 + _fpRand(502) * 40,
altitude: null,
altitudeAccuracy: null,
@@ -2461,8 +2461,8 @@ globalThis.navigator = {
watchPosition(success, error) {
if (typeof success === 'function') {
const coords = {
latitude: 50.1109 + (_fpRand(503) - 0.5) * 0.1,
longitude: 8.6821 + (_fpRand(504) - 0.5) * 0.1,
latitude: (globalThis.__obscura_geo_lat ?? 50.1109) + (_fpRand(503) - 0.5) * 0.1,
longitude: (globalThis.__obscura_geo_lon ?? 8.6821) + (_fpRand(504) - 0.5) * 0.1,
accuracy: 10 + _fpRand(505) * 40,
altitude: null,
altitudeAccuracy: null,