chore: automated housekeeping...
This commit is contained in:
parent
8109c13b38
commit
297bb1c498
185 changed files with 2826 additions and 5874 deletions
|
@ -107,9 +107,9 @@ class GenerateLayouts extends Script {
|
|||
if (!layout.icon.endsWith(".svg")) {
|
||||
console.warn(
|
||||
"Not creating a social image for " +
|
||||
layout.id +
|
||||
" as it is _not_ a .svg: " +
|
||||
layout.icon
|
||||
layout.id +
|
||||
" as it is _not_ a .svg: " +
|
||||
layout.icon
|
||||
)
|
||||
return undefined
|
||||
}
|
||||
|
@ -142,9 +142,9 @@ class GenerateLayouts extends Script {
|
|||
id: "icon",
|
||||
transform: `translate(${cx - r},${cy - r}) scale(${
|
||||
(r * 2) / Number(width)
|
||||
}) `
|
||||
}) `,
|
||||
},
|
||||
g: [svg]
|
||||
g: [svg],
|
||||
}
|
||||
},
|
||||
(mightBeTokenToReplace) => {
|
||||
|
@ -205,19 +205,19 @@ class GenerateLayouts extends Script {
|
|||
icons.push({
|
||||
src: name,
|
||||
sizes: size + "x" + size,
|
||||
type: "image/png"
|
||||
type: "image/png",
|
||||
})
|
||||
}
|
||||
icons.push({
|
||||
src: path,
|
||||
sizes: "513x513",
|
||||
type: "image/svg"
|
||||
type: "image/svg",
|
||||
})
|
||||
} else if (icon.endsWith(".png")) {
|
||||
icons.push({
|
||||
src: icon,
|
||||
sizes: "513x513",
|
||||
type: "image/png"
|
||||
type: "image/png",
|
||||
})
|
||||
} else {
|
||||
console.log(icon)
|
||||
|
@ -236,11 +236,11 @@ class GenerateLayouts extends Script {
|
|||
description: ogDescr,
|
||||
orientation: "portrait-primary, landscape-primary",
|
||||
icons: icons,
|
||||
categories: ["map", "navigation"]
|
||||
categories: ["map", "navigation"],
|
||||
}
|
||||
return {
|
||||
manifest,
|
||||
whiteIcons
|
||||
whiteIcons,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ class GenerateLayouts extends Script {
|
|||
if (lang === "_context") {
|
||||
continue
|
||||
}
|
||||
let display = " style=\"display: none\""
|
||||
let display = ' style="display: none"'
|
||||
if (!defaultSet) {
|
||||
display = ""
|
||||
defaultSet = true
|
||||
|
@ -272,7 +272,7 @@ class GenerateLayouts extends Script {
|
|||
...eli.features,
|
||||
bing,
|
||||
...eli_global.map((properties) => ({ properties })),
|
||||
...layers_global.layers.map((properties) => ({ properties }))
|
||||
...layers_global.layers.map((properties) => ({ properties })),
|
||||
]
|
||||
for (const feature of rasterLayers) {
|
||||
const f = <RasterLayerPolygon>feature
|
||||
|
@ -293,7 +293,7 @@ class GenerateLayouts extends Script {
|
|||
url = url.substring("pmtiles://".length)
|
||||
}
|
||||
const styleSpec = await Utils.downloadJsonCached(url, 1000 * 120, {
|
||||
Origin: "https://mapcomplete.org"
|
||||
Origin: "https://mapcomplete.org",
|
||||
})
|
||||
urls.push(...(f.properties["connect-src"] ?? []))
|
||||
for (const key of Object.keys(styleSpec?.["sources"] ?? {})) {
|
||||
|
@ -309,7 +309,7 @@ class GenerateLayouts extends Script {
|
|||
urls.push(url)
|
||||
if (urlClipped.endsWith(".json")) {
|
||||
const tileInfo = await Utils.downloadJsonCached(url, 1000 * 120, {
|
||||
Origin: "https://mapcomplete.org"
|
||||
Origin: "https://mapcomplete.org",
|
||||
})
|
||||
urls.push(tileInfo["tiles"] ?? [])
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ class GenerateLayouts extends Script {
|
|||
"https://api.panoramax.xyz",
|
||||
"https://panoramax.mapcomplete.org",
|
||||
"https://data.velopark.be",
|
||||
"https://data.mapcomplete.org"
|
||||
"https://data.mapcomplete.org",
|
||||
].concat(...(await this.eliUrls()))
|
||||
|
||||
SpecialVisualizations.specialVisualizations.forEach((sv) => {
|
||||
|
@ -433,17 +433,15 @@ class GenerateLayouts extends Script {
|
|||
"script-src": [
|
||||
"'self'",
|
||||
"https://gc.zgo.at/count.js",
|
||||
...(options?.scriptSrcs?.map((s) => "'" + s + "'") ?? [])
|
||||
...(options?.scriptSrcs?.map((s) => "'" + s + "'") ?? []),
|
||||
].join(" "),
|
||||
"connect-src": "'self' " + connectSrc.join(" ")
|
||||
"connect-src": "'self' " + connectSrc.join(" "),
|
||||
}
|
||||
const content = Object.keys(csp)
|
||||
.map((k) => k + " " + csp[k])
|
||||
.join(" ; ")
|
||||
|
||||
return [
|
||||
`<meta http-equiv="Content-Security-Policy" content="${content}">`
|
||||
].join("\n")
|
||||
return [`<meta http-equiv="Content-Security-Policy" content="${content}">`].join("\n")
|
||||
}
|
||||
|
||||
async createLandingPage(
|
||||
|
@ -454,12 +452,12 @@ class GenerateLayouts extends Script {
|
|||
) {
|
||||
Locale.language.setData(layout.language[0])
|
||||
const targetLanguage = layout.language[0]
|
||||
const ogTitle = Translations.T(layout.title).textFor(targetLanguage).replace(/"/g, "\\\"")
|
||||
const ogTitle = Translations.T(layout.title).textFor(targetLanguage).replace(/"/g, '\\"')
|
||||
const ogDescr = Translations.T(
|
||||
layout.shortDescription ?? "Easily add and edit geodata with OpenStreetMap"
|
||||
)
|
||||
.textFor(targetLanguage)
|
||||
.replace(/"/g, "\\\"")
|
||||
.replace(/"/g, '\\"')
|
||||
let ogImage = layout.socialImage
|
||||
let twitterImage = ogImage
|
||||
if (ogImage === ThemeConfig.defaultSocialImage && layout.official) {
|
||||
|
@ -530,7 +528,7 @@ class GenerateLayouts extends Script {
|
|||
og,
|
||||
customCss,
|
||||
`<link rel="icon" href="${icon}" sizes="any" type="image/svg+xml">`,
|
||||
...apple_icons
|
||||
...apple_icons,
|
||||
].join("\n")
|
||||
|
||||
let branchname = await this.getBranchName()
|
||||
|
@ -553,7 +551,7 @@ class GenerateLayouts extends Script {
|
|||
.replace(
|
||||
/<!-- CSP -->/,
|
||||
await this.generateCsp(layout, layoutJson, {
|
||||
scriptSrcs: [this.removeOtherLanguagesHash]
|
||||
scriptSrcs: [this.removeOtherLanguagesHash],
|
||||
})
|
||||
)
|
||||
.replace(
|
||||
|
@ -584,7 +582,7 @@ class GenerateLayouts extends Script {
|
|||
|
||||
const imports = [
|
||||
`import theme from "./public/assets/generated/themes/${theme.id}.json"`,
|
||||
`import { ThemeMetaTagging } from "./src/assets/generated/metatagging/${theme.id}"`
|
||||
`import { ThemeMetaTagging } from "./src/assets/generated/metatagging/${theme.id}"`,
|
||||
]
|
||||
for (const layerName of Constants.added_by_default) {
|
||||
imports.push(
|
||||
|
@ -631,7 +629,7 @@ class GenerateLayouts extends Script {
|
|||
"account",
|
||||
"openstreetmap",
|
||||
"custom",
|
||||
"theme"
|
||||
"theme",
|
||||
]
|
||||
const args = process.argv
|
||||
const theme = args[2]
|
||||
|
@ -682,7 +680,7 @@ class GenerateLayouts extends Script {
|
|||
startLon: 0,
|
||||
startZoom: 0,
|
||||
title: { en: "MapComplete" },
|
||||
description: { en: "A thematic map viewer and editor based on OpenStreetMap" }
|
||||
description: { en: "A thematic map viewer and editor based on OpenStreetMap" },
|
||||
}),
|
||||
alreadyWritten
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue