notify: escapeHtml for titles

This commit is contained in:
Ralf Vogler 2023-01-25 20:56:35 +01:00
parent f8932af2a1
commit 72a61458fc
4 changed files with 12 additions and 11 deletions

View file

@ -95,3 +95,7 @@ export const notify = (html) => {
if (stdout) console.log(`stdout: ${stdout}`);
});
}
export const escapeHtml = (unsafe) => unsafe.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;').replaceAll('"', '&quot;').replaceAll("'", '&#039;');
export const html_game_list = games => games.map(g => `- <a href="${g.url}">${escapeHtml(g.title)}</a> (${g.status})`).join('<br>');