feat: add silence health check to HDHomeRun server

This commit is contained in:
2025-10-01 00:40:35 -07:00
parent 865a2fd645
commit e6701cda95

View File

@@ -2464,6 +2464,13 @@ const serverHdHomeRun = http.createServer( ( req, resp ) =>
chalk.blueBright( `<method>` ), chalk.gray( `${ method }` ) ); chalk.blueBright( `<method>` ), chalk.gray( `${ method }` ) );
if ( subdomainHealth.some( ( urlKeyword ) => loadFile.startsWith( urlKeyword ) ) && method === 'GET' ) if ( subdomainHealth.some( ( urlKeyword ) => loadFile.startsWith( urlKeyword ) ) && method === 'GET' )
{
const paramSilent = new URL( req.url, `http://${ req.headers.host }` ).searchParams.get( 'silent' );
// do not show log if query is `uptime`, since uptime runs every 1 second.
// do not show logs if query has striggered `silent?=true` in url
if ( Utils.str2bool( paramSilent ) !== true )
{ {
Log.info( `http`, chalk.yellow( `[requests]` ), chalk.white( `` ), Log.info( `http`, chalk.yellow( `[requests]` ), chalk.white( `` ),
chalk.blueBright( `<msg>` ), chalk.gray( `Requesting to access health api` ), chalk.blueBright( `<msg>` ), chalk.gray( `Requesting to access health api` ),
@@ -2471,6 +2478,7 @@ const serverHdHomeRun = http.createServer( ( req, resp ) =>
chalk.blueBright( `<client>` ), chalk.gray( `${ clientIp( req ) }` ), chalk.blueBright( `<client>` ), chalk.gray( `${ clientIp( req ) }` ),
chalk.blueBright( `<file>` ), chalk.gray( `${ loadFile }` ), chalk.blueBright( `<file>` ), chalk.gray( `${ loadFile }` ),
chalk.blueBright( `<method>` ), chalk.gray( `${ method }` ) ); chalk.blueBright( `<method>` ), chalk.gray( `${ method }` ) );
}
await serveHealthCheck( req, resp ); await serveHealthCheck( req, resp );
return; return;