Display the correct file extension on download button

This commit is contained in:
2026-03-06 22:06:20 +01:00
parent 564f816fb9
commit 5b4d3d435e
5 changed files with 30 additions and 4 deletions

View File

@@ -21,6 +21,15 @@ class DownloadButton extends Component
public $background = 'bg-rose-600';
public $fileExtension = 'HEVC';
public function mount()
{
if (str_contains($this->downloadUrl, 'AV1')) {
$this->fileExtension = 'AV1';
}
}
public function clicked($downloadId)
{
$download = Downloads::find($downloadId);

View File

@@ -12,7 +12,7 @@
@else
<p class="text-lg">Episode {{ $episodeNumber }}</p>
@endif
<p class="text-xs">HEVC MKV {{ $fileSize ?? '' }}</p>
<p class="text-xs">{{ $fileExtension }} MKV {{ $fileSize ?? '' }}</p>
<p class="text-xs" id="count-{{ $downloadId }}">Downloaded {{ $downloadCount }} times</p>
</div>
</button>

View File

@@ -235,6 +235,11 @@
'/' .
$expire;
}
$fileExtension = "HEVC";
if (str_contains($download->url, 'AV1')) {
$fileExtension = "AV1";
}
@endphp
<a href="{{ $downloadURL }}" wire:click="clicked({{ $download->id }})"
download>
@@ -249,7 +254,7 @@
</svg>
</div>
<div class="flex flex-col text-center w-full">
<p class="text-xs">HEVC MKV</p>
<p class="text-xs">{{ $fileExtension }} MKV</p>
</div>
</button>
</a>

View File

@@ -1,4 +1,10 @@
<a href="{{ $dldomains[array_rand($dldomains)] }}/{{ $hdl->getDownloadByType('FHD')->url }}">
@php
$fileExtension = "HEVC";
if (str_contains($hdl->getDownloadByType('FHD')->url, 'AV1')) {
$fileExtension = "AV1";
}
@endphp
<button class="group rounded-md shadow bg-rose-600 text-white cursor-pointer flex justify-between items-center overflow-hidden transition-all hover:glow m-1 w-[150px]">
<div class="relative w-12 h-12 bg-white bg-opacity-20 text-white flex justify-center items-center transition-all"><svg id="arrow" class="w-4 h-4 transition-all group-hover:-translate-y-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 14l-7 7m0 0l-7-7m7 7V3"></path>
@@ -7,7 +13,7 @@
</div>
<div class="w-32 text-center">
<p class="px-5 text-sm row-span-2">Episode {{ $hdl->episode }}</p>
<p class="px-5 text-xs">HEVC MKV</p>
<p class="px-5 text-xs">{{ $fileExtension }} MKV</p>
</div>
</button>
</a>

View File

@@ -28,9 +28,15 @@
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 14l-7 7m0 0l-7-7m7 7V3"></path>
</svg>
</div>
@php
$fileExtension = "HEVC";
if (str_contains($episode->getDownloadByType('FHD')->url, 'AV1')) {
$fileExtension = "AV1";
}
@endphp
<div class="flex flex-col text-center w-full">
<p class="text-xl">Episode {{ $episode->episode }}</p>
<p class="text-xs">HEVC MKV {{ $episode->getDownloadByType('FHD')->getFileSize() ?? '' }}</p>
<p class="text-xs">{{ $fileExtension }} MKV {{ $episode->getDownloadByType('FHD')->getFileSize() ?? '' }}</p>
<p class="text-xs" id="downloadCount">Downloaded {{ $episode->getDownloadByType('FHD')->count }} times</p>
</div>
</button>