@@ -128,8 +128,8 @@ function findResourceFile(filename) {
128128
129129ipcMain . on ( 'run-server' , ( event ) => {
130130 // Make sure this OS is supported
131- if ( process . platform !== 'linux' && process . platform !== 'win32' ) {
132- let error = 'Unsupported platform ' + process . platform + '. Only linux and win32 are supported, darwin (MacOS) not yet. Please reach out!' ;
131+ if ( process . platform !== 'linux' && process . platform !== 'win32' && process . platform != 'darwin' ) {
132+ let error = 'Unsupported platform ' + process . platform + '. Only Linux, Windows and MacOS are supported, yours not yet. Please reach out!' ;
133133 console . log ( error ) ;
134134 event . reply ( error ) ;
135135 return - 1 ;
@@ -153,6 +153,8 @@ ipcMain.on('run-server', (event) => {
153153 serverChild = runProcess ( foundBinary , [ 'SecurityTypes=VncAuth' , 'localhost=1' , 'interface=127.0.0.1' , 'rfbport=55900' , 'PasswordFile=' + dirname + nodePath . sep + 'plain.bin' ] ) ;
154154 } else if ( process . platform === 'win32' ) {
155155 serverChild = findAndRunProcess ( 'uvnc-windows\\x64\\winvnc.exe' ) ; // uses the config file next to the binary
156+ } else if ( process . platform === 'darwin' ) {
157+ serverChild = findAndRunProcess ( 'macVNC.app/Contents/MacOS/macVNC' , [ '-rfbport' , '55900' , '-passwd' , 'nopassword' ] ) ;
156158 }
157159 if ( ! serverChild ) {
158160 event . reply ( 'run-server-log' , "ERROR: Listening for connections using VNC server failed." ) ;
@@ -165,8 +167,8 @@ ipcMain.on('run-server', (event) => {
165167
166168ipcMain . on ( 'run-client' , ( event , data ) => {
167169 // Make sure this OS is supported
168- if ( process . platform !== 'linux' && process . platform !== 'win32' ) {
169- let error = 'Unsupported platform ' + process . platform + '. Only linux and win32 are supported, darwin (MacOS) not yet. Please reach out!' ;
170+ if ( process . platform !== 'linux' && process . platform !== 'win32' && process . platform != 'darwin' ) {
171+ let error = 'Unsupported platform ' + process . platform + '. Only Linux, Windows and MacOS are supported, yours not yet. Please reach out!' ;
170172 console . log ( error ) ;
171173 event . reply ( error ) ;
172174 return - 1 ;
@@ -182,12 +184,23 @@ ipcMain.on('run-client', (event, data) => {
182184 event . reply ( 'run-client-log' , "Network layer initialized." ) ;
183185
184186 event . reply ( 'run-client-log' , "Establishing outgoing connection..." ) ;
185- if ( process . platform === 'linux' ) {
187+ if ( process . platform === 'linux' || process . platform === 'darwin' ) {
186188 let binaryName = 'tigervnc-linux-x86_64/usr/bin/vncviewer' ;
187- let foundBinary = findResourceFile ( binaryName ) ;
188- if ( ! foundBinary ) {
189- console . log ( "Binary " + binaryName + " not found." ) ;
190- return - 2 ;
189+ let foundBinary = '' ;
190+ if ( process . platform === 'linux' ) {
191+ let binaryName = 'tigervnc-linux-x86_64/usr/bin/vncviewer' ;
192+ foundBinary = findResourceFile ( binaryName ) ;
193+ if ( ! foundBinary ) {
194+ console . log ( "Binary " + binaryName + " not found." ) ;
195+ return - 2 ;
196+ }
197+ } else if ( process . platform === 'darwin' ) {
198+ let binaryName = 'tigervnc-macos-x86_64/Contents/MacOS/TigerVNC\ Viewer' ;
199+ foundBinary = findResourceFile ( binaryName ) ;
200+ if ( ! foundBinary ) {
201+ console . log ( "Binary " + binaryName + " not found." ) ;
202+ return - 2 ;
203+ }
191204 }
192205 // PasswordFile of TigerVNC viewer cannot be passed on commandline, so use the file next to the binary.
193206 let dirname = nodePath . dirname ( foundBinary ) ;
0 commit comments