Kill process if www/js/player.js is not found at startup

This commit is contained in:
Calvin Montgomery 2018-04-05 20:39:49 -07:00
parent 2087921072
commit c1e78fd4dc
2 changed files with 20 additions and 1 deletions

View file

@ -10,6 +10,8 @@ if (parseInt(ver[1], 10) < 6) {
process.exit(1); process.exit(1);
} }
checkPlayerExists();
const args = parseArgs(); const args = parseArgs();
if (args.has('--daemonize')) { if (args.has('--daemonize')) {
@ -77,3 +79,20 @@ function parseArgs() {
return args; return args;
} }
function checkPlayerExists() {
const fs = require('fs');
const path = require('path');
const playerDotJs = path.join(__dirname, 'www', 'js', 'player.js');
if (!fs.existsSync(playerDotJs)) {
console.error(
'Missing video player: www/js/player.js. This should have been ' +
'automatically generated by the postinstall step of ' +
'`npm install`, but you can manually regenerate it by running ' +
'`npm run build-player`'
);
process.exit(1);
}
}

View file

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "3.55.5", "version": "3.55.6",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },