Prechádzať zdrojové kódy

fix tautulli url code

CauseFX 6 rokov pred
rodič
commit
0dece42743

+ 8 - 8
api/functions/homepage-connect-functions.php

@@ -2433,9 +2433,9 @@ function getTautulli()
 	if ($GLOBALS['homepageTautulliEnabled'] && !empty($GLOBALS['tautulliURL']) && !empty($GLOBALS['tautulliApikey']) && qualifyRequest($GLOBALS['homepageTautulliAuth'])) {
 		$api = [];
 		$url = qualifyURL($GLOBALS['tautulliURL']);
-		$url = $url . '/api/v2?apikey=' . $GLOBALS['tautulliApikey'];
+		$apiURL = $url . '/api/v2?apikey=' . $GLOBALS['tautulliApikey'];
 		try {
-			$homestatsUrl = $url . '&cmd=get_home_stats';
+			$homestatsUrl = $apiURL . '&cmd=get_home_stats';
 			$homestats = Requests::get($homestatsUrl, [], []);
 			if ($homestats->success) {
 				$homestats = json_decode($homestats->body, true);
@@ -2445,8 +2445,8 @@ function getTautulli()
 				foreach($categories as $cat) {
 					$key = array_search($cat, array_column($api['homestats']['data'], 'stat_id'));
 					$img = $api['homestats']['data'][$key]['rows'][0];
-					cacheImage($GLOBALS['tautulliURL'] . 'pms_image_proxy?img=' . $img['art'], $img['title'] . '-art');
-					cacheImage($GLOBALS['tautulliURL'] . 'pms_image_proxy?img=' . $img['thumb'], $img['title'] . '-thumb');
+					cacheImage($url . '/pms_image_proxy?img=' . $img['art'], $img['title'] . '-art');
+					cacheImage($url . '/pms_image_proxy?img=' . $img['thumb'], $img['title'] . '-thumb');
 					$img['art'] = '/plugins/images/cache/' . $img['title'] . '-art.jpg';
 					$img['thumb'] = '/plugins/images/cache/' . $img['title'] . '-thumb.jpg';
 					$api['homestats']['data'][$key]['rows'][0] = $img;
@@ -2454,9 +2454,9 @@ function getTautulli()
 				// Cache the platform icon
 				$key = array_search('top_platforms', array_column($api['homestats']['data'], 'stat_id'));
 				$platform = $api['homestats']['data'][$key]['rows'][0]['platform_name'];
-				cacheImage($GLOBALS['tautulliURL'] . 'images/platforms/' . $platform . '.svg', 'tautulli-' . $platform, 'svg');
+				cacheImage($url . '/images/platforms/' . $platform . '.svg', 'tautulli-' . $platform, 'svg');
 			}
-			$libstatsUrl = $url . '&cmd=get_libraries';
+			$libstatsUrl = $apiURL . '&cmd=get_libraries';
 			$libstats = Requests::get($libstatsUrl, [], []);
 			if ($libstats->success) {
 				$libstats = json_decode($libstats->body, true);
@@ -2464,11 +2464,11 @@ function getTautulli()
 				$categories = [ 'movie.svg', 'show.svg', 'artist.png' ];
 				foreach($categories as $cat) {
 					$parts = explode('.', $cat);
-					cacheImage($GLOBALS['tautulliURL'] . 'images/libraries/' . $cat, 'tautulli-' . $parts[0], $parts[1]);
+					cacheImage($url . '/images/libraries/' . $cat, 'tautulli-' . $parts[0], $parts[1]);
 				}
 			}
 			$api['options'] = [
-				'url' => $GLOBALS['tautulliURL'],
+				'url' => $url,
 				'libraries' => $GLOBALS['tautulliLibraries'],
 				'topMovies' => $GLOBALS['tautulliTopMovies'],
 				'topTV' => $GLOBALS['tautulliTopTV'],