Add support for png icons

This commit is contained in:
Pieter Vander Vennet 2021-07-06 15:43:21 +02:00
parent bf0924a699
commit d7cb06445b

View file

@ -1,5 +1,6 @@
// We HAVE to mark this while importing // We HAVE to mark this while importing
import {Utils} from "../Utils"; import {Utils} from "../Utils";
Utils.runningFromConsole = true; Utils.runningFromConsole = true;
import LayoutConfig from "../Customizations/JSON/LayoutConfig"; import LayoutConfig from "../Customizations/JSON/LayoutConfig";
@ -10,6 +11,7 @@ import {Translation} from "../UI/i18n/Translation";
import Constants from "../Models/Constants"; import Constants from "../Models/Constants";
import * as all_known_layouts from "../assets/generated/known_layers_and_themes.json" import * as all_known_layouts from "../assets/generated/known_layers_and_themes.json"
import {LayoutConfigJson} from "../Customizations/JSON/LayoutConfigJson"; import {LayoutConfigJson} from "../Customizations/JSON/LayoutConfigJson";
const sharp = require('sharp'); const sharp = require('sharp');
@ -84,6 +86,12 @@ async function createManifest(layout: LayoutConfig) {
sizes: "513x513", sizes: "513x513",
type: "image/svg" type: "image/svg"
}) })
} else if (icon.endsWith(".png")) {
icons.push({
src: icon,
sizes: "513x513",
type: "image/svg"
})
} else { } else {
console.log(icon) console.log(icon)
throw "Icon is not an svg for " + layout.id throw "Icon is not an svg for " + layout.id
@ -199,7 +207,7 @@ for (const i in all) {
createLandingPage(layout, manifObj).then(landing => { createLandingPage(layout, manifObj).then(landing => {
writeFile(enc(layout.id) + ".html", landing, err) writeFile(enc(layout.id) + ".html", landing, err)
}); });
}) }).catch(e => console.log("Could not generate the manifest: ", e))
} }