-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
42 lines (34 loc) · 1.18 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Load up the Bonjour client
const getThoriumAddress = require("./helpers/bonjour");
const getClient = require("./helpers/graphqlClient");
const registerClient = require("./helpers/registerClient");
const startApp = require("./app");
const { clientId } = require("./config.json");
const { useBonjour } = require("./config.json");
const { serverAddress } = require("./config.json");
const { serverPort } = require("./config.json");
var graphQLClient;
//clientName
module.exports.clientId = clientId;
if (useBonjour) {
console.log("Activating bonjour browser...");
getThoriumAddress()
.then(({ address, port, name }) => {
graphQLClient = getClient(address, port, clientId);
console.log("Found Thorium server:");
console.log(`Address: ${address}:${port} ${name}`);
startApp(address, port, clientId);
})
.catch(err => {
console.error("An error occured");
console.error(err);
});
} else {
graphQLClient = getClient(serverAddress, serverPort, clientId);
console.log("Found Thorium server:");
console.log(`Address: ${serverAddress}:${serverPort} Manual`);
startApp(serverAddress, serverPort, clientId);
}
setTimeout(function() {
//startApp.App.emit("FD_weaponsFire")
}, 3000)