diff --git a/assets/main.js b/assets/main.js index 7bbceaa..045004f 100644 --- a/assets/main.js +++ b/assets/main.js @@ -93,11 +93,21 @@ function chargerAlbums() { async function chargerDepeches() { const feed = document.getElementById('feed'); + function escapeHtml(str) { + return str + .replace(/&/g, '&') + .replace(//g, '>'); + } + async function parseTexte(texte) { const urlRegex = /(https?:\/\/[^\s]+)/g; const urls = texte.match(urlRegex) || []; let html = texte.replace(urlRegex, '___URL___'); + // échappe le HTML et convertit les retours à la ligne + html = escapeHtml(html).replace(/\n/g, '
'); + const embeds = await Promise.all(urls.map(async url => { if (url.includes('soundcloud.com')) { try {