Browse Source

Merge pull request #1621 from HalianElf/v2-develop

Bug fixes
causefx 5 years ago
parent
commit
ffafc368fe
3 changed files with 4 additions and 3 deletions
  1. 1 1
      api/classes/organizr.class.php
  2. 2 1
      api/functions/sso-functions.php
  3. 1 1
      api/v2/routes/socks.php

+ 1 - 1
api/classes/organizr.class.php

@@ -6051,7 +6051,7 @@ class Organizr
 		if (!$error) {
 		if (!$error) {
 			$pre = explode('/api/v2/socks/', $requestObject->getUri()->getPath());
 			$pre = explode('/api/v2/socks/', $requestObject->getUri()->getPath());
 			$endpoint = explode('/', $pre[1]);
 			$endpoint = explode('/', $pre[1]);
-			$new = str_ireplace($endpoint[0], '', $pre[1]);
+			$new = urldecode(preg_replace('/'.$endpoint[0].'/', '', $pre[1], 1));
 			$getParams = ($_GET) ? '?' . http_build_query($_GET) : '';
 			$getParams = ($_GET) ? '?' . http_build_query($_GET) : '';
 			$url = $this->qualifyURL($this->config[$url]) . $new . $getParams;
 			$url = $this->qualifyURL($this->config[$url]) . $new . $getParams;
 			$url = $this->cleanPath($url);
 			$url = $this->cleanPath($url);

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

@@ -47,7 +47,8 @@ trait SSOFunctions
 			}
 			}
 		}
 		}
 		if ($this->config['ssoPetio']) {
 		if ($this->config['ssoPetio']) {
-			$petioToken = $this->getPetioToken($this->getSSOUserFor('petio', $userobj), $password, $token);
+			$fallback = ($this->config['petioFallbackUser'] !== '' && $this->config['petioFallbackPassword'] !== '');
+			$petioToken = $this->getPetioToken($this->getSSOUserFor('petio', $userobj), $password, $token, $fallback);
 			if ($petioToken) {
 			if ($petioToken) {
 				$this->coookie('set', 'petio_jwt', $petioToken, $this->config['rememberMeDays'], false);
 				$this->coookie('set', 'petio_jwt', $petioToken, $this->config['rememberMeDays'], false);
 			}
 			}

+ 1 - 1
api/v2/routes/socks.php

@@ -30,7 +30,7 @@ $app->any('/socks/{app}/{route:.*}', function ($request, $response, $args) {
 			$url = 'nzbgetURL';
 			$url = 'nzbgetURL';
 			$enabled = 'nzbgetSocksEnabled';
 			$enabled = 'nzbgetSocksEnabled';
 			$auth = 'nzbgetSocksAuth';
 			$auth = 'nzbgetSocksAuth';
-			$header = null;
+			$header = 'Authorization';
 			break;
 			break;
 		default:
 		default:
 			$Organizr->setAPIResponse('error', 'Application not supported for socks', 404);
 			$Organizr->setAPIResponse('error', 'Application not supported for socks', 404);