feat: various fixes for electron, and database migration and version on loading page

This commit is contained in:
Ivan 2026-08-14 15:38:01 -05:00
parent 5ac3e4e279
commit eebef7898a
No known key found for this signature in database
14 changed files with 616 additions and 22 deletions

View file

@ -0,0 +1,40 @@
#!/usr/bin/env node
"use strict";
/**
* Electron sandbox preloads cannot require() sibling modules. Bundle shellOrigin
* into a single preload script for packaged AppImage / desktop builds.
*/
const fs = require("fs");
const path = require("path");
const root = path.join(__dirname, "..");
const shellPath = path.join(root, "electron", "shellOrigin.js");
const preloadPath = path.join(root, "electron", "preload.js");
const outPath = path.join(root, "electron", "preload.bundle.js");
const shellSource = fs.readFileSync(shellPath, "utf8");
const preloadSource = fs.readFileSync(preloadPath, "utf8");
const shellBody = shellSource
.replace(/^"use strict";\s*/m, "")
.replace(/\nmodule\.exports\s*=\s*\{[\s\S]*$/m, "")
.trim();
const preloadBody = preloadSource
.replace(/const \{ isTrustedShellOrigin \} = require\("\.\/shellOrigin"\);\s*/m, "")
.trim();
const bundled = `// SPDX-License-Identifier: 0BSD
// Generated by scripts/bundle-electron-preload.cjs. Do not edit by hand.
"use strict";
${shellBody}
${preloadBody}
`;
fs.writeFileSync(outPath, bundled, "utf8");
console.log(`Bundled electron preload -> ${path.relative(root, outPath)}`);

View file

@ -8,6 +8,7 @@
* meshchatx/src/frontend/public/meshchatx-docs/en/platform-guides/raspberry-pi.md,
* meshchatx/src/backend/data/licenses_backend.json (reticulum-meshchatx entry),
* android/app/build.gradle,
* electron/app-version.json,
* pipx example, packaging/arch/PKGBUILD pkgver / printf fallback,
* then runs scripts/bake_build_meta.js (git commit / channel overlay).
*
@ -137,6 +138,9 @@ patchFile("packaging/arch/.SRCINFO", (c) =>
console.log(`Synced version ${version} from package.json`);
const appVersionPath = path.join(root, "electron", "app-version.json");
writeIfChanged(appVersionPath, `${JSON.stringify({ version }, null, 4)}\n`);
try {
require("./bake_build_meta.js");
} catch (err) {