[170] Linux-Paket: AppImage (electron-builder), .obp-Dateizuordnung, Datei per Argument, Release-Job
Gepackt lädt Electron dist über dossier://app; einzige Instanz reicht .obp-Argumente weiter. Flatpak-Manifest unter packaging/linux (ungetestet). Doku in README, Website und TODO.
This commit is contained in:
17 files changed
+3172
-12
No files matched your search
@@ -1,7 +1,9 @@
|
||||
# Release ([30]): bei Tag `v*` baut die macOS-App (Tauri, universal = arm64 + x64) und legt einen
|
||||
# Release-Entwurf mit den Artefakten an. Ohne Secrets entstehen unsignierte Artefakte; mit Secrets
|
||||
# werden sie signiert/notarisiert und die Updater-Signaturen (latest.json) erzeugt.
|
||||
# Secrets: siehe README, Abschnitt „Releases". Ein Linux-/Electron-Build existiert nicht (nur Prototyp-Shell).
|
||||
# Secrets: siehe README, Abschnitt „Releases". Linux ([170]): Job `linux` baut das AppImage (Electron, electron-builder,
|
||||
# kein Secret nötig) und hängt es mit SHA256SUMS an dasselbe Release; er läuft nach `macos`, damit nicht beide
|
||||
# gleichzeitig den Release-Entwurf anlegen.
|
||||
name: release
|
||||
on:
|
||||
push:
|
||||
@@ -89,3 +91,59 @@ jobs:
|
||||
printf '\n\n' >> body.txt
|
||||
cat CHANGELOG-release.md >> body.txt
|
||||
gh release edit "$GITHUB_REF_NAME" --notes-file body.txt
|
||||
|
||||
linux:
|
||||
needs: macos
|
||||
if: ${{ !cancelled() }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with: { fetch-depth: 0 }
|
||||
- uses: actions/setup-node@v4
|
||||
with: { node-version: 22, cache: npm }
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with: { targets: wasm32-unknown-unknown }
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: |
|
||||
src-tauri/core
|
||||
src-tauri/render2d
|
||||
src-tauri/render3d
|
||||
src-tauri/trucksolid
|
||||
src-tauri/fileio
|
||||
- uses: taiki-e/install-action@v2
|
||||
with: { tool: wasm-pack }
|
||||
- run: npm ci || (sleep 30 && npm ci) || (sleep 90 && npm ci) # Netz-Aussetzer (z. B. 504 beim wasm-pack-Download)
|
||||
- name: WASM-Pakete bauen
|
||||
run: |
|
||||
for s in core truck engine3d engine fileio; do
|
||||
npm run "build:$s" || npm run "build:$s" -- --no-opt
|
||||
done
|
||||
- run: npm run build
|
||||
- name: AppImage bauen
|
||||
run: |
|
||||
# Version aus dem Tag (v0.2.0 -> 0.2.0); ohne Tag (workflow_dispatch) die aus package.json.
|
||||
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
|
||||
npm run electron:pack -- -c.extraMetadata.version="${GITHUB_REF_NAME#v}"
|
||||
else
|
||||
npm run electron:pack
|
||||
fi
|
||||
cd release
|
||||
sha256sum Dossier-*.AppImage > SHA256SUMS-linux.txt
|
||||
cat SHA256SUMS-linux.txt
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dossier-linux-appimage
|
||||
path: |
|
||||
release/Dossier-*.AppImage
|
||||
release/SHA256SUMS-linux.txt
|
||||
- name: An Release anhängen
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
# Entwurf anlegen, falls der macOS-Job keinen hinterlassen hat (z. B. weil er fehlschlug).
|
||||
gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1 \
|
||||
|| gh release create "$GITHUB_REF_NAME" --draft --title "Dossier $GITHUB_REF_NAME" --notes "Dossier $GITHUB_REF_NAME"
|
||||
gh release upload "$GITHUB_REF_NAME" release/Dossier-*.AppImage release/SHA256SUMS-linux.txt --clobber
|
||||
@@ -5,6 +5,7 @@ node_modules/
|
||||
dist/
|
||||
dist-test/
|
||||
dist-cli/
|
||||
release/
|
||||
*.tsbuildinfo
|
||||
target/
|
||||
/src-tauri/gen/
|
||||
|
||||
@@ -104,6 +104,22 @@ npm run dev # nur im Browser, für Entwicklung
|
||||
Prüfen: `npm run check` (TypeScript, Vitest und die Rust-Tests aller Crates),
|
||||
`npm run e2e` für die Oberflächentests mit Playwright.
|
||||
|
||||
## Linux installieren
|
||||
|
||||
Linux (x86_64) läuft in Electron (Chromium mit WebGPU über ANGLE-Vulkan; Mesa-Vulkan-Treiber nötig). Das
|
||||
AppImage stammt aus den Releases auf GitHub:
|
||||
|
||||
```bash
|
||||
chmod +x Dossier-*-x86_64.AppImage # ausführbar machen
|
||||
./Dossier-*-x86_64.AppImage datei.obp # starten, Projekt optional als Argument
|
||||
```
|
||||
|
||||
Das AppImage braucht FUSE 2 (`libfuse2`); sonst `--appimage-extract-and-run` anhängen. Für Menüeintrag und
|
||||
Doppelklick auf `.obp` ein Werkzeug wie AppImageLauncher nutzen oder den Desktop-Eintrag selbst anlegen.
|
||||
Selbst bauen: `npm run build && npm run electron:pack` (erzeugt `release/Dossier-<Version>-x86_64.AppImage`).
|
||||
Ein Flatpak-Manifest liegt unter `packaging/linux/ch.dossier.cad.yml` (nicht veröffentlicht, ungetestet; Aufruf im
|
||||
Dateikopf).
|
||||
|
||||
## Releases
|
||||
|
||||
Ein Release entsteht aus einem Tag: Version in `src-tauri/tauri.conf.json` anheben, committen, dann
|
||||
@@ -118,7 +134,8 @@ entstehen unsignierte Artefakte. Optionale Repository-Secrets:
|
||||
(passend zum `pubkey` in `tauri.conf.json`; ohne Schlüssel entfallen die Updater-Artefakte)
|
||||
|
||||
Der Updater-Endpunkt in `tauri.conf.json` zeigt noch auf `git.openbureau.ch`; soll er GitHub nutzen,
|
||||
dort `…/releases/latest/download/latest.json` eintragen. Linux (Electron) hat keinen Release-Build.
|
||||
dort `…/releases/latest/download/latest.json` eintragen. Für Linux baut der Job `linux` ein AppImage
|
||||
(Electron, electron-builder, kein Secret nötig) und hängt es samt `SHA256SUMS-linux.txt` an dasselbe Release.
|
||||
|
||||
## Kommandozeile
|
||||
|
||||
|
||||
@@ -303,8 +303,16 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `*
|
||||
- ◐ **[120]** macOS in CI (`.github/workflows/macos.yml`). Bildvergleich Metal ↔ WebGPU (gleiche Szene per
|
||||
`render2d::headless` und Chromium, Pixeltoleranz aus `tests/golden.rs`); Golden-Bilder für 3D in der CI ([R1]). · M
|
||||
- ◐ **[30]** Release-Workflow (`release.yml`). Updater-Endpunkt (zeigt auf git.openbureau.ch), Secrets setzen,
|
||||
Linux-Build; nicht auf GitHub gelaufen. Zielbild laut [C8]: macOS universal signiert/notarisiert, Windows MSI,
|
||||
Linux-Job (AppImage, [170]) ergänzt; nicht auf GitHub gelaufen. Zielbild laut [C8]: macOS universal signiert/notarisiert, Windows MSI,
|
||||
Linux AppImage/Flatpak/deb/rpm, `SHA256SUMS.txt`. · M
|
||||
- ◐ **[170]** Linux-Paket (9.11.). AppImage x86_64 mit electron-builder (`electron-builder.yml`, `npm run electron:pack`
|
||||
nach `npm run build`): Desktop-Eintrag (Graphics;Engineering;), MIME `application/x-dossier-project` für `.obp`,
|
||||
`dossier datei.obp` / Doppelklick (Hauptprozess liest die Datei, einzige Instanz, `useProjectFileActions`);
|
||||
gepackt lädt die App `dist` über das Schema `dossier://app`, WebGPU-Flags unverändert; Job `linux` in `release.yml`.
|
||||
Geprüft nur im Container (Xvfb, SwiftShader): entpacktes Paket startet, Oberfläche rendert, `navigator.gpu` liefert
|
||||
einen Adapter, AppImage enthält Desktop-Datei, MIME und Icon. Offen: Start des AppImage selbst (FUSE) und echte
|
||||
AMD-GPU/ANGLE-Vulkan, Öffnen einer gültigen `.obp` per Argument, Flatpak-Manifest (`packaging/linux/ch.dossier.cad.yml`)
|
||||
nie gebaut, deb/rpm, `--no-sandbox` im Desktop-Eintrag (AppImage-Vorgabe) ersetzen, Workflow nicht auf GitHub gelaufen. · M
|
||||
- ◐ **[57]** Tests bei jedem Push (`check.yml`). Nicht auf GitHub gelaufen. · S
|
||||
- ○ **[51]** Herkunft übernommenen Codes: Dateikopf + `NOTICE` je übernommene Datei; fällig für Manifold ([107]). · S
|
||||
- ○ **[C6]** `cargo xtask ci`: Formatierung, Clippy, Tests, Crate-Schichtung, Asset-Herkunft, WASM-Build in einem
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ Blätter, `render3d` für 3D. Beide laufen als WASM über WebGPU. Auf macOS zeic
|
||||
Grundriss zusätzlich nativ über Metal in eine Fläche hinter der Webansicht. Kein three.js, kein WebGL.
|
||||
|
||||
**Plattformen.** macOS: Tauri (`src-tauri/src`, WKWebView). Linux: Electron (`scripts/electron-main.cjs`,
|
||||
Chromium mit WebGPU). Browser: für Entwicklung und e2e-Tests. Dazu die Kommandozeile `dossier-cli`
|
||||
Chromium mit WebGPU; Paket: AppImage über `electron-builder.yml` und `packaging/linux/`, [170]). Browser: für Entwicklung und e2e-Tests. Dazu die Kommandozeile `dossier-cli`
|
||||
(`src/cli/main.ts`), die nur `src/core` importiert und alles ohne Oberfläche kann (Pläne als SVG, IFC,
|
||||
DXF, Kennzahlen, Benchmarks).
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
# electron-builder ([170]): Linux-Pakete der Electron-Hülle (scripts/electron-main.cjs).
|
||||
# Bauen: `npm run build` (dist) und `npm run electron:pack` -> release/Dossier-<Version>-x86_64.AppImage
|
||||
# Die WebGPU-Flags (ANGLE-Vulkan) setzt electron-main.cjs selbst; die Oberfläche kommt aus dist/.
|
||||
appId: ch.dossier.cad
|
||||
productName: Dossier
|
||||
copyright: Karim Gabriele Varano, AGPL-3.0-or-later
|
||||
directories:
|
||||
output: release
|
||||
buildResources: packaging/linux
|
||||
electronVersion: 43.0.0
|
||||
asar: true
|
||||
publish: null
|
||||
# Nur die Hülle und das gebaute dist; die npm-Abhängigkeiten stecken schon gebündelt im Vite-Build.
|
||||
files:
|
||||
- scripts/electron-main.cjs
|
||||
- scripts/electron-preload.cjs
|
||||
- scripts/csp.cjs
|
||||
- dist/**
|
||||
- package.json
|
||||
- "!**/node_modules/**"
|
||||
extraMetadata:
|
||||
main: scripts/electron-main.cjs
|
||||
linux:
|
||||
target:
|
||||
- target: AppImage
|
||||
arch: x64
|
||||
executableName: dossier
|
||||
icon: src-tauri/icons/icon.png
|
||||
category: Graphics;Engineering;
|
||||
synopsis: CAAD für Architektinnen und Architekten
|
||||
description: CAAD für Architektinnen und Architekten
|
||||
syncDesktopName: true
|
||||
desktop:
|
||||
entry:
|
||||
Name: Dossier
|
||||
Comment: CAAD für Architektinnen und Architekten
|
||||
Keywords: CAD;CAAD;Architektur;BIM;IFC;DXF;
|
||||
StartupWMClass: Dossier
|
||||
fileAssociations:
|
||||
- ext: obp
|
||||
name: Dossier-Projekt
|
||||
description: Dossier-Projekt
|
||||
mimeType: application/x-dossier-project
|
||||
role: Editor
|
||||
appImage:
|
||||
artifactName: Dossier-${version}-${arch}.AppImage
|
||||
Generated
+2785
-2
File diff suppressed because it is too large.
Load diff
@@ -3,6 +3,9 @@
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"main": "scripts/electron-main.cjs",
|
||||
"desktopName": "dossier.desktop",
|
||||
"description": "Dossier: CAAD für Architektinnen und Architekten",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"author": "Karim Gabriele Varano",
|
||||
"scripts": {
|
||||
@@ -23,6 +26,7 @@
|
||||
"dump:native": "node scripts/dump-native-scene.mjs",
|
||||
"shell": "scripts/chromium-shell.sh",
|
||||
"electron": "scripts/electron-shell.sh",
|
||||
"electron:pack": "electron-builder --config electron-builder.yml --linux AppImage --x64 --publish never",
|
||||
"build:engine": "wasm-pack build src-tauri/render2d --release --target web --out-dir ../../src/engine/pkg --out-name render2d --no-default-features --features web",
|
||||
"build:engine3d": "wasm-pack build src-tauri/render3d --release --target web --out-dir ../../src/engine/pkg3d --out-name render3d --no-default-features --features web",
|
||||
"build:fileio": "wasm-pack build src-tauri/fileio --release --target web --out-dir ../../src/engine/pkgFileIo --out-name fileio --no-default-features --features web",
|
||||
@@ -54,6 +58,7 @@
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vitejs/plugin-react": "^4.3.2",
|
||||
"electron": "^43.0.0",
|
||||
"electron-builder": "^26.18.0",
|
||||
"gltf-validator": "^2.0.0-dev.3.10",
|
||||
"playwright": "^1.61.1",
|
||||
"puppeteer": "^25.2.1",
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Name=Dossier
|
||||
Comment=CAAD für Architektinnen und Architekten
|
||||
Exec=dossier %F
|
||||
Icon=ch.dossier.cad
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Graphics;Engineering;
|
||||
MimeType=application/x-dossier-project;
|
||||
StartupWMClass=Dossier
|
||||
Keywords=CAD;CAAD;Architektur;BIM;IFC;DXF;
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop-application">
|
||||
<id>ch.dossier.cad</id>
|
||||
<name>Dossier</name>
|
||||
<summary>CAAD für Architektinnen und Architekten</summary>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>AGPL-3.0-or-later</project_license>
|
||||
<description>
|
||||
<p>Dossier ist ein CAAD-Programm mit einem semantischen Gebäudemodell. Grundriss, Schnitt, Ansicht und 3D werden daraus abgeleitet.</p>
|
||||
</description>
|
||||
<launchable type="desktop-id">ch.dossier.cad.desktop</launchable>
|
||||
<provides><mediatype>application/x-dossier-project</mediatype></provides>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="0.1.0" date="2026-11-09"/>
|
||||
</releases>
|
||||
</component>
|
||||
@@ -0,0 +1,48 @@
|
||||
# Flatpak-Manifest für Dossier ([170]). Ungetestet (im Entwicklungscontainer gibt es kein flatpak-builder);
|
||||
# als Quelle dient das von electron-builder entpackte Verzeichnis, es entsteht also kein zweiter Build:
|
||||
#
|
||||
# npm run build && npm run electron:pack # erzeugt release/linux-unpacked
|
||||
# flatpak install flathub org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08 org.electronjs.Electron2.BaseApp//24.08
|
||||
# flatpak-builder --user --install --force-clean build-flatpak packaging/linux/ch.dossier.cad.yml
|
||||
# flatpak run ch.dossier.cad [datei.obp]
|
||||
app-id: ch.dossier.cad
|
||||
runtime: org.freedesktop.Platform
|
||||
runtime-version: "24.08"
|
||||
sdk: org.freedesktop.Sdk
|
||||
base: org.electronjs.Electron2.BaseApp
|
||||
base-version: "24.08"
|
||||
command: dossier
|
||||
separate-locales: false
|
||||
finish-args:
|
||||
- --share=ipc
|
||||
- --socket=x11
|
||||
- --socket=wayland
|
||||
- --device=dri # GPU: WebGPU läuft über Vulkan/ANGLE, braucht /dev/dri
|
||||
- --filesystem=home # Projekte (.obp), Importe und Exporte liegen im Home
|
||||
- --share=network # Lage-/Geodaten und Materialbibliothek (nur die Hosts aus src/net)
|
||||
- --talk-name=org.freedesktop.Notifications
|
||||
modules:
|
||||
- name: dossier
|
||||
buildsystem: simple
|
||||
build-commands:
|
||||
- mkdir -p /app/lib/dossier
|
||||
- cp -r --no-preserve=ownership . /app/lib/dossier
|
||||
- install -Dm755 dossier.sh /app/bin/dossier
|
||||
- install -Dm644 ch.dossier.cad.desktop /app/share/applications/ch.dossier.cad.desktop
|
||||
- install -Dm644 ch.dossier.cad.metainfo.xml /app/share/metainfo/ch.dossier.cad.metainfo.xml
|
||||
- install -Dm644 dossier-project.xml /app/share/mime/packages/ch.dossier.cad.xml
|
||||
- install -Dm644 icon.png /app/share/icons/hicolor/512x512/apps/ch.dossier.cad.png
|
||||
sources:
|
||||
- type: dir
|
||||
path: ../../release/linux-unpacked
|
||||
- type: file
|
||||
path: dossier.sh
|
||||
- type: file
|
||||
path: ch.dossier.cad.desktop
|
||||
- type: file
|
||||
path: ch.dossier.cad.metainfo.xml
|
||||
- type: file
|
||||
path: dossier-project.xml
|
||||
- type: file
|
||||
path: ../../src-tauri/icons/icon.png
|
||||
dest-filename: icon.png
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- MIME-Typ für Dossier-Projekte ([170]); wird von Flatpak/deb nach share/mime/packages installiert. -->
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="application/x-dossier-project">
|
||||
<comment>Dossier project</comment>
|
||||
<comment xml:lang="de">Dossier-Projekt</comment>
|
||||
<icon name="ch.dossier.cad"/>
|
||||
<glob pattern="*.obp"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# Startet Dossier im Flatpak über zypak (Chromium-Sandbox innerhalb von Flatpak).
|
||||
exec zypak-wrapper /app/lib/dossier/dossier "$@"
|
||||
+105
-4
@@ -4,8 +4,9 @@
|
||||
// (render2d-WASM-Engine, ?engine=wasm) zuverlässig läuft. Kein Rust-Backend
|
||||
// nötig: compute_joins hat einen TS-Fallback (src/compute/index.ts).
|
||||
|
||||
const { app, BrowserWindow, Menu, ipcMain } = require("electron");
|
||||
const { app, BrowserWindow, Menu, ipcMain, protocol, session } = require("electron");
|
||||
const path = require("node:path");
|
||||
const fs = require("node:fs");
|
||||
const { buildCsp } = require("./csp.cjs");
|
||||
|
||||
// Randloses App-Fenster wie chromium-shell.sh (--app=…): keine native
|
||||
@@ -21,10 +22,104 @@ app.commandLine.appendSwitch("enable-unsafe-webgpu");
|
||||
app.commandLine.appendSwitch("enable-features", "Vulkan,VulkanFromANGLE,DefaultANGLEVulkan");
|
||||
|
||||
const DEV_URL = "http://localhost:5187";
|
||||
const isDev = !app.isPackaged;
|
||||
const isDev = !app.isPackaged && !process.env.DOSSIER_USE_DIST; // DOSSIER_USE_DIST=1: gebautes dist ohne Paket prüfen
|
||||
|
||||
// [170] Gepackt (AppImage/Flatpak) lädt die App aus `dist` über ein eigenes, „standard“-Schema statt
|
||||
// file://: absolute Asset-Pfade (/assets/…), fetch() der WASM-Module (application/wasm), Worker und
|
||||
// localStorage brauchen einen richtigen Ursprung. Muss vor `ready` registriert werden.
|
||||
const APP_SCHEME = "dossier";
|
||||
const APP_ORIGIN = `${APP_SCHEME}://app`;
|
||||
const DIST_DIR = path.join(__dirname, "..", "dist");
|
||||
const MIME = {
|
||||
".html": "text/html; charset=utf-8",
|
||||
".js": "text/javascript; charset=utf-8",
|
||||
".mjs": "text/javascript; charset=utf-8",
|
||||
".css": "text/css; charset=utf-8",
|
||||
".json": "application/json; charset=utf-8",
|
||||
".wasm": "application/wasm",
|
||||
".svg": "image/svg+xml",
|
||||
".png": "image/png",
|
||||
".jpg": "image/jpeg",
|
||||
".webp": "image/webp",
|
||||
".woff": "font/woff",
|
||||
".woff2": "font/woff2",
|
||||
".ttf": "font/ttf",
|
||||
".txt": "text/plain; charset=utf-8",
|
||||
".map": "application/json; charset=utf-8",
|
||||
};
|
||||
protocol.registerSchemesAsPrivileged([
|
||||
{ scheme: APP_SCHEME, privileges: { standard: true, secure: true, supportFetchAPI: true, stream: true, corsEnabled: true } },
|
||||
]);
|
||||
|
||||
function serveDist(request) {
|
||||
const { pathname } = new URL(request.url);
|
||||
let rel = decodeURIComponent(pathname);
|
||||
if (rel === "/" || rel === "") rel = "/index.html";
|
||||
const file = path.normalize(path.join(DIST_DIR, rel));
|
||||
// Kein Ausbruch aus dist (../).
|
||||
if (file !== DIST_DIR && !file.startsWith(DIST_DIR + path.sep)) return new Response("Forbidden", { status: 403 });
|
||||
try {
|
||||
const body = fs.readFileSync(file);
|
||||
const type = MIME[path.extname(file).toLowerCase()] || "application/octet-stream";
|
||||
return new Response(body, { headers: { "content-type": type } });
|
||||
} catch {
|
||||
return new Response("Not found", { status: 404 });
|
||||
}
|
||||
}
|
||||
|
||||
// [170] Projektdatei per Argument (`dossier datei.obp`, Doppelklick im Dateimanager über %F im
|
||||
// Desktop-Eintrag). Erste vorhandene .obp-Datei der Argumente; relative Pfade gegen `cwd`.
|
||||
function findProjectArg(argv, cwd) {
|
||||
for (const a of argv.slice(1)) {
|
||||
if (!a || a.startsWith("-") || !/\.obp$/i.test(a)) continue;
|
||||
const full = path.resolve(cwd || process.cwd(), a);
|
||||
try {
|
||||
if (fs.statSync(full).isFile()) return full;
|
||||
} catch {
|
||||
/* nicht vorhanden: ignorieren */
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
let mainWindow = null;
|
||||
let pendingOpenFile = findProjectArg(process.argv, process.cwd());
|
||||
|
||||
function readProject(file) {
|
||||
try {
|
||||
return { name: path.basename(file), path: file, text: fs.readFileSync(file, "utf8") };
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Nur eine Instanz: ein zweiter Start (`dossier b.obp`) reicht die Datei an das offene Fenster weiter.
|
||||
const gotLock = app.requestSingleInstanceLock();
|
||||
if (!gotLock) {
|
||||
app.quit();
|
||||
} else {
|
||||
app.on("second-instance", (_event, argv, cwd) => {
|
||||
const file = findProjectArg(argv, cwd);
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) mainWindow.restore();
|
||||
mainWindow.focus();
|
||||
const proj = file && readProject(file);
|
||||
if (proj) mainWindow.webContents.send("launch:open-file", proj);
|
||||
} else if (file) {
|
||||
pendingOpenFile = file;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ipcMain.handle("launch:take-open-file", () => {
|
||||
const file = pendingOpenFile;
|
||||
pendingOpenFile = null;
|
||||
return file ? readProject(file) : null;
|
||||
});
|
||||
|
||||
function createWindow() {
|
||||
const win = new BrowserWindow({
|
||||
title: "Dossier",
|
||||
width: 1600,
|
||||
height: 1000,
|
||||
frame: false,
|
||||
@@ -36,6 +131,11 @@ function createWindow() {
|
||||
},
|
||||
});
|
||||
|
||||
mainWindow = win;
|
||||
win.on("closed", () => {
|
||||
if (mainWindow === win) mainWindow = null;
|
||||
});
|
||||
|
||||
const notifyMaximized = () => {
|
||||
win.webContents.send("window:maximized-changed", win.isMaximized());
|
||||
};
|
||||
@@ -45,7 +145,7 @@ function createWindow() {
|
||||
if (isDev) {
|
||||
win.loadURL(DEV_URL);
|
||||
} else {
|
||||
win.loadFile(require("node:path").join(__dirname, "..", "dist", "index.html"));
|
||||
win.loadURL(`${APP_ORIGIN}/index.html`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,9 +168,10 @@ ipcMain.handle("window:is-maximized", (event) => {
|
||||
});
|
||||
|
||||
app.whenReady().then(() => {
|
||||
if (!gotLock) return;
|
||||
// [117] CSP als Antwort-Header — nur gepackt: der Dev-Server (Vite HMR) braucht Inline-Skripte.
|
||||
if (!isDev) {
|
||||
const { session } = require("electron");
|
||||
protocol.handle(APP_SCHEME, serveDist);
|
||||
session.defaultSession.webRequest.onHeadersReceived((details, cb) => {
|
||||
cb({ responseHeaders: { ...details.responseHeaders, "Content-Security-Policy": [buildCsp()] } });
|
||||
});
|
||||
|
||||
@@ -17,3 +17,14 @@ contextBridge.exposeInMainWorld("dossierWindow", {
|
||||
return () => ipcRenderer.removeListener("window:maximized-changed", listener);
|
||||
},
|
||||
});
|
||||
|
||||
// [170] Projektdatei, mit der die App gestartet wurde (`dossier datei.obp`), und spätere Aufrufe
|
||||
// einer zweiten Instanz. Inhalt wird im Hauptprozess gelesen: {name, path, text} oder null.
|
||||
contextBridge.exposeInMainWorld("dossierLaunch", {
|
||||
takeOpenFile: () => ipcRenderer.invoke("launch:take-open-file"),
|
||||
onOpenFile: (callback) => {
|
||||
const listener = (_event, file) => callback(file);
|
||||
ipcRenderer.on("launch:open-file", listener);
|
||||
return () => ipcRenderer.removeListener("launch:open-file", listener);
|
||||
},
|
||||
});
|
||||
@@ -63,6 +63,20 @@ export type ImportDialogState = {
|
||||
} | null;
|
||||
|
||||
/** Meldung eines abgefangenen Fehlers (Rust-Fehler kommen als String, Worker-Fehler als Error). */
|
||||
/** Von electron-preload.cjs injiziert (nur Electron/Linux, [170]): Projektdatei aus `dossier datei.obp`. */
|
||||
interface LaunchProject {
|
||||
name: string;
|
||||
text: string;
|
||||
}
|
||||
declare global {
|
||||
interface Window {
|
||||
dossierLaunch?: {
|
||||
takeOpenFile: () => Promise<LaunchProject | null>;
|
||||
onOpenFile: (callback: (file: LaunchProject) => void) => () => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const errorText = (err: unknown): string => (err instanceof Error ? err.message : String(err));
|
||||
|
||||
|
||||
@@ -622,6 +636,18 @@ export function useProjectFileActions(
|
||||
r.readAsText(file);
|
||||
};
|
||||
|
||||
// [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.
|
||||
const chosenRef = useRef(onProjectFileChosen);
|
||||
chosenRef.current = onProjectFileChosen;
|
||||
useEffect(() => {
|
||||
const api = window.dossierLaunch;
|
||||
if (!api) return;
|
||||
const open = (f: LaunchProject) => chosenRef.current(new File([f.text], f.name));
|
||||
void api.takeOpenFile().then((f) => f && open(f));
|
||||
return api.onOpenFile(open);
|
||||
}, []);
|
||||
|
||||
const importParentName = (decision: ImportDecision): string =>
|
||||
decision.target.kind === "new" ? decision.target.name : "DXF";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ description: "Dossier aus dem Quellcode bauen: macOS (Tauri), Linux (Electron),
|
||||
---
|
||||
|
||||
Fertige Installer gibt es noch nicht. Die Release-Pipeline (macOS-App,
|
||||
universal für Apple Silicon und Intel) steht, veröffentlichte Versionen
|
||||
universal für Apple Silicon und Intel; Linux als AppImage) steht, veröffentlichte Versionen
|
||||
erscheinen künftig unter
|
||||
[Releases auf GitHub](https://github.com/expiredtanin/DOSSIER/releases). Bis
|
||||
dahin baut man Dossier aus dem Quellcode – das dauert beim ersten Mal einige
|
||||
@@ -16,13 +16,28 @@ Minuten, weil der Rust-Kern und die beiden Anzeige-Engines zu WebAssembly
|
||||
| Plattform | Hülle | Anzeige | Stand |
|
||||
|---|---|---|---|
|
||||
| macOS (Apple Silicon, Intel) | Tauri | nativ über Metal | Hauptplattform |
|
||||
| Linux | Electron (Chromium) | WebGPU | läuft, ohne Release-Build |
|
||||
| Linux (x86_64) | Electron (Chromium) | WebGPU | läuft; AppImage im Release |
|
||||
| Browser (Chromium mit WebGPU) | – | WebGPU | für Entwicklung und Tests; ohne Dateisperre und native Dialoge |
|
||||
| Windows | – | – | nicht geprüft |
|
||||
|
||||
Linux nutzt Electron statt Tauri, weil die WebKitGTK-Webansicht von Tauri unter
|
||||
Linux kein verlässliches WebGPU bietet.
|
||||
|
||||
## Linux: AppImage installieren
|
||||
|
||||
Das AppImage lädt man aus den Releases auf GitHub. Es braucht einen Mesa-Vulkan-Treiber (AMD, Intel) oder den
|
||||
proprietären NVIDIA-Treiber, damit WebGPU läuft.
|
||||
|
||||
```bash
|
||||
chmod +x Dossier-*-x86_64.AppImage # ausführbar machen
|
||||
./Dossier-*-x86_64.AppImage # starten
|
||||
./Dossier-*-x86_64.AppImage datei.obp # Projekt direkt öffnen
|
||||
```
|
||||
|
||||
Fehlt FUSE 2 (`libfuse2`), hängt man `--appimage-extract-and-run` an. Einen Menüeintrag und die Zuordnung der
|
||||
Endung `.obp` richtet ein Werkzeug wie AppImageLauncher ein. Ein Flatpak-Manifest liegt im Quellcode unter
|
||||
`packaging/linux/` (noch nicht veröffentlicht). Selbst bauen: `npm run build && npm run electron:pack`.
|
||||
|
||||
## Voraussetzungen
|
||||
|
||||
- [Node.js](https://nodejs.org/) 22 mit npm
|
||||
|
||||
Reference in new issue
Block a user