Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function updateSettings () {
var presets = ipcRenderer.sendSync('get-user-data', 'presets')
var customCss = ipcRenderer.sendSync('get-user-data', 'css')
var imagery = ipcRenderer.sendSync('get-user-data', 'imagery')
var icons = ipcRenderer.sendSync('get-user-data', 'icons')
if (presets) {
const iDPresets = convertPresets(presets)
if (!id.current) {
iDPresets.fields = { ...iD.data.presets.fields, ...iDPresets.fields }
iD.data.presets = iDPresets
}
}
if (customCss) insertCss(customCss)
if (imagery) {
// iD upgraded to use 'dataImagery' in 2.14.3, this is for backwards
// compatibility
if (imagery.dataImagery) imagery = imagery.dataImagery
imagery.forEach((img, idx) => {
// Add id
img.id = img.name + '_' + idx
iD.data.imagery.unshift(img)
})
}
if (icons) {
var parser = new window.DOMParser()
var iconsSvg = parser.parseFromString(icons, 'image/svg+xml')
imagery.forEach((img, idx) => {
// Add id
img.id = img.name + '_' + idx
iD.data.imagery.unshift(img)
})
}