[170][30][261] Linux-App: AppImage im Container gebaut und mit Playwright-Electron geprüft, vier Fehler behoben

Linux ist ab 1.0 offiziell (Entscheid 16.11.). Das AppImage wird wie im Release gebaut
(npm run build && npm run electron:pack) und mit `npm run test:linux-app` bedient
(e2e/linuxApp170.spec.ts, Playwright _electron, Xvfb; im normalen e2e-Lauf übersprungen):
Start, Kern, Wand per Befehlszeile, Speichern atomar mit .obp~, Strg+S, Öffnen per Dialog
und per Argument, PDF/DXF auf die Platte, Autosave-Wiederherstellen nach kill -9.
Grün über FUSE, mit APPIMAGE_EXTRACT_AND_RUN=1 und entpackt (linux-unpacked).

Behoben:
- scripts/electron-files.cjs fehlte in `files` von electron-builder.yml: das gepackte
  Programm startete nicht („Cannot find module“). Test src/native/electronPackage.test.ts
  prüft alle require() von Hauptprozess und Preload gegen die Paketliste.
- `dossier datei.obp`: Datei wurde hinter dem Startbildschirm geladen bzw. wartete auf eine
  Rückfrage, die dort nicht erscheint; jetzt direkt in den Editor (onLaunchFile).
- Strg+S / Strg+Umschalt+S / Strg+O gab es nur im nativen Tauri-Menü; jetzt auch im
  Browser/Electron (useFileShortcuts, fileShortcutFor + Test).
- Datei → „Exportieren: PDF“ fehlte im Browser/Electron (nur natives Menü); ergänzt, e2e io.spec.ts.

Buildnummer [261]: Vite schreibt dist/build-info.json; scripts/electron-pack.cjs gibt sie über
die electron-builder-API als buildVersion und extraMetadata.dossierBuild weiter (über `-c.` auf der
Kommandozeile würde „261116.10“ zur Zahl). release.yml: `--version=` statt `-c.extraMetadata.version`,
neuer Schritt „AppImage prüfen“ (xvfb, libfuse2t64; nicht auf GitHub gelaufen).

Doku: doc/RELEASE-1.0.md Abschnitt 15 (Linux-App, Status je Schritt), Release-Notes Linux,
README „Linux installieren“, TODO [170]/[261].

Geprüft: npm run check --fast (tsc, vitest) grün; e2e io/datensicherheit116/start im Browser grün;
test:linux-app dreimal grün. Nicht geprüft: Rust-Tests (nichts geändert), echte GPU, Wayland,
GTK-Dialoge von Hand, Sandbox als normaler Benutzer, Mac/Tauri.
This commit is contained in:
Claude committed 2026-11-16 10:47:51 +00:00
1 parent a03f4432bc
commit 64563dba44
22 files changed
+643 -30

No files matched your search

