Просмотр исходного кода

Added toggle for jellyfin on emby settings, Please toggle after updating!

CauseFX 5 лет назад
Родитель
Сommit
f014fcfe27

+ 1 - 0
api/config/default.php

@@ -139,6 +139,7 @@ return array(
 	'homepageOmbiEnabled' => false,
 	'homepageOmbiAuth' => '1',
 	'homepageOmbiRequestAuth' => '1',
+	'homepageJellyfinInstead' => false,
 	'ombiLimitUser' => false,
 	'ombiRefresh' => '600000',
 	'ombiTvDefault' => 'all',

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

@@ -343,7 +343,7 @@ function resolveEmbyItem($itemDetails)
 	$embyItem['user'] = ($GLOBALS['homepageShowStreamNames'] && qualifyRequest($GLOBALS['homepageShowStreamNamesAuth'])) ? @(string)$itemDetails['UserName'] : "";
 	$embyItem['userThumb'] = '';
 	$embyItem['userAddress'] = (isset($itemDetails['RemoteEndPoint']) ? $itemDetails['RemoteEndPoint'] : "x.x.x.x");
-	$embyURL = (strpos($GLOBALS['embyURL'], 'jellyfin') !== false) ? $GLOBALS['embyURL'] . '/web/index.html#!/itemdetails.html?id=' : 'https://app.emby.media/#!/item/item.html?id=';
+	$embyURL = ($GLOBALS['homepageJellyfinInstead']) ? $GLOBALS['embyURL'] . '/web/index.html#!/itemdetails.html?id=' : 'https://app.emby.media/#!/item/item.html?id=';
 	$embyItem['address'] = $GLOBALS['embyTabURL'] ? rtrim($GLOBALS['embyTabURL'], '/') . "/web/#!/item/item.html?id=" . $embyItem['uid'] : $embyURL . $embyItem['uid'] . "&serverId=" . $embyItem['id'];
 	$embyItem['nowPlayingOriginalImage'] = 'api/?v1/image&source=emby&type=' . $embyItem['nowPlayingImageType'] . '&img=' . $embyItem['nowPlayingThumb'] . '&height=' . $nowPlayingHeight . '&width=' . $nowPlayingWidth . '&key=' . $embyItem['nowPlayingKey'] . '$' . randString();
 	$embyItem['originalImage'] = 'api/?v1/image&source=emby&type=' . $embyItem['imageType'] . '&img=' . $embyItem['thumb'] . '&height=' . $height . '&width=' . $width . '&key=' . $embyItem['key'] . '$' . randString();

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

@@ -987,14 +987,20 @@ function getHomepageList()
 						'name' => 'embyURL',
 						'label' => 'URL',
 						'value' => $GLOBALS['embyURL'],
-						'help' => 'Please make sure to use local IP address and port - You also may use local dns name too. Make sure if Jelly fin to end url with /jellyfin',
-						'placeholder' => 'http(s)://hostname:port - make sure if Jelly fin to end url with /jellyfin'
+						'help' => 'Please make sure to use local IP address and port - You also may use local dns name too.',
+						'placeholder' => 'http(s)://hostname:port'
 					),
 					array(
 						'type' => 'password-alt',
 						'name' => 'embyToken',
 						'label' => 'Token',
 						'value' => $GLOBALS['embyToken']
+					),
+					array(
+						'type' => 'switch',
+						'name' => 'homepageJellyfinInstead',
+						'label' => 'Jellyfin',
+						'value' => $GLOBALS['homepageJellyfinInstead']
 					)
 				),
 				'Active Streams' => array(

+ 4 - 4
api/functions/organizr-functions.php

@@ -49,7 +49,7 @@ function organizrSpecialSettings()
 				)
 			),
 			'media' => array(
-				'jellyfin' => (strpos($GLOBALS['embyURL'], 'jellyfin') !== false) ? true : false
+				'jellyfin' => $GLOBALS['homepageJellyfinInstead']
 			)
 		),
 		'sso' => array(
@@ -739,7 +739,7 @@ function getSettingsMain()
 				'type' => 'password-alt',
 				'name' => 'embyToken',
 				'class' => 'embyAuth switchAuth',
-				'label' => 'Emby/Jellyin Token',
+				'label' => 'Emby/Jellyfin Token',
 				'value' => $GLOBALS['embyToken'],
 				'placeholder' => ''
 			),
@@ -2688,10 +2688,10 @@ function importUserButtons()
 	if (!empty($GLOBALS['plexToken'])) {
 		$buttons .= '<button class="btn m-b-20 m-r-20 bg-plex text-muted waves-effect waves-light importUsersButton" onclick="importUsers(\'plex\')" type="button"><span class="btn-label"><i class="mdi mdi-plex"></i></span><span lang="en">Import Plex Users</span></button>';
 	}
-	if (!empty($GLOBALS['embyURL']) && !empty($GLOBALS['embyToken']) && (strpos($GLOBALS['embyURL'], 'jellyfin') !== false)) {
+	if (!empty($GLOBALS['embyURL']) && !empty($GLOBALS['embyToken']) && ($GLOBALS['homepageJellyfinInstead'])) {
 		$buttons .= '<button class="btn m-b-20 m-r-20 bg-primary text-muted waves-effect waves-light importUsersButton" onclick="importUsers(\'jellyfin\')" type="button"><span class="btn-label"><i class="mdi mdi-fish"></i></span><span lang="en">Import Jellyfin Users</span></button>';
 	}
-	if (!empty($GLOBALS['embyURL']) && !empty($GLOBALS['embyToken']) && (strpos($GLOBALS['embyURL'], 'jellyfin') === false)) {
+	if (!empty($GLOBALS['embyURL']) && !empty($GLOBALS['embyToken']) && (!$GLOBALS['homepageJellyfinInstead'])) {
 		$buttons .= '<button class="btn m-b-20 m-r-20 bg-emby text-muted waves-effect waves-light importUsersButton" onclick="importUsers(\'emby\')" type="button"><span class="btn-label"><i class="mdi mdi-emby"></i></span><span lang="en">Import Jellyfin Users</span></button>';
 	}
 	return ($buttons !== '') ? $buttons : $emptyButtons;