[208] Anonymitäts-Tor an allen Export-Einstiegen: Berichte, Bild-/Rendering-Exporte, CLI (--ignore-anonymity), KI-Export; Dateiname nach Wiederherstellen

This commit is contained in:
Claude committed 2026-11-14 08:31:00 +00:00
1 parent 7954ab647f
commit be000985ed
21 files changed
+260 -59

No files matched your search

+6 -1
View File
@@ -10,6 +10,8 @@ import { getState } from "../state/appStore";
import { cancelCameraTour, currentTourKeys, getTourSettings, playCameraTour, recordCameraTour, setTourSettings } from "../state/cameraTourActions";
import { setCameraTourDialogOpener } from "../state/cameraTourDialogHook";
import { saveBinaryFile } from "../native/saveFile";
import { runWithAnonymityGate } from "../state/anonymityGate";
import { exportProjectName } from "../core";
import { getViewportCanvas } from "../viewport/cameraBridge";
import { availableVideoFormats, videoFileName } from "../viewport/videoRecorder";
import type { TourMode } from "../viewport/cameraTour";
@@ -82,7 +84,10 @@ export const CameraTourDialogHost = memo(function CameraTourDialogHost() {
if (!res) return;
try {
const bytes = new Uint8Array(await res.blob.arrayBuffer());
if (await saveBinaryFile(bytes, videoFileName(getState().project.name, res.ext), res.blob.type || "video/webm")) getState().notify(t("tour.saved"), "info");
const name = videoFileName(exportProjectName(getState().project) || "projekt", res.ext);
runWithAnonymityGate(getState().project, [name], async () => {
if (await saveBinaryFile(bytes, name, res.blob.type || "video/webm")) getState().notify(t("tour.saved"), "info");
});
} catch (err) {
getState().notify(t("tour.recordFailed", { reason: err instanceof Error ? err.message : String(err) }), "warning");
}
+7 -3
View File
@@ -7,7 +7,8 @@
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useModalFocus } from "./modalFocus";
import { t } from "../i18n";
import { paperPixels } from "../core";
import { exportProjectName, paperPixels } from "../core";
import { runWithAnonymityGate } from "../state/anonymityGate";
import { getState } from "../state/appStore";
import { setImageExportDialogOpener } from "../state/imageExportDialogHook";
import { defaultTargetLayout, placeImageOnLayout } from "../state/layoutImageActions";
@@ -155,10 +156,13 @@ export const ImageExportDialogHost = memo(function ImageExportDialogHost() {
if (transparent && !img.transparent) setMessage(t("image3d.noTransparency"));
};
const fileName = () => imageFileName(getState().project.name, result?.width ?? 0, result?.height ?? 0);
const fileName = () => imageFileName(exportProjectName(getState().project) || "projekt", result?.width ?? 0, result?.height ?? 0);
const save = async () => {
if (!result) return;
if (await saveBinaryFile(result.png, fileName(), "image/png")) getState().notify(t("image3d.saved"), "info");
const name = fileName();
runWithAnonymityGate(getState().project, [name], async () => {
if (await saveBinaryFile(result.png, name, "image/png")) getState().notify(t("image3d.saved"), "info");
});
};
const placeInLayout = () => {
if (!result) return;
+15 -7
View File
@@ -19,6 +19,7 @@ import {
type BlenderHost,
type RenderCameraChoice,
type RenderCameraSpec,
exportProjectName,
} from "../core";
import { getState } from "../state/appStore";
import { setRenderDialogOpener } from "../state/renderDialogHook";
@@ -26,6 +27,7 @@ import { getBlenderPath, setBlenderPath } from "../state/blenderSettings";
import { buildPackage, currentRenderCamera, openInBlender, packageAsZip, renderHost, renderWithBlender, saveBlendWithBlender } from "../state/renderAction";
import { openExternalUrl } from "../native/blender";
import { saveBinaryFile } from "../native/saveFile";
import { runWithAnonymityGate } from "../state/anonymityGate";
import { defaultTargetLayout, placeImageOnLayout } from "../state/layoutImageActions";
type SizeId = "hd" | "uhd" | "a4" | "a3" | "a2" | "custom";
@@ -236,8 +238,10 @@ export const RenderDialogHost = memo(function RenderDialogHost() {
st.notify(t("render.blend.opened"), "info");
} else {
const res = await saveBlendWithBlender(host, pkg, hooks);
const name = `${(st.project.name || "projekt").replace(/[^\w.-]+/g, "_")}.blend`;
if (await saveBinaryFile(res.blend, name, "application/octet-stream")) st.notify(t("render.blend.saved"), "info");
const name = `${(exportProjectName(st.project) || "projekt").replace(/[^\w.-]+/g, "_")}.blend`;
runWithAnonymityGate(st.project, [name], async () => {
if (await saveBinaryFile(res.blend, name, "application/octet-stream")) st.notify(t("render.blend.saved"), "info");
});
}
setPhase("setup");
} catch (err) {
@@ -255,8 +259,10 @@ export const RenderDialogHost = memo(function RenderDialogHost() {
try {
const pkg = await buildPackage(st.project, request());
const bytes = await packageAsZip(pkg);
const name = `${(st.project.name || "projekt").replace(/[^\w.-]+/g, "_")}-render.zip`;
if (await saveBinaryFile(bytes, name, "application/zip")) st.notify(t("render.zip.saved"), "info");
const name = `${(exportProjectName(st.project) || "projekt").replace(/[^\w.-]+/g, "_")}-render.zip`;
runWithAnonymityGate(st.project, [name], async () => {
if (await saveBinaryFile(bytes, name, "application/zip")) st.notify(t("render.zip.saved"), "info");
});
setPhase("setup");
} catch (err) {
setPhase("error");
@@ -269,7 +275,7 @@ export const RenderDialogHost = memo(function RenderDialogHost() {
if (!png) return;
const st = getState();
const layout = (st.project.layouts ?? []).find((l) => l.id === layoutTarget);
const name = `${(st.project.name || "projekt").replace(/[^\w.-]+/g, "_")}-rendering.png`;
const name = `${(exportProjectName(st.project) || "projekt").replace(/[^\w.-]+/g, "_")}-rendering.png`;
if (layout && placeImageOnLayout(layout.id, name, png)) st.notify(t("render.toLayout.done", { name: layout.name }), "info");
else st.notify(t("render.toLayout.none"), "warning");
};
@@ -277,8 +283,10 @@ export const RenderDialogHost = memo(function RenderDialogHost() {
const savePng = async () => {
if (!png) return;
const st = getState();
const name = `${(st.project.name || "projekt").replace(/[^\w.-]+/g, "_")}-rendering.png`;
if (await saveBinaryFile(png, name, "image/png")) st.notify(t("render.saved"), "info");
const name = `${(exportProjectName(st.project) || "projekt").replace(/[^\w.-]+/g, "_")}-rendering.png`;
runWithAnonymityGate(st.project, [name], async () => {
if (await saveBinaryFile(png, name, "image/png")) st.notify(t("render.saved"), "info");
});
};
const camLabel = cameraKey !== "live" ? t("render.camera.saved", { name: cameras.find((c) => c.id === cameraKey)?.name ?? "" }) : "preset" in camera ? t("render.camera.preset", { name: t(`view3d.${camera.preset === "right" ? "side" : camera.preset}` as never) }) : t("render.camera.view");