diff --git a/CHANGELOG.md b/CHANGELOG.md index f1d651b..b8a2bb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | +| 4.31.0 | 2020-12-06 | `osInfo()` added FQDN | | 4.30.11 | 2020-12-02 | `cpu()` bug fix speed parsing | | 4.30.10 | 2020-12-01 | `cpu()` handled speed parsing error (Apple Silicon) | | 4.30.9 | 2020-12-01 | `cpu()` corrected processor names (Raspberry Pi) | diff --git a/README.md b/README.md index 47f74bf..f918b26 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ si.cpu() (last 7 major and minor version releases) +- Version 4.31.0: `osInfo()` added FQDN - Version 4.30.0: `get()` added possibility to provide parameters - Version 4.29.0: `fsSize()` correct fs type detection macOS (HFS, APFS, NFS) - Version 4.28.0: `graphics()` added deviceName (Windows) @@ -100,7 +101,6 @@ si.cpu() - Version 4.26.0: `diskLayout()` added full S.M.A.R.T data (Linux) - Version 4.25.0: `get()` added function to get partial system info - Version 4.24.0: `networkInterfaces()` added subnet mask ip4 and ip6 -- Version 4.23.0: `versions()` added param to specify which program/lib versions to detect - ... You can find all changes here: [detailed changelog][changelog-url] @@ -298,6 +298,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m | | kernel | X | X | X | X | X | kernel release - same as os.release() | | | arch | X | X | X | X | X | same as os.arch() | | | hostname | X | X | X | X | X | same as os.hostname() | +| | fqdn | X | X | X | X | X | FQDN fully qualified domain name | | | codepage | X | X | X | X | | OS build version | | | logofile | X | X | X | X | X | e.g. 'apple', 'debian', 'fedora', ... | | | serial | X | X | X | X | | OS/Host serial number | diff --git a/docs/history.html b/docs/history.html index 0a80223..3329992 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.31.0 + 2020-12-06 + osInfo() added FQDN + 4.30.11 2020-12-02 diff --git a/docs/index.html b/docs/index.html index 830a013..83918cd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -169,7 +169,7 @@
systeminformation
-
Current Version: 4.30.11
+
Current Version: 4.31.0
@@ -208,7 +208,7 @@
Downloads last month
-
359
+
364
Dependents
diff --git a/docs/os.html b/docs/os.html index 0e0aba5..a22ea87 100644 --- a/docs/os.html +++ b/docs/os.html @@ -145,6 +145,16 @@ X same as os.hostname() + + + fqdn + X + X + X + X + X + fully qualfied domain name + codepage @@ -220,6 +230,7 @@ si.osInfo().then(data => console.log(data)); kernel: '19.3.0', arch: 'x64', hostname: 'hostname.local', + fqdn: 'hostname.local', codepage: 'UTF-8', logofile: 'apple', serial: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', diff --git a/lib/index.d.ts b/lib/index.d.ts index e3b96be..47ba3c4 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -285,6 +285,7 @@ export namespace Systeminformation { kernel: string; arch: string; hostname: string; + fqdn: string; codepage: string; logofile: string; serial: string; diff --git a/lib/osinfo.js b/lib/osinfo.js index 446ea1c..734c318 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -17,6 +17,7 @@ const os = require('os'); const exec = require('child_process').exec; const util = require('./util'); const fs = require('fs'); +const { execSync } = require('child_process'); let _platform = process.platform; @@ -160,6 +161,30 @@ function getLogoFile(distro) { return result; } +// -------------------------- +// FQDN + +function getFQDN() { + let fqdn = os.hostname; + if (_linux || _darwin || _freebsd || _openbsd || _netbsd) { + try { + const stdout = execSync('hostname -f'); + fqdn = stdout.toString().split(os.EOL)[0]; + } catch (e) { + util.noop(); + } + } + if (_windows) { + try { + const stdout = execSync('echo %COMPUTERNAME%.%USERDNSDOMAIN%'); + fqdn = stdout.toString().split(os.EOL)[0]; + } catch (e) { + util.noop(); + } + } + return fqdn; +} + // -------------------------- // OS Information @@ -176,6 +201,7 @@ function osInfo(callback) { kernel: os.release(), arch: os.arch(), hostname: os.hostname(), + fqdn: getFQDN(), codepage: '', logofile: '', serial: '',