From 57bb215c5c666a4c655fcbb454a823570b85443d Mon Sep 17 00:00:00 2001 From: Aetherinox Date: Sat, 31 May 2025 00:28:26 -0700 Subject: [PATCH] fix: add url rewrite for address `fl2.moveonjoy` to `fl6.moveonjoy` #64 moveonjoy url has been changed from fl2.moveonjoy to fl6.moveonjoy. re-write url on `/playlist` request --- tvapp2/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tvapp2/index.js b/tvapp2/index.js index 589af0a9..70d698cc 100755 --- a/tvapp2/index.js +++ b/tvapp2/index.js @@ -1522,11 +1522,34 @@ async function serveM3U( res, req ) const updatedContent = formattedContent .replace( /(https?:\/\/[^\s]*thetvapp[^\s]*)/g, ( fullUrl ) => { + Log.debug( `.m3u`, chalk.yellow( `[assigner]` ), chalk.white( `⚙️` ), + chalk.blueBright( `` ), chalk.gray( `Rewriting url for keyword` ), + chalk.blueBright( `` ), chalk.gray( `*thetvapp` ), + chalk.blueBright( `` ), chalk.gray( `${ fullUrl }` ), + chalk.blueBright( `` ), chalk.gray( `${ baseUrl }/channel?url=${ encodeURIComponent( fullUrl ) }` ) ); + return `${ baseUrl }/channel?url=${ encodeURIComponent( fullUrl ) }`; }) .replace( /(https?:\/\/[^\s]*tvpass[^\s]*)/g, ( fullUrl ) => { + Log.debug( `.m3u`, chalk.yellow( `[assigner]` ), chalk.white( `⚙️` ), + chalk.blueBright( `` ), chalk.gray( `Rewriting url for keyword` ), + chalk.blueBright( `` ), chalk.gray( `*tvpass` ), + chalk.blueBright( `` ), chalk.gray( `${ fullUrl }` ), + chalk.blueBright( `` ), chalk.gray( `${ baseUrl }/channel?url=${ encodeURIComponent( fullUrl ) }` ) ); + return `${ baseUrl }/channel?url=${ encodeURIComponent( fullUrl ) }`; + }) + .replace( /(https?:\/\/[^\s]*fl2.moveonjoy[^\s]*)/g, ( fullUrl ) => + { + const urlRewrite = fullUrl.replace( 'fl2.moveonjoy', 'fl6.moveonjoy' ); + Log.debug( `.m3u`, chalk.yellow( `[assigner]` ), chalk.white( `⚙️` ), + chalk.blueBright( `` ), chalk.gray( `Rewriting url for keyword` ), + chalk.blueBright( `` ), chalk.gray( `*fl2.moveonjoy` ), + chalk.blueBright( `` ), chalk.gray( `${ fullUrl }` ), + chalk.blueBright( `` ), chalk.gray( `${ urlRewrite }` ) ); + + return `${ urlRewrite }`; }); res.writeHead( 200, {