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