refactor: clean up chat and split up embed handling

This commit is contained in:
Andy Burke 2025-09-16 12:25:11 -07:00
parent 03751c6d00
commit 7e4ab72fe6
14 changed files with 352 additions and 274 deletions

13
public/js/embeds/image.js Normal file
View file

@ -0,0 +1,13 @@
function embed_image(link_info) {
if (typeof link_info.extension !== "string") {
return;
}
const is_image = get_mime_types(link_info.extension).shift()?.indexOf("image") === 0;
if (!is_image) {
return;
}
return `<div class="embed-container image"><img src="${link_info.url}" alt="An image from ${link_info.domain}" /></div>`;
}