Settings: a legacy "Middle East" location no longer kills the page

Profiles from before the country picker carry locationMode "spoof" with a
region; the Settings page migrates them to a country on load. middle_east
mapped to AE, which was missing from COUNTRIES, so the destructure threw
partway through the page script. Everything wired after that point never
ran: the Ariadne panel stayed on "checking...", showed no collision
policy, left Sources empty, and its on/off switch had no handler, so
flipping it never asked for UAC and changed nothing.

Add the United Arab Emirates (same Dubai coordinates main.js already uses
for the region) and fall back to Germany for any region without a
country, so a stale value can never stop the page again.
This commit is contained in:
Local Dev 2026-10-03 23:28:58 +02:00
parent 4f745406d8
commit 41523a5cbf

View file

@ -1579,6 +1579,7 @@
// country's capital (or biggest city) so pages that geocode the position
// land in the right country. Alphabetised for the dropdown.
const COUNTRIES = {
AE: ["United Arab Emirates", 25.2048, 55.2708],
AR: ["Argentina", -34.6037, -58.3816],
AT: ["Austria", 48.2082, 16.3738],
AU: ["Australia", -33.8688, 151.2093],
@ -1658,7 +1659,10 @@
// has a valid value and the settings file is normalised on next save.
const initialMode = (() => {
if (s.locationMode === "spoof") {
const code = REGION_TO_COUNTRY[s.locationRegion] || "DE";
// Every region must map to a COUNTRIES entry: this runs before the
// rest of the page is wired, so a throw here (middle_east -> AE, once
// missing from COUNTRIES) left Plug-ins and everything below it dead.
const code = COUNTRIES[REGION_TO_COUNTRY[s.locationRegion]] ? REGION_TO_COUNTRY[s.locationRegion] : "DE";
const [, la, lo] = COUNTRIES[code];
C.set("locationCountry", code);
C.set("locationLat", String(la));