Upgrade electron 11 -> 19 (huge jump). Install new remote module to preserve legacy communication protocol.

This commit is contained in:
Matt McWilliams 2022-06-04 11:11:23 -04:00
parent 96e0ce6050
commit f585aa2a5a
10 changed files with 2641 additions and 3026 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "1.6.9", "version": "1.7.0",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {
@ -178,7 +178,10 @@
"cameras": "4", "cameras": "4",
"camera_projectors_identifier": "5", "camera_projectors_identifier": "5",
"cameras_projector_identifier": "6", "cameras_projector_identifier": "6",
"cameras_projectors_identifier": "7" "cameras_projectors_identifier": "7",
"camera_capper_identifier" : "8",
"camera_capper_projector_identifier" : "9",
"camera_capper_projectors_identifier" : "0"
} }
} }
} }

View File

@ -2474,8 +2474,9 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return l[e]||(m.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",m.cssRules.length),l[e]=1),e}function d(a,b){var c,d,e=a.style;for(b=b.charAt(0).toUpperCase()+b.slice(1),d=0;d<k.length;d++)if(c=k[d]+b,void 0!==e[c])return c;return void 0!==e[b]?b:void 0}function e(a,b){for(var c in b)a.style[d(a,c)||c]=b[c];return a}function f(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)void 0===a[d]&&(a[d]=c[d])}return a}function g(a,b){return"string"==typeof a?a:a[b%a.length]}function h(a){this.opts=f(a||{},h.defaults,n)}function i(){function c(b,c){return a("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',c)}m.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:k+" "+k,coordorigin:-j+" "+-j}),{width:k,height:k})}function h(a,h,i){b(m,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~h}),b(e(c("roundrect",{arcsize:d.corners}),{width:j,height:d.width,left:d.radius,top:-d.width>>1,filter:i}),c("fill",{color:g(d.color,a),opacity:d.opacity}),c("stroke",{opacity:0}))))}var i,j=d.length+d.width,k=2*j,l=2*-(d.width+d.length)+"px",m=e(f(),{position:"absolute",top:l,left:l});if(d.shadow)for(i=1;i<=d.lines;i++)h(i,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(i=1;i<=d.lines;i++)h(i);return b(a,m)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d<e.childNodes.length&&(e=e.childNodes[b+d],e=e&&e.firstChild,e=e&&e.firstChild,e&&(e.opacity=c))}}var j,k=["webkit","Moz","ms","O"],l={},m=function(){var c=a("style",{type:"text/css"});return b(document.getElementsByTagName("head")[0],c),c.sheet||c.styleSheet}(),n={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"50%",left:"50%",position:"absolute"};h.defaults={},f(h.prototype,{spin:function(b){this.stop();{var c=this,d=c.opts,f=c.el=e(a(0,{className:d.className}),{position:d.position,width:0,zIndex:d.zIndex});d.radius+d.length+d.width}if(e(f,{left:d.left,top:d.top}),b&&b.insertBefore(f,b.firstChild||null),f.setAttribute("role","progressbar"),c.lines(f,c.opts),!j){var g,h=0,i=(d.lines-1)*(1-d.direction)/2,k=d.fps,l=k/d.speed,m=(1-d.opacity)/(l*d.trail/100),n=l/d.lines;!function o(){h++;for(var a=0;a<d.lines;a++)g=Math.max(1-(h+(d.lines-a)*n)%l*m,d.opacity),c.opacity(f,a*d.direction+i,g,d);c.timeout=c.el&&setTimeout(o,~~(1e3/k))}()}return c},stop:function(){var a=this.el;return a&&(clearTimeout(this.timeout),a.parentNode&&a.parentNode.removeChild(a),this.el=void 0),this},lines:function(d,f){function h(b,c){return e(a(),{position:"absolute",width:f.length+f.width+"px",height:f.width+"px",background:b,boxShadow:c,transformOrigin:"left",transform:"rotate("+~~(360/f.lines*k+f.rotate)+"deg) translate("+f.radius+"px,0)",borderRadius:(f.corners*f.width>>1)+"px"})}for(var i,k=0,l=(f.lines-1)*(1-f.direction)/2;k<f.lines;k++)i=e(a(),{position:"absolute",top:1+~(f.width/2)+"px",transform:f.hwaccel?"translate3d(0,0,0)":"",opacity:f.opacity,animation:j&&c(f.opacity,f.trail,l+k*f.direction,f.lines)+" "+1/f.speed+"s linear infinite"}),f.shadow&&b(i,e(h("#000","0 0 4px #000"),{top:"2px"})),b(d,b(i,h(g(f.color,k),"0 0 1px rgba(0,0,0,.1)")));return d},opacity:function(a,b,c){b<a.childNodes.length&&(a.childNodes[b].style.opacity=c)}});var o=e(a("group"),{behavior:"url(#default#VML)"});return!d(o,"transform")&&o.adj?i():j=d(o,"animation"),h}); !function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return l[e]||(m.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",m.cssRules.length),l[e]=1),e}function d(a,b){var c,d,e=a.style;for(b=b.charAt(0).toUpperCase()+b.slice(1),d=0;d<k.length;d++)if(c=k[d]+b,void 0!==e[c])return c;return void 0!==e[b]?b:void 0}function e(a,b){for(var c in b)a.style[d(a,c)||c]=b[c];return a}function f(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)void 0===a[d]&&(a[d]=c[d])}return a}function g(a,b){return"string"==typeof a?a:a[b%a.length]}function h(a){this.opts=f(a||{},h.defaults,n)}function i(){function c(b,c){return a("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',c)}m.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:k+" "+k,coordorigin:-j+" "+-j}),{width:k,height:k})}function h(a,h,i){b(m,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~h}),b(e(c("roundrect",{arcsize:d.corners}),{width:j,height:d.width,left:d.radius,top:-d.width>>1,filter:i}),c("fill",{color:g(d.color,a),opacity:d.opacity}),c("stroke",{opacity:0}))))}var i,j=d.length+d.width,k=2*j,l=2*-(d.width+d.length)+"px",m=e(f(),{position:"absolute",top:l,left:l});if(d.shadow)for(i=1;i<=d.lines;i++)h(i,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(i=1;i<=d.lines;i++)h(i);return b(a,m)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d<e.childNodes.length&&(e=e.childNodes[b+d],e=e&&e.firstChild,e=e&&e.firstChild,e&&(e.opacity=c))}}var j,k=["webkit","Moz","ms","O"],l={},m=function(){var c=a("style",{type:"text/css"});return b(document.getElementsByTagName("head")[0],c),c.sheet||c.styleSheet}(),n={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"50%",left:"50%",position:"absolute"};h.defaults={},f(h.prototype,{spin:function(b){this.stop();{var c=this,d=c.opts,f=c.el=e(a(0,{className:d.className}),{position:d.position,width:0,zIndex:d.zIndex});d.radius+d.length+d.width}if(e(f,{left:d.left,top:d.top}),b&&b.insertBefore(f,b.firstChild||null),f.setAttribute("role","progressbar"),c.lines(f,c.opts),!j){var g,h=0,i=(d.lines-1)*(1-d.direction)/2,k=d.fps,l=k/d.speed,m=(1-d.opacity)/(l*d.trail/100),n=l/d.lines;!function o(){h++;for(var a=0;a<d.lines;a++)g=Math.max(1-(h+(d.lines-a)*n)%l*m,d.opacity),c.opacity(f,a*d.direction+i,g,d);c.timeout=c.el&&setTimeout(o,~~(1e3/k))}()}return c},stop:function(){var a=this.el;return a&&(clearTimeout(this.timeout),a.parentNode&&a.parentNode.removeChild(a),this.el=void 0),this},lines:function(d,f){function h(b,c){return e(a(),{position:"absolute",width:f.length+f.width+"px",height:f.width+"px",background:b,boxShadow:c,transformOrigin:"left",transform:"rotate("+~~(360/f.lines*k+f.rotate)+"deg) translate("+f.radius+"px,0)",borderRadius:(f.corners*f.width>>1)+"px"})}for(var i,k=0,l=(f.lines-1)*(1-f.direction)/2;k<f.lines;k++)i=e(a(),{position:"absolute",top:1+~(f.width/2)+"px",transform:f.hwaccel?"translate3d(0,0,0)":"",opacity:f.opacity,animation:j&&c(f.opacity,f.trail,l+k*f.direction,f.lines)+" "+1/f.speed+"s linear infinite"}),f.shadow&&b(i,e(h("#000","0 0 4px #000"),{top:"2px"})),b(d,b(i,h(g(f.color,k),"0 0 1px rgba(0,0,0,.1)")));return d},opacity:function(a,b,c){b<a.childNodes.length&&(a.childNodes[b].style.opacity=c)}});var o=e(a("group"),{behavior:"url(#default#VML)"});return!d(o,"transform")&&o.adj?i():j=d(o,"animation"),h});
const mcopy = {}; const mcopy = {};
const { remote, ipcRenderer } = require('electron'); const remote = require('@electron/remote');
const dialog = require('electron').remote.dialog; const { ipcRenderer } = require('electron');
const { dialog } = remote;
const notifier = require('node-notifier'); const notifier = require('node-notifier');
const fs = require('fs'); const fs = require('fs');
const uuid = require('uuid').v4; const uuid = require('uuid').v4;

