Intervention flag display
This commit is contained in:
parent
8f8ae3cae9
commit
9b9ad90292
5 changed files with 74 additions and 24 deletions
|
|
@ -60,7 +60,7 @@ export type Proof = {
|
|||
};
|
||||
|
||||
export type ProofHintFlagsGenerator = "unknown" | "camera" | "screenshot" | "ai";
|
||||
export type ProofHintFlagsGeneratorSource = "c2pa" | "exif" | "metadata";
|
||||
export type ProofHintFlagSource = "c2pa" | "exif" | "metadata";
|
||||
//export type ProofHintFlagsEditor = "unknown" | "manual" | "ai";
|
||||
|
||||
export type ProofHintFlagsEdit = {
|
||||
|
|
@ -71,8 +71,9 @@ export type ProofHintFlagsEdit = {
|
|||
export type ProofHintFlags = {
|
||||
device?: string;
|
||||
creationDate?: Date;
|
||||
creationDateSource?: ProofHintFlagSource;
|
||||
generator?: ProofHintFlagsGenerator;
|
||||
generatorSource?: ProofHintFlagsGeneratorSource;
|
||||
generatorSource?: ProofHintFlagSource;
|
||||
edits?: ProofHintFlagsEdit[];
|
||||
containsC2PA?: boolean;
|
||||
containsEXIF?: boolean;
|
||||
|
|
@ -316,6 +317,7 @@ export const extractProofHintFlags = (proof?: Proof): ProofHintFlags | undefined
|
|||
|
||||
let source: string | undefined = undefined;
|
||||
let dateCreated: Date | undefined = undefined;
|
||||
let dateCreatedSource: ProofHintFlagSource | undefined = undefined;
|
||||
|
||||
const creationAction = extractFlagValues(
|
||||
"integrity/c2pa/manifest_info/manifests[]/assertions[label=c2pa.actions]/data/actions[action=c2pa.created]",
|
||||
|
|
@ -324,11 +326,12 @@ export const extractProofHintFlags = (proof?: Proof): ProofHintFlags | undefined
|
|||
if (creationAction.length > 0) {
|
||||
source = softwareAgentFromAction(creationAction[0]);
|
||||
dateCreated = getFirstWithDataAsDate(["when", "../../metadata/dateTime", "../../../signature_info/time"], creationAction[0].path);
|
||||
dateCreatedSource = "c2pa";
|
||||
}
|
||||
console.log("DATE CREATED", dateCreated);
|
||||
|
||||
let generator: ProofHintFlagsGenerator = matchFlag(ruleAiGenerated(), rootMatchPath).result ? "ai" : matchFlag(ruleScreenshotC2PA(), rootMatchPath).result ? "screenshot" : matchFlag(ruleCamera(), rootMatchPath).result ? "camera" : "unknown";
|
||||
let generatorSource: ProofHintFlagsGeneratorSource | undefined = undefined;
|
||||
let generatorSource: ProofHintFlagSource | undefined = undefined;
|
||||
|
||||
if (generator !== "unknown" && valid) {
|
||||
generatorSource = "c2pa";
|
||||
|
|
@ -365,6 +368,7 @@ export const extractProofHintFlags = (proof?: Proof): ProofHintFlags | undefined
|
|||
const flags: ProofHintFlags = {
|
||||
device: source,
|
||||
creationDate: dateCreated,
|
||||
creationDateSource: dateCreatedSource,
|
||||
generator: generator,
|
||||
generatorSource: generatorSource,
|
||||
edits: edits,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue