feat: add git.binaryninja.net health check; stop overwriting m3u/epg when down

stops the app from wiping the m3u and xml file if the bit.binaryninja.net repo /website is down
This commit is contained in:
2025-09-30 22:52:21 -07:00
parent 2a09bc1ea3
commit 4c0d49508f

View File

@@ -159,6 +159,19 @@ const fileIpContainer = '/var/run/s6/container_environment/IP_CONTAINER';
const envIpGateway = fs.existsSync( fileIpGateway ) ? fs.readFileSync( fileIpGateway, 'utf8' ) : `0.0.0.0`; 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`; const envIpContainer = fs.existsSync( fileIpContainer ) ? fs.readFileSync( fileIpContainer, 'utf8' ) : `0.0.0.0`;
/*
Hosts
*/
const hosts =
[
{ name: 'TVPass.org', url: 'https://tvpass.org' },
{ name: 'TheTVApp.to', url: 'https://thetvapp.to' },
{ name: 'MoveOnJoy.com', url: 'http://moveonjoy.com' },
{ name: 'Daddylive.dad', url: 'https://daddylivestream.com' },
{ name: 'git.binaryninja.com', url: envUrlRepo }
];
/* /*
Get Server OS Get Server OS
@@ -630,7 +643,35 @@ async function getFile( url, filePath )
chalk.blueBright( `<src>` ), chalk.gray( `${ url }` ), chalk.blueBright( `<src>` ), chalk.gray( `${ url }` ),
chalk.blueBright( `<dest>` ), chalk.gray( `${ filePath }` ) ); chalk.blueBright( `<dest>` ), chalk.gray( `${ filePath }` ) );
await downloadFile( url, filePath ); const ok = await hostCheck( 'git.binaryninja.com', `${ envUrlRepo }` );
if ( ok )
{
try
{
await downloadFile( url, filePath );
return true;
}
catch ( err )
{
Log.error( `file`, chalk.redBright( `[download]` ), chalk.white( `` ),
chalk.redBright( `<msg>` ), chalk.gray( `Download attempt failed after service check succeeded` ),
chalk.redBright( `<error>` ), chalk.gray( `${ err.message }` ),
chalk.redBright( `<src>` ), chalk.gray( `${ url }` ),
chalk.redBright( `<dest>` ), chalk.gray( `${ filePath }` ) );
return false;
}
}
else
{
Log.info( `file`, chalk.yellow( `[download]` ), chalk.white( `` ),
chalk.yellowBright( `<msg>` ), chalk.gray( `Skipping download because service is offline; using existing local file` ),
chalk.yellowBright( `<url>` ), chalk.gray( `${ url }` ),
chalk.yellowBright( `<dest>` ), chalk.gray( `${ filePath }` ) );
return false;
}
} }
catch ( err ) catch ( err )
{ {