view: torrent buffs with slider

This commit is contained in:
Jay Sizzla
2021-12-06 20:49:16 +01:00
parent 72e177324d
commit 47c0b98386
4 changed files with 199 additions and 83 deletions
+39 -50
View File
@@ -202,7 +202,11 @@ class TorrentController extends Controller
'platforms', ])
->find($torrent->igdb);
$link = collect($meta->videos)->take(1)->pluck('video_id');
$trailer = isset($link[0]) ? 'https://www.youtube.com/embed/'.$link[0] : '/img/no-video.png';
if (isset($link[0])) {
$trailer = 'https://www.youtube.com/embed/'.$link[0];
} else {
$trailer = '/img/no-video.png';
}
$platforms = PlatformLogo::whereIn('id', collect($meta->platforms)->pluck('platform_logo')->toArray())->get();
}
@@ -277,8 +281,6 @@ class TorrentController extends Controller
$torrent->tmdb = $request->input('tmdb');
$torrent->mal = $request->input('mal');
$torrent->igdb = $request->input('igdb');
$torrent->season_number = $request->input('season_number');
$torrent->episode_number = $request->input('episode_number');
$torrent->type_id = $request->input('type_id');
$torrent->resolution_id = $request->input('resolution_id');
$torrent->mediainfo = $request->input('mediainfo');
@@ -291,38 +293,26 @@ class TorrentController extends Controller
$category = Category::findOrFail($request->input('category_id'));
$resolutionRule = 'nullable|exists:resolutions,id';
$resRule = 'nullable|exists:resolutions,id';
if ($category->movie_meta || $category->tv_meta) {
$resolutionRule = 'required|exists:resolutions,id';
}
$episodeRule = 'nullable|numeric';
if ($category->tv_meta) {
$episodeRule = 'required|numeric';
}
$seasonRule = 'nullable|numeric';
if ($category->tv_meta) {
$seasonRule = 'required|numeric';
$resRule = 'required|exists:resolutions,id';
}
$v = \validator($torrent->toArray(), [
'name' => 'required',
'slug' => 'required',
'description' => 'required',
'category_id' => 'required|exists:categories,id',
'type_id' => 'required|exists:types,id',
'resolution_id' => $resolutionRule,
'imdb' => 'required|numeric',
'tvdb' => 'required|numeric',
'tmdb' => 'required|numeric',
'mal' => 'required|numeric',
'igdb' => 'required|numeric',
'season_number' => $seasonRule,
'episode_number' => $episodeRule,
'anon' => 'required',
'stream' => 'required',
'sd' => 'required',
'name' => 'required',
'slug' => 'required',
'description' => 'required',
'category_id' => 'required|exists:categories,id',
'type_id' => 'required|exists:types,id',
'resolution_id' => $resRule,
'imdb' => 'required|numeric',
'tvdb' => 'required|numeric',
'tmdb' => 'required|numeric',
'mal' => 'required|numeric',
'igdb' => 'required|numeric',
'anon' => 'required',
'stream' => 'required',
'sd' => 'required',
]);
if ($v->fails()) {
@@ -577,8 +567,6 @@ class TorrentController extends Controller
$torrent->tmdb = $request->input('tmdb');
$torrent->mal = $request->input('mal');
$torrent->igdb = $request->input('igdb');
$torrent->season_number = $request->input('season_number');
$torrent->episode_number = $request->input('episode_number');
$torrent->anon = $request->input('anonymous');
$torrent->stream = $request->input('stream');
$torrent->sd = $request->input('sd');
@@ -594,16 +582,6 @@ class TorrentController extends Controller
$resRule = 'required|exists:resolutions,id';
}
$episodeRule = 'nullable|numeric';
if ($category->tv_meta) {
$episodeRule = 'required|numeric';
}
$seasonRule = 'nullable|numeric';
if ($category->tv_meta) {
$seasonRule = 'required|numeric';
}
// Validation
$v = \validator($torrent->toArray(), [
'name' => 'required|unique:torrents',
@@ -623,8 +601,6 @@ class TorrentController extends Controller
'tmdb' => 'required|numeric',
'mal' => 'required|numeric',
'igdb' => 'required|numeric',
'season_number' => $seasonRule,
'episode_number' => $episodeRule,
'anon' => 'required',
'stream' => 'required',
'sd' => 'required',
@@ -745,7 +721,7 @@ class TorrentController extends Controller
// User's ratio is too low
if ($user->getRatio() < \config('other.ratio')) {
return \redirect()->route('torrent', ['id' => $torrent->id])
->withErrors('Your Ratio Is Too Low To Download!');
->withErrors('Your Ratio Is To Low To Download!');
}
// User's download rights are revoked
@@ -849,7 +825,7 @@ class TorrentController extends Controller
}
/**
* 100% Freeleech A Torrent.
* Freeleech A Torrent (1% to 100% Free).
*
* @param \App\Models\Torrent $id
*
@@ -862,18 +838,31 @@ class TorrentController extends Controller
\abort_unless($user->group->is_modo || $user->group->is_internal, 403);
$torrent = Torrent::withAnyStatus()->findOrFail($id);
$torrentUrl = \href_torrent($torrent);
$torrentFlAmount = $request->input('freeleech');
$v = \validator($request->input(), [
'freeleech' => 'numeric|not_in:0',
]);
if ($v->fails()) {
return \redirect()->route('torrent', ['id' => $torrent->id])
->withErrors($v->errors());
}
if ($torrent->free == 0) {
$torrent->free = '1';
$torrent->free = $torrentFlAmount;
$this->chatRepository->systemMessage(
\sprintf('Ladies and Gents, [url=%s]%s[/url] has been granted 100%% FreeLeech! Grab It While You Can! :fire:', $torrentUrl, $torrent->name)
\sprintf('Ladies and Gents, [url=%s]%s[/url] has been granted %s%% FreeLeech! Grab It While You Can! :fire:', $torrentUrl, $torrent->name, $torrentFlAmount)
);
} else {
// Get amount of FL before revoking for chat announcement
$torrentFlAmount = $torrent->free;
$torrent->free = '0';
$this->chatRepository->systemMessage(
\sprintf('Ladies and Gents, [url=%s]%s[/url] has been revoked of its 100%% FreeLeech! :poop:', $torrentUrl, $torrent->name)
\sprintf('Ladies and Gents, [url=%s]%s[/url] has been revoked of its %s%% FreeLeech! :poop:', $torrentUrl, $torrent->name, $torrentFlAmount)
);
}
@@ -296,12 +296,34 @@
title='' data-original-title='@lang('torrent.double-upload')'></i>
</span>
@endif
@if ($torrent->free == 1)
<span class='badge-extra text-bold'>
<i class='{{ config('other.font-awesome') }} fa-star text-gold' data-toggle='tooltip'
title='' data-original-title='@lang('torrent.freeleech')'></i>
</span>
@endif
@if ($torrent->free >= '90')
<span class="badge-extra text-bold torrent-listings-freeleech" data-toggle="tooltip" data-html="true" title="
<p>{{ $torrent->free }}% @lang('common.free')</p>
">
<i class="{{ config('other.font-awesome') }} fa-star text-gold"></i>
</span>
@elseif ($torrent->free < '90' && $torrent->free >= '30')
<style>
.star50 {position: relative;}
.star50:after {content: "\f005";position: absolute;left: 0;top: 0;width: 50%;overflow: hidden;color: #FFB800;}
</style>
<span class="badge-extra text-bold torrent-listings-freeleech" data-toggle="tooltip" data-html="true" title="
<p>{{ $torrent->free }}% @lang('common.free')</p>
">
<i class="star50 {{ config('other.font-awesome') }} fa-star"></i>
</span>
@elseif ($torrent->free < '30' && $torrent->free != '0')
<style>
.star30 {position: relative;}
.star30:after {content: "\f005";position: absolute;left: 0;top: 0;width: 30%;overflow: hidden;color: #FFB800;}
</style>
<span class="badge-extra text-bold torrent-listings-freeleech" data-toggle="tooltip" data-html="true" title="
<p>{{ $torrent->free }}% @lang('common.free')</p>
">
<i class="star30 {{ config('other.font-awesome') }} fa-star"></i>
</span>
@endif
@endif
@if ($user->freeleechTokens->where('torrent_id', $torrent->id)->first())
@@ -543,12 +543,34 @@
title='' data-original-title='@lang('torrent.double-upload')'></i>
</span>
@endif
@if ($torrent->free == 1)
<span class='badge-extra text-bold torrent-listings-freeleech'>
<i class='{{ config('other.font-awesome') }} fa-star text-gold' data-toggle='tooltip'
title='' data-original-title='@lang('torrent.freeleech')'></i>
</span>
@endif
@if ($torrent->free >= '90')
<span class="badge-extra text-bold torrent-listings-freeleech" data-toggle="tooltip" data-html="true" title="
<p>{{ $torrent->free }}% @lang('common.free')</p>
">
<i class="{{ config('other.font-awesome') }} fa-star text-gold"></i>
</span>
@elseif ($torrent->free < '90' && $torrent->free >= '30')
<style>
.star50 {position: relative;}
.star50:after {content: "\f005";position: absolute;left: 0;top: 0;width: 50%;overflow: hidden;color: #FFB800;}
</style>
<span class="badge-extra text-bold torrent-listings-freeleech" data-toggle="tooltip" data-html="true" title="
<p>{{ $torrent->free }}% @lang('common.free')</p>
">
<i class="star50 {{ config('other.font-awesome') }} fa-star"></i>
</span>
@elseif ($torrent->free < '30' && $torrent->free != '0')
<style>
.star30 {position: relative;}
.star30:after {content: "\f005";position: absolute;left: 0;top: 0;width: 30%;overflow: hidden;color: #FFB800;}
</style>
<span class="badge-extra text-bold torrent-listings-freeleech" data-toggle="tooltip" data-html="true" title="
<p>{{ $torrent->free }}% @lang('common.free')</p>
">
<i class="star30 {{ config('other.font-awesome') }} fa-star"></i>
</span>
@endif
@endif
@if ($personalFreeleech)
+104 -21
View File
@@ -85,12 +85,9 @@
</button>
@endif
<form action="{{ route('comment_thanks', ['id' => $torrent->id]) }}" method="POST" style="display: inline;">
@csrf
<button type="submit" class="btn btn-sm btn-primary">
<i class='{{ config("other.font-awesome") }} fa-heart'></i> @lang('torrent.quick-comment')
</button>
</form>
<a href="{{ route('comment_thanks', ['id' => $torrent->id]) }}" role="button" class="btn btn-sm btn-primary">
<i class='{{ config("other.font-awesome") }} fa-heart'></i> @lang('torrent.quick-comment')
</a>
<a data-toggle="modal" href="#myModal" role="button" class="btn btn-sm btn-primary">
<i class='{{ config("other.font-awesome") }} fa-file'></i> @lang('torrent.show-files')
@@ -162,8 +159,8 @@
</div>
<div class="torrent-discounts" style="display: inline-block">
@if ($torrent->featured == '0')
@if ($freeleech_token || $user->group->is_freeleech == '1' || $personal_freeleech || $torrent->free == '1' || config('other.freeleech') == '1' || $torrent->doubleup == '1' || $user->group->is_double_upload == '1' || config('other.doubleup') == '1')
@if ($freeleech_token || $user->group->is_freeleech == '1' || $personal_freeleech || $torrent->free == '1' || config('other.freeleech') == '1')
@if ($freeleech_token || $user->group->is_freeleech == '1' || $personal_freeleech || $torrent->free > '1' || config('other.freeleech') == '1' || $torrent->doubleup == '1' || $user->group->is_double_upload == '1' || config('other.doubleup') == '1')
@if ($freeleech_token || $user->group->is_freeleech == '1' || $personal_freeleech || config('other.freeleech') == '1')
<span class="badge-extra" data-toggle="tooltip" data-html="true" title="
@if ($freeleech_token)
@@ -178,10 +175,6 @@
<p>@lang('common.personal') @lang('torrent.freeleech')</p>
@endif
@if ($torrent->free == '1')
<p>100% @lang('common.free')</p>
@endif
@if (config('other.freeleech') == '1')
<p>@lang('common.global') @lang('torrent.freeleech')</p>
@endif
@@ -190,6 +183,34 @@
>
<i class="{{ config('other.font-awesome') }} fa-star text-gold"></i>
</span>
@elseif ($torrent->free > '1')
@if ($torrent->free >= '90')
<span class="badge-extra text-bold" data-toggle="tooltip" data-html="true" title="
<p>{{ $torrent->free }}% @lang('common.free')</p>
">
<i class="{{ config('other.font-awesome') }} fa-star text-gold"></i>
</span>
@elseif ($torrent->free < '90' && $torrent->free >= '30')
<style>
.star50 {position: relative;}
.star50:after {content: "\f005";position: absolute;left: 0;top: 0;width: 50%;overflow: hidden;color: #FFB800;}
</style>
<span class="badge-extra text-bold" data-toggle="tooltip" data-html="true" title="
<p>{{ $torrent->free }}% @lang('common.free')</p>
">
<i class="star50 {{ config('other.font-awesome') }} fa-star"></i>
</span>
@elseif ($torrent->free < '30' && $torrent->free != '0')
<style>
.star30 {position: relative;}
.star30:after {content: "\f005";position: absolute;left: 0;top: 0;width: 30%;overflow: hidden;color: #FFB800;}
</style>
<span class="badge-extra text-bold" data-toggle="tooltip" data-html="true" title="
<p>{{ $torrent->free }}% @lang('common.free')</p>
">
<i class="star30 {{ config('other.font-awesome') }} fa-star"></i>
</span>
@endif
@endif
@if ($torrent->doubleup == '1' || $user->group->is_double_upload == '1' || config('other.doubleup') == '1')
@@ -374,7 +395,7 @@
<strong>@lang('torrent.discounts')</strong>
</td>
<td>
@if ($torrent->doubleup == '1' || $torrent->free == '1' || config('other.freeleech') == '1' || config('other.doubleup') == '1' || $personal_freeleech || $user->group->is_freeleech == '1' || $freeleech_token)
@if ($torrent->doubleup == '1' || $torrent->free > '1' || config('other.freeleech') == '1' || config('other.doubleup') == '1' || $personal_freeleech || $user->group->is_freeleech == '1' || $freeleech_token)
@if ($freeleech_token)
<span class="badge-extra text-bold">
<i class="{{ config('other.font-awesome') }} fa-coins text-bold"></i> @lang('common.fl_token')
@@ -405,9 +426,25 @@
</span>
@endif
@if ($torrent->free == '1')
@if ($torrent->free >= '90')
<span class="badge-extra text-bold">
<i class="{{ config('other.font-awesome') }} fa-star text-gold"></i> 100% @lang('common.free')
<i class="{{ config('other.font-awesome') }} fa-star text-gold"></i> {{ $torrent->free }}% @lang('common.free')
</span>
@elseif ($torrent->free < '90' && $torrent->free >= '30')
<style>
.star50 {position: relative;}
.star50:after {content: "\f005";position: absolute;left: 0;top: 0;width: 50%;overflow: hidden;color: #FFB800;}
</style>
<span class="badge-extra text-bold">
<i class="star50 {{ config('other.font-awesome') }} fa-star"></i> {{ $torrent->free }}% @lang('common.free')
</span>
@elseif ($torrent->free < '30' && $torrent->free != '0')
<style>
.star30 {position: relative;}
.star30:after {content: "\f005";position: absolute;left: 0;top: 0;width: 30%;overflow: hidden;color: #FFB800;}
</style>
<span class="badge-extra text-bold">
<i class="star30 {{ config('other.font-awesome') }} fa-star"></i> {{ $torrent->free }}% @lang('common.free')
</span>
@endif
@@ -651,16 +688,62 @@
@if ($torrent->free == 0)
<form action="{{ route('torrent_fl', ['id' => $torrent->id]) }}" method="POST" style="display: inline;">
@csrf
<button type="submit" class="btn btn-xs btn-success">
<i class="{{ config('other.font-awesome') }} fa-star"></i> @lang('torrent.grant') @lang('torrent.freeleech')
</button>
<div x-data="{total_value:0}" style="display: flex; margin-bottom: 5px;">
<input type="range"
x-model="total_value" min="0" max="100" step="25" list="steplist"
name="freeleech" value="{{ $torrent->free ?? '0' }}"
/>
<datalist id="steplist">
<option>0</option>
<option>25</option>
<option>50</option>
<option>75</option>
<option>100</option>
</datalist>
<button style="width:80%;" type="submit" class="btn btn-xs btn-success">
<i class="{{ config('other.font-awesome') }} fa-star"></i> @lang('torrent.grant') <span x-text="total_value"></span>% @lang('torrent.freeleech')
</button>
</div>
</form>
@else
<form action="{{ route('torrent_fl', ['id' => $torrent->id]) }}" method="POST" style="display: inline;">
@csrf
@elseif ($torrent->featured)
<form action="{{ route('torrent_fl', ['id' => $torrent->id]) }}" method="POST" style="display: inline;">
@csrf
<div x-data="{total_value:0}" style="display: flex; margin-bottom: 5px;">
<input disabled type="range"
x-model="total_value" min="0" max="100" step="25" list="steplist"
name="freeleech" value="{{ $torrent->free ?? '0' }}"
/>
<datalist id="steplist">
<option>0</option>
<option>25</option>
<option>50</option>
<option>75</option>
<option>100</option>
</datalist>
<button type="submit" class="btn btn-xs btn-danger">
<i class="{{ config('other.font-awesome') }} fa-star"></i> @lang('torrent.revoke') @lang('torrent.freeleech')
</button>
</div>
</form>
@else
<form action="{{ route('torrent_fl', ['id' => $torrent->id]) }}" method="POST" style="display: inline;">
@csrf
<div x-data="{total_value:0}" style="display: flex; margin-bottom: 5px;">
<input disabled type="range"
x-model="total_value" min="0" max="100" step="25" list="steplist"
name="freeleech" value="{{ $torrent->free ?? '0' }}"
/>
<datalist id="steplist">
<option>0</option>
<option>25</option>
<option>50</option>
<option>75</option>
<option>100</option>
</datalist>
<button type="submit" class="btn btn-xs btn-danger">
<i class="{{ config('other.font-awesome') }} fa-star"></i> @lang('torrent.revoke') {{ $torrent->free ?? '0' }}% @lang('torrent.freeleech')
</button>
</div>
</form>
@endif