refactor: split telegram delivery and unify media/frontmatter/i18n pipelines

This commit is contained in:
Peter Steinberger
2026-03-02 04:12:23 +00:00
parent 706cfcd54f
commit e1f3ded033
15 changed files with 1239 additions and 925 deletions

View File

@@ -1,4 +1,5 @@
import { loadWebMedia } from "../web/media.js";
import { buildOutboundMediaLoadOptions } from "./load-options.js";
import { saveMediaBuffer } from "./store.js";
export async function resolveOutboundAttachmentFromUrl(
@@ -6,10 +7,13 @@ export async function resolveOutboundAttachmentFromUrl(
maxBytes: number,
options?: { localRoots?: readonly string[] },
): Promise<{ path: string; contentType?: string }> {
const media = await loadWebMedia(mediaUrl, {
maxBytes,
localRoots: options?.localRoots,
});
const media = await loadWebMedia(
mediaUrl,
buildOutboundMediaLoadOptions({
maxBytes,
mediaLocalRoots: options?.localRoots,
}),
);
const saved = await saveMediaBuffer(
media.buffer,
media.contentType ?? undefined,