show seed box icon configurable

This commit is contained in:
xiaomlove
2022-09-06 21:54:13 +08:00
parent 8eda506f6c
commit 9231da1c6b
6 changed files with 10 additions and 1 deletions

View File

@@ -17,9 +17,11 @@ class SearchBox extends NexusModel
];
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 $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

View File

@@ -3320,14 +3320,17 @@ function torrenttable($rows, $variant = "torrent", $searchBoxId = 0) {
$tagKeyById = $tagCollection->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()

View File

@@ -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,
]]);
}

View File

@@ -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',
],
];

View File

@@ -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 图标',
],
];

View File

@@ -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 圖標',
],
];