mirror of
https://github.com/TheBinaryNinja/tvapp2.git
synced 2026-06-04 06:45:41 -04:00
fix: dynamic uptime on footer causing spam in console
This commit is contained in:
@@ -1296,7 +1296,7 @@ async function serveM3UPlaylist( req, res )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cachedUrl = getCache( decodedUrl, req );
|
const cachedUrl = getCache( req, decodedUrl );
|
||||||
if ( cachedUrl )
|
if ( cachedUrl )
|
||||||
{
|
{
|
||||||
const rewrittenPlaylist = await rewriteM3U( cachedUrl, req );
|
const rewrittenPlaylist = await rewriteM3U( cachedUrl, req );
|
||||||
@@ -1369,7 +1369,7 @@ async function serveM3UPlaylist( req, res )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setCache( decodedUrl, tokenizedUrl, 4 * 60 * 60 * 1000, req );
|
setCache( req, decodedUrl, tokenizedUrl, 4 * 60 * 60 * 1000 );
|
||||||
const hdUrl = tokenizedUrl.replace( 'tracks-v2a1', 'tracks-v1a1' );
|
const hdUrl = tokenizedUrl.replace( 'tracks-v2a1', 'tracks-v1a1' );
|
||||||
const rewrittenPlaylist = await rewriteM3U( hdUrl, req );
|
const rewrittenPlaylist = await rewriteM3U( hdUrl, req );
|
||||||
|
|
||||||
@@ -1441,11 +1441,15 @@ async function serveHealthCheck( req, res )
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
const paramUrl = new URL( req.url, `http://${ req.headers.host }` ).searchParams.get( 'api' );
|
const paramUrl = new URL( req.url, `http://${ req.headers.host }` ).searchParams.get( 'api' );
|
||||||
|
const paramQuery = new URL( req.url, `http://${ req.headers.host }` ).searchParams.get( 'query' );
|
||||||
if ( !paramUrl )
|
if ( !paramUrl )
|
||||||
|
{
|
||||||
|
if ( paramQuery !== 'uptime' )
|
||||||
{
|
{
|
||||||
Log.debug( `/api`, chalk.yellow( `[health]` ), chalk.white( `⚙️` ),
|
Log.debug( `/api`, chalk.yellow( `[health]` ), chalk.white( `⚙️` ),
|
||||||
chalk.blueBright( `<msg>` ), chalk.gray( `No API key passed to health check` ) );
|
chalk.blueBright( `<msg>` ), chalk.gray( `No API key passed to health check` ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const statusCheck =
|
const statusCheck =
|
||||||
{
|
{
|
||||||
@@ -1467,8 +1471,7 @@ async function serveHealthCheck( req, res )
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
});
|
});
|
||||||
|
|
||||||
const paramQuery = new URL( req.url, `http://${ req.headers.host }` ).searchParams.get( 'query' );
|
if ( paramQuery !== 'uptime' )
|
||||||
if ( paramQuery !== 'query' )
|
|
||||||
{
|
{
|
||||||
Log.ok( `/api`, chalk.yellow( `[health]` ), chalk.white( `✅` ),
|
Log.ok( `/api`, chalk.yellow( `[health]` ), chalk.white( `✅` ),
|
||||||
chalk.greenBright( `<msg>` ), chalk.gray( `Response` ),
|
chalk.greenBright( `<msg>` ), chalk.gray( `Response` ),
|
||||||
@@ -1789,7 +1792,7 @@ async function serveGZP( res, req )
|
|||||||
cache > set
|
cache > set
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function setCache( key, value, ttl, req )
|
function setCache( req, key, value, ttl )
|
||||||
{
|
{
|
||||||
const expiry = Date.now() + ttl;
|
const expiry = Date.now() + ttl;
|
||||||
cache.set( key, {
|
cache.set( key, {
|
||||||
@@ -1809,7 +1812,7 @@ function setCache( key, value, ttl, req )
|
|||||||
cache > get
|
cache > get
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getCache( key, req )
|
function getCache( req, key )
|
||||||
{
|
{
|
||||||
const cached = cache.get( key );
|
const cached = cache.get( key );
|
||||||
if ( cached && cached.expiry > Date.now() )
|
if ( cached && cached.expiry > Date.now() )
|
||||||
@@ -2021,6 +2024,9 @@ const server = http.createServer( ( req, resp ) =>
|
|||||||
loadFile channel?url=https%3A%2F%2Ftvpass.org%2Fchannel%2Fabc-wabc-new-york-ny%2F
|
loadFile channel?url=https%3A%2F%2Ftvpass.org%2Fchannel%2Fabc-wabc-new-york-ny%2F
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const paramQuery = new URL( req.url, `http://${ req.headers.host }` ).searchParams.get( 'query' );
|
||||||
|
if ( paramQuery !== 'uptime' )
|
||||||
|
{
|
||||||
Log.debug( `http`, chalk.yellow( `[requests]` ), chalk.white( `⚙️` ),
|
Log.debug( `http`, chalk.yellow( `[requests]` ), chalk.white( `⚙️` ),
|
||||||
chalk.blueBright( `<msg>` ), chalk.gray( `Request started` ),
|
chalk.blueBright( `<msg>` ), chalk.gray( `Request started` ),
|
||||||
chalk.blueBright( `<client>` ), chalk.gray( `${ clientIp( req ) }` ),
|
chalk.blueBright( `<client>` ), chalk.gray( `${ clientIp( req ) }` ),
|
||||||
@@ -2028,6 +2034,7 @@ const server = http.createServer( ( req, resp ) =>
|
|||||||
chalk.blueBright( `<reqUrl>` ), chalk.gray( `${ reqUrl }` ),
|
chalk.blueBright( `<reqUrl>` ), chalk.gray( `${ reqUrl }` ),
|
||||||
chalk.blueBright( `<file>` ), chalk.gray( `${ loadFile }` ),
|
chalk.blueBright( `<file>` ), chalk.gray( `${ loadFile }` ),
|
||||||
chalk.blueBright( `<method>` ), chalk.gray( `${ method }` ) );
|
chalk.blueBright( `<method>` ), chalk.gray( `${ method }` ) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( subdomainRestart.some( ( urlKeyword ) => loadFile.startsWith( urlKeyword ) ) )
|
if ( subdomainRestart.some( ( urlKeyword ) => loadFile.startsWith( urlKeyword ) ) )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user