Use same intervention flag text in send and view

This commit is contained in:
N-Pex 2025-09-29 11:24:06 +02:00
parent ed4991a5b1
commit b022e2f800
6 changed files with 78 additions and 66 deletions

View file

@ -10,8 +10,8 @@
<script setup lang="ts">
import { computed } from "vue";
import { ProofHintFlags } from "../../models/proof";
import dayjs from "dayjs";
import { useI18n } from "vue-i18n";
import { interventionText } from "./intervention";
const { t } = useI18n()
@ -31,41 +31,7 @@ const showCheck = computed(() => {
const infoText = computed(() => {
if (!multiple && flags.length == 1) {
const f = flags[0];
let res = "";
if (f.generator !== "unknown" && f.generatorSource === "c2pa") {
if (f.generator === "camera") {
res += "<b>" + t("cc.captured_with_camera") + "</b> ";
} else if (f.generator === "screenshot") {
res += "<b>" + t("cc.screenshot") + "</b> ";
} else if (f.generator === "ai") {
res += "<b>" + t("cc.generated_with_ai") + "</b> ";
}
if ((f.edits?.length ?? 0) > 0) {
res += "<b>" + t("cc.modified") + "</b> ";
}
if (f.creationDate && dayjs().diff(f.creationDate, "month") >= 3) {
res += "<b>" + t("cc.older_than_n_months", {n: 3}) + "</b> ";
}
return res;
} else if (f.generator !== "unknown") {
if (f.generator === "camera") {
res += "<b>" + t("cc.captured_with_camera") + "</b> ";
} else if (f.generator === "screenshot") {
res += "<b>" + t("cc.screenshot_probably") + "</b> ";
return res;
} else if (f.generator === "ai") {
res += "<b>" + t("cc.generated_with_ai") + "</b> ";
}
if ((f.edits?.length ?? 0) > 0) {
res += "<b>" + t("cc.modified") + "</b> ";
}
if (f.creationDate && dayjs().diff(f.creationDate, "month") >= 3) {
res += "<b>" + t("cc.older_than_n_months", {n: 3}) + "</b> ";
}
return res;
}
return interventionText(t, flags[0]);
} else if (multiple && flags.length >= 1) {
const modifiedMedia = flags.some((f) => f.edits?.length);
const aiGeneratedMedia = flags.some((f) => f.generator === "ai");