ソースを参照

Jellyfin SSO fails behind reverse proxy (#1585)

CauseFX 5 年 前
コミット
525b9bbc68
3 ファイル変更14 行追加3 行削除
  1. 10 2
      api/classes/organizr.class.php
  2. 1 0
      api/config/default.php
  3. 3 1
      api/functions/sso-functions.php

+ 10 - 2
api/classes/organizr.class.php

@@ -2375,11 +2375,19 @@ class Organizr
 				array(
 					'type' => 'input',
 					'name' => 'jellyfinURL',
-					'label' => 'Jellyfin URL',
+					'label' => 'Jellyfin API URL',
 					'value' => $this->config['jellyfinURL'],
-					'help' => 'Please make sure to use the same (sub)domain to access Jellyfin as Organizr\'s',
+					'help' => 'Please make sure to use the local address to the API',
 					'placeholder' => 'http(s)://hostname:port'
 				),
+				array(
+					'type' => 'input',
+					'name' => 'jellyfinSSOURL',
+					'label' => 'Jellyfin SSO URL',
+					'value' => $this->config['jellyfinSSOURL'],
+					'help' => 'Please make sure to use the same (sub)domain to access Jellyfin as Organizr\'s',
+					'placeholder' => 'http(s)://domain.com'
+				),
 				array(
 					'type' => 'switch',
 					'name' => 'ssoJellyfin',

+ 1 - 0
api/config/default.php

@@ -46,6 +46,7 @@ return array(
 	'jellyfinTabName' => '',
 	'jellyfinURL' => '',
 	'jellyfinToken' => '',
+	'jellyfinSSOURL' => '',
 	'plexID' => '',
 	'tautulliURL' => '',
 	'ombiURL' => '',

+ 3 - 1
api/functions/sso-functions.php

@@ -53,6 +53,7 @@ trait SSOFunctions
 		$token = null;
 		try {
 			$url = $this->qualifyURL($this->config['jellyfinURL']);
+			$ssoUrl = $this->qualifyURL($this->config['jellyfinSSOURL']);
 			$headers = array(
 				'X-Emby-Authorization' => 'MediaBrowser Client="Organizr Jellyfin Tab", Device="Organizr_PHP", DeviceId="Organizr_SSO", Version="1.0"',
 				"Accept" => "application/json",
@@ -68,13 +69,14 @@ trait SSOFunctions
 			if ($response->success) {
 				$token = json_decode($response->body, true);
 				$this->writeLog('success', 'Jellyfin Token Function - Grabbed token.', $username);
+				return '{"Servers":[{"ManualAddress":"' . $ssoUrl . '","Id":"' . $token['ServerId'] . '","UserId":"' . $token['User']['Id'] . '","AccessToken":"' . $token['AccessToken'] . '"}]}';
 			} else {
 				$this->writeLog('error', 'Jellyfin Token Function - Jellyfin did not return Token', $username);
 			}
 		} catch (Requests_Exception $e) {
 			$this->writeLog('error', 'Jellyfin Token Function - Error: ' . $e->getMessage(), $username);
 		}
-		return '{"Servers":[{"ManualAddress":"' . $url . '","Id":"' . $token['ServerId'] . '","UserId":"' . $token['User']['Id'] . '","AccessToken":"' . $token['AccessToken'] . '"}]}';
+		return false;
 	}
 	
 	public function getOmbiToken($username, $password, $oAuthToken = null, $fallback = false)