Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const applyTodoMvcStyling = (ctx, assetUrl) => {
const escapeHtml = dangerouslySetHTML(
``
);
ctx.template.head.push(escapeHtml);
};
return async (ctx, next) => {
if (!ctx.element) {
return next();
}
const helmetContext = {};
ctx.element = (
{ctx.element}
);
await next();
const {helmet} = helmetContext;
if (helmet) {
ctx.template.title = dangerouslySetHTML(
helmet.title
.toString()
.replace('', '')
.replace(/^/, '')
);
keys.forEach(key => {
ctx.template.head.push(dangerouslySetHTML(helmet[key].toString()));
});
}
};
},
return next().then(() => {
const stylesForHead = engine.getStylesheetsHtml();
ctx.template.head.push(dangerouslySetHTML(stylesForHead));
});
} else {
if (__NODE__) {
ctx.template.head.push(html`<style>`);
if (withStyleOverloads) {
ctx.template.head.push(
dangerouslySetHTML(generateStyledFontFaces(styledFonts))
);
} else {
ctx.template.head.push(
dangerouslySetHTML(generateAtomicFontFaces(atomicFonts))
);
}
ctx.template.head.push(html`</style>`);
if (!withStyleOverloads) {
const atomicFonts: AtomicFontsObjectType = (fonts: any);
ctx.template.head.push(
dangerouslySetHTML(
generatePreloadLinks(
preloadOverrides || preloadSession.fontsToPreload,
atomicFonts
)
)
);
}
}
});
} else {
keys.forEach(key => {
ctx.template.head.push(dangerouslySetHTML(helmet[key].toString()));
});
}
return next().then(() => {
if (__NODE__) {
ctx.template.head.push(html`<style>`);
if (withStyleOverloads) {
ctx.template.head.push(
dangerouslySetHTML(generateStyledFontFaces(styledFonts))
);
} else {
ctx.template.head.push(
dangerouslySetHTML(generateAtomicFontFaces(atomicFonts))
);
}
ctx.template.head.push(html`</style>`);
if (!withStyleOverloads) {
const atomicFonts: AtomicFontsObjectType = (fonts: any);
ctx.template.head.push(
dangerouslySetHTML(
generatePreloadLinks(
preloadOverrides || preloadSession.fontsToPreload,
atomicFonts
)
)
);
}
}
});
return next().then(() => {
if (__NODE__) {
ctx.template.head.push(html`<style>`);
if (withStyleOverloads) {
ctx.template.head.push(
dangerouslySetHTML(generateStyledFontFaces(styledFonts))
);
} else {
ctx.template.head.push(
dangerouslySetHTML(generateAtomicFontFaces(atomicFonts))
);
}
ctx.template.head.push(html`</style>`);
if (!withStyleOverloads) {
const atomicFonts: AtomicFontsObjectType = (fonts: any);
ctx.template.head.push(
dangerouslySetHTML(
generatePreloadLinks(
preloadOverrides || preloadSession.fontsToPreload,
atomicFonts
)
)