fix(posts): infinite loading due to replaceAll() not being present in Node 14

This commit is contained in:
Monty 2021-10-02 10:38:24 +02:00
parent 7e7cac8ee8
commit 390f6975b7
No known key found for this signature in database
GPG Key ID: 78B405B6520E1012

View File

@ -92,8 +92,8 @@ router.get('/:slug', async (request, response, next) => {
// Replace [yt-iframe](videoID) with the full <iframe />
content = content
.replaceAll(/(?<!`)\[yt-iframe]\(/g, '<div class="aspectratio-fallback"><iframe src="https://www.youtube-nocookie.com/embed/')
.replaceAll(/(?<=<iframe src="https:\/\/www\.youtube-nocookie\.com\/embed\/.{11})\)/g, '" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>');
.replace(/(?<!`)\[yt-iframe]\(/g, '<div class="aspectratio-fallback"><iframe src="https://www.youtube-nocookie.com/embed/')
.replace(/(?<=<iframe src="https:\/\/www\.youtube-nocookie\.com\/embed\/.{11})\)/g, '" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>');
// Convert the content into HTML
const htmlPost = marked(content);