homegames-common 0.3.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +29 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -17,6 +17,7 @@ const getUserHash = (username) => {
|
|
|
17
17
|
|
|
18
18
|
const DEFAULT_CONFIG = {
|
|
19
19
|
"LINK_ENABLED": true,
|
|
20
|
+
"HTTPS_ENABLED": true,
|
|
20
21
|
"HOMENAMES_PORT": 7400,
|
|
21
22
|
"HOME_PORT": 9801,
|
|
22
23
|
"LOG_LEVEL": "INFO",
|
|
@@ -25,11 +26,10 @@ const DEFAULT_CONFIG = {
|
|
|
25
26
|
"IS_DEMO": false,
|
|
26
27
|
"BEZEL_SIZE_Y": 15,
|
|
27
28
|
"BEZEL_SIZE_X": 15,
|
|
29
|
+
"PUBLIC_GAMES": true,
|
|
28
30
|
"DOWNLOADED_GAME_DIRECTORY": "hg-games",
|
|
29
|
-
"LOG_PATH": "hg_log.txt"
|
|
30
|
-
|
|
31
|
-
"PUBLIC_GAMES": false
|
|
32
|
-
};
|
|
31
|
+
"LOG_PATH": "hg_log.txt"
|
|
32
|
+
}
|
|
33
33
|
|
|
34
34
|
const getLocalIP = () => {
|
|
35
35
|
const ifaces = os.networkInterfaces();
|
|
@@ -446,7 +446,7 @@ const guaranteeCerts = (authPath, certPath) => new Promise((resolve, reject) =>
|
|
|
446
446
|
const linkInit = (authPath) => new Promise((resolve, reject) => {
|
|
447
447
|
|
|
448
448
|
getLoginInfo(authPath).then((loginInfo) => {
|
|
449
|
-
const client = new WebSocket('wss://
|
|
449
|
+
const client = new WebSocket('wss://homegames.link:7080');
|
|
450
450
|
|
|
451
451
|
client.on('open', () => {
|
|
452
452
|
console.log('opened connection to link');
|
|
@@ -456,6 +456,11 @@ const linkInit = (authPath) => new Promise((resolve, reject) => {
|
|
|
456
456
|
accessToken: loginInfo.tokens.accessToken
|
|
457
457
|
}));
|
|
458
458
|
});
|
|
459
|
+
|
|
460
|
+
client.on('error', (err) => {
|
|
461
|
+
console.log('some error happened');
|
|
462
|
+
console.log(err);
|
|
463
|
+
});
|
|
459
464
|
});
|
|
460
465
|
|
|
461
466
|
});
|
|
@@ -718,6 +723,23 @@ const log = {
|
|
|
718
723
|
|
|
719
724
|
}
|
|
720
725
|
|
|
726
|
+
const getAppDataPath = () => {
|
|
727
|
+
switch (process.platform) {
|
|
728
|
+
case "darwin": {
|
|
729
|
+
return path.join(process.env.HOME, "Library", "Application Support", "homegames");
|
|
730
|
+
}
|
|
731
|
+
case "win32": {
|
|
732
|
+
return path.join(process.env.APPDATA, "homegames");
|
|
733
|
+
}
|
|
734
|
+
case "linux": {
|
|
735
|
+
return path.join(process.env.HOME, ".homegames");
|
|
736
|
+
}
|
|
737
|
+
default: {
|
|
738
|
+
console.log("Unsupported platform!");
|
|
739
|
+
process.exit(1);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
721
743
|
|
|
722
744
|
module.exports = {
|
|
723
745
|
signup,
|
|
@@ -732,6 +754,7 @@ module.exports = {
|
|
|
732
754
|
guaranteeDir,
|
|
733
755
|
getUrl,
|
|
734
756
|
getConfigValue,
|
|
735
|
-
log
|
|
757
|
+
log,
|
|
758
|
+
getAppDataPath
|
|
736
759
|
};
|
|
737
760
|
|