diff --git a/tvapp2/index.js b/tvapp2/index.js index 562c9d0b..310c104a 100755 --- a/tvapp2/index.js +++ b/tvapp2/index.js @@ -10,6 +10,7 @@ import http from 'http'; import https from 'https'; import os from 'node:os'; import osName from 'os-name'; +import getos from 'getos'; import zlib from 'zlib'; import chalk from 'chalk'; import ejs from 'ejs'; @@ -102,7 +103,13 @@ const envHealthTimer = process.env.HEALTH_TIMER || 600000; const envTaskCronSync = process.env.TASK_CRON_SYNC || '0 0 */3 * *'; const envGitSHA1 = process.env.GIT_SHA1 || '0000000000000000000000000000000000000000'; const LOG_LEVEL = process.env.LOG_LEVEL || 4; -let TIME_STARTUP = 0; + +/* + Server +*/ + +let serverOs = 'Unknown'; +let serverStartup = 0; /* Define > Externals @@ -152,6 +159,36 @@ const fileIpContainer = '/var/run/s6/container_environment/IP_CONTAINER'; const envIpGateway = fs.existsSync( fileIpGateway ) ? fs.readFileSync( fileIpGateway, 'utf8' ) : `0.0.0.0`; const envIpContainer = fs.existsSync( fileIpContainer ) ? fs.readFileSync( fileIpContainer, 'utf8' ) : `0.0.0.0`; +/* + Get Server OS + + attempts to get the OS of a server a few different ways; and not just show "Linux". + + Windows machines will show Windows 11 + Linux machines will show Linux Alpine (3.22.0) +*/ + +getos( function( e, json ) +{ + + if( e ) + return osName( os.platform(), os.release() ) + + if ( json.os === 'win32' ) + serverOs = osName( os.platform(), os.release() ); + + if ( json.os === 'linux' ) + { + if ( json.dist ) + serverOs = json.dist + + if ( json.release ) + serverOs = serverOs.concat(" ", '(' + json.release + ')' ); + } + + return serverOs; +}) + /* Define > Logs @@ -1957,10 +1994,10 @@ async function initialize() FILE_GZP_MODIFIED = getFileModified( FILE_GZP ); const end = performance.now(); - TIME_STARTUP = `${ end - start }`; + serverStartup = `${ end - start }`; Log.info( `core`, chalk.yellow( `[initiate]` ), chalk.white( `ℹ️` ), chalk.blueBright( `` ), chalk.gray( `TVApp2 container is ready` ), - chalk.blueBright( `