Fix --widevine broken since 46.0.0

See https://github.com/nativefier/nativefier/pull/1288#issuecomment-1006307669 ,
"the version prefix changed from -wvvmp to +wvcus",

and message from CastLabs:
The v16 series of Electron for Content Security, labeled wvcus, moves to using the Component Updater Service to handle installation of the Widevine CDM, and has incompatible API updates compared to the previous wvvmp releases.
This commit is contained in:
Ronan Jouchet 2022-01-06 09:34:20 -05:00
parent 5276a839bb
commit 5e3c23267a
1 changed files with 8 additions and 1 deletions

View File

@ -142,6 +142,7 @@ export async function getOptions(rawOptions: RawOptions): Promise<AppOptions> {
log.setLevel('info');
}
let requestedElectronBefore16 = false;
if (options.packager.electronVersion) {
const requestedVersion: string = options.packager.electronVersion;
if (!SEMVER_VERSION_NUMBER_REGEX.exec(requestedVersion)) {
@ -155,12 +156,18 @@ export async function getOptions(rawOptions: RawOptions): Promise<AppOptions> {
`\nSimply abort & re-run without passing the version flag to default to ${DEFAULT_ELECTRON_VERSION}`,
);
}
if (requestedMajorVersion < 16) {
requestedElectronBefore16 = true;
}
}
if (options.nativefier.widevine) {
const widevineSuffix = requestedElectronBefore16 ? '-wvvmp' : '+wvcus';
log.debug(`Using widevine release suffix "${widevineSuffix}"`);
const widevineElectronVersion = `${
options.packager.electronVersion as string
}-wvvmp`;
}${widevineSuffix}`;
try {
await axios.get(
`https://github.com/castlabs/electron-releases/releases/tag/v${widevineElectronVersion}`,