Implement first-draft of HTML message/reply parsing + HTML sanitization

This commit is contained in:
2025-01-04 04:43:39 -05:00
parent bfe94aa2fe
commit 0460771d5d
7 changed files with 88 additions and 5 deletions

View File

@@ -4,6 +4,8 @@ import type {Message, ThreadData} from "../types.ts";
import {AsyncCollection} from "../bones/collection/AsyncCollection.ts";
import {sha256} from "../bones/crypto.ts";
import {config} from "../config.ts";
import { marked } from "marked";
import {sanitizeHtml} from "../mail/sanitize.ts";
export async function refreshThreadsEntirely(): Promise<void> {
await withClient(async client => {
@@ -51,12 +53,13 @@ export async function refreshThreadsEntirely(): Promise<void> {
threadData.comments.push({
user: {
name: message.from.name || '(anonymous)',
mailId: sha256(message.from.address!),
domainId: sha256(message.from.address!.split('@').reverse()[0]),
mailId: sha256(message.from.address!.toLowerCase()),
domainId: sha256(message.from.address!.toLowerCase().split('@').reverse()[0]),
},
date: message.date,
subject: message.subject,
text: message.content,
rendered: message.html || sanitizeHtml(await marked(message.content)),
})
}