mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-02 04:12:47 +02:00
Extend desktop package scripts and local dependency compose
This commit is contained in:
parent
b0810b4d47
commit
a7d3e4ff18
5 changed files with 178 additions and 3 deletions
24
surfsense_desktop/scripts/electron-dev.mjs
Normal file
24
surfsense_desktop/scripts/electron-dev.mjs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* Linux dev: (1) ELECTRON_DISABLE_SANDBOX before start — setuid chrome-sandbox in node_modules.
|
||||
* (2) --ozone-platform=x11 — use X11 via XWayland so global shortcuts / GPU warnings match many
|
||||
* Linux Electron setups better than native Wayland. Set SURFSENSE_ELECTRON_WAYLAND=1 to skip (2).
|
||||
* Packaged apps are not launched through this script.
|
||||
*/
|
||||
import { spawnSync } from 'child_process';
|
||||
import { dirname, join } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const cli = join(root, 'node_modules', 'electron', 'cli.js');
|
||||
|
||||
const env = { ...process.env };
|
||||
const args = [cli, '.'];
|
||||
if (process.platform === 'linux') {
|
||||
env.ELECTRON_DISABLE_SANDBOX = '1';
|
||||
if (env.SURFSENSE_ELECTRON_WAYLAND !== '1') {
|
||||
args.push('--ozone-platform=x11');
|
||||
}
|
||||
}
|
||||
|
||||
const r = spawnSync(process.execPath, args, { cwd: root, env, stdio: 'inherit' });
|
||||
process.exit(r.status === null ? 1 : r.status ?? 0);
|
||||
25
surfsense_desktop/scripts/postinstall-rebuild.mjs
Normal file
25
surfsense_desktop/scripts/postinstall-rebuild.mjs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* node-mac-permissions is macOS-only; electron-rebuild would still compile it on Linux/Windows
|
||||
* (missing `make`, wrong platform). We skip rebuild there.
|
||||
*/
|
||||
import { existsSync } from 'fs';
|
||||
import { spawnSync } from 'child_process';
|
||||
import { dirname, join } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
|
||||
if (process.platform !== 'darwin') {
|
||||
console.log('[surfsense-desktop] Skipping electron-rebuild on non-macOS (native permissions module is darwin-only).');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const bin = join(root, 'node_modules', '.bin', 'electron-rebuild');
|
||||
|
||||
if (!existsSync(bin)) {
|
||||
console.warn('[surfsense-desktop] electron-rebuild not found in node_modules/.bin, skipping.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const result = spawnSync(bin, [], { cwd: root, stdio: 'inherit' });
|
||||
process.exit(result.status === null ? 1 : result.status);
|
||||
Loading…
Add table
Add a link
Reference in a new issue