Fixed details tab not updating on Linux (#4466)
Ylian Saint-Hilaire committed
Aug 30, 2022 at 15:30 UTC
ad7cd67c0273b9164ee745528184110821729959
1 file changed
+8
agents/meshcore.js
+8
@@ -1757,6 +1757,13 @@ function onFileWatcher(a, b) {
1757
}
1758
*/
1759
1760
+// Replace all key name spaces with _ in an object recursively.
1761
+// This is a workaround since require('identifiers').get() returns key names with spaces in them on Linux.
1762
+function replaceSpacesWithUnderscoresRec(o) {
1763
+ if (typeof o != 'object') return;
1764
+ for (var i in o) { if (i.indexOf(' ') >= 0) { o[i.split(' ').join('_')] = o[i]; delete o[i]; } replaceSpacesWithUnderscoresRec(o[i]); }
1765
+}
1766
+
1767
function getSystemInformation(func) {
1768
try {
1769
var results = { hardware: require('identifiers').get() }; // Hardware info
@@ -1778,6 +1785,7 @@ function getSystemInformation(func) {
1785
} catch (ex) { }
1786
}
1787
results.hardware.agentvers = process.versions;
1788
+ replaceSpacesWithUnderscoresRec(results);
1789
var hasher = require('SHA384Stream').create();
1790
results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex');
1791
func(results);