Compare commits

...

3 commits

4 changed files with 712 additions and 337 deletions

View file

@ -4,7 +4,7 @@ const Ty = require("../../types")
const DiscordTypes = require("discord-api-types/v10") const DiscordTypes = require("discord-api-types/v10")
const {Readable} = require("stream") const {Readable} = require("stream")
const chunk = require("chunk-text") const chunk = require("chunk-text")
const TurndownService = require("turndown") const TurndownService = require("@cloudrac3r/turndown")
const domino = require("domino") const domino = require("domino")
const assert = require("assert").strict const assert = require("assert").strict
const entities = require("entities") const entities = require("entities")
@ -541,7 +541,7 @@ async function eventToMessage(event, guild, di) {
.replace(/<span [^>]*data-mx-spoiler\b[^>]*>.*?<\/span>/g, "[spoiler]") // Good enough method of removing spoiler content. (I don't want to break out the HTML parser unless I have to.) .replace(/<span [^>]*data-mx-spoiler\b[^>]*>.*?<\/span>/g, "[spoiler]") // Good enough method of removing spoiler content. (I don't want to break out the HTML parser unless I have to.)
.replace(/<[^>]+>/g, "") // Completely strip all HTML tags and formatting. .replace(/<[^>]+>/g, "") // Completely strip all HTML tags and formatting.
), 50) ), 50)
replyLine = "> " + contentPreviewChunks[0] replyLine = "> -# " + contentPreviewChunks[0]
if (contentPreviewChunks.length > 1) replyLine = replyLine.replace(/[,.']$/, "") + "..." if (contentPreviewChunks.length > 1) replyLine = replyLine.replace(/[,.']$/, "") + "..."
replyLine += "\n" replyLine += "\n"
return return
@ -595,14 +595,14 @@ async function eventToMessage(event, guild, di) {
repliedToContent = entities.decodeHTML5Strict(repliedToContent) // Remove entities like &amp; &quot; repliedToContent = entities.decodeHTML5Strict(repliedToContent) // Remove entities like &amp; &quot;
const contentPreviewChunks = chunk(repliedToContent, 50) const contentPreviewChunks = chunk(repliedToContent, 50)
if (contentPreviewChunks.length) { if (contentPreviewChunks.length) {
contentPreview = ":\n> " + contentPreviewChunks[0] contentPreview = ":\n> -# " + contentPreviewChunks[0]
if (contentPreviewChunks.length > 1) contentPreview = contentPreview.replace(/[,.']$/, "") + "..." if (contentPreviewChunks.length > 1) contentPreview = contentPreview.replace(/[,.']$/, "") + "..."
} else { } else {
console.log("Unable to generate reply preview for this replied-to event because we stripped all of it:", repliedToEvent) console.log("Unable to generate reply preview for this replied-to event because we stripped all of it:", repliedToEvent)
contentPreview = "" contentPreview = ""
} }
} }
replyLine = `> ${replyLine}${contentPreview}\n` replyLine = `> -# ${replyLine}${contentPreview}\n`
})() })()
if (event.content.format === "org.matrix.custom.html" && event.content.formatted_body) { if (event.content.format === "org.matrix.custom.html" && event.content.formatted_body) {

View file

@ -263,6 +263,45 @@ test("event2message: links in formatted body where the text & href are the same,
) )
}) })
test("event2message: markdown in link text does not attempt to be escaped because that doesn't work", async t => {
t.deepEqual(
await eventToMessage({
content: {
body: "hey mario sports mix [she/her], is it possible to listen on a unix socket?",
format: "org.matrix.custom.html",
formatted_body: "hey <a href=\"https://matrix.to/#/%40cadence%3Acadence.moe\">mario sports mix [she/her]</a>, is it possible to listen on a unix socket?",
"m.mentions": {
"user_ids": [
"@cadence:cadence.moe"
]
},
msgtype: "m.text"
},
event_id: "$g07oYSZFWBkxohNEfywldwgcWj1hbhDzQ1sBAKvqOOU",
origin_server_ts: 1688301929913,
room_id: "!kLRqKKUQXcibIMtOpl:cadence.moe",
sender: "@cadence:cadence.moe",
type: "m.room.message",
unsigned: {
age: 405299
}
}),
{
ensureJoined: [],
messagesToDelete: [],
messagesToEdit: [],
messagesToSend: [{
username: "cadence [they]",
content: "hey [mario sports mix [she/her]](<https://matrix.to/#/%40cadence%3Acadence.moe>), is it possible to listen on a unix socket?",
avatar_url: undefined,
allowed_mentions: {
parse: ["users", "roles"]
}
}]
}
)
})
test("event2message: basic html is converted to markdown", async t => { test("event2message: basic html is converted to markdown", async t => {
t.deepEqual( t.deepEqual(
await eventToMessage({ await eventToMessage({
@ -999,8 +1038,8 @@ test("event2message: rich reply to a sim user", async t => {
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 <@111604486476181504>:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 <@111604486476181504>:"
+ "\n> Slow news day." + "\n> -# Slow news day."
+ "\nTesting this reply, ignore", + "\nTesting this reply, ignore",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
allowed_mentions: { allowed_mentions: {
@ -1071,8 +1110,8 @@ test("event2message: rich reply to a rich reply to a multi-line message should c
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**:"
+ "\n> I just checked in a fix that will probably work..." + "\n> -# I just checked in a fix that will probably work..."
+ "\nwill try later (tomorrow if I don't forgor)", + "\nwill try later (tomorrow if I don't forgor)",
avatar_url: undefined, avatar_url: undefined,
allowed_mentions: { allowed_mentions: {
@ -1151,8 +1190,8 @@ test("event2message: rich reply to an already-edited message will quote the new
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647><@111604486476181504>:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647><@111604486476181504>:"
+ "\n> this is the new content. heya!" + "\n> -# this is the new content. heya!"
+ "\nhiiiii....", + "\nhiiiii....",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
allowed_mentions: { allowed_mentions: {
@ -1205,7 +1244,7 @@ test("event2message: rich reply to a missing event will quote from formatted_bod
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> But who sees the seashells she sells sitting..." content: "> -# But who sees the seashells she sells sitting..."
+ "\nWhat a tongue-bender...", + "\nWhat a tongue-bender...",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
allowed_mentions: { allowed_mentions: {
@ -1356,8 +1395,8 @@ test("event2message: should avoid using blockquote contents as reply preview in
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 <@111604486476181504>:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 <@111604486476181504>:"
+ "\n> that can't be true! there's no way :o" + "\n> -# that can't be true! there's no way :o"
+ "\nI agree!", + "\nI agree!",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
allowed_mentions: { allowed_mentions: {
@ -1445,8 +1484,8 @@ test("event2message: should include a reply preview when message ends with a blo
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**_ooye_cookie**:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**_ooye_cookie**:"
+ "\n> https://tootsuite.net/Warp-Gate2.gif tanget: @..." + "\n> -# https://tootsuite.net/Warp-Gate2.gif tanget: @..."
+ "\naichmophobia", + "\naichmophobia",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
allowed_mentions: { allowed_mentions: {
@ -1529,8 +1568,8 @@ test("event2message: should include a reply preview when replying to a descripti
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/497161350934560778/1162625810109317170 <@1109360903096369153>:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/497161350934560778/1162625810109317170 <@1109360903096369153>:"
+ "\n> It looks like this queue has ended." + "\n> -# It looks like this queue has ended."
+ `\nso you're saying on matrix side I would have to edit ^this^ to add "Timed out" before the blockquote?`, + `\nso you're saying on matrix side I would have to edit ^this^ to add "Timed out" before the blockquote?`,
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
allowed_mentions: { allowed_mentions: {
@ -1582,8 +1621,8 @@ test("event2message: entities are not escaped in main message or reply preview",
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**:"
+ "\n> Testing? \"':.`[]&things" + "\n> -# Testing? \"':.`[]&things"
+ "\n_Testing?_ \"':.\\`\\[\\]&things", + "\n_Testing?_ \"':.\\`\\[\\]&things",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
allowed_mentions: { allowed_mentions: {
@ -1632,8 +1671,8 @@ test("event2message: reply preview converts emoji formatting when replying to a
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**:"
+ "\n> <:hippo:230201364309868544>" + "\n> -# <:hippo:230201364309868544>"
+ "\nreply", + "\nreply",
avatar_url: undefined, avatar_url: undefined,
allowed_mentions: { allowed_mentions: {
@ -1682,8 +1721,8 @@ test("event2message: reply preview can guess custom emoji based on the name if i
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**:"
+ "\n> <:hippo:230201364309868544>" + "\n> -# <:hippo:230201364309868544>"
+ "\nreply", + "\nreply",
avatar_url: undefined, avatar_url: undefined,
allowed_mentions: { allowed_mentions: {
@ -1732,8 +1771,8 @@ test("event2message: reply preview uses emoji title text when replying to an unk
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**:"
+ "\n> :svkftngur_gkdne:" + "\n> -# :svkftngur_gkdne:"
+ "\nreply", + "\nreply",
avatar_url: undefined, avatar_url: undefined,
allowed_mentions: { allowed_mentions: {
@ -1782,8 +1821,8 @@ test("event2message: reply preview ignores garbage image", async t => {
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**:"
+ "\n> I am having a nice day" + "\n> -# I am having a nice day"
+ "\nreply", + "\nreply",
avatar_url: undefined, avatar_url: undefined,
allowed_mentions: { allowed_mentions: {
@ -1832,7 +1871,7 @@ test("event2message: reply to empty message doesn't show an extra line or anythi
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**cadence [they]**"
+ "\nreply", + "\nreply",
avatar_url: undefined, avatar_url: undefined,
allowed_mentions: { allowed_mentions: {
@ -1914,8 +1953,8 @@ test("event2message: editing a rich reply to a sim user", async t => {
id: "1144874214311067708", id: "1144874214311067708",
message: { message: {
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 <@111604486476181504>:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 <@111604486476181504>:"
+ "\n> Slow news day." + "\n> -# Slow news day."
+ "\nEditing this reply, which is also a test", + "\nEditing this reply, which is also a test",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
allowed_mentions: { allowed_mentions: {
@ -2205,8 +2244,8 @@ test("event2message: rich reply to a matrix user's long message with formatting"
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 Ⓜ️**cadence [they]**:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 Ⓜ️**cadence [they]**:"
+ "\n> i should have a little happy test list bold em..." + "\n> -# i should have a little happy test list bold em..."
+ "\n**no you can't!!!**", + "\n**no you can't!!!**",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
allowed_mentions: { allowed_mentions: {
@ -2268,7 +2307,7 @@ test("event2message: rich reply to an image", async t => {
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 <@111604486476181504> 🖼️" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 <@111604486476181504> 🖼️"
+ "\nCaught in 8K UHD VR QLED Epic Edition", + "\nCaught in 8K UHD VR QLED Epic Edition",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
allowed_mentions: { allowed_mentions: {
@ -2323,8 +2362,8 @@ test("event2message: rich reply to a spoiler should ensure the spoiler is hidden
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 <@111604486476181504>:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 <@111604486476181504>:"
+ "\n> [spoiler] cw crossword spoilers you'll never..." + "\n> -# [spoiler] cw crossword spoilers you'll never..."
+ "\nomg NO WAY!!", + "\nomg NO WAY!!",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
allowed_mentions: { allowed_mentions: {
@ -2378,8 +2417,8 @@ test("event2message: with layered rich replies, the preview should only be the r
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "cadence [they]", username: "cadence [they]",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 Ⓜ️**cadence [they]**:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/112760669178241024/687028734322147344/1144865310588014633 Ⓜ️**cadence [they]**:"
+ "\n> two" + "\n> -# two"
+ "\nthree", + "\nthree",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
allowed_mentions: { allowed_mentions: {
@ -2434,8 +2473,8 @@ test("event2message: if event is a reply and starts with a quote, they should be
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "Rose", username: "Rose",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**Rose**:" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**Rose**:"
+ "\n> i have a feeling that clients are meant to strip..." + "\n> -# i have a feeling that clients are meant to strip..."
+ "\n" + "\n"
+ "\n> To strip the fallback on the `body`, the client should iterate over each line of the string, removing any lines that start with the fallback prefix (\"> “, including the space, without quotes) and stopping when a line is encountered without the prefix. This prefix is known as the “fallback prefix sequence”.", + "\n> To strip the fallback on the `body`, the client should iterate over each line of the string, removing any lines that start with the fallback prefix (\"> “, including the space, without quotes) and stopping when a line is encountered without the prefix. This prefix is known as the “fallback prefix sequence”.",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/syndicated.gay/ZkBUPXCiXTjdJvONpLJmcbKP", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/syndicated.gay/ZkBUPXCiXTjdJvONpLJmcbKP",
@ -2494,7 +2533,7 @@ test("event2message: rich reply to a deleted event", async t => {
messagesToEdit: [], messagesToEdit: [],
messagesToSend: [{ messagesToSend: [{
username: "Ampflower 🌺", username: "Ampflower 🌺",
content: "> <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**Ampflower 🌺** (in reply to a deleted message)" content: "> -# <:L1:1144820033948762203><:L2:1144820084079087647>Ⓜ️**Ampflower 🌺** (in reply to a deleted message)"
+ "\nHuh it did the same thing here too", + "\nHuh it did the same thing here too",
avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/PRfhXYBTOalvgQYtmCLeUXko", avatar_url: "https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/PRfhXYBTOalvgQYtmCLeUXko",
allowed_mentions: { allowed_mentions: {
@ -4097,7 +4136,7 @@ slow()("event2message: unknown emoji at the end is reuploaded as a sprite sheet"
t.deepEqual(testResult, { t.deepEqual(testResult, {
content: "a b", content: "a b",
fileName: "emojis.png", fileName: "emojis.png",
fileContentStart: "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAPoAAAD6AG1e1JrAAALkklEQVR4nM1ZeWyUxxV/azAGwn0JMJUppPhce++1Oc1i" fileContentStart: "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAPoAAAD6AG1e1JrAAALoklEQVR4nM1ZaVBU2RU+LZSIGnAvFUtcRkSk6abpbkDH"
}) })
}) })
@ -4122,7 +4161,7 @@ slow()("event2message: known emoji from an unreachable server at the end is reup
t.deepEqual(testResult, { t.deepEqual(testResult, {
content: "a b", content: "a b",
fileName: "emojis.png", fileName: "emojis.png",
fileContentStart: "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAPoAAAD6AG1e1JrAAAOnUlEQVR4nM1aCXCb1Z3/kig+5NjWaeu+LOuWLFnHJ8l2" fileContentStart: "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAPoAAAD6AG1e1JrAAAOoUlEQVR4nM1aCXBbx3l+Eu8bN0CAuO+TAHGTFAmAJHgT"
}) })
}) })
@ -4147,7 +4186,7 @@ slow()("event2message: known and unknown emojis in the end are reuploaded as a s
t.deepEqual(testResult, { t.deepEqual(testResult, {
content: "known unknown: <:hippo:230201364309868544> [:ms_robot_dress:](https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/wcouHVjbKJJYajkhJLsyeJAA) and known unknown:", content: "known unknown: <:hippo:230201364309868544> [:ms_robot_dress:](https://matrix.cadence.moe/_matrix/media/r0/download/cadence.moe/wcouHVjbKJJYajkhJLsyeJAA) and known unknown:",
fileName: "emojis.png", fileName: "emojis.png",
fileContentStart: "iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAYAAADuFn/PAAAACXBIWXMAAAPoAAAD6AG1e1JrAAAT5UlEQVR4nOVbCXSVRZauR9gMsoYlvKwvARKSkPUlJOyL" fileContentStart: "iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAYAAADuFn/PAAAACXBIWXMAAAPoAAAD6AG1e1JrAAAAeXRFWHRSYXcACklQVEMgcHJvZmlsZQogICAgICA0Ngoz"
}) })
}) })
@ -4172,6 +4211,6 @@ slow()("event2message: all unknown chess emojis are reuploaded as a sprite sheet
t.deepEqual(testResult, { t.deepEqual(testResult, {
content: "testing", content: "testing",
fileName: "emojis.png", fileName: "emojis.png",
fileContentStart: "iVBORw0KGgoAAAANSUhEUgAAAYAAAABgCAYAAAAU9KWJAAAACXBIWXMAAAPoAAAD6AG1e1JrAAAgAElEQVR4nOx9B3xT1/W/UkImYKZtLdt4a0uWMaQkzS9t" fileContentStart: "iVBORw0KGgoAAAANSUhEUgAAAYAAAABgCAYAAAAU9KWJAAAACXBIWXMAAAPoAAAD6AG1e1JrAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48"
}) })
}) })

909
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -21,10 +21,12 @@
"@cloudrac3r/html-template-tag": "^5.0.1", "@cloudrac3r/html-template-tag": "^5.0.1",
"@cloudrac3r/mixin-deep": "^3.0.0", "@cloudrac3r/mixin-deep": "^3.0.0",
"@cloudrac3r/pngjs": "^7.0.3", "@cloudrac3r/pngjs": "^7.0.3",
"better-sqlite3": "^9.0.0", "@cloudrac3r/turndown": "^7.1.4",
"better-sqlite3": "^11.1.2",
"chunk-text": "^2.0.1", "chunk-text": "^2.0.1",
"cloudstorm": "^0.10.8", "cloudstorm": "^0.10.8",
"entities": "^4.5.0", "domino": "^2.1.6",
"entities": "^5.0.0",
"get-stream": "^6.0.1", "get-stream": "^6.0.1",
"heatsync": "^2.5.3", "heatsync": "^2.5.3",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
@ -32,18 +34,17 @@
"minimist": "^1.2.8", "minimist": "^1.2.8",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.7",
"prettier-bytes": "^1.0.4", "prettier-bytes": "^1.0.4",
"sharp": "^0.32.6", "sharp": "^0.33.4",
"snowtransfer": "^0.10.5", "snowtransfer": "^0.10.5",
"stream-mime-type": "^1.0.2", "stream-mime-type": "^1.0.2",
"try-to-catch": "^3.0.1", "try-to-catch": "^3.0.1",
"turndown": "^7.1.2",
"xxhash-wasm": "^1.0.2" "xxhash-wasm": "^1.0.2"
}, },
"devDependencies": { "devDependencies": {
"@cloudrac3r/tap-dot": "^2.0.2", "@cloudrac3r/tap-dot": "^2.0.2",
"@types/node": "^18.16.0", "@types/node": "^18.16.0",
"@types/node-fetch": "^2.6.3", "@types/node-fetch": "^2.6.3",
"c8": "^8.0.1", "c8": "^10.1.2",
"colorette": "^1.4.0", "colorette": "^1.4.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"discord-api-types": "^0.37.60", "discord-api-types": "^0.37.60",