keanu-weblite/src/models/eventAttachment.ts
N-Pex 1aff02c7d4 Rename ProofHintFlags to MediaMetadata
Also, introduce the MediaInterventionFlags class to not send all metadata across, just the info needed for showing the intervention flags.
2025-10-23 10:13:14 +02:00

42 lines
No EOL
1.4 KiB
TypeScript

import { MatrixEvent, Room } from "matrix-js-sdk";
import { AttachmentBatch } from "./attachment";
import { Proof, MediaMetadata } from "./proof";
export type KeanuEventExtension = {
isMxThread?: boolean;
isChannelMessage?: boolean;
isPinned?: boolean;
parentThread?: MatrixEvent & KeanuEventExtension;
replyEvent?: MatrixEvent & KeanuEventExtension;
uploadBatch?: AttachmentBatch;
}
export type KeanuEvent = MatrixEvent & KeanuEventExtension;
export type EventAttachmentUrlType = "src" | "thumbnail";
export type EventAttachmentUrlData = {data: string, type: EventAttachmentUrlType};
export type EventAttachment = {
event: KeanuEvent;
name: string;
src?: string;
srcSize: number;
srcProgress: number;
srcPromise?: Promise<EventAttachmentUrlData>;
thumbnail?: string;
thumbnailProgress: number;
thumbnailPromise?: Promise<EventAttachmentUrlData>;
autoDownloadable: boolean;
proof?: Proof;
mediaInterventionFlags?: MediaInterventionFlags;
mediaMetadata?: MediaMetadata;
loadSrc: () => Promise<EventAttachmentUrlData>;
loadThumbnail: () => Promise<EventAttachmentUrlData>;
loadBlob: () => Promise<{data: Blob}>;
release: (src: boolean, thumbnail: boolean) => void;
};
export type KeanuRoom = Room & {
displayType: "im.keanu.room_type_default" | "im.keanu.room_type_voice" | "im.keanu.room_type_file" | "im.keanu.room_type_channel" | undefined;
}