View File

@ -2,10 +2,10 @@
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
//import Log = require('log'); //import Log = require('log');
const delay_1 = require("delay"); const delay_1 = require("delay");
const SerialPort = require('serialport'); const { SerialPort } = require('serialport');
const Readline = SerialPort.parsers.Readline; const { ReadlineParser } = require('@serialport/parser-readline');
const exec = require('child_process').exec; const exec = require('child_process').exec;
const parser = new Readline(''); const parser = new ReadlineParser({});
const newlineRe = new RegExp('\n', 'g'); const newlineRe = new RegExp('\n', 'g');
const returnRe = new RegExp('\r', 'g'); const returnRe = new RegExp('\r', 'g');
let eventEmitter; let eventEmitter;
@ -241,7 +241,10 @@ class Arduino {
|| data === cfg.arduino.cmd.camera_second_forward || data === cfg.arduino.cmd.camera_second_forward
|| data === cfg.arduino.cmd.camera_second_backward || data === cfg.arduino.cmd.camera_second_backward
|| data === cfg.arduino.cmd.camera_second || data === cfg.arduino.cmd.camera_second
|| data === cfg.arduino.cmd.cameras) { || data === cfg.arduino.cmd.cameras
|| data === cfg.arduino.cmd.camera_capper_identifier
|| data === cfg.arduino.cmd.camera_capper_projector_identifier
|| data === cfg.arduino.cmd.camera_capper_projectors_identifier) {
this.confirmExec(null, data); this.confirmExec(null, data);
this.confirmExec = {}; this.confirmExec = {};
} }
@ -313,6 +316,15 @@ class Arduino {
else if (data === cfg.arduino.cmd.cameras_projectors_identifier) { else if (data === cfg.arduino.cmd.cameras_projectors_identifier) {
type = 'camera,camera_second,projector,projector_second'; type = 'camera,camera_second,projector,projector_second';
} }
else if (data === cfg.arduino.cmd.camera_capper_identifier) {
type = 'camera,capper';
}
else if (data === cfg.arduino.cmd.camera_capper_projector_identifier) {
type = 'camera,capper,projector';
}
else if (data === cfg.arduino.cmd.camera_capper_projectors_identifier) {
type = 'camera,capper,projector,projector_second';
}
return resolve(type); return resolve(type);
}; };
await delay_1.delay(cfg.arduino.serialDelay); await delay_1.delay(cfg.arduino.serialDelay);

