Support build-time specified protocol scheme for oidc callback (#2285)
This commit is contained in:
committed by
GitHub
parent
468d2249d1
commit
ec4c610158
@@ -1,6 +1,6 @@
|
||||
import * as os from "node:os";
|
||||
import * as fs from "node:fs";
|
||||
import { Configuration as BaseConfiguration } from "electron-builder";
|
||||
import { type Configuration as BaseConfiguration, type Protocol } from "electron-builder";
|
||||
|
||||
/**
|
||||
* This script has different outputs depending on your os platform.
|
||||
@@ -16,9 +16,13 @@ import { Configuration as BaseConfiguration } from "electron-builder";
|
||||
* Passes $ED_DEBIAN_CHANGELOG to build.deb.fpm if specified
|
||||
*/
|
||||
|
||||
const DEFAULT_APP_ID = "im.riot.app";
|
||||
const NIGHTLY_APP_ID = "im.riot.nightly";
|
||||
const NIGHTLY_DEB_NAME = "element-nightly";
|
||||
|
||||
const DEFAULT_PROTOCOL_SCHEME = "io.element.desktop";
|
||||
const NIGHTLY_PROTOCOL_SCHEME = "io.element.nightly";
|
||||
|
||||
interface Pkg {
|
||||
name: string;
|
||||
productName: string;
|
||||
@@ -33,7 +37,11 @@ type Writable<T> = NonNullable<
|
||||
const pkg: Pkg = JSON.parse(fs.readFileSync("package.json", "utf8"));
|
||||
|
||||
interface Configuration extends BaseConfiguration {
|
||||
extraMetadata: Partial<Pick<Pkg, "version">> & Omit<Pkg, "version">;
|
||||
extraMetadata: Partial<Pick<Pkg, "version">> &
|
||||
Omit<Pkg, "version"> & {
|
||||
electron_appId: string;
|
||||
electron_protocol: string;
|
||||
};
|
||||
linux: BaseConfiguration["linux"];
|
||||
win: BaseConfiguration["win"];
|
||||
mac: BaseConfiguration["mac"];
|
||||
@@ -50,7 +58,7 @@ const config: Omit<Writable<Configuration>, "electronFuses"> & {
|
||||
// Make all fuses required to ensure they are all explicitly specified
|
||||
electronFuses: Required<Configuration["electronFuses"]>;
|
||||
} = {
|
||||
appId: "im.riot.app",
|
||||
appId: DEFAULT_APP_ID,
|
||||
asarUnpack: "**/*.node",
|
||||
electronFuses: {
|
||||
enableCookieEncryption: true,
|
||||
@@ -85,6 +93,8 @@ const config: Omit<Writable<Configuration>, "electronFuses"> & {
|
||||
name: pkg.name,
|
||||
productName: pkg.productName,
|
||||
description: pkg.description,
|
||||
electron_appId: DEFAULT_APP_ID,
|
||||
electron_protocol: DEFAULT_PROTOCOL_SCHEME,
|
||||
},
|
||||
linux: {
|
||||
target: ["tar.gz", "deb"],
|
||||
@@ -142,12 +152,10 @@ const config: Omit<Writable<Configuration>, "electronFuses"> & {
|
||||
directories: {
|
||||
output: "dist",
|
||||
},
|
||||
protocols: [
|
||||
{
|
||||
name: "element",
|
||||
schemes: ["io.element.desktop", "element"],
|
||||
},
|
||||
],
|
||||
protocols: {
|
||||
name: "element",
|
||||
schemes: [DEFAULT_PROTOCOL_SCHEME, "element"],
|
||||
},
|
||||
nativeRebuilder: "sequential",
|
||||
nodeGypRebuild: false,
|
||||
npmRebuild: true,
|
||||
@@ -170,11 +178,12 @@ if (process.env.ED_SIGNTOOL_SUBJECT_NAME && process.env.ED_SIGNTOOL_THUMBPRINT)
|
||||
if (process.env.ED_NIGHTLY) {
|
||||
config.deb.fpm = []; // Clear the fpm as the breaks deb fields don't apply to nightly
|
||||
|
||||
config.appId = NIGHTLY_APP_ID;
|
||||
config.appId = config.extraMetadata.electron_appId = NIGHTLY_APP_ID;
|
||||
config.extraMetadata.productName += " Nightly";
|
||||
config.extraMetadata.name += "-nightly";
|
||||
config.extraMetadata.description += " (nightly unstable build)";
|
||||
config.deb.fpm.push("--name", NIGHTLY_DEB_NAME);
|
||||
(config.protocols as Protocol).schemes[0] = config.extraMetadata.electron_protocol = NIGHTLY_PROTOCOL_SCHEME;
|
||||
|
||||
let version = process.env.ED_NIGHTLY;
|
||||
if (os.platform() === "win32") {
|
||||
|
||||
Reference in New Issue
Block a user