فهرست منبع

added multiple Tautulli on SSO
Added top nav bar scroll with page on org pages
Fix Radarr banner/fanart

causefx 8 سال پیش
والد
کامیت
c0394721ed
3فایلهای تغییر یافته به همراه80 افزوده شده و 68 حذف شده
  1. 6 6
      api/functions/homepage-connect-functions.php
  2. 71 62
      api/functions/sso-functions.php
  3. 3 0
      js/functions.js

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

@@ -1185,7 +1185,7 @@ function getRadarrCalendar($array, $number, $url)
 			}
 			$banner = "/plugins/images/cache/no-np.png";
 			foreach ($child['images'] as $image) {
-				if ($image['coverType'] == "banner") {
+				if ($image['coverType'] == "banner" || $image['coverType'] == "fanart") {
 					$url = rtrim($url, '/'); //remove trailing slash
 					$imageUrl = $image['url'];
 					$urlParts = explode("/", $url);
@@ -1221,11 +1221,11 @@ function getRadarrCalendar($array, $number, $url)
 				"runtime" => $child['runtime'],
 				"image" => $banner,
 				"ratings" => $child['ratings']['value'],
-				"videoQuality" => $child["hasFile"] ? $child['movieFile']['quality']['quality']['name'] : "unknown",
-				"audioChannels" => $child["hasFile"] ? $child['movieFile']['mediaInfo']['audioChannels'] : "unknown",
-				"audioCodec" => $child["hasFile"] ? $child['movieFile']['mediaInfo']['audioFormat'] : "unknown",
-				"videoCodec" => $child["hasFile"] ? $child['movieFile']['mediaInfo']['videoCodec'] : "unknown",
-				"size" => $child["hasFile"] ? $child['movieFile']['size'] : "unknown",
+				"videoQuality" => $child["hasFile"] ? @$child['movieFile']['quality']['quality']['name'] : "unknown",
+				"audioChannels" => $child["hasFile"] ? @$child['movieFile']['mediaInfo']['audioChannels'] : "unknown",
+				"audioCodec" => $child["hasFile"] ? @$child['movieFile']['mediaInfo']['audioFormat'] : "unknown",
+				"videoCodec" => $child["hasFile"] ? @$child['movieFile']['mediaInfo']['videoCodec'] : "unknown",
+				"size" => $child["hasFile"] ? @$child['movieFile']['size'] : "unknown",
 				"genres" => $child['genres'],
 			);
 			array_push($gotCalendar, array(

+ 71 - 62
api/functions/sso-functions.php

@@ -1,71 +1,80 @@
 <?php
-
-function ssoCheck($username, $password, $token=null)
+function ssoCheck($username, $password, $token = null)
 {
-    $test = '';
-    if ($GLOBALS['ssoPlex'] && $token) {
-        coookie('set', 'mpt', $token, 7);
-    }
-    if ($GLOBALS['ssoOmbi']) {
-        $ombiToken = getOmbiToken($username, $password);
-        if ($ombiToken) {
-            coookie('set', 'Auth', $ombiToken, 7, false);
-        }
-    }
-    if ($GLOBALS['ssoTautulli']) {
-        $tautulliToken = getTautulliToken($username, $password);
-        if ($tautulliToken) {
-            coookie('set', 'tautulli_token_'.$tautulliToken['uuid'], $tautulliToken['token'], 7, false);
-        }
-    }
-    return true;
+	$test = '';
+	if ($GLOBALS['ssoPlex'] && $token) {
+		coookie('set', 'mpt', $token, 7);
+	}
+	if ($GLOBALS['ssoOmbi']) {
+		$ombiToken = getOmbiToken($username, $password);
+		if ($ombiToken) {
+			coookie('set', 'Auth', $ombiToken, 7, false);
+		}
+	}
+	if ($GLOBALS['ssoTautulli']) {
+		$tautulliToken = getTautulliToken($username, $password);
+		if ($tautulliToken) {
+			foreach ($tautulliToken as $key => $value) {
+				coookie('set', 'tautulli_token_' . $value['uuid'], $value['token'], 7, false);
+			}
+		}
+	}
+	return true;
 }
+
 function getOmbiToken($username, $password)
 {
-    try {
-        $url = $GLOBALS['ombiURL'].'/api/v1/Token';
-        $token = null;
-        $headers = array(
-            "Accept" => "application/json",
-            "Content-Type" => "application/json"
-        );
-        $data = array(
-            "username" => $username,
-            "password" => $password,
-            "rememberMe" => "true",
-        );
-        $options = (localURL($url)) ? array('verify' => false ) : array();
-        $response = Requests::post($url, $headers, json_encode($data), $options);
-        if ($response->success) {
-            $token = json_decode($response->body, true)['access_token'];
-        }
-        return ($token) ? $token : false;
-    } catch (Requests_Exception $e) {
-        writeLog('success', 'Ombi Token Function - Error: '.$e->getMessage(), $username);
-    };
+	try {
+		$url = $GLOBALS['ombiURL'] . '/api/v1/Token';
+		$token = null;
+		$headers = array(
+			"Accept" => "application/json",
+			"Content-Type" => "application/json"
+		);
+		$data = array(
+			"username" => $username,
+			"password" => $password,
+			"rememberMe" => "true",
+		);
+		$options = (localURL($url)) ? array('verify' => false) : array();
+		$response = Requests::post($url, $headers, json_encode($data), $options);
+		if ($response->success) {
+			$token = json_decode($response->body, true)['access_token'];
+		}
+		return ($token) ? $token : false;
+	} catch (Requests_Exception $e) {
+		writeLog('success', 'Ombi Token Function - Error: ' . $e->getMessage(), $username);
+	};
 }
+
 function getTautulliToken($username, $password)
 {
-    try {
-        $url = $GLOBALS['tautulliURL'].'/auth/signin';
-        $token = null;
-        $headers = array(
-            "Accept" => "application/json",
-            "Content-Type" => "application/x-www-form-urlencoded"
-        );
-        $data = array(
-            "username" => $username,
-            "password" => $password,
-            "remember_me" => 1,
-        );
-        $options = (localURL($url)) ? array('verify' => false ) : array();
-        $response = Requests::post($url, $headers, $data, $options);
-        if ($response->success) {
-            $token['token'] = json_decode($response->body, true)['token'];
-            $token['uuid'] = json_decode($response->body, true)['uuid'];
-        }
-        return ($token) ? $token : false;
-    } catch (Requests_Exception $e) {
-        writeLog('success', 'Tautulli Token Function - Error: '.$e->getMessage(), $username);
-    };
+	$tautulli = array();
+	$token = null;
+	$tautulliURLList = explode(',', $GLOBALS['tautulliURL']);
+	if (count($tautulliURLList) !== 0) {
+		foreach ($tautulliURLList as $key => $value) {
+			try {
+				$url = $value . '/auth/signin';
+				$headers = array(
+					"Accept" => "application/json",
+					"Content-Type" => "application/x-www-form-urlencoded"
+				);
+				$data = array(
+					"username" => $username,
+					"password" => $password,
+					"remember_me" => 1,
+				);
+				$options = (localURL($url)) ? array('verify' => false) : array();
+				$response = Requests::post($url, $headers, $data, $options);
+				if ($response->success) {
+					$token[$key]['token'] = json_decode($response->body, true)['token'];
+					$token[$key]['uuid'] = json_decode($response->body, true)['uuid'];
+				}
+			} catch (Requests_Exception $e) {
+				writeLog('success', 'Tautulli Token Function - Error: ' . $e->getMessage(), $username);
+			};
+		}
+	}
+	return ($token) ? $token : false;
 }

+ 3 - 0
js/functions.js

@@ -257,18 +257,21 @@ function removeMenuActive(){
 function swapDisplay(type){
 	switch (type) {
 		case 'internal':
+		    $('body').removeClass('fix-header');
 			$('.iFrame-listing').addClass('hidden').removeClass('show');
 			$('.internal-listing').addClass('show').removeClass('hidden');
 			$('.login-area').addClass('hidden').removeClass('show');
 			//$('body').removeClass('fix-header');
 			break;
 		case 'iframe':
+            $('body').addClass('fix-header');
 			$('.iFrame-listing').addClass('show').removeClass('hidden');
 			$('.internal-listing').addClass('hidden').removeClass('show');
 			$('.login-area').addClass('hidden').removeClass('show');
 			//$('body').addClass('fix-header');
 			break;
 		case 'login':
+            $('body').removeClass('fix-header');
 			$('.iFrame-listing').addClass('hidden').removeClass('show');
 			$('.internal-listing').addClass('hidden').removeClass('show');
 			$('.login-area').addClass('show').removeClass('hidden');