From b366b6c9982255ee5a171e0c6ccaf0b8a39a58dc Mon Sep 17 00:00:00 2001 From: Martti Malmi Date: Tue, 28 Jan 2020 14:40:02 +0200 Subject: [PATCH] connect to localhost:8767 on electron --- src/index.html | 2 +- src/js/app.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/index.html b/src/index.html index 997c9e01..73a8137d 100644 --- a/src/index.html +++ b/src/index.html @@ -8,7 +8,7 @@ - + diff --git a/src/js/app.js b/src/js/app.js index 7d199f44..0ed70e46 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -1,6 +1,9 @@ -var gun = Gun({ - peers: ['http://localhost:8765/gun', 'https://gun-us.herokuapp.com/gun', 'https://gunjs.herokuapp.com/gun'] -}); +var isElectron = (userAgent.indexOf(' electron/') > -1); +var peers = ['https://gun-us.herokuapp.com/gun', 'https://gunjs.herokuapp.com/gun']; +if (isElectron) { + peers.push('http://localhost:8767/gun'); +} +var gun = Gun({peers}); window.gun = gun; var notificationSound = new Audio('./notification.mp3'); var chat = gun.get('converse/' + location.hash.slice(1));