versions() added deno and bun

This commit is contained in:
Sebastian Hildebrandt 2024-12-31 12:52:29 +01:00
parent f5d308f302
commit 3a8b3b640e
2 changed files with 65 additions and 42 deletions

View File

@ -452,47 +452,49 @@ function isUefiWindows() {
function versions(apps, callback) { function versions(apps, callback) {
let versionObject = { let versionObject = {
kernel: os.release(), kernel: os.release(),
openssl: '',
systemOpenssl: '',
systemOpensslLib: '',
node: process.versions.node,
v8: process.versions.v8,
npm: '',
yarn: '',
pm2: '',
gulp: '',
grunt: '',
git: '',
tsc: '',
mysql: '',
redis: '',
mongodb: '',
apache: '', apache: '',
nginx: '', bash: '',
php: '', bun: '',
deno: '',
docker: '', docker: '',
dotnet: '',
fish: '',
gcc: '',
git: '',
grunt: '',
gulp: '',
java: '',
mongodb: '',
mysql: '',
nginx: '',
node: process.versions.node,
npm: '',
openssl: '',
perl: '',
php: '',
pip3: '',
pip: '',
pm2: '',
postfix: '', postfix: '',
postgresql: '', postgresql: '',
perl: '',
python: '',
python3: '',
pip: '',
pip3: '',
java: '',
gcc: '',
virtualbox: '',
bash: '',
zsh: '',
fish: '',
powershell: '', powershell: '',
dotnet: '' python3: '',
python: '',
redis: '',
systemOpenssl: '',
systemOpensslLib: '',
tsc: '',
v8: process.versions.v8,
virtualbox: '',
yarn: '',
zsh: ''
}; };
function checkVersionParam(apps) { function checkVersionParam(apps) {
if (apps === '*') { if (apps === '*') {
return { return {
versions: versionObject, versions: versionObject,
counter: 30 counter: 32
}; };
} }
if (!Array.isArray(apps)) { if (!Array.isArray(apps)) {
@ -1027,6 +1029,27 @@ function versions(apps, callback) {
functionProcessed(); functionProcessed();
}); });
} }
if ({}.hasOwnProperty.call(appsObj.versions, 'bun')) {
exec('bun -v', function (error, stdout) {
if (!error) {
const line = stdout.toString().split('\n')[0].trim();
appsObj.versions.fish = line;
}
functionProcessed();
});
}
if ({}.hasOwnProperty.call(appsObj.versions, 'deno')) {
exec('deno -v', function (error, stdout) {
if (!error) {
const line = stdout.toString().split('\n')[0].trim();
const parts = line.split(' ');
if (parts.length > 1) {
appsObj.versions.fish = parts[1];
}
}
functionProcessed();
});
}
if ({}.hasOwnProperty.call(appsObj.versions, 'powershell')) { if ({}.hasOwnProperty.call(appsObj.versions, 'powershell')) {
if (_windows) { if (_windows) {
util.powerShell('$PSVersionTable').then(stdout => { util.powerShell('$PSVersionTable').then(stdout => {

View File

@ -50,10 +50,10 @@ function system(callback) {
let lines = stdout.toString().split('\n'); let lines = stdout.toString().split('\n');
result.manufacturer = util.getValue(lines, 'manufacturer'); result.manufacturer = util.getValue(lines, 'manufacturer');
result.model = util.getValue(lines, 'product name'); result.model = util.getValue(lines, 'product name');
result.version = util.getValue(lines, 'version'); result.version = cleanDefaults(util.getValue(lines, 'version'));
result.serial = util.getValue(lines, 'serial number'); result.serial = cleanDefaults(util.getValue(lines, 'serial number'));
result.uuid = util.getValue(lines, 'uuid').toLowerCase(); result.uuid = cleanDefaults((util.getValue(lines, 'uuid').toLowerCase()));
result.sku = util.getValue(lines, 'sku number'); result.sku = cleanDefaults(util.getValue(lines, 'sku number'));
// Non-Root values // Non-Root values
const cmd = `echo -n "product_name: "; cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null; echo; const cmd = `echo -n "product_name: "; cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null; echo;
echo -n "product_serial: "; cat /sys/devices/virtual/dmi/id/product_serial 2>/dev/null; echo; echo -n "product_serial: "; cat /sys/devices/virtual/dmi/id/product_serial 2>/dev/null; echo;
@ -64,17 +64,17 @@ function system(callback) {
lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
result.manufacturer = result.manufacturer === '' ? util.getValue(lines, 'sys_vendor') : result.manufacturer; result.manufacturer = result.manufacturer === '' ? util.getValue(lines, 'sys_vendor') : result.manufacturer;
result.model = result.model === '' ? util.getValue(lines, 'product_name') : result.model; result.model = result.model === '' ? util.getValue(lines, 'product_name') : result.model;
result.version = result.version === '' ? util.getValue(lines, 'product_version') : result.version; result.version = cleanDefaults(result.version === '' ? util.getValue(lines, 'product_version') : result.version);
result.serial = result.serial === '' ? util.getValue(lines, 'product_serial') : result.serial; result.serial = cleanDefaults(result.serial === '' ? util.getValue(lines, 'product_serial') : result.serial);
result.uuid = result.uuid === '' ? util.getValue(lines, 'product_uuid').toLowerCase() : result.uuid; result.uuid = cleanDefaults(result.uuid === '' ? util.getValue(lines, 'product_uuid').toLowerCase() : result.uuid);
} catch (e) { } catch (e) {
util.noop(); util.noop();
} }
if (!result.serial || result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; } if (!result.serial) { result.serial = '-'; }
if (!result.manufacturer || result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) { result.manufacturer = ''; } if (!result.manufacturer) { result.manufacturer = ''; }
if (!result.model || result.model.toLowerCase().indexOf('o.e.m.') !== -1) { result.model = 'Computer'; } if (!result.model) { result.model = 'Computer'; }
if (!result.version || result.version.toLowerCase().indexOf('o.e.m.') !== -1) { result.version = ''; } if (!result.version) { result.version = ''; }
if (!result.sku || result.sku.toLowerCase().indexOf('o.e.m.') !== -1) { result.sku = '-'; } if (!result.sku) { result.sku = '-'; }
// detect virtual (1) // detect virtual (1)
if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware') || result.model.toLowerCase().startsWith('droplet')) { if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware') || result.model.toLowerCase().startsWith('droplet')) {