v3: added attachments to resources, allow users to paste images into TextEditor, strengthened WS reliability

This commit is contained in:
khannurien
2026-03-27 08:53:32 +00:00
parent ca70bdc14b
commit f0f6472db6
19 changed files with 450 additions and 57 deletions

View File

@@ -18,6 +18,7 @@ import {
} from "./notification-service.ts";
import { makeSlug, UUID_RE } from "../lib/slugify.ts";
import { DUMPS_DIR } from "../lib/upload.ts";
import { linkAttachments } from "./attachment-service.ts";
const MAX_FILE_SIZE = 50 * 1024 * 1024; // 50 MB
@@ -109,6 +110,7 @@ export async function createUrlDump(
}
if (request.comment) {
notifyMentions(userId, request.comment, "dump", dumpId, title);
linkAttachments(request.comment, dumpId);
}
return dump;
}
@@ -185,7 +187,10 @@ export async function createFileDump(
broadcastNewDump(dump);
notifyUserFollowersNewDump(userId, dumpId, file.name);
}
if (comment) notifyMentions(userId, comment, "dump", dumpId, file.name);
if (comment) {
notifyMentions(userId, comment, "dump", dumpId, file.name);
linkAttachments(comment, dumpId);
}
return dump;
}
@@ -282,6 +287,7 @@ export async function updateDump(
dumpId,
updatedDump.title,
);
linkAttachments(updatedDump.comment, dumpId);
}
return updatedDump;
}
@@ -344,6 +350,7 @@ export async function updateDump(
dumpId,
updatedDump.title,
);
linkAttachments(updatedDump.comment, dumpId);
}
return updatedDump;
}
@@ -401,7 +408,10 @@ export async function replaceFileDump(
throw err;
}
if (comment) notifyMentions(dump.userId, comment, "dump", dumpId, file.name);
if (comment) {
notifyMentions(dump.userId, comment, "dump", dumpId, file.name);
linkAttachments(comment, dumpId);
}
return {
...dump,
title: file.name,