Skip to content

Commit

Permalink
Widevine DRM signing support via the python package Castlabs EVS
Browse files Browse the repository at this point in the history
  • Loading branch information
WesselKroos committed Apr 9, 2022
1 parent 91396bf commit 99ca2a1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/dist
/node_modules
/windowBounds.*
/windowBounds.*
*.config
6 changes: 6 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ __This app is unofficial and is not associated in any way with the Formula 1 com
## Installation
1. Install the LTS version of Node: [Node (LTS)](https://nodejs.org/)
2. Run in a cmd window: `npm install`
#### Optional steps for DRM support (Required to play streams with Widevine DRM)
3. Install python 3: [Python 3](https://www.python.org/downloads/)
4. Install the castlabs-evs package for Python: `python -m pip install --upgrade castlabs-evs`
5. Sign up for an EVS account: `python -m castlabs_evs.account signup`
6. For DRM support while develping, sign the electron.exe file: `python -m castlabs_evs.vmp sign-pkg node_modules/electron/dist`
7. For more info about EVS: https://github.com/castlabs/electron-releases/wiki/EVS

## Start the app
1. run in a cmd window: `npm start`
30 changes: 30 additions & 0 deletions after-sign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
exports.default = async function(context) {

// If we are not packaging for windows we don't sign here, just return
if (context.packager.platform.name !== 'windows') {
return;
}

// Make sure we don't leave an outdated electron.exe.sig laying about
if (context.packager.appInfo.productFilename !== 'electron') {
var fs = require("fs");
var path = context.appOutDir + '/electron.exe.sig'
if (fs.existsSync(path)) {
fs.unlinkSync(path)
}
}

// Sign the application package
var spawnSync = require("child_process").spawnSync;
var vmp = spawnSync('python', [
'-m', 'castlabs_evs.vmp', 'sign-pkg', 'dist/win-unpacked'
],
{
stdio: 'inherit'
});

if (vmp.status != 0) {
throw new Error('vmp-resign.py failed with code: ' + vmp.status);
}

}
3 changes: 2 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ ipcMain.handle('video-ipc', (event, videoUrl, referrer) => {
webPreferences: {
contextIsolation: false,
nodeIntegration: true,
webviewTag: true
webviewTag: true,
plugins: true
}
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"productName": "Race TV Multiplayer",
"electronDownload": {
"mirror": "https://github.com/castlabs/electron-releases/releases/download/v"
}
},
"afterSign": "./after-sign.js"
}
}

0 comments on commit 99ca2a1

Please sign in to comment.