torrents list show seedbox icon

This commit is contained in:
xiaomlove
2022-09-02 19:49:41 +08:00
parent 17b225424e
commit 875e8ea797
19 changed files with 180 additions and 39 deletions
+1 -3
View File
@@ -86,9 +86,7 @@ class Test extends Command
*/
public function handle()
{
$role = Role::query()->first();
$r = $role->permissions()->createMany([['permission' => 'sss']]);
dd($r);
}
@@ -44,7 +44,7 @@ class TagResource extends Resource
Forms\Components\TextInput::make('margin')->required()->label(__('label.tag.margin')),
Forms\Components\TextInput::make('padding')->required()->label(__('label.tag.padding')),
Forms\Components\TextInput::make('border_radius')->required()->label(__('label.tag.border_radius')),
Forms\Components\TextInput::make('priority')->integer()->label(__('label.priority')),
Forms\Components\TextInput::make('priority')->integer()->required()->label(__('label.priority'))->default(0),
]);
}
@@ -10,4 +10,8 @@ class CreateTag extends CreateRecord
{
protected static string $resource = TagResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('index');
}
}
+20 -1
View File
@@ -9,9 +9,28 @@ class SearchBox extends NexusModel
protected $fillable = [
'name', 'catsperrow', 'catpadding', 'showsubcat',
'showsource', 'showmedium', 'showcodec', 'showstandard', 'showprocessing', 'showteam', 'showaudiocodec',
'custom_fields', 'custom_fields_display_name', 'custom_fields_display'
'custom_fields', 'custom_fields_display_name', 'custom_fields_display', 'extra'
];
protected $casts = [
'extra' => 'object'
];
const EXTRA_DISPLAY_COVER_ON_TORRENT_LIST = 'display_cover_on_torrent_list';
public static array $extras = [
self::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => ['text' => 'Display cover on torrent list'],
];
public static function listExtraText(): array
{
$result = [];
foreach (self::$extras as $extra => $info) {
$result[$extra] = nexus_trans("searchbox.extras.$extra");
}
return $result;
}
public function categories(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(Category::class, 'mode');
+10 -5
View File
@@ -130,13 +130,18 @@ class SeedBoxRepository extends BaseRepository
});
}
public function renderIcon($ip, $uid): string
public function renderIcon($ipArr, $uid): string
{
$result = '';
if ((isIPV4($ip) || isIPV6($ip)) && get_setting('seed_box.enabled') == 'yes' && isIPSeedBox($ip, $uid)) {
$result = '<img src="pic/misc/seed-box.png" style="vertical-align: bottom; height: 16px; margin-left: 4px" title="SeedBox" />';
static $enableSeedBox;
if ($enableSeedBox === null) {
$enableSeedBox = get_setting('seed_box.enabled') == 'yes';
}
return $result;
foreach (Arr::wrap($ipArr) as $ip) {
if ((isIPV4($ip) || isIPV6($ip)) && $enableSeedBox && isIPSeedBox($ip, $uid)) {
return '<img src="pic/misc/seed-box.png" style="vertical-align: bottom; height: 16px; margin-left: 4px" title="SeedBox" />';
}
}
return '';
}
private function clearCache()