fix: serve world-atlas topojson locally to satisfy CSP connect-src

Fetching from cdn.jsdelivr.net was blocked by connect-src 'self'.
Copy countries-110m.json from world-atlas npm package into public/geo/
and reference it as /geo/countries-110m.json instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
fuomag9
2026-02-26 21:38:01 +01:00
parent 8be69d2774
commit 89a6a71d3e
4 changed files with 13 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ import { feature } from 'topojson-client';
import type { Topology, GeometryCollection } from 'topojson-specification';
import { Box, CircularProgress } from '@mui/material';
const WORLD_ATLAS = 'https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json';
const WORLD_ATLAS = '/geo/countries-110m.json';
// ISO 3166-1 alpha-2 → numeric
const A2N: Record<string, string> = {

10
package-lock.json generated
View File

@@ -35,7 +35,8 @@
"drizzle-kit": "^0.31.9",
"eslint": "^9.39.2",
"eslint-config-next": "^16.1.3",
"typescript": "^5.9.3"
"typescript": "^5.9.3",
"world-atlas": "^2.0.2"
}
},
"node_modules/@auth/core": {
@@ -8226,6 +8227,13 @@
"node": ">=0.10.0"
}
},
"node_modules/world-atlas": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/world-atlas/-/world-atlas-2.0.2.tgz",
"integrity": "sha512-IXfV0qwlKXpckz1FhwXVwKRjiIhOnWttOskm5CtxMsjgE/MXAYRHWJqgXOpM8IkcPBoXnyTU5lFHcYa5ChG0LQ==",
"dev": true,
"license": "ISC"
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",

View File

@@ -40,6 +40,7 @@
"drizzle-kit": "^0.31.9",
"eslint": "^9.39.2",
"eslint-config-next": "^16.1.3",
"typescript": "^5.9.3"
"typescript": "^5.9.3",
"world-atlas": "^2.0.2"
}
}

File diff suppressed because one or more lines are too long