changement du fonctionnement des depêches, retours a la ligne

This commit is contained in:
ewen 2026-05-16 21:12:42 +02:00
parent 650cd6eab2
commit 624b21554c

View file

@ -93,11 +93,21 @@ function chargerAlbums() {
async function chargerDepeches() {
const feed = document.getElementById('feed');
function escapeHtml(str) {
return str
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}
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, '<br>');
const embeds = await Promise.all(urls.map(async url => {
if (url.includes('soundcloud.com')) {
try {