+19
View File
@@ -3,6 +3,7 @@ import { setLanguage } from "../i18n";
import {
comboFromEvent,
comboMatches,
fileShortcutFor,
findConflict,
formatCombo,
isReservedCombo,
@@ -201,3 +202,21 @@ describe("[252] tabKeyAction", () => {
expect(tabKeyAction(ev({ key: "a", ctrlKey: true }))).toBeNull();
});
});
describe("[170] Datei-Kürzel ausserhalb von Tauri (Browser/Electron-Linux)", () => {
it("Strg/Cmd+S speichert, +Umschalt speichert unter, Strg/Cmd+O öffnet", () => {
expect(fileShortcutFor(key("s", { ctrlKey: true }))).toBe("save");
expect(fileShortcutFor(key("s", { metaKey: true }))).toBe("save");
expect(fileShortcutFor(key("S", { ctrlKey: true, shiftKey: true }))).toBe("saveAs");
expect(fileShortcutFor(key("o", { ctrlKey: true }))).toBe("open");
});
it("ohne Strg/Cmd oder mit Alt: nichts (s = Spiegeln bleibt frei)", () => {
expect(fileShortcutFor(key("s"))).toBeNull();
expect(fileShortcutFor(key("s", { ctrlKey: true, altKey: true }))).toBeNull();
expect(fileShortcutFor(key("o", { ctrlKey: true, shiftKey: true }))).toBeNull();
});
it("kollidiert mit keinem belegbaren Kürzel", () => {
const combos = SHORTCUT_DEFS.map((d) => d.defaultCombo);
for (const c of ["mod+s", "mod+shift+s", "mod+o"]) expect(combos).not.toContain(c);
});
});
+15
View File
@@ -323,6 +323,21 @@ export function comboMatches(e: KeyboardEvent, combo: string): boolean {
return k === key;
}
/** [170] Datei-Kürzel ausserhalb von Tauri. */
export type FileShortcut = "save" | "saveAs" | "open";
/**
* [170] Strg/Cmd+S, Strg/Cmd+Umschalt+S, Strg/Cmd+O im Browser und in der Linux-App (Electron, ohne native Menüleiste).
* Unter Tauri liefert das native Menü dieselben Kürzel (`native/appMenu.ts`, Accelerator) — dort nicht verwenden.
* Fest wie die Menü-Accelerators, nicht umbelegbar (nicht in {@link SHORTCUT_DEFS}).
*/
export function fileShortcutFor(e: KeyboardEvent): FileShortcut | null {
if (comboMatches(e, "mod+shift+s")) return "saveAs";
if (comboMatches(e, "mod+s")) return "save";
if (comboMatches(e, "mod+o")) return "open";
return null;
}
/** Kurzform: matcht `e` gegen die (übersteuerte oder Default-)Kombination von `id`. */
export function matchesShortcut(
e: KeyboardEvent,
+22 -1
View File
@@ -32,7 +32,8 @@ import {
} from "../editors/elementClipboard";
import type { ElementClipboard, ElementSelectionIds, PastedIds } from "../editors/elementClipboard";
import { parseClipboardText, serializeClipboardText } from "../editors/elementClipboardSerialize";
import { matchesShortcut, tabKeyAction, type ShortcutId, type ShortcutOverrides } from "./keyboardShortcuts";
import { fileShortcutFor, matchesShortcut, tabKeyAction, type FileShortcut, type ShortcutId, type ShortcutOverrides } from "./keyboardShortcuts";
import { isTauriRuntime } from "../native/projectFile";
import { isolateSelectionLayerCodes, showAllLayerCodes } from "./layerIsolate";
import { isInModalDialog } from "./modalScope";
import { toggleTraceAction } from "./traceActions";
@@ -751,3 +752,23 @@ export function useFitShortcuts(fitAll: () => void, fitSelection: () => void, ov
return () => window.removeEventListener("keydown", onKey);
}, [overrides]);
}
/**
* [170] Strg/Cmd+S (Speichern), +Umschalt (Speichern unter), Strg/Cmd+O (Öffnen) im Browser und in der Linux-App (Electron hat
* keine native Menüleiste). Unter Tauri übernimmt das native Menü (Accelerator) — dort nichts tun. Nicht in modalen Dialogen.
*/
export function useFileShortcuts(handlers: Record<FileShortcut, () => void>): void {
const ref = useRef(handlers);
ref.current = handlers;
useEffect(() => {
if (isTauriRuntime()) return;
const onKey = (e: KeyboardEvent) => {
const action = fileShortcutFor(e);
if (!action || isInModalDialog(e.target)) return;
e.preventDefault();
ref.current[action]();
};
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, []);
}
+19 -4
View File
@@ -118,6 +118,12 @@ export function useProjectFileActions(
activeCategoryCode: string,
setActiveLevelId: (id: string) => void,
planViewRef: RefObject<PlanViewHandle | null>,
/**
* [170] Electron: eine per Argument/Doppelklick übergebene Datei ist angekommen. Der Aufrufer wechselt in den Editor
* (sonst bliebe der Startbildschirm davor) und meldet, ob die App noch im Startablauf war — dann gibt es nichts zu
* verwerfen und die Rückfrage „Ungespeicherte Änderungen" entfällt.
*/
onLaunchFile?: () => { wasBooting: boolean },
) {
// Verstecktes Datei-Input zum Laden eines Projekts (Datei-Burger „Öffnen").
// Wird NUR im Browser-Pfad benutzt (ohne Tauri) — unter Tauri geht „Öffnen"
@@ -759,7 +765,7 @@ export function useProjectFileActions(
}
};
const onProjectFileChosen = (file: File, knownPath?: string | null) => {
const onProjectFileChosen = (file: File, knownPath?: string | null, askDiscard = true) => {
const r = new FileReader();
r.onload = () => {
const content = String(r.result ?? "");
@@ -767,14 +773,16 @@ export function useProjectFileActions(
const path = knownPath ?? electronFiles()?.pathForFile(file) ?? null;
// Browser-Pfad hat keinen echten Dateipfad → kein Lock für die neue
// Datei, aber ein evtl. vorher (unter Tauri) gehaltener Lock wird frei.
guardDiscard(() => {
const apply = () => {
const loaded = openOrOfferBackup(content, path, false);
if (!loaded) return;
releaseCurrentProjectLock();
lastSavedProjectRef.current = loaded;
if (path) savePathRef.current = path;
setAnonymityProjectFileName(path ?? file.name); // [208] Browser/Electron-Start: kein Pfad, aber der Dateiname
});
};
if (askDiscard) guardDiscard(apply);
else apply();
};
r.onerror = () => notify(`${t("project.open.failed")} ${r.error?.message ?? ""}`, "error");
r.readAsText(file);
@@ -782,12 +790,19 @@ export function useProjectFileActions(
// [170] Electron: per Kommandozeile/Doppelklick übergebene .obp (beim Start und von einer zweiten
// Instanz) wie eine im Browser gewählte Datei öffnen. Der Ref hält die jeweils aktuelle Fassung.
// Kommt die Datei noch im Startablauf (Splash/Startbildschirm), wechselt `onLaunchFile` in den Editor ([170], Befund 16.11.:
// vorher wurde die Datei hinter dem Startbildschirm geladen bzw. wartete auf eine Rückfrage, die dort nicht angezeigt wird).
const chosenRef = useRef(onProjectFileChosen);
chosenRef.current = onProjectFileChosen;
const launchRef = useRef(onLaunchFile);
launchRef.current = onLaunchFile;
useEffect(() => {
const api = window.dossierLaunch;
if (!api) return;
const open = (f: LaunchProject) => chosenRef.current(new File([f.text], f.name), f.path);
const open = (f: LaunchProject) => {
const wasBooting = launchRef.current?.().wasBooting ?? false;
chosenRef.current(new File([f.text], f.name), f.path, !wasBooting);
};
void api.takeOpenFile().then((f) => f && open(f));
return api.onOpenFile(open);
}, []);