display mail in iframe, add design for thread and unseen

This commit is contained in:
grimhilt
2023-03-27 01:04:43 +02:00
parent a9d15027aa
commit bffcdafe7a
22 changed files with 237 additions and 201 deletions

25
back/utils/string.js Normal file
View File

@@ -0,0 +1,25 @@
function transformEmojis(str) {
if (!str) return str;
// Use a regular expression to match emojis in the string
const regex =
/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{1F900}-\u{1F9FF}\u{1F1E0}-\u{1F1FF}]/gu;
// Replace each matched emoji with its Unicode code point
const transformedStr = str.replace(regex, (match) => {
return "\\u{" + match.codePointAt(0).toString(16).toUpperCase() + "}";
});
return transformedStr;
}
function decodeEmojis(text) {
const regex = /\\u{([^}]+)}/g;
const decodedText = text.replace(regex, (_, hex) => String.fromCodePoint(parseInt(hex, 16)));
return decodedText;
}
module.exports = {
transformEmojis,
decodeEmojis
}