diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index 2f2194546..092c884de 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -50,8 +50,8 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use Intervention\Image\Facades\Image; -use MarcReichel\IGDBLaravel\Models\Character; use MarcReichel\IGDBLaravel\Models\Game; +use MarcReichel\IGDBLaravel\Models\PlatformLogo; /** * @see \Tests\Todo\Feature\Http\Controllers\TorrentControllerTest @@ -159,7 +159,12 @@ class TorrentController extends Controller /** * Display The Torrent. * - * @param \App\Models\Torrent $id + * @param \Illuminate\Http\Request $request + * @param \App\Models\Torrent $id + * + * @throws \JsonException + * @throws \MarcReichel\IGDBLaravel\Exceptions\MissingEndpointException + * @throws \ReflectionException */ public function torrent(Request $request, $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View { @@ -175,6 +180,7 @@ class TorrentController extends Controller $meta = null; $trailer = null; + $platforms = null; if ($torrent->category->tv_meta && $torrent->tmdb && $torrent->tmdb != 0) { $meta = Tv::with('genres', 'cast', 'companies', 'networks', 'recommendations')->where('id', '=', $torrent->tmdb)->first(); $trailer = ( new \App\Services\Tmdb\Client\TV($torrent->tmdb))->get_trailer(); @@ -185,10 +191,19 @@ class TorrentController extends Controller $trailer = ( new \App\Services\Tmdb\Client\Movie($torrent->tmdb))->get_trailer(); } - $characters = null; if ($torrent->category->game_meta && ($torrent->igdb || $torrent->igdb != 0)) { - $meta = Game::with(['cover' => ['url', 'image_id'], 'artworks' => ['url', 'image_id'], 'genres' => ['name']])->find($torrent->igdb); - $characters = Character::whereIn('games', [$torrent->igdb])->take(6)->get(); + $meta = Game::with([ + 'cover' => ['url', 'image_id'], + 'artworks' => ['url', 'image_id'], + 'genres' => ['name'], + 'videos' => ['video_id', 'name'], + 'involved_companies.company', + 'involved_companies.company.logo', + 'platforms']) + ->find($torrent->igdb); + $link = collect($meta->videos)->take(1)->pluck('video_id'); + $trailer = 'https://www.youtube.com/embed/'.$link; + $platforms = PlatformLogo::whereIn('id', collect($meta->platforms)->pluck('platform_logo')->toArray())->get(); } $featured = $torrent->featured == 1 ? FeaturedTorrent::where('torrent_id', '=', $id)->first() : null; @@ -208,7 +223,7 @@ class TorrentController extends Controller 'freeleech_token' => $freeleechToken, 'meta' => $meta, 'trailer' => $trailer, - 'characters' => $characters, + 'platforms' => $platforms, 'total_tips' => $totalTips, 'user_tips' => $userTips, 'featured' => $featured, diff --git a/composer.json b/composer.json index 05c2471f1..7e85af4cb 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "league/flysystem-cached-adapter": "~1.0", "league/flysystem-sftp": "~1.0", "livewire/livewire": "^2.0", - "marcreichel/igdb-laravel": "^2.1.0", + "marcreichel/igdb-laravel": "^3.1.2", "mews/purifier": "^3.2", "paragonie/constant_time_encoding": "^2.0", "predis/predis": "^1.1", diff --git a/composer.lock b/composer.lock index 7b2025375..071b8ae45 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "72ca7985df39d8775ca92d1d6be838da", + "content-hash": "2cdb93faee4c22dfdd7ae1fca66d07e6", "packages": [ { "name": "andkab/laravel-joypixels", @@ -3047,26 +3047,27 @@ }, { "name": "marcreichel/igdb-laravel", - "version": "2.4.6", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/marcreichel/igdb-laravel.git", - "reference": "aaaf7da764553f4318688266db0850c5164b25f2" + "reference": "2d12908bf9f18d11e74094256fb3cd41f03d1517" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/marcreichel/igdb-laravel/zipball/aaaf7da764553f4318688266db0850c5164b25f2", - "reference": "aaaf7da764553f4318688266db0850c5164b25f2", + "url": "https://api.github.com/repos/marcreichel/igdb-laravel/zipball/2d12908bf9f18d11e74094256fb3cd41f03d1517", + "reference": "2d12908bf9f18d11e74094256fb3cd41f03d1517", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/guzzle": "~6.0|~7.0", "laravel/framework": "^8.40.0", - "php": "^7.3 | ^7.4 | ^8.0" + "php": "^8.0" }, "require-dev": { "nunomaduro/collision": "^5.3", + "nunomaduro/larastan": "^0.7.13", "orchestra/testbench": "^6.0", "phpunit/phpunit": "^9.5.4", "roave/security-advisories": "dev-latest" @@ -3105,7 +3106,7 @@ ], "support": { "issues": "https://github.com/marcreichel/igdb-laravel/issues", - "source": "https://github.com/marcreichel/igdb-laravel/tree/2.4.6" + "source": "https://github.com/marcreichel/igdb-laravel/tree/3.1.2" }, "funding": [ { @@ -3113,7 +3114,7 @@ "type": "github" } ], - "time": "2021-06-27T09:36:13+00:00" + "time": "2021-10-23T07:45:35+00:00" }, { "name": "mews/purifier", diff --git a/config/igdb.php b/config/igdb.php index e635b9024..77b711423 100644 --- a/config/igdb.php +++ b/config/igdb.php @@ -16,7 +16,7 @@ return [ * These are the credentials you got from https://dev.twitch.tv/console/apps */ 'credentials' => [ - 'client_id' => env('TWITCH_CLIENT_ID', ''), + 'client_id' => env('TWITCH_CLIENT_ID', ''), 'client_secret' => env('TWITCH_CLIENT_SECRET', ''), ], @@ -29,7 +29,15 @@ return [ 'cache_lifetime' => env('IGDB_CACHE_LIFETIME', 3600), /* - * This is the per-page limit for your tier. + * Path where the webhooks should be handled. */ - 'per_page_limit' => 500, -]; + 'webhook_path' => 'igdb-webhook/handle', + + /* + * The webhook secret. + * + * This needs to be a string of your choice in order to use the webhook + * functionality. + */ + 'webhook_secret' => env('IGDB_WEBHOOK_SECRET'), +]; \ No newline at end of file diff --git a/public/img/igdb.png b/public/img/igdb.png new file mode 100644 index 000000000..0f6dd9e92 Binary files /dev/null and b/public/img/igdb.png differ diff --git a/resources/views/category/show.blade.php b/resources/views/category/show.blade.php index c91f370e1..fcefc66e7 100644 --- a/resources/views/category/show.blade.php +++ b/resources/views/category/show.blade.php @@ -41,403 +41,367 @@
| Poster | - @else -- @endif - | @lang('torrent.category') | -@lang('torrent.type')/@lang('torrent.resolution') | -@lang('common.name') | -- | - | - | - | + | + | + | + @lang('common.name') + | +
+
+
+
+ |
+
+
+
+
+ |
+ + + | ++ + | ++ + | ++ + | ++ @lang('common.created_at') + | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
- @if ($user->show_poster == 1)
-
- @if ($torrent->category->movie_meta || $torrent->category->tv_meta)
-
+ @if ($user->show_poster == 1)
+ |
-
-
+ @if ($torrent->category->movie_meta || $torrent->category->tv_meta)
+
- @else
-
- @endif
-
+ @endif
+
+ @if ($torrent->category->music_meta)
+
+ @else
+
- @endif
-
- @if ($torrent->category->music_meta)
-
- @else
-
- @if ($torrent->category->image != null)
-
- |
-
-
-
-
- @else
-
-
-
-
-
- @endif
-
- |
-
- {{ $torrent->type->name }}
-
+ @endif
-
-
- {{ $torrent->resolution->name ?? 'No Res' }}
-
+ @else
+
+ @endif
+
+
+ |
-
-
+
-
-
- {{ $torrent->name }}
-
-
- @if ($current = $user->history->where('info_hash', $torrent->info_hash)->first())
- @if ($current->seeder == 1 && $current->active == 1)
-
- @endif
-
- @if ($current->seeder == 0 && $current->active == 1)
-
- @endif
-
- @if ($current->seeder == 0 && $current->active == 0 && $current->completed_at == null)
-
- @endif
-
- @if ($current->seeder == 1 && $current->active == 0 && $current->completed_at != null)
-
- @endif
- @endif
-
- |
+ - @if ($torrent->anon == 1) - - @lang('common.anonymous') - @if ($user->id == $torrent->user->id || $user->group->is_modo) - - ({{ $torrent->user->username }}) - @endif - - @else - - - - {{ $torrent->user->username }} - - - @endif - - @if ($torrent->category->movie_meta || $torrent->category->tv_meta) - -
+
+ {{ $torrent->name }}
+
+ @if ($current = $user->history->where('info_hash', $torrent->info_hash)->first())
+ @if ($current->seeder == 1 && $current->active == 1)
+
+ @endif
+
+ @if ($current->seeder == 0 && $current->active == 1)
+
+ @endif
+
+ @if ($current->seeder == 0 && $current->active == 0 && $current->completed_at == null)
+
+ @endif
+
+ @if ($current->seeder == 1 && $current->active == 0 && $current->completed_at != null)
+
+ @endif
+ @endif
+ |
-
- + @if ($torrent->anon === 0) + + + + {{ $torrent->user->username }} + + + @else + + + {{ strtoupper(trans('common.anonymous')) }} + @if ($user->group->is_modo || $torrent->user->username === $user->username) + + ({{ $torrent->user->username }}) - - @if ($torrent->internal == 1) - + @endif + + @endif + + {{ $torrent->thanks_count }} + + + {{ $torrent->comments_count }} + + @if ($torrent->internal == 1) + - @endif + @endif - @if ($torrent->stream == 1) - + @if ($torrent->personal_release == 1) + + + + @endif + + @if ($torrent->stream == 1) + - @endif + @endif - @if ($torrent->featured == 0) - @if ($torrent->doubleup == 1) - + @if ($torrent->featured == 0) + @if ($torrent->doubleup == 1) + - @endif - @if ($torrent->free == 1) - + @endif + @if ($torrent->free == 1) + - @endif @endif + @endif - @if ($personal_freeleech) - + @if ($personal_freeleech) + - @endif + @endif - @if ($user->freeleechTokens->where('torrent_id', $torrent->id)->first()) - + @if ($user->freeleechTokens->where('torrent_id', $torrent->id)->first()) + - @endif + @endif - @if ($torrent->featured == 1) - + @if ($torrent->featured == 1) + - @endif + @endif - @if ($user->group->is_freeleech == 1) - + @if ($user->group->is_freeleech == 1) + - @endif + @endif - @if (config('other.freeleech') == 1) - + @if (config('other.freeleech') == 1) + - @endif + @endif - @if (config('other.doubleup') == 1) - + @if (config('other.doubleup') == 1) + - @endif + @endif - @if ($user->group->is_double_upload == 1) - - - - @endif + @if ($user->group->is_double_upload == 1) + + + + @endif - @if ($torrent->leechers >= 5) - + @if ($torrent->leechers >= 5) + - @endif + @endif - @if ($torrent->sticky == 1) - + @if ($torrent->sticky == 1) + - @endif + @endif - @if ($user->updated_at->getTimestamp() < $torrent->created_at->getTimestamp()) - - - - @endif + @if ($torrent->highspeed == 1) + + + + @endif - @if ($torrent->highspeed == 1) - - - - @endif + @if ($torrent->sd == 1) + + + + @endif - @if ($torrent->sd == 1) - - - - @endif - - - - @if ($torrent->category->game_meta) - @if (isset($meta) && $meta->genres) - @foreach ($meta->genres as $genre) - - {{ $genre->name }} - - @endforeach - @endif - @endif - - @if ($torrent->category->movie_meta || $torrent->category->tv_meta) - @if (isset($meta) && $meta->genres) - @foreach($meta->genres as $genre) - - {{ $genre->name }} - - @endforeach - @endif - @endif -
- @if (file_exists(public_path().'/files/torrents/'.$torrent->file_name))
- @if (config('torrent.download_check_page') == 1)
-
-
-
- @else
-
-
-
- @endif
- @else
-
-
-
- @endif
- |
-
-
-
- |
-
-
-
- |
-
- {{ $torrent->getSize() }}
- |
-
-
-
- {{ $torrent->seeders }}
-
+ @if ($torrent->bumped_at != $torrent->created_at && $torrent->bumped_at < Carbon\Carbon::now()->addDay(2))
+
+
+
+ @endif
+ |
+
+ @if (config('torrent.download_check_page') == 1)
+
+
- |
-
-
-
- {{ $torrent->leechers }}
-
+ @else
+
+
- |
-
-
-
- {{ $torrent->times_completed }} @lang('common.times')
-
+ @endif
+ @if (config('torrent.magnet') == 1)
+
+
- |
-
+ @livewire('small-bookmark-button', ['torrent' => $torrent->id], key($torrent->id))
+
+ |
+
+ @if ($torrent->category->game_meta)
+
+ {{ $torrent->igdb }}
+ + + + @endif + @if ($torrent->category->movie_meta || $torrent->category->tv_meta) + + + {{ $torrent->tmdb }}
+
+ + + + @endif + |
+ + + {{ $torrent->getSize() }} + + | ++ + + {{ $torrent->seeders }} + + + | ++ + + {{ $torrent->leechers }} + + + | ++ + + {{ $torrent->times_completed }} + + + | ++ + {{ $torrent->created_at->diffForHumans() }} + + | +
category->game_meta)
+
@endif
@if ($torrent->category->music_meta)
-
{{ $torrent->tmdb }}
-
-
{{ $torrent->igdb }}
+
{{ $torrent->tmdb }}
+
+