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

added Active Plex Streams show user information without IP toggle (FR#147)

CauseFX 4 лет назад
Родитель
Сommit
204d991e09
2 измененных файлов с 7 добавлено и 3 удалено
  1. 2 0
      api/config/default.php
  2. 5 3
      api/homepage/plex.php

+ 2 - 0
api/config/default.php

@@ -360,6 +360,8 @@ return [
 	'homepageOrderDonate' => '41',
 	'homepageShowStreamNames' => false,
 	'homepageShowStreamNamesAuth' => '1',
+	'homepageShowStreamNamesWithoutIp' => false,
+	'homepageShowStreamNamesWithoutIpAuth' => '1',
 	'homepageUseCustomStreamNames' => false,
 	'homepageCustomStreamNames' => '',
 	'homepageStreamRefresh' => '60000',

+ 5 - 3
api/homepage/plex.php

@@ -45,8 +45,10 @@ trait PlexHomepageItem
 				'Active Streams' => [
 					$this->settingsOption('enable', 'homepagePlexStreams'),
 					$this->settingsOption('auth', 'homepagePlexStreamsAuth'),
-					$this->settingsOption('switch', 'homepageShowStreamNames', ['label' => 'User Information']),
+					$this->settingsOption('switch', 'homepageShowStreamNames', ['label' => 'User Information', 'help' => 'Show user and IP information']),
 					$this->settingsOption('auth', 'homepageShowStreamNamesAuth'),
+					$this->settingsOption('switch', 'homepageShowStreamNamesWithoutIp', ['label' => 'User Information Without IP', 'help' => 'Only shows username and no IP information']),
+					$this->settingsOption('auth', 'homepageShowStreamNamesWithoutIpAuth'),
 					$this->settingsOption('refresh', 'homepageStreamRefresh'),
 					$this->settingsOption('plex-library-exclude', 'homepagePlexStreamsExclude', ['options' => $libraryList]),
 				],
@@ -566,7 +568,7 @@ trait PlexHomepageItem
 		$plexItem['sessionType'] = isset($item->TranscodeSession['progress']) ? 'Transcoding' : 'Direct Playing';
 		$plexItem['state'] = (((string)$item->Player['state'] == "paused") ? "pause" : "play");
 		$plexItem['user'] = $this->formatPlexUserName($item);
-		$plexItem['userThumb'] = ($this->config['homepageShowStreamNames'] && $this->qualifyRequest($this->config['homepageShowStreamNamesAuth'])) ? (string)$item->User['thumb'] : "";
+		$plexItem['userThumb'] = (($this->config['homepageShowStreamNames'] && $this->qualifyRequest($this->config['homepageShowStreamNamesAuth'])) || ($this->config['homepageShowStreamNamesWithoutIp'] && $this->qualifyRequest($this->config['homepageShowStreamNamesWithoutIpAuth']))) ? (string)$item->User['thumb'] : "";
 		$plexItem['userAddress'] = ($this->config['homepageShowStreamNames'] && $this->qualifyRequest($this->config['homepageShowStreamNamesAuth'])) ? (string)$item->Player['address'] : "x.x.x.x";
 		$plexItem['address'] = $this->config['plexTabURL'] ? $this->config['plexTabURL'] . "/web/index.html#!/server/" . $this->config['plexID'] . "/details?key=/library/metadata/" . $item['ratingKey'] : "https://app.plex.tv/web/app#!/server/" . $this->config['plexID'] . "/details?key=/library/metadata/" . $item['ratingKey'];
 		$plexItem['nowPlayingOriginalImage'] = 'api/v2/homepage/image?source=plex&img=' . $plexItem['nowPlayingThumb'] . '&height=' . $nowPlayingHeight . '&width=' . $nowPlayingWidth . '&key=' . $plexItem['nowPlayingKey'] . '$' . $this->randString();
@@ -690,7 +692,7 @@ trait PlexHomepageItem
 
 	private function formatPlexUserName($item)
 	{
-		$name = ($this->config['homepageShowStreamNames'] && $this->qualifyRequest($this->config['homepageShowStreamNamesAuth'])) ? (string)$item->User['title'] : "";
+		$name = (($this->config['homepageShowStreamNames'] && $this->qualifyRequest($this->config['homepageShowStreamNamesAuth'])) || ($this->config['homepageShowStreamNamesWithoutIp'] && $this->qualifyRequest($this->config['homepageShowStreamNamesWithoutIpAuth']))) ? (string)$item->User['title'] : "";
 		try {
 			if ($this->config['homepageUseCustomStreamNames']) {
 				$customNames = json_decode($this->config['homepageCustomStreamNames'], true);