diff --git a/app/Models/SearchBox.php b/app/Models/SearchBox.php index 5b00a233..65aa2df8 100644 --- a/app/Models/SearchBox.php +++ b/app/Models/SearchBox.php @@ -25,6 +25,7 @@ class SearchBox extends NexusModel const EXTRA_TAXONOMY_LABELS = 'taxonomy_labels'; const EXTRA_DISPLAY_COVER_ON_TORRENT_LIST = 'display_cover_on_torrent_list'; + const EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST = 'display_seed_box_icon_on_torrent_list'; public static array $subCatFields = [ 'source', 'medium', 'codec', 'audiocodec', 'team', 'standard', 'processing' @@ -32,6 +33,7 @@ class SearchBox extends NexusModel public static array $extras = [ self::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => ['text' => 'Display cover on torrent list'], + self::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => ['text' => 'Display seed box icon on torrent list'], ]; public static function listExtraText(): array diff --git a/app/Repositories/TorrentRepository.php b/app/Repositories/TorrentRepository.php index 12b9676c..aab17db3 100644 --- a/app/Repositories/TorrentRepository.php +++ b/app/Repositories/TorrentRepository.php @@ -617,7 +617,7 @@ class TorrentRepository extends BaseRepository $input = <<
- + $note
$btn diff --git a/include/constants.php b/include/constants.php index e1d5ff46..07693973 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ keyBy('id'); $torrentTagResult = $torrentTagCollection->groupBy('torrent_id'); $showCover = false; + $showSeedBoxIcon = get_setting('seed_box.enabled') == 'yes'; if ($searchBoxId) { $searchBoxExtra = get_searchbox_value($searchBoxId, "extra"); if (!empty($searchBoxExtra[\App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST])) { $showCover = true; } + if (empty($searchBoxExtra[\App\Models\SearchBox::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST])) { + $showSeedBoxIcon = false; + } } //seedBoxIcon - $showSeedBoxIcon = get_setting('seed_box.enabled') == 'yes'; if ($showSeedBoxIcon) { $seedBoxRep = new \App\Repositories\SeedBoxRepository(); $ownerPeerInfo = \App\Models\Peer::query() diff --git a/nexus/Install/Update.php b/nexus/Install/Update.php index 0f454cc7..5dc5d344 100644 --- a/nexus/Install/Update.php +++ b/nexus/Install/Update.php @@ -250,6 +250,7 @@ class Update extends Install $this->runMigrate('database/migrations/2022_09_02_031539_add_extra_to_searchbox_table.php'); SearchBox::query()->update(['extra' => [ SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => 1, + SearchBox::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => 1, ]]); } diff --git a/public/getusertorrentlistajax.php b/public/getusertorrentlistajax.php index a4e7d743..515bfd2e 100644 --- a/public/getusertorrentlistajax.php +++ b/public/getusertorrentlistajax.php @@ -11,6 +11,7 @@ header("Pragma: no-cache" ); $torrentRep = new \App\Repositories\TorrentRepository(); $claimRep = new \App\Repositories\ClaimRepository(); +$claimTorrentTTL = \App\Models\Claim::getConfigTorrentTTL(); $id = intval($_GET['userid'] ?? 0); $type = $_GET['type']; if (!in_array($type,array('uploaded','seeding','leeching','completed','incomplete'))) @@ -21,7 +22,7 @@ if(!user_can('torrenthistory') && $id != $CURUSER["id"]) function maketable($res, $mode = 'seeding') { global $lang_getusertorrentlistajax,$CURUSER,$smalldescription_main, $lang_functions, $id; - global $torrentRep, $claimRep; + global $torrentRep, $claimRep, $claimTorrentTTL; $showActionClaim = false; switch ($mode) { @@ -213,11 +214,12 @@ function maketable($res, $mode = 'seeding') $ret .= ""."". str_replace(" ", "
", gettime($arr['completedat'],false)). ""; if ($showanonymous) $ret .= "".$arr['anonymous'].""; - if ($showActionClaim) { + $claimButton = ''; + if ($showActionClaim && \App\Models\Claim::getConfigIsEnabled() && \Carbon\Carbon::parse($arr['added'])->addDays($claimTorrentTTL)->lte(\Carbon\Carbon::now())) { $claim = $claimData->get($arr['torrent']); $claimButton = $claimRep->buildActionButtons($arr['torrent'], $claim); - $ret .= sprintf('%s', $claimButton); } + $ret .= sprintf('%s', $claimButton); $ret .="\n"; } diff --git a/resources/lang/en/searchbox.php b/resources/lang/en/searchbox.php index e9c077e6..ceb08948 100644 --- a/resources/lang/en/searchbox.php +++ b/resources/lang/en/searchbox.php @@ -11,5 +11,6 @@ return [ 'sub_category_audio_codec_label' => 'AudioCodec', 'extras' => [ \App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => 'Display cover on torrent list', + \App\Models\SearchBox::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => 'Display seed box icon on torrent list', ], ]; diff --git a/resources/lang/zh_CN/searchbox.php b/resources/lang/zh_CN/searchbox.php index 114ce9cf..69344bbe 100644 --- a/resources/lang/zh_CN/searchbox.php +++ b/resources/lang/zh_CN/searchbox.php @@ -11,5 +11,6 @@ return [ 'sub_category_audio_codec_label' => '音频编码', 'extras' => [ \App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => '种子列表页展示封面', + \App\Models\SearchBox::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => '种子列表页展示 SeedBox 图标', ], ]; diff --git a/resources/lang/zh_TW/searchbox.php b/resources/lang/zh_TW/searchbox.php index 9c062526..e053f2b7 100644 --- a/resources/lang/zh_TW/searchbox.php +++ b/resources/lang/zh_TW/searchbox.php @@ -11,5 +11,6 @@ return [ 'sub_category_audio_codec_label' => '音頻編碼', 'extras' => [ \App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => '種子列表頁展示封面', + \App\Models\SearchBox::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => '種子列表頁展示 SeedBox 圖標', ], ];