Rename ProofHintFlags to MediaMetadata
Also, introduce the MediaInterventionFlags class to not send all metadata across, just the info needed for showing the intervention flags.
This commit is contained in:
parent
5fcbcb77fb
commit
1aff02c7d4
13 changed files with 101 additions and 90 deletions
|
|
@ -18,8 +18,8 @@ import {
|
|||
import proofmode from "../plugins/proofmode";
|
||||
import imageResize from "image-resize";
|
||||
import { computed, ref, Ref, shallowReactive, unref } from "vue";
|
||||
import utils, { THUMBNAIL_MAX_WIDTH, THUMBNAIL_MAX_HEIGHT, CLIENT_EVENT_PROOF_HINT } from "@/plugins/utils";
|
||||
import { extractProofHintFlags } from "./proof";
|
||||
import utils, { THUMBNAIL_MAX_WIDTH, THUMBNAIL_MAX_HEIGHT, CLIENT_EVENT_MEDIA_INTERVENTION_FLAGS } from "@/plugins/utils";
|
||||
import { extractMediaMetadata } from "./proof";
|
||||
|
||||
export class AttachmentManager {
|
||||
matrixClient: MatrixClient;
|
||||
|
|
@ -118,7 +118,7 @@ export class AttachmentManager {
|
|||
}
|
||||
try {
|
||||
attachment.proof = await proofmode.proofCheckFile(file);
|
||||
attachment.proofHintFlags = extractProofHintFlags(attachment.proof);
|
||||
attachment.mediaMetadata = extractMediaMetadata(attachment.proof);
|
||||
|
||||
// Default to scaled version if the image does not contain Content Credentials
|
||||
//
|
||||
|
|
@ -220,7 +220,7 @@ export class AttachmentManager {
|
|||
|
||||
const fileSize = this.getSrcFileSize(event);
|
||||
|
||||
let proofHintFlags = event.getContent()[CLIENT_EVENT_PROOF_HINT];
|
||||
let mediaInterventionFlags = event.getContent()[CLIENT_EVENT_MEDIA_INTERVENTION_FLAGS];
|
||||
|
||||
const attachment: EventAttachment = {
|
||||
event: event,
|
||||
|
|
@ -229,7 +229,8 @@ export class AttachmentManager {
|
|||
srcProgress: -1,
|
||||
thumbnailProgress: -1,
|
||||
autoDownloadable: fileSize <= this.maxSizeAutoDownloads,
|
||||
proofHintFlags: proofHintFlags ? JSON.parse(proofHintFlags) : proofHintFlags,
|
||||
mediaInterventionFlags: mediaInterventionFlags ? JSON.parse(mediaInterventionFlags) : undefined,
|
||||
mediaMetadata: undefined,
|
||||
proof: undefined,
|
||||
loadSrc: () => Promise.reject("Not implemented"),
|
||||
loadThumbnail: () => Promise.reject("Not implemented"),
|
||||
|
|
@ -632,7 +633,7 @@ export const createUploadBatch = (manager: AttachmentManager | null, room: Room
|
|||
eventId,
|
||||
attachment.dimensions,
|
||||
attachment.thumbnail,
|
||||
attachment.proofHintFlags
|
||||
attachment.mediaMetadata
|
||||
)
|
||||
.then((mediaEventId: string) => {
|
||||
// Look at last item rotation, flipping the sign on this, so looks more like a true stack
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue