mirror of
https://github.com/TheBinaryNinja/tvapp2.git
synced 2026-06-04 02:35:42 -04:00
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:
@@ -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 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
|
||||
|
||||
@@ -630,7 +643,35 @@ async function getFile( url, filePath )
|
||||
chalk.blueBright( `<src>` ), chalk.gray( `${ url }` ),
|
||||
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 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user