forked from MapComplete/MapComplete
		
	Merge master
This commit is contained in:
		
						commit
						3659276351
					
				
					 84 changed files with 3508 additions and 3472 deletions
				
			
		| 
						 | 
				
			
			@ -162,9 +162,7 @@ class GenerateLayouts extends Script {
 | 
			
		|||
        return path
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async createManifest(
 | 
			
		||||
        layout: ThemeConfig
 | 
			
		||||
    ): Promise<{
 | 
			
		||||
    async createManifest(layout: ThemeConfig): Promise<{
 | 
			
		||||
        manifest: any
 | 
			
		||||
        whiteIcons: string[]
 | 
			
		||||
    }> {
 | 
			
		||||
| 
						 | 
				
			
			@ -453,11 +451,7 @@ class GenerateLayouts extends Script {
 | 
			
		|||
        return [`<meta http-equiv="Content-Security-Policy" content="${content}">`].join("\n")
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async createLandingPage(
 | 
			
		||||
        layout: ThemeConfig,
 | 
			
		||||
        layoutJson: ThemeConfigJson,
 | 
			
		||||
        whiteIcons
 | 
			
		||||
    ) {
 | 
			
		||||
    async createLandingPage(layout: ThemeConfig, layoutJson: ThemeConfigJson, whiteIcons) {
 | 
			
		||||
        Locale.language.setData(layout.language[0])
 | 
			
		||||
        const targetLanguage = layout.language[0]
 | 
			
		||||
        const ogTitle = Translations.T(layout.title).textFor(targetLanguage).replace(/"/g, '\\"')
 | 
			
		||||
| 
						 | 
				
			
			@ -634,11 +628,7 @@ class GenerateLayouts extends Script {
 | 
			
		|||
        writeFile("public/" + manifestLocation, manif, err)
 | 
			
		||||
 | 
			
		||||
        // Create a landing page for the given theme
 | 
			
		||||
        const landing = await this.createLandingPage(
 | 
			
		||||
            layout,
 | 
			
		||||
            layoutConfigJson,
 | 
			
		||||
            whiteIcons
 | 
			
		||||
        )
 | 
			
		||||
        const landing = await this.createLandingPage(layout, layoutConfigJson, whiteIcons)
 | 
			
		||||
 | 
			
		||||
        writeFile(this.enc(layout.id) + ".html", landing, err)
 | 
			
		||||
        await this.createIndexFor(layout)
 | 
			
		||||
| 
						 | 
				
			
			@ -670,11 +660,12 @@ class GenerateLayouts extends Script {
 | 
			
		|||
            console.warn("Only generating layout " + theme)
 | 
			
		||||
        }
 | 
			
		||||
        const paths = ScriptUtils.readDirRecSync("./public/assets/generated/themes/", 1)
 | 
			
		||||
        const configs = paths.map(path => <ThemeConfigJson>JSON.parse(readFileSync(path, "utf8")))
 | 
			
		||||
        const configsFiltered = configs
 | 
			
		||||
            .filter(config => (theme !== undefined && config.id === theme) || !blacklist.has(config.id))
 | 
			
		||||
        const configs = paths.map((path) => <ThemeConfigJson>JSON.parse(readFileSync(path, "utf8")))
 | 
			
		||||
        const configsFiltered = configs.filter(
 | 
			
		||||
            (config) => (theme !== undefined && config.id === theme) || !blacklist.has(config.id)
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        await Promise.all(configsFiltered.map(config => this.createThemeFor(config)))
 | 
			
		||||
        await Promise.all(configsFiltered.map((config) => this.createThemeFor(config)))
 | 
			
		||||
 | 
			
		||||
        const { manifest } = await this.createManifest(
 | 
			
		||||
            new ThemeConfig({
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue