Files
OmniRoute/scripts/dbsetup.js
diegosouzapw 1f962a2167 fix(mitm): harden packaged runtime and privileged command execution
Compile MITM utilities as NodeNext ESM for prepublish builds, copy the
CommonJS MITM server into standalone artifacts, and resolve MITM data
paths without relying on Next.js aliases at runtime.

Replace shell-interpolated setup and elevated command flows with
argument-based spawn and execFile helpers for database setup, DNS edits,
certificate install flows, and Tailscale sudo execution. Also tighten
the Electron production CSP, update provider icon loading to use direct
@lobehub/icons imports with local fallbacks, and pin dependency
configuration to avoid unused peer installs and known audit findings.
2026-04-25 00:31:43 -03:00

28 lines
706 B
JavaScript
Executable File

#!/usr/bin/env node
import { spawn } from "node:child_process";
const env = { ...process.env };
await exec("npx", ["next", "build", "--experimental-build-mode", "generate"]);
// launch application
const [command, ...args] = process.argv.slice(2);
if (!command) {
throw new Error("Missing command to launch after database setup");
}
await exec(command, args);
function exec(command, args = []) {
const child = spawn(command, args, { stdio: "inherit", env });
return new Promise((resolve, reject) => {
child.on("exit", (code) => {
if (code === 0) {
resolve();
} else {
reject(new Error(`${[command, ...args].join(" ")} failed rc=${code}`));
}
});
});
}