File diff suppressed because one or more lines are too long

View File

@ -3,13 +3,15 @@
'use strict' 'use strict'
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'; //process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
const electron = require('electron') const electron = require('electron')
const { Menu, BrowserWindow, app } = electron const { Menu, BrowserWindow, app } = electron
const { EventEmitter } = require('events') const { EventEmitter } = require('events')
const { join } = require('path') const { join } = require('path')
require('@electron/remote/main').initialize()
const ee = new EventEmitter() const ee = new EventEmitter()
const settings = require('settings') const settings = require('settings')
const system = require('system') const system = require('system')
@ -55,18 +57,22 @@ var createWindow = function () {
toolbar: false, toolbar: false,
webPreferences : { webPreferences : {
nodeIntegration : true, nodeIntegration : true,
enableRemoteModule: true enableRemoteModule: true,
contextIsolation : false
} }
}) })
mainWindow.setMenu(null)
mainWindow.setAutoHideMenuBar(true)
mainWindow.loadURL('file://' + __dirname + '/index.html') mainWindow.loadURL('file://' + __dirname + '/index.html')
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) { if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
mainWindow.webContents.openDevTools() mainWindow.webContents.openDevTools()
} else {
mainWindow.setMenu(null)
mainWindow.setAutoHideMenuBar(true)
} }
mainWindow.on('closed', () => { mainWindow.on('closed', () => {
mainWindow = null mainWindow = null
}) })
require('@electron/remote/main').enable(mainWindow.webContents)
} }
var errorState = function () { var errorState = function () {

5550
app/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -35,21 +35,22 @@
}, },
"homepage": "https://github.com/sixteenmillimeter/mcopy#readme", "homepage": "https://github.com/sixteenmillimeter/mcopy#readme",
"devDependencies": { "devDependencies": {
"@types/jquery": "^3.5.5", "@types/jquery": "^3.5.14",
"chai": "^4.3.0", "chai": "^4.3.6",
"electron": "^11.3.0", "electron": "^19.0.1",
"electron-installer-common": "^0.10.3", "electron-installer-common": "^0.10.3",
"electron-installer-dmg": "^3.0.0", "electron-installer-dmg": "^4.0.0",
"electron-packager": "^15.4.0", "electron-packager": "^15.5.1",
"electron-rebuild": "^2.3.5", "electron-rebuild": "^3.2.7",
"electron-wix-msi": "^3.0.6", "electron-wix-msi": "^4.0.0",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-concat": "^2.6.1", "gulp-concat": "^2.6.1",
"gulp-less": "^4.0.1", "gulp-less": "^5.0.0",
"mocha": "^8.3.0", "mocha": "^10.0.0",
"typescript": "^4.1.5" "typescript": "^4.7.2"
}, },
"dependencies": { "dependencies": {
"@electron/remote": "^2.0.8",
"animated-gif-detector": "^1.2.0", "animated-gif-detector": "^1.2.0",
"arduino": "file:lib/arduino", "arduino": "file:lib/arduino",
"cam": "file:lib/cam", "cam": "file:lib/cam",
@ -61,31 +62,31 @@
"exec": "file:lib/exec", "exec": "file:lib/exec",
"exit": "file:lib/exit", "exit": "file:lib/exit",
"ffmpeg": "file:lib/ffmpeg", "ffmpeg": "file:lib/ffmpeg",
"ffmpeg-static": "^4.2.7", "ffmpeg-static": "^5.0.0",
"ffprobe": "file:lib/ffprobe", "ffprobe": "file:lib/ffprobe",
"ffprobe-static": "^3.0.0", "ffprobe-static": "^3.0.0",
"filmout": "file:lib/filmout", "filmout": "file:lib/filmout",
"frame": "file:lib/frame", "frame": "file:lib/frame",
"fs-extra": "^9.1.0", "fs-extra": "^10.1.0",
"humanize-duration": "^3.25.1", "humanize-duration": "^3.27.2",
"intval": "file:lib/intval", "intval": "file:lib/intval",
"jimp": "^0.16.1", "jimp": "^0.16.1",
"light": "file:lib/light", "light": "file:lib/light",
"log": "file:lib/log", "log": "file:lib/log",
"moment": "^2.29.1", "moment": "^2.29.3",
"mscript": "file:lib/mscript", "mscript": "file:lib/mscript",
"node-notifier": "^9.0.0", "node-notifier": "^10.0.1",
"processing": "file:lib/processing", "processing": "file:lib/processing",
"proj": "file:lib/proj", "proj": "file:lib/proj",
"request": "^2.88.2", "request": "^2.88.2",
"sequencer": "file:lib/sequencer", "sequencer": "file:lib/sequencer",
"serialport": "^9.0.7", "serialport": "^10.4.0",
"server": "file:lib/server", "server": "file:lib/server",
"settings": "file:lib/settings", "settings": "file:lib/settings",
"spawn": "file:lib/spawn", "spawn": "file:lib/spawn",
"system": "file:lib/system", "system": "file:lib/system",
"uuid": "^8.3.2", "uuid": "^8.3.2",
"winston": "^3.3.3" "winston": "^3.7.2"
}, },
"optionalDependencies": { "optionalDependencies": {
"electron-installer-debian": "^3.1.0" "electron-installer-debian": "^3.1.0"

View File

@ -1,7 +1,8 @@
const mcopy = {}; const mcopy = {};
const { remote, ipcRenderer } = require('electron'); const remote = require('@electron/remote');
const dialog = require('electron').remote.dialog; const { ipcRenderer } = require('electron');
const { dialog } = remote;
const notifier = require('node-notifier'); const notifier = require('node-notifier');
const fs = require('fs'); const fs = require('fs');
const uuid = require('uuid').v4; const uuid = require('uuid').v4;

View File

@ -1,5 +1,5 @@
{ {
"version": "1.6.9", "version": "1.7.0",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {
@ -178,7 +178,10 @@
"cameras": "4", "cameras": "4",
"camera_projectors_identifier": "5", "camera_projectors_identifier": "5",
"cameras_projector_identifier": "6", "cameras_projector_identifier": "6",
"cameras_projectors_identifier": "7" "cameras_projectors_identifier": "7",
"camera_capper_identifier" : "8",
"camera_capper_projector_identifier" : "9",
"camera_capper_projectors_identifier" : "0"
} }
} }
} }

View File

@ -3,11 +3,11 @@
//import Log = require('log'); //import Log = require('log');
import { delay } from 'delay'; import { delay } from 'delay';
const SerialPort = require('serialport') const { SerialPort } = require('serialport')
const Readline = SerialPort.parsers.Readline const { ReadlineParser } = require('@serialport/parser-readline')
const exec = require('child_process').exec const exec = require('child_process').exec
const parser : any = new Readline('') const parser : any = new ReadlineParser({ })
const newlineRe : RegExp = new RegExp('\n', 'g') const newlineRe : RegExp = new RegExp('\n', 'g')
const returnRe : RegExp = new RegExp('\r', 'g') const returnRe : RegExp = new RegExp('\r', 'g')