Files
ThreadNet-Web/apps/desktop/src/build-config.ts
T
Michael TelatynskiandGitHub 9ea4079c3b Use the code signing Subject Name as basis for Tray GUID on Windows (#32939)
* Use the code signing Subject Name as basis for Tray GUID on Windows

Fixes https://github.com/element-hq/element-web/issues/32907

* Delint

* Iterate

* Add missing imports
2026-03-31 08:22:27 +00:00

39 lines
1.3 KiB
TypeScript

/*
Copyright 2025 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import path, { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { type JsonObject, loadJsonFile } from "./utils.js";
const __dirname = dirname(fileURLToPath(import.meta.url));
let buildConfig: BuildConfig;
interface BuildConfig {
// Application User Model ID
appId: string;
// Protocol string used for OIDC callbacks
protocol: string;
// Subject name of the code signing cert used for Windows packages, if signed
// used as a basis for the Tray GUID which must be rolled if the certificate changes.
windowsCertSubjectName: string | undefined;
}
export function getBuildConfig(): BuildConfig {
if (!buildConfig) {
const packageJson = loadJsonFile(path.join(__dirname, "..", "package.json")) as JsonObject;
buildConfig = {
appId: (packageJson["electron_appId"] as string) || "im.riot.app",
protocol: (packageJson["electron_protocol"] as string) || "io.element.desktop",
windowsCertSubjectName: packageJson["electron_windows_cert_sn"] as string,
};
}
return buildConfig;
}