Implement first-draft of HTML message/reply parsing + HTML sanitization
This commit is contained in:
@@ -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)),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user