Ver código fonte

Added option to define local IP override

causefx 7 anos atrás
pai
commit
5a10077f8e

+ 3 - 1
api/config/default.php

@@ -217,5 +217,7 @@ return array(
 	'plexStrictFriends' => true,
 	'debugAreaAuth' => '1',
 	'commit' => 'n/a',
-	'ombiLimit' => '50'
+	'ombiLimit' => '50',
+	'localIPFrom' => '',
+	'localIPTo' => ''
 );

+ 17 - 1
api/functions/normal-functions.php

@@ -587,7 +587,7 @@ function dbExtension($string)
 
 function localIPRanges()
 {
-	return array(
+	$mainArray = array(
 		array(
 			'from' => '10.0.0.0',
 			'to' => '10.255.255.255'
@@ -605,6 +605,22 @@ function localIPRanges()
 			'to' => '127.255.255.255'
 		),
 	);
+	$override = false;
+	if ($GLOBALS['localIPFrom']) {
+		$from = trim($GLOBALS['localIPFrom']);
+		$override = true;
+	}
+	if ($GLOBALS['localIPTo']) {
+		$to = trim($GLOBALS['localIPTo']);
+	}
+	if ($override) {
+		$newArray = array(
+			'from' => $from,
+			'to' => (isset($to)) ? $to : $from
+		);
+		array_push($mainArray, $newArray);
+	}
+	return $mainArray;
 }
 
 function isLocal($checkIP = null)

+ 16 - 0
api/functions/organizr-functions.php

@@ -756,6 +756,22 @@ function getSettingsMain()
 				'help' => 'Default status of Remember Me button on login screen',
 				'value' => $GLOBALS['rememberMe'],
 			),
+			array(
+				'type' => 'input',
+				'name' => 'localIPFrom',
+				'label' => 'Override Local IP From',
+				'value' => $GLOBALS['localIPFrom'],
+				'placeholder' => 'i.e. 123.123.123.123',
+				'help' => 'IPv4 only at the moment - This will set your login as local if your IP falls within the From and To'
+			),
+			array(
+				'type' => 'input',
+				'name' => 'localIPTo',
+				'label' => 'Override Local IP To',
+				'value' => $GLOBALS['localIPTo'],
+				'placeholder' => 'i.e. 123.123.123.123',
+				'help' => 'IPv4 only at the moment - This will set your login as local if your IP falls within the From and To'
+			),
 		),
 		'Ping' => array(
 			array(