From e269456d77cb17e768c7d519be354398caa06ef2 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 11:38:02 -0400 Subject: [PATCH 01/51] add: resolutions migration --- app/Models/Resolution.php | 69 +++++++++++++++++++ ..._06_06_185230_create_resolutions_table.php | 44 ++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 app/Models/Resolution.php create mode 100644 database/migrations/2020_06_06_185230_create_resolutions_table.php diff --git a/app/Models/Resolution.php b/app/Models/Resolution.php new file mode 100644 index 0000000000..6741738358 --- /dev/null +++ b/app/Models/Resolution.php @@ -0,0 +1,69 @@ +hasMany(Torrent::class); + } + + /** + * Has Many Torrent Requests. + * + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function requests() + { + return $this->hasMany(TorrentRequest::class); + } +} diff --git a/database/migrations/2020_06_06_185230_create_resolutions_table.php b/database/migrations/2020_06_06_185230_create_resolutions_table.php new file mode 100644 index 0000000000..4d25957055 --- /dev/null +++ b/database/migrations/2020_06_06_185230_create_resolutions_table.php @@ -0,0 +1,44 @@ + + * @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 + */ + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +class CreateResolutionsTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('resolutions', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('name'); + $table->string('slug'); + $table->integer('position'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('resolutions'); + } +} From bfb8600e4fe76c1c5ba22cce3d443f3515110ad6 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 11:39:17 -0400 Subject: [PATCH 02/51] Revert "add: resolutions migration" This reverts commit e269456d77cb17e768c7d519be354398caa06ef2. --- app/Models/Resolution.php | 69 ------------------- ..._06_06_185230_create_resolutions_table.php | 44 ------------ 2 files changed, 113 deletions(-) delete mode 100644 app/Models/Resolution.php delete mode 100644 database/migrations/2020_06_06_185230_create_resolutions_table.php diff --git a/app/Models/Resolution.php b/app/Models/Resolution.php deleted file mode 100644 index 6741738358..0000000000 --- a/app/Models/Resolution.php +++ /dev/null @@ -1,69 +0,0 @@ -hasMany(Torrent::class); - } - - /** - * Has Many Torrent Requests. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function requests() - { - return $this->hasMany(TorrentRequest::class); - } -} diff --git a/database/migrations/2020_06_06_185230_create_resolutions_table.php b/database/migrations/2020_06_06_185230_create_resolutions_table.php deleted file mode 100644 index 4d25957055..0000000000 --- a/database/migrations/2020_06_06_185230_create_resolutions_table.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 - */ - -use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; - -class CreateResolutionsTable extends Migration -{ - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('resolutions', function (Blueprint $table) { - $table->bigIncrements('id'); - $table->string('name'); - $table->string('slug'); - $table->integer('position'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('resolutions'); - } -} From a1e80374b1d4f7fdf6bffcfe33c8eb1c930edcce Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 11:42:02 -0400 Subject: [PATCH 03/51] add: resolutions migration --- ..._06_06_185230_create_resolutions_table.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 database/migrations/2020_06_06_185230_create_resolutions_table.php diff --git a/database/migrations/2020_06_06_185230_create_resolutions_table.php b/database/migrations/2020_06_06_185230_create_resolutions_table.php new file mode 100644 index 0000000000..c2e3b79cb1 --- /dev/null +++ b/database/migrations/2020_06_06_185230_create_resolutions_table.php @@ -0,0 +1,44 @@ + + * @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 + */ + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +class CreateResolutionsTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('resolutions', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('name'); + $table->string('slug'); + $table->integer('position'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('resolutions'); + } +} \ No newline at end of file From 870b5be03569155cfbd02a70753551082a1d2254 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 11:42:48 -0400 Subject: [PATCH 04/51] add: resolution model --- app/Models/Resolution.php | 69 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 app/Models/Resolution.php diff --git a/app/Models/Resolution.php b/app/Models/Resolution.php new file mode 100644 index 0000000000..6741738358 --- /dev/null +++ b/app/Models/Resolution.php @@ -0,0 +1,69 @@ +hasMany(Torrent::class); + } + + /** + * Has Many Torrent Requests. + * + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function requests() + { + return $this->hasMany(TorrentRequest::class); + } +} From 5a37509b9a2b278ebbe2410137b85fe6f0a86690 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 11:46:31 -0400 Subject: [PATCH 05/51] add: staff resolution controller --- .../Staff/ResolutionController.php | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 app/Http/Controllers/Staff/ResolutionController.php diff --git a/app/Http/Controllers/Staff/ResolutionController.php b/app/Http/Controllers/Staff/ResolutionController.php new file mode 100644 index 0000000000..b42356b85e --- /dev/null +++ b/app/Http/Controllers/Staff/ResolutionController.php @@ -0,0 +1,138 @@ + + * @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 + */ + +namespace App\Http\Controllers\Staff; + +use App\Http\Controllers\Controller; +use App\Models\Resolution; +use Illuminate\Http\Request; +use Illuminate\Support\Str; + +class ResolutionController extends Controller +{ + /** + * Display All Resolutions. + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function index() + { + $resolutions = Resolution::all()->sortBy('position'); + + return view('Staff.resolution.index', ['resolutions' => $resolutions]); + } + + /** + * Show Resolution Create Form. + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function create() + { + return view('Staff.resolution.create'); + } + + /** + * Store A New Resolution. + * + * @param \Illuminate\Http\Request $request + * + * @return \Illuminate\Http\RedirectResponse + */ + public function store(Request $request) + { + $resolution = new Resolution(); + $resolution->name = $request->input('name'); + $resolution->slug = Str::slug($resolution->name); + $resolution->position = $request->input('position'); + + $v = validator($resolution->toArray(), [ + 'name' => 'required', + 'slug' => 'required', + 'position' => 'required', + ]); + + if ($v->fails()) { + return redirect()->route('staff.resolutions.index') + ->withErrors($v->errors()); + } else { + $resolution->save(); + + return redirect()->route('staff.resolutions.index') + ->withSuccess('Resolution Successfully Added'); + } + } + + /** + * Resolution Edit Form. + * + * @param $id + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function edit($id) + { + $resolution = Resolution::findOrFail($id); + + return view('Staff.resolution.edit', ['resolution' => $resolution]); + } + + /** + * Edit A Resolution. + * + * @param \Illuminate\Http\Request $request + * @param $id + * + * @return Illuminate\Http\RedirectResponse + */ + public function update(Request $request, $id) + { + $resolution = Resolution::findOrFail($id); + $resolution->name = $request->input('name'); + $resolution->slug = Str::slug($resolution->name); + $resolution->position = $request->input('position'); + + $v = validator($resolution->toArray(), [ + 'name' => 'required', + 'slug' => 'required', + 'position' => 'required', + ]); + + if ($v->fails()) { + return redirect()->route('staff.resolutions.index') + ->withErrors($v->errors()); + } else { + $resolution->save(); + + return redirect()->route('staff.resolutions.index') + ->withSuccess('Resolution Successfully Modified'); + } + } + + /** + * Delete A Resolution. + * + * @param $id + * + * @return Illuminate\Http\RedirectResponse + * @throws \Exception + */ + public function destroy($id) + { + $resolution = Resolution::findOrFail($id); + $resolution->delete(); + + return redirect()->route('staff.resolutions.index') + ->withSuccess('Resolution Successfully Deleted'); + } +} From 7a86b12afca1578037eb5c0f560355c9527ef729 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 11:48:32 -0400 Subject: [PATCH 06/51] add: staff resolution views --- .../views/Staff/resolution/create.blade.php | 42 ++++++++++++++ .../views/Staff/resolution/edit.blade.php | 44 +++++++++++++++ .../views/Staff/resolution/index.blade.php | 56 +++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 resources/views/Staff/resolution/create.blade.php create mode 100644 resources/views/Staff/resolution/edit.blade.php create mode 100644 resources/views/Staff/resolution/index.blade.php diff --git a/resources/views/Staff/resolution/create.blade.php b/resources/views/Staff/resolution/create.blade.php new file mode 100644 index 0000000000..245d1fc643 --- /dev/null +++ b/resources/views/Staff/resolution/create.blade.php @@ -0,0 +1,42 @@ +@extends('layout.default') + +@section('breadcrumb') +
  • + +
  • +
  • + +
  • +
  • + +
  • +@endsection + +@section('content') +
    +

    Add A Torrent Resolution

    +
    + @csrf +
    + + +
    +
    + + +
    + + +
    +
    +@endsection diff --git a/resources/views/Staff/resolution/edit.blade.php b/resources/views/Staff/resolution/edit.blade.php new file mode 100644 index 0000000000..8e8e433cd0 --- /dev/null +++ b/resources/views/Staff/resolution/edit.blade.php @@ -0,0 +1,44 @@ +@extends('layout.default') + +@section('breadcrumb') +
  • + +
  • +
  • + +
  • +
  • + +
  • +@endsection + +@section('content') +
    +

    @lang('common.edit') A Torrent Resolution

    +
    + @method('PATCH') + @csrf +
    + + +
    + +
    + + +
    + + +
    +
    +@endsection diff --git a/resources/views/Staff/resolution/index.blade.php b/resources/views/Staff/resolution/index.blade.php new file mode 100644 index 0000000000..7dedb8239f --- /dev/null +++ b/resources/views/Staff/resolution/index.blade.php @@ -0,0 +1,56 @@ +@extends('layout.default') + +@section('breadcrumb') +
  • + +
  • +
  • + +
  • +@endsection + +@section('content') +
    +

    @lang('common.resolutions')

    + Add A Torrent Resolution + +
    + + + + + + + + + + @foreach ($resolutions as $resolution) + + + + + + @endforeach + +
    @lang('common.position')@lang('common.name')@lang('common.action')
    + {{ $resolution->position }} + + + {{ $resolution->name }} + + +
    + @csrf + @method('DELETE') + @lang('common.edit') + +
    +
    +
    +
    +@endsection From cbe5baeea1331a7ffe7f6ca217517b7c16168d6b Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 11:49:49 -0400 Subject: [PATCH 07/51] add: staff resolution routes --- routes/web.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/routes/web.php b/routes/web.php index a64f305b02..152101ba5a 100755 --- a/routes/web.php +++ b/routes/web.php @@ -798,6 +798,18 @@ }); }); + // Resolutions + Route::group(['prefix' => 'resolutions'], function () { + Route::name('staff.resolutions.')->group(function () { + Route::get('/', 'ResolutionController@index')->name('index'); + Route::get('/create', 'ResolutionController@create')->name('create'); + Route::post('/store', 'ResolutionController@store')->name('store'); + Route::get('/{id}/edit', 'ResolutionController@edit')->name('edit'); + Route::patch('/{id}/update', 'ResolutionController@update')->name('update'); + Route::delete('/{id}/destroy', 'ResolutionController@destroy')->name('destroy'); + }); + }); + // RSS System Route::group(['prefix' => 'rss'], function () { Route::name('staff.rss.')->group(function () { From 394716be51f41cacca9f19d5f9a2ef7889d73fcf Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 11:53:44 -0400 Subject: [PATCH 08/51] update: torrent upload view --- resources/views/torrent/upload.blade.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/resources/views/torrent/upload.blade.php b/resources/views/torrent/upload.blade.php index 0eb4dde395..3f49d00274 100644 --- a/resources/views/torrent/upload.blade.php +++ b/resources/views/torrent/upload.blade.php @@ -102,6 +102,20 @@ +
    + + +
    + @php $data = App\Models\Category::where('id', '=', isset($category_id) ? $category_id : old('category_id'))->first();@endphp @if ($data->movie_meta || $data->tv_meta)
    From 66b2d07e711fba643ba6f440a3e30f8b197657f7 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 11:59:21 -0400 Subject: [PATCH 09/51] update: torrent edit view --- resources/views/torrent/edit_torrent.blade.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/resources/views/torrent/edit_torrent.blade.php b/resources/views/torrent/edit_torrent.blade.php index 573c06402a..a347cb5d44 100644 --- a/resources/views/torrent/edit_torrent.blade.php +++ b/resources/views/torrent/edit_torrent.blade.php @@ -84,6 +84,20 @@
    + +
    + + +
    From 9422f54f3bf45b2feeec781f3386dc8e8d9c8690 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 11:59:46 -0400 Subject: [PATCH 10/51] update: torrents list view --- resources/views/torrent/torrents.blade.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/resources/views/torrent/torrents.blade.php b/resources/views/torrent/torrents.blade.php index 1ddcc85ec2..a9c58083d4 100644 --- a/resources/views/torrent/torrents.blade.php +++ b/resources/views/torrent/torrents.blade.php @@ -139,6 +139,21 @@ class="type facetedSearch" trigger="click"> {{ $type }} @endforeach
    + +
    + +
    + @foreach ($repository->resolutions() as $id => $resolution) + + + + @endforeach +
    +
    + +
    + +
    + @foreach ($repository->resolutions() as $id => $resolution) + + + + @endforeach +
    +
    +
    + +
    + @foreach ($repository->resolutions() as $id => $resolution) + + + + @endforeach +
    +
    +
    diff --git a/resources/views/torrent/torrents.blade.php b/resources/views/torrent/torrents.blade.php index a9c58083d4..72977f36bd 100644 --- a/resources/views/torrent/torrents.blade.php +++ b/resources/views/torrent/torrents.blade.php @@ -141,8 +141,7 @@ class="type facetedSearch" trigger="click"> {{ $type }}
    - +
    @foreach ($repository->resolutions() as $id => $resolution) diff --git a/resources/views/torrent/upload.blade.php b/resources/views/torrent/upload.blade.php index 3f49d00274..f2a436a7cd 100644 --- a/resources/views/torrent/upload.blade.php +++ b/resources/views/torrent/upload.blade.php @@ -103,9 +103,9 @@
    - +
    +
    + +
    + @foreach ($torrent_repository->resolutions() as $id => $resolution) + + + + @endforeach +
    +
    diff --git a/resources/views/Staff/rss/edit.blade.php b/resources/views/Staff/rss/edit.blade.php index b1263d4efa..4a16e5edaa 100644 --- a/resources/views/Staff/rss/edit.blade.php +++ b/resources/views/Staff/rss/edit.blade.php @@ -102,6 +102,24 @@ class="category"> {{ $category }} @endforeach
    +
    + +
    + @foreach ($torrent_repository->resolutions() as $id => $resolution) + + + + @endforeach +
    +
    diff --git a/resources/views/Staff/rss/index.blade.php b/resources/views/Staff/rss/index.blade.php index f6e918429b..6315eafdb3 100644 --- a/resources/views/Staff/rss/index.blade.php +++ b/resources/views/Staff/rss/index.blade.php @@ -26,6 +26,7 @@ @lang('common.position') @lang('common.categories') @lang('common.types') + @lang('common.resolutions') @lang('common.genres') @lang('torrent.discounts') @lang('common.special') @@ -46,6 +47,9 @@ class="{{ config('other.font-awesome') }} fa-times text-red">@endif @if ($rss->object_torrent->types)@else@endif + @if ($rss->object_torrent->resolutions)@else@endif @if ($rss->object_torrent->genres)@else@endif diff --git a/resources/views/rss/create.blade.php b/resources/views/rss/create.blade.php index de6277c6fd..f7d1882aa0 100644 --- a/resources/views/rss/create.blade.php +++ b/resources/views/rss/create.blade.php @@ -81,6 +81,19 @@ class="category"> {{ $category }} @endforeach
    +
    + +
    + @foreach ($torrent_repository->resolutions() as $id => $resolution) + + + + @endforeach +
    +
    diff --git a/resources/views/rss/edit.blade.php b/resources/views/rss/edit.blade.php index 82b4dc53a1..f5bbc7565e 100644 --- a/resources/views/rss/edit.blade.php +++ b/resources/views/rss/edit.blade.php @@ -98,6 +98,24 @@ class="category"> {{ $category }} @endforeach
    +
    + +
    + @foreach ($torrent_repository->resolutions() as $id => $resolution) + + + + @endforeach +
    +
    diff --git a/resources/views/rss/index.blade.php b/resources/views/rss/index.blade.php index 7509116615..3650439b04 100644 --- a/resources/views/rss/index.blade.php +++ b/resources/views/rss/index.blade.php @@ -39,6 +39,7 @@ @lang('common.name') @lang('common.categories') @lang('common.types') + @lang('common.resolutions') @lang('common.genres') @lang('torrent.discounts') @lang('common.special') @@ -59,6 +60,9 @@ class="{{ config('other.font-awesome') }} fa-times text-red">@endif class="{{ config('other.font-awesome') }} fa-check text-green">@else@endif + @if ($rss->object_torrent->resolutions)@else@endif @if ($rss->object_torrent->genres)@else@endif @@ -100,6 +104,7 @@ class="{{ config('other.font-awesome') }} fa-times text-red">@endif @lang('common.name') @lang('common.categories') @lang('common.types') + @lang('common.resolutions') @lang('common.genres') @lang('torrent.discounts') @lang('common.special') @@ -121,6 +126,9 @@ class="{{ config('other.font-awesome') }} fa-times text-red">@endif class="{{ config('other.font-awesome') }} fa-check text-green">@else@endif + @if ($rss->object_torrent->resolutions)@else@endif @if ($rss->object_torrent->genres)@else@endif From 1fc58b98fc2b5b44c8ffe1219fa649d87dac0316 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 21:52:37 -0400 Subject: [PATCH 20/51] update: torrent model --- app/Models/Torrent.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Models/Torrent.php b/app/Models/Torrent.php index 1681f1642f..515f10b93c 100644 --- a/app/Models/Torrent.php +++ b/app/Models/Torrent.php @@ -204,6 +204,16 @@ public function type() return $this->belongsTo(Type::class); } + /** + * Belongs To A Resolution. + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function resolution() + { + return $this->belongsTo(Resolution::class); + } + /** * Torrent Has Been Moderated By. * From c9c59cafc9e48970922513b73352b52df3360bf2 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 21:52:50 -0400 Subject: [PATCH 21/51] update: torrent request model --- app/Models/TorrentRequest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Models/TorrentRequest.php b/app/Models/TorrentRequest.php index 372dff5b68..fa86176f31 100644 --- a/app/Models/TorrentRequest.php +++ b/app/Models/TorrentRequest.php @@ -167,6 +167,16 @@ public function type() return $this->belongsTo(Type::class); } + /** + * Belongs To A Resolution. + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function resolution() + { + return $this->belongsTo(Resolution::class); + } + /** * Belongs To A Torrent. * From 65f427d5789ec8aefea944b448e4a532a511c997 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 21:59:35 -0400 Subject: [PATCH 22/51] update: torrent request controller --- app/Http/Controllers/RequestController.php | 69 +++++++++++++--------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/app/Http/Controllers/RequestController.php b/app/Http/Controllers/RequestController.php index 14d53b6d9b..5f6c5acf10 100644 --- a/app/Http/Controllers/RequestController.php +++ b/app/Http/Controllers/RequestController.php @@ -13,6 +13,7 @@ namespace App\Http\Controllers; +use App\Models\Resolution; use App\Achievements\UserFilled100Requests; use App\Achievements\UserFilled25Requests; use App\Achievements\UserFilled50Requests; @@ -119,6 +120,7 @@ public function faceted(Request $request, TorrentRequest $torrentRequest) $igdb = $request->input('igdb'); $categories = $request->input('categories'); $types = $request->input('types'); + $resolutions = $request->input('resolutions'); $myrequests = $request->input('myrequests'); $terms = explode(' ', $search); @@ -161,6 +163,10 @@ public function faceted(Request $request, TorrentRequest $torrentRequest) $torrentRequest->whereIn('type_id', $types); } + if ($request->has('resolutions') && $request->input('resolutions') != null) { + $torrentRequest->whereIn('resolution_id', $resolutions); + } + if ($request->has('unfilled') && $request->input('unfilled') != null) { $torrentRequest->where('filled_hash', '=', null); } @@ -280,12 +286,13 @@ public function addRequestForm(Request $request, $title = '', $imdb = 0, $tmdb = $user = $request->user(); return view('requests.add_request', [ - 'categories' => Category::all()->sortBy('position'), - 'types' => Type::all()->sortBy('position'), - 'user' => $user, - 'title' => $title, - 'imdb' => str_replace('tt', '', $imdb), - 'tmdb' => $tmdb, + 'categories' => Category::all()->sortBy('position'), + 'types' => Type::all()->sortBy('position'), + 'resolutions' => Resolution::all()->sortBy('position'), + 'user' => $user, + 'title' => $title, + 'imdb' => str_replace('tt', '', $imdb), + 'tmdb' => $tmdb, ]); } @@ -312,22 +319,24 @@ public function addrequest(Request $request) $tr->mal = $request->input('mal'); $tr->igdb = $request->input('igdb'); $tr->type_id = $request->input('type_id'); + $tr->resolution_id = $request->input('resolution_id'); $tr->bounty = $request->input('bounty'); $tr->votes = 1; $tr->anon = $request->input('anon'); $v = validator($tr->toArray(), [ - 'name' => 'required|max:180', - 'imdb' => 'required|numeric', - 'tvdb' => 'required|numeric', - 'tmdb' => 'required|numeric', - 'mal' => 'required|numeric', - 'igdb' => 'required|numeric', - 'category_id' => 'required|exists:categories,id', - 'type_id' => 'required|exists:types,id', - 'description' => 'required|string', - 'bounty' => sprintf('required|numeric|min:0|max:%s', $user->seedbonus), - 'anon' => 'required', + 'name' => 'required|max:180', + 'imdb' => 'required|numeric', + 'tvdb' => 'required|numeric', + 'tmdb' => 'required|numeric', + 'mal' => 'required|numeric', + 'igdb' => 'required|numeric', + 'category_id' => 'required|exists:categories,id', + 'type_id' => 'required|exists:types,id', + 'resolution_id' => 'required|exists:resolutions,id', + 'description' => 'required|string', + 'bounty' => sprintf('required|numeric|min:0|max:%s', $user->seedbonus), + 'anon' => 'required', ]); if ($v->fails()) { @@ -384,6 +393,7 @@ public function editRequestForm(Request $request, $id) return view('requests.edit_request', [ 'categories' => Category::all()->sortBy('position'), 'types' => Type::all()->sortBy('position'), + 'resolutions' => Resolution::all()->sortBy('position'), 'user' => $user, 'torrentRequest' => $torrentRequest, ]); } @@ -411,6 +421,7 @@ public function editrequest(Request $request, $id) $igdb = $request->input('igdb'); $category = $request->input('category_id'); $type = $request->input('type_id'); + $resolution = $request->input('resolution_id'); $description = $request->input('description'); $anon = $request->input('anon'); @@ -422,20 +433,22 @@ public function editrequest(Request $request, $id) $torrentRequest->igdb = $igdb; $torrentRequest->category_id = $category; $torrentRequest->type_id = $type; + $torrentRequest->resolution_id = $resolution; $torrentRequest->description = $description; $torrentRequest->anon = $anon; $v = validator($torrentRequest->toArray(), [ - 'name' => 'required|max:180', - 'imdb' => 'required|numeric', - 'tvdb' => 'required|numeric', - 'tmdb' => 'required|numeric', - 'mal' => 'required|numeric', - 'igdb' => 'required|numeric', - 'category_id' => 'required|exists:categories,id', - 'type_id' => 'required|exists:types,id', - 'description' => 'required|string', - 'anon' => 'required', + 'name' => 'required|max:180', + 'imdb' => 'required|numeric', + 'tvdb' => 'required|numeric', + 'tmdb' => 'required|numeric', + 'mal' => 'required|numeric', + 'igdb' => 'required|numeric', + 'category_id' => 'required|exists:categories,id', + 'type_id' => 'required|exists:types,id', + 'resolution_id' => 'required|exists:resolutions,id', + 'description' => 'required|string', + 'anon' => 'required', ]); if ($v->fails()) { @@ -681,6 +694,7 @@ public function rejectRequest(Request $request, $id) * @param \App\Models\TorrentRequest $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function deleteRequest(Request $request, $id) { @@ -744,6 +758,7 @@ public function claimRequest(Request $request, $id) * @param \App\Models\TorrentRequest $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function unclaimRequest(Request $request, $id) { From 4e19b2a0eefb6ded4b70cce367b4e8208c84d285 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 22:07:54 -0400 Subject: [PATCH 23/51] add: torrents/requests resolution_id migrations --- ...38_add_resolution_id_to_torrents_table.php | 58 +++++++++++++++++++ ...32_add_resolution_id_to_requests_table.php | 45 ++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 database/migrations/2020_06_07_023938_add_resolution_id_to_torrents_table.php create mode 100644 database/migrations/2020_06_07_054632_add_resolution_id_to_requests_table.php diff --git a/database/migrations/2020_06_07_023938_add_resolution_id_to_torrents_table.php b/database/migrations/2020_06_07_023938_add_resolution_id_to_torrents_table.php new file mode 100644 index 0000000000..bc6e690ff6 --- /dev/null +++ b/database/migrations/2020_06_07_023938_add_resolution_id_to_torrents_table.php @@ -0,0 +1,58 @@ + + * @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 + */ + +use App\Models\Torrent; +use App\Models\Type; +use App\Models\Resolution; +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +class AddResolutionIdToTorrentsTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::table('torrents', function (Blueprint $table) { + $table->integer('resolution_id')->index(); + }); + + if (Schema::hasColumn('torrents', 'resolution')) { + foreach (Torrent::all() as $torrent) { + $resolution_id = Resolution::where('name', '=', $torrent->resolution)->firstOrFail()->id; + $torrent->resolution_id = $resolution_id; + $torrent->save(); + } + + Schema::table('torrents', function (Blueprint $table) { + $table->dropColumn('resolution'); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('torrents', function (Blueprint $table) { + // + }); + } +} diff --git a/database/migrations/2020_06_07_054632_add_resolution_id_to_requests_table.php b/database/migrations/2020_06_07_054632_add_resolution_id_to_requests_table.php new file mode 100644 index 0000000000..dc451c88a6 --- /dev/null +++ b/database/migrations/2020_06_07_054632_add_resolution_id_to_requests_table.php @@ -0,0 +1,45 @@ + + * @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 + */ + +use App\Models\TorrentRequest; +use App\Models\Type; +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +class AddResolutionIdToRequestsTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::table('requests', function (Blueprint $table) { + $table->integer('resolution_id')->index(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('requests', function (Blueprint $table) { + // + }); + } +} From c8adeb7d35881f2ab4c22b5ea1529de8b3a7f648 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sun, 7 Jun 2020 02:09:28 +0000 Subject: [PATCH 24/51] Apply fixes from StyleCI [ci skip] [skip ci] --- app/Http/Controllers/RequestController.php | 8 ++++--- app/Http/Controllers/RssController.php | 8 ++++--- .../Staff/ResolutionController.php | 21 +++++++++---------- app/Http/Controllers/Staff/RssController.php | 2 +- app/Http/Controllers/TorrentController.php | 2 +- app/Models/Resolution.php | 2 ++ app/Models/Rss.php | 6 +++--- app/Repositories/RequestFacetedRepository.php | 2 +- app/Repositories/TorrentFacetedRepository.php | 2 +- ..._06_06_185230_create_resolutions_table.php | 2 +- ...38_add_resolution_id_to_torrents_table.php | 3 +-- ...32_add_resolution_id_to_requests_table.php | 2 -- 12 files changed, 31 insertions(+), 29 deletions(-) diff --git a/app/Http/Controllers/RequestController.php b/app/Http/Controllers/RequestController.php index 5f6c5acf10..ee1fc85913 100644 --- a/app/Http/Controllers/RequestController.php +++ b/app/Http/Controllers/RequestController.php @@ -13,13 +13,13 @@ namespace App\Http\Controllers; -use App\Models\Resolution; use App\Achievements\UserFilled100Requests; use App\Achievements\UserFilled25Requests; use App\Achievements\UserFilled50Requests; use App\Achievements\UserFilled75Requests; use App\Models\BonTransactions; use App\Models\Category; +use App\Models\Resolution; use App\Models\Torrent; use App\Models\TorrentRequest; use App\Models\TorrentRequestBounty; @@ -693,8 +693,9 @@ public function rejectRequest(Request $request, $id) * @param \Illuminate\Http\Request $request * @param \App\Models\TorrentRequest $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function deleteRequest(Request $request, $id) { @@ -757,8 +758,9 @@ public function claimRequest(Request $request, $id) * @param \Illuminate\Http\Request $request * @param \App\Models\TorrentRequest $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function unclaimRequest(Request $request, $id) { diff --git a/app/Http/Controllers/RssController.php b/app/Http/Controllers/RssController.php index 8a2575f0d3..f2e9e015bc 100644 --- a/app/Http/Controllers/RssController.php +++ b/app/Http/Controllers/RssController.php @@ -15,12 +15,12 @@ use App\Models\Category; use App\Models\Group; +use App\Models\Resolution; use App\Models\Rss; use App\Models\TagTorrent; use App\Models\Torrent; use App\Models\Type; use App\Models\User; -use App\Models\Resolution; use App\Repositories\TorrentFacetedRepository; use Illuminate\Http\Request; @@ -144,8 +144,9 @@ public function store(Request $request) * @param int $id * @param string $rsskey * - * @return \Illuminate\Http\Response * @throws \Psr\SimpleCache\InvalidArgumentException + * + * @return \Illuminate\Http\Response */ public function show($id, $rsskey) { @@ -394,8 +395,9 @@ public function update(Request $request, $id) * * @param int $id * - * @return \Illuminate\Http\Response * @throws \Exception + * + * @return \Illuminate\Http\Response */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/ResolutionController.php b/app/Http/Controllers/Staff/ResolutionController.php index b42356b85e..cf57031e69 100644 --- a/app/Http/Controllers/Staff/ResolutionController.php +++ b/app/Http/Controllers/Staff/ResolutionController.php @@ -65,12 +65,11 @@ public function store(Request $request) if ($v->fails()) { return redirect()->route('staff.resolutions.index') ->withErrors($v->errors()); - } else { - $resolution->save(); + } + $resolution->save(); - return redirect()->route('staff.resolutions.index') + return redirect()->route('staff.resolutions.index') ->withSuccess('Resolution Successfully Added'); - } } /** @@ -90,8 +89,8 @@ public function edit($id) /** * Edit A Resolution. * - * @param \Illuminate\Http\Request $request - * @param $id + * @param \Illuminate\Http\Request $request + * @param $id * * @return Illuminate\Http\RedirectResponse */ @@ -111,12 +110,11 @@ public function update(Request $request, $id) if ($v->fails()) { return redirect()->route('staff.resolutions.index') ->withErrors($v->errors()); - } else { - $resolution->save(); + } + $resolution->save(); - return redirect()->route('staff.resolutions.index') + return redirect()->route('staff.resolutions.index') ->withSuccess('Resolution Successfully Modified'); - } } /** @@ -124,8 +122,9 @@ public function update(Request $request, $id) * * @param $id * - * @return Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/RssController.php b/app/Http/Controllers/Staff/RssController.php index aa45642757..4132e2f5a5 100644 --- a/app/Http/Controllers/Staff/RssController.php +++ b/app/Http/Controllers/Staff/RssController.php @@ -13,9 +13,9 @@ namespace App\Http\Controllers\Staff; -use App\Models\Resolution; use App\Http\Controllers\Controller; use App\Models\Category; +use App\Models\Resolution; use App\Models\Rss; use App\Models\Type; use App\Repositories\TorrentFacetedRepository; diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index 3895dcd647..861a11d480 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -13,7 +13,6 @@ namespace App\Http\Controllers; -use App\Models\Resolution; use App\Bots\IRCAnnounceBot; use App\Helpers\Bbcode; use App\Helpers\Bencode; @@ -31,6 +30,7 @@ use App\Models\PersonalFreeleech; use App\Models\PlaylistTorrent; use App\Models\PrivateMessage; +use App\Models\Resolution; use App\Models\Subtitle; use App\Models\TagTorrent; use App\Models\Torrent; diff --git a/app/Models/Resolution.php b/app/Models/Resolution.php index 6741738358..4c0d5f633e 100644 --- a/app/Models/Resolution.php +++ b/app/Models/Resolution.php @@ -25,6 +25,7 @@ * @property int $position * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TorrentRequest[] $requests * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Torrent[] $torrents + * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution newQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution query() @@ -33,6 +34,7 @@ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution wherePosition($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution whereSlug($value) * @mixin \Eloquent + * * @property-read int|null $requests_count * @property-read int|null $torrents_count */ diff --git a/app/Models/Rss.php b/app/Models/Rss.php index 6f630caf34..b8047181a7 100644 --- a/app/Models/Rss.php +++ b/app/Models/Rss.php @@ -135,9 +135,9 @@ public function getExpectedFieldsAttribute() { // Just Torrents for now... extendable to check on feed type in future. $expected_fields = ['search' => null, 'description' => null, 'uploader' => null, 'imdb' => null, - 'mal' => null, 'categories' => null, 'types' => null, 'resolutions' => null, 'genres' => null, - 'freeleech' => null, 'doubleupload' => null, 'featured' => null, 'stream' => null, 'highspeed' => null, - 'internal' => null, 'alive' => null, 'dying' => null, 'dead' => null, 'sd' => null, ]; + 'mal' => null, 'categories' => null, 'types' => null, 'resolutions' => null, 'genres' => null, + 'freeleech' => null, 'doubleupload' => null, 'featured' => null, 'stream' => null, 'highspeed' => null, + 'internal' => null, 'alive' => null, 'dying' => null, 'dead' => null, 'sd' => null, ]; return $expected_fields; } diff --git a/app/Repositories/RequestFacetedRepository.php b/app/Repositories/RequestFacetedRepository.php index 19dfa8ca71..c6a52e3844 100644 --- a/app/Repositories/RequestFacetedRepository.php +++ b/app/Repositories/RequestFacetedRepository.php @@ -14,8 +14,8 @@ namespace App\Repositories; use App\Models\Category; -use App\Models\Type; use App\Models\Resolution; +use App\Models\Type; class RequestFacetedRepository { diff --git a/app/Repositories/TorrentFacetedRepository.php b/app/Repositories/TorrentFacetedRepository.php index 9b961c8527..e92d6ef718 100644 --- a/app/Repositories/TorrentFacetedRepository.php +++ b/app/Repositories/TorrentFacetedRepository.php @@ -14,9 +14,9 @@ namespace App\Repositories; use App\Models\Category; +use App\Models\Resolution; use App\Models\Tag; use App\Models\Type; -use App\Models\Resolution; class TorrentFacetedRepository { diff --git a/database/migrations/2020_06_06_185230_create_resolutions_table.php b/database/migrations/2020_06_06_185230_create_resolutions_table.php index c2e3b79cb1..4d25957055 100644 --- a/database/migrations/2020_06_06_185230_create_resolutions_table.php +++ b/database/migrations/2020_06_06_185230_create_resolutions_table.php @@ -41,4 +41,4 @@ public function down() { Schema::dropIfExists('resolutions'); } -} \ No newline at end of file +} diff --git a/database/migrations/2020_06_07_023938_add_resolution_id_to_torrents_table.php b/database/migrations/2020_06_07_023938_add_resolution_id_to_torrents_table.php index bc6e690ff6..d3fbe5e05b 100644 --- a/database/migrations/2020_06_07_023938_add_resolution_id_to_torrents_table.php +++ b/database/migrations/2020_06_07_023938_add_resolution_id_to_torrents_table.php @@ -11,9 +11,8 @@ * @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 */ -use App\Models\Torrent; -use App\Models\Type; use App\Models\Resolution; +use App\Models\Torrent; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2020_06_07_054632_add_resolution_id_to_requests_table.php b/database/migrations/2020_06_07_054632_add_resolution_id_to_requests_table.php index dc451c88a6..8a4bb00629 100644 --- a/database/migrations/2020_06_07_054632_add_resolution_id_to_requests_table.php +++ b/database/migrations/2020_06_07_054632_add_resolution_id_to_requests_table.php @@ -11,8 +11,6 @@ * @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 */ -use App\Models\TorrentRequest; -use App\Models\Type; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; From 5756be5432433083bf5f8191bfa3cfc3e2bb6f2b Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 22:14:31 -0400 Subject: [PATCH 25/51] update: tests --- database/factories/ResolutionFactory.php | 13 +++++++ database/factories/TorrentFactory.php | 3 ++ database/factories/TorrentRequestFactory.php | 3 ++ .../Controllers/API/TorrentControllerTest.php | 37 ++++++++++--------- 4 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 database/factories/ResolutionFactory.php diff --git a/database/factories/ResolutionFactory.php b/database/factories/ResolutionFactory.php new file mode 100644 index 0000000000..adaea5ef87 --- /dev/null +++ b/database/factories/ResolutionFactory.php @@ -0,0 +1,13 @@ +define(App\Models\Resolution::class, function (Faker $faker) { + return [ + 'name' => $faker->name, + 'slug' => $faker->slug, + 'position' => $faker->randomNumber(), + ]; +}); diff --git a/database/factories/TorrentFactory.php b/database/factories/TorrentFactory.php index a450d062d2..89597a35fa 100644 --- a/database/factories/TorrentFactory.php +++ b/database/factories/TorrentFactory.php @@ -33,6 +33,9 @@ 'type_id' => function () { return factory(App\Models\Type::class)->create()->id; }, + 'resolution_id' => function () { + return factory(App\Models\Resolution::class)->create()->id; + }, 'stream' => $faker->boolean, 'free' => $faker->boolean, 'doubleup' => $faker->boolean, diff --git a/database/factories/TorrentRequestFactory.php b/database/factories/TorrentRequestFactory.php index 56915f6222..df6dbc3b43 100644 --- a/database/factories/TorrentRequestFactory.php +++ b/database/factories/TorrentRequestFactory.php @@ -13,6 +13,9 @@ 'type_id' => function () { return factory(App\Models\Type::class)->create()->id; }, + 'resolution_id' => function () { + return factory(App\Models\Resolution::class)->create()->id; + }, 'imdb' => $faker->word, 'tvdb' => $faker->word, 'tmdb' => $faker->word, diff --git a/tests/Feature/Http/Controllers/API/TorrentControllerTest.php b/tests/Feature/Http/Controllers/API/TorrentControllerTest.php index bc70b3d7b1..0d73b2a71e 100644 --- a/tests/Feature/Http/Controllers/API/TorrentControllerTest.php +++ b/tests/Feature/Http/Controllers/API/TorrentControllerTest.php @@ -8,6 +8,7 @@ use App\Models\User; use BotsTableSeeder; use ChatroomTableSeeder; +use App\Models\Resolution; use Illuminate\Http\UploadedFile; use Tests\TestCase; use UsersTableSeeder; @@ -113,6 +114,7 @@ public function store_returns_an_ok_response() $category = factory(Category::class)->create(); $type = factory(Type::class)->create(); + $resolution = factory(Resolution::class)->create(); $torrent = factory(Torrent::class)->make(); @@ -121,23 +123,24 @@ public function store_returns_an_ok_response() base_path('tests/Resources/Pony Music - Mind Fragments (2014).torrent'), 'Pony Music - Mind Fragments (2014).torrent' ), - 'category_id' => $category->id, - 'name' => 'Pony Music - Mind Fragments (2014)', - 'description' => 'One song that represents the elements of being lost, abandoned, sadness and innocence.', - 'imdb' => $torrent->imdb, - 'tvdb' => $torrent->tvdb, - 'tmdb' => $torrent->tmdb, - 'mal' => $torrent->mal, - 'igdb' => $torrent->igdb, - 'type_id' => $type->id, - 'anonymous' => $torrent->anon, - 'stream' => $torrent->stream, - 'sd' => $torrent->sd, - 'internal' => $torrent->internal, - 'featured' => false, - 'doubleup' => $torrent->doubleup, - 'free' => $torrent->free, - 'sticky' => $torrent->sticky, + 'category_id' => $category->id, + 'name' => 'Pony Music - Mind Fragments (2014)', + 'description' => 'One song that represents the elements of being lost, abandoned, sadness and innocence.', + 'imdb' => $torrent->imdb, + 'tvdb' => $torrent->tvdb, + 'tmdb' => $torrent->tmdb, + 'mal' => $torrent->mal, + 'igdb' => $torrent->igdb, + 'type_id' => $type->id, + 'resolution_id' => $resolution->id, + 'anonymous' => $torrent->anon, + 'stream' => $torrent->stream, + 'sd' => $torrent->sd, + 'internal' => $torrent->internal, + 'featured' => false, + 'doubleup' => $torrent->doubleup, + 'free' => $torrent->free, + 'sticky' => $torrent->sticky, ]); $response->assertOk() From 231c33927ad0df47b5b90f73826e9001fa5e4321 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 22:16:10 -0400 Subject: [PATCH 26/51] chore: styleci --- tests/Feature/Http/Controllers/API/TorrentControllerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Feature/Http/Controllers/API/TorrentControllerTest.php b/tests/Feature/Http/Controllers/API/TorrentControllerTest.php index 0d73b2a71e..c26ce1bce2 100644 --- a/tests/Feature/Http/Controllers/API/TorrentControllerTest.php +++ b/tests/Feature/Http/Controllers/API/TorrentControllerTest.php @@ -3,12 +3,12 @@ namespace Tests\Feature\Http\Controllers\API; use App\Models\Category; +use App\Models\Resolution; use App\Models\Torrent; use App\Models\Type; use App\Models\User; use BotsTableSeeder; use ChatroomTableSeeder; -use App\Models\Resolution; use Illuminate\Http\UploadedFile; use Tests\TestCase; use UsersTableSeeder; From 5ae474c1c93cf1d2a044648dfcf75cc111b9aa69 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 22:18:03 -0400 Subject: [PATCH 27/51] update: upload helper js --- resources/js/unit3d/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/unit3d/helper.js b/resources/js/unit3d/helper.js index 22b4c4a126..3ff0f4b7f3 100644 --- a/resources/js/unit3d/helper.js +++ b/resources/js/unit3d/helper.js @@ -219,7 +219,7 @@ class uploadExtensionBuilder { } // Torrent Resolution - //$("#autores").val(release.resolution); + $("#autores").val(release.resolution); // Torrent TMDB ID if (release.type === "Movie") { From 296e4f590b38c4c4dd9d93ccc338446c38037589 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 22:36:16 -0400 Subject: [PATCH 28/51] update: torrent api controller --- app/Http/Controllers/API/TorrentController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/API/TorrentController.php b/app/Http/Controllers/API/TorrentController.php index 474b030744..3ab744c705 100644 --- a/app/Http/Controllers/API/TorrentController.php +++ b/app/Http/Controllers/API/TorrentController.php @@ -143,7 +143,7 @@ public function store(Request $request, Torrent $torrent) 'announce' => 'required', 'size' => 'required', 'category_id' => 'required|exists:categories,id', - 'type_id' => 'required|exists:types,name', + 'type_id' => 'required|exists:types,id', 'resolution_id' => 'exists:resolutions,id', 'user_id' => 'required|exists:users,id', 'imdb' => 'required|numeric', @@ -330,6 +330,7 @@ public function filter(Request $request, Torrent $torrent) $end_year = $request->input('end_year'); $categories = $request->input('categories'); $types = $request->input('types'); + $resolutions = $request->input('resolutions'); $genres = $request->input('genres'); $freeleech = $request->input('freeleech'); $doubleupload = $request->input('doubleupload'); @@ -428,6 +429,10 @@ public function filter(Request $request, Torrent $torrent) $torrent->whereIn('torrents.type_id', $types); } + if ($request->has('resolutions') && $request->input('resolutions') != null) { + $torrent->whereIn('torrents.resolution_id', $resolutions); + } + if ($request->has('genres') && $request->input('genres') != null) { $genreID = TagTorrent::select(['torrent_id'])->distinct()->whereIn('tag_name', $genres)->get(); $torrent->whereIn('torrents.id', $genreID); From eace55915f7781aaa5dc021f7b34a37a4df948c0 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 22:36:49 -0400 Subject: [PATCH 29/51] update: torrent controller --- app/Http/Controllers/TorrentController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index 861a11d480..936bd5715f 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -1344,7 +1344,7 @@ public function upload(Request $request) 'announce' => 'required', 'size' => 'required', 'category_id' => 'required|exists:categories,id', - 'type_id' => 'required|exists:types,name', + 'type_id' => 'required|exists:types,id', 'resolution_id' => 'exists:resolutions,id', 'user_id' => 'required|exists:users,id', 'imdb' => 'required|numeric', From b44cb8e2bbf0249b29fe59a2f9bad5360855eab3 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 22:37:21 -0400 Subject: [PATCH 30/51] update: torrent resource --- app/Http/Resources/TorrentResource.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Resources/TorrentResource.php b/app/Http/Resources/TorrentResource.php index c8119d4780..b226890b0a 100644 --- a/app/Http/Resources/TorrentResource.php +++ b/app/Http/Resources/TorrentResource.php @@ -34,6 +34,7 @@ public function toArray($request) 'release_year' => $this->release_year, 'category' => $this->category->name, 'type' => $this->type->name, + 'resolution' => $this->resolution->name, 'size' => $this->getSize(), 'freeleech' => $this->free ? 'Yes' : 'No', 'double_upload' => $this->doubleup ? 'Yes' : 'No', From 1cad55ac49c4e7f8e2abd5f131f45662a61b6710 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 22:37:42 -0400 Subject: [PATCH 31/51] update: torrent moderation view --- resources/views/Staff/moderation/index.blade.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/views/Staff/moderation/index.blade.php b/resources/views/Staff/moderation/index.blade.php index 6cddeab358..96aa173f07 100644 --- a/resources/views/Staff/moderation/index.blade.php +++ b/resources/views/Staff/moderation/index.blade.php @@ -27,6 +27,7 @@ @lang('common.name') @lang('common.category') @lang('common.type') + @lang('common.resolution') @lang('torrent.size') @lang('torrent.uploader') @lang('common.moderation-approve') @@ -45,6 +46,7 @@ class="l-breadcrumb-item-link-title">{{ $p->name }} {{ $p->type->name }} + {{ $p->resolution->name }} {{ $p->getSize() }} {{ $post->type->name }} + {{ $post->resolution->name }} {{ $post->getSize() }} @lang('common.reason') @lang('common.name') @lang('common.category') @lang('common.type') + @lang('common.resolution') @lang('torrent.size') @lang('torrent.uploader') @lang('common.staff') @@ -314,6 +319,7 @@ class="l-breadcrumb-item-link-title">{{ $reject->name }} {{ $reject->type->name }} + {{ $reject->resolution->name }} {{ $reject->getSize() }} @if ($reject->user) Date: Sat, 6 Jun 2020 22:38:12 -0400 Subject: [PATCH 32/51] update: torrent groupings view --- resources/views/torrent/groupings.blade.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/views/torrent/groupings.blade.php b/resources/views/torrent/groupings.blade.php index 5fb9ba9288..443970260d 100644 --- a/resources/views/torrent/groupings.blade.php +++ b/resources/views/torrent/groupings.blade.php @@ -373,6 +373,12 @@ class="resolution facetedSearch" trigger="click"> {{ $resolution }} {{ $current->type->name }}
    +
    + + {{ $current->resolution->name }} + +
    From d25a753de4e430983e5d37bb21883ca6c338f22c Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 22:38:30 -0400 Subject: [PATCH 33/51] update: torrent list view --- resources/views/torrent/results.blade.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/resources/views/torrent/results.blade.php b/resources/views/torrent/results.blade.php index 908d3c1602..1e4bf9391c 100644 --- a/resources/views/torrent/results.blade.php +++ b/resources/views/torrent/results.blade.php @@ -18,7 +18,8 @@ @else @endif - @lang('torrent.category')/@lang('torrent.type') + @lang('torrent.category') + @lang('torrent.type')/@lang('torrent.resolution') @sortablelink('name', trans('common.name'), '', ['id'=>'name','class'=>'facetedSearch facetedSort','trigger'=>'sort','state'=> ($sorting && $sorting == "name" ? $direction : 0)]) @@ -124,13 +125,22 @@ class="torrent-poster-img-small show-poster" alt="@lang('torrent.poster')">
    @endif -
    + + + +
    + data-original-title="@lang('torrent.type')"> {{ $torrent->type->name }} -
    - +
    +
    + + {{ $torrent->resolution->name }} + +
    + From b7b5e2adfeb19fa20d35fd61273fd49c98554d01 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 6 Jun 2020 23:46:28 -0400 Subject: [PATCH 34/51] update: torrent cards view --- resources/views/torrent/cards.blade.php | 2 ++ resources/views/torrent/results_cards.blade.php | 1 + 2 files changed, 3 insertions(+) diff --git a/resources/views/torrent/cards.blade.php b/resources/views/torrent/cards.blade.php index 9cfbce27ff..990f30108b 100644 --- a/resources/views/torrent/cards.blade.php +++ b/resources/views/torrent/cards.blade.php @@ -317,6 +317,8 @@ class="{{ config('other.font-awesome') }} fa-fw fa-check text-orange">{{ $t-   {{ $t->getSize() }}  + {{ $t->resolution->name }} {{ $t->type->name }}  {{ $t->times_completed }}   {{ $t->getSize() }}  + {{ $t->resolution->name }} {{ $t->type->name }}  {{ $t->category->name }} 
    From 47bf783dfff55cb0f136afa8fb28c08714624e65 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sun, 7 Jun 2020 00:22:03 -0400 Subject: [PATCH 35/51] update: torrent grouping views --- resources/views/torrent/groupings.blade.php | 14 +++++++------- .../views/torrent/results_groupings.blade.php | 6 ++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/resources/views/torrent/groupings.blade.php b/resources/views/torrent/groupings.blade.php index 443970260d..f64bfd7305 100644 --- a/resources/views/torrent/groupings.blade.php +++ b/resources/views/torrent/groupings.blade.php @@ -369,15 +369,15 @@ class="resolution facetedSearch" trigger="click"> {{ $resolution }} @endif
    - - {{ $current->type->name }} - + + {{ $current->type->name }} +
    - - {{ $current->resolution->name }} - + + {{ $current->resolution->name }} +
    diff --git a/resources/views/torrent/results_groupings.blade.php b/resources/views/torrent/results_groupings.blade.php index 381de618ee..a1106b3481 100644 --- a/resources/views/torrent/results_groupings.blade.php +++ b/resources/views/torrent/results_groupings.blade.php @@ -123,6 +123,12 @@ {{ $current->type->name }} +
    + + {{ $current->resolution->name }} + +
    From 2fb100459b6ee40ea8382c8fe926745fc2b23f61 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sun, 7 Jun 2020 12:53:20 -0400 Subject: [PATCH 36/51] add: resolutions database seeder --- database/seeds/DatabaseSeeder.php | 1 + database/seeds/ResolutionsTableSeeder.php | 90 +++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 database/seeds/ResolutionsTableSeeder.php diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 6e5e6a44b3..030a5b59a7 100755 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -37,5 +37,6 @@ public function run() $this->call(TagsTableSeeder::class); $this->call(BotsTableSeeder::class); $this->call(MediaLanguagesSeeder::class); + $this->call(ResolutionsTableSeeder::class); } } diff --git a/database/seeds/ResolutionsTableSeeder.php b/database/seeds/ResolutionsTableSeeder.php new file mode 100644 index 0000000000..82f92de872 --- /dev/null +++ b/database/seeds/ResolutionsTableSeeder.php @@ -0,0 +1,90 @@ + + * @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 + */ + +use Illuminate\Database\Seeder; + +class ResolutionsTableSeeder extends Seeder +{ + /** + * Auto generated seed file. + * + * @return void + */ + public function run() + { + \DB::table('resolutions')->delete(); + + \DB::table('resolutions')->insert([ + 0 => [ + 'id' => 1, + 'name' => '4320p', + 'slug' => '4320p', + 'position' => 0, + ], + 1 => [ + 'id' => 2, + 'name' => '2160p', + 'slug' => '2160p', + 'position' => 1, + ], + 2 => [ + 'id' => 3, + 'name' => '1080p', + 'slug' => '1080p', + 'position' => 2, + ], + 3 => [ + 'id' => 4, + 'name' => '1080i', + 'slug' => '1080i', + 'position' => 4, + ], + 4 => [ + 'id' => 5, + 'name' => '720p', + 'slug' => '720p', + 'position' => 5, + ], + 5 => [ + 'id' => 6, + 'name' => '576p', + 'slug' => '576p', + 'position' => 6, + ], + 6 => [ + 'id' => 7, + 'name' => '576i', + 'slug' => '576i', + 'position' => 7, + ], + 7 => [ + 'id' => 8, + 'name' => '480p', + 'slug' => '480p', + 'position' => 8, + ], + 8 => [ + 'id' => 9, + 'name' => '480i', + 'slug' => '480i', + 'position' => 9, + ], + 9 => [ + 'id' => 10, + 'name' => 'Other', + 'slug' => 'other', + 'position' => 10, + ], + ]); + } +} From f58e8906f41c8cb48eb05b047f9c98a53e9e2c4b Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sun, 7 Jun 2020 20:08:03 -0400 Subject: [PATCH 37/51] update: upload parser --- resources/js/unit3d/helper.js | 5 +++++ resources/js/unit3d/parser.js | 21 +++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/resources/js/unit3d/helper.js b/resources/js/unit3d/helper.js index 3ff0f4b7f3..db3baf3bd0 100644 --- a/resources/js/unit3d/helper.js +++ b/resources/js/unit3d/helper.js @@ -651,6 +651,7 @@ class facetedSearchBuilder { var end_year = $("#end_year").val(); var categories = []; var types = []; + var resolutions = []; var genres = []; var qty = $("#qty").val(); var notdownloaded = (function () { @@ -734,6 +735,9 @@ class facetedSearchBuilder { $(".type:checked").each(function () { types.push($(this).val()); }); + $(".resolution:checked").each(function () { + resolutions.push($(this).val()); + }); $(".genre:checked").each(function () { genres.push($(this).val()); }); @@ -818,6 +822,7 @@ class facetedSearchBuilder { end_year: end_year, categories: categories, types: types, + resolutions: resolutions, genres: genres, freeleech: freeleech, doubleupload: doubleupload, diff --git a/resources/js/unit3d/parser.js b/resources/js/unit3d/parser.js index f61287daca..21fc7ceb27 100644 --- a/resources/js/unit3d/parser.js +++ b/resources/js/unit3d/parser.js @@ -135,40 +135,37 @@ const rules = }, "resolution": { - "4320p": [ + "1": [ "4320p", "8k" ], - "2160p": [ + "2": [ "2160p", "4k", "uhd" ], - "1080p": [ + "3": [ "1080p" ], - "1080i": [ + "4": [ "1080i" ], - "900p": [ - "900p" - ], - "720p": [ + "5": [ "720p" ], - "576p": [ + "6": [ "576p", "PAL", ], - "576i": [ + "7": [ "576i", "PAL", ], - "480p": [ + "8": [ "480p", "NTSC", ], - "480i": [ + "9": [ "480i", "NTSC", ], From 299a9abfcdd32f8d6f582faa859214cf769bcadd Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sun, 7 Jun 2020 20:08:25 -0400 Subject: [PATCH 38/51] update: staff category controller --- app/Http/Controllers/Staff/CategoryController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Staff/CategoryController.php b/app/Http/Controllers/Staff/CategoryController.php index 2515e6becf..865e81da6d 100644 --- a/app/Http/Controllers/Staff/CategoryController.php +++ b/app/Http/Controllers/Staff/CategoryController.php @@ -67,7 +67,7 @@ public function store(Request $request) $image = $request->file('image'); $filename = 'category-'.uniqid().'.'.$image->getClientOriginalExtension(); $path = public_path('/files/img/'.$filename); - Image::make($image->getRealPath())->fit(40, 40)->encode('png', 100)->save($path); + Image::make($image->getRealPath())->fit(60, 60)->encode('png', 100)->save($path); $category->image = $filename; } else { $category->image = null; @@ -134,7 +134,7 @@ public function update(Request $request, $id) $image = $request->file('image'); $filename = 'category-'.uniqid().'.'.$image->getClientOriginalExtension(); $path = public_path('/files/img/'.$filename); - Image::make($image->getRealPath())->fit(40, 40)->encode('png', 100)->save($path); + Image::make($image->getRealPath())->fit(60, 60)->encode('png', 100)->save($path); $category->image = $filename; } From 7f47c78d81b0c8dec1a53c92068c7449e6cc765a Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sun, 7 Jun 2020 20:08:46 -0400 Subject: [PATCH 39/51] update: torrent views --- resources/views/torrent/groupings.blade.php | 28 +++++++------- resources/views/torrent/results.blade.php | 38 +++++++++---------- .../views/torrent/results_groupings.blade.php | 21 +++++----- resources/views/torrent/torrent.blade.php | 10 +++-- 4 files changed, 53 insertions(+), 44 deletions(-) diff --git a/resources/views/torrent/groupings.blade.php b/resources/views/torrent/groupings.blade.php index f64bfd7305..efe29448f9 100644 --- a/resources/views/torrent/groupings.blade.php +++ b/resources/views/torrent/groupings.blade.php @@ -317,6 +317,7 @@ class="resolution facetedSearch" trigger="click"> {{ $resolution }} @lang('torrent.category') + @lang('torrent.type')/@lang('torrent.resolution') @lang('torrent.name') @@ -349,36 +350,37 @@ class="resolution facetedSearch" trigger="click"> {{ $resolution }} @else @endif - + @if ($current->category->image != null)
    {{ $current->category->name }} + data-original-title="{{ $current->category->name }} {{ strtolower(trans('torrent.torrent')) }}"">
    @else
    + data-original-title="{{ $current->category->name }} {{ strtolower(trans('torrent.torrent')) }}"">
    @endif -
    - + + +
    + {{ $current->type->name }}
    -
    - - {{ $current->resolution->name }} - -
    +
    + + {{ $current->resolution->name }} + +
    diff --git a/resources/views/torrent/results.blade.php b/resources/views/torrent/results.blade.php index 1e4bf9391c..23fce58967 100644 --- a/resources/views/torrent/results.blade.php +++ b/resources/views/torrent/results.blade.php @@ -107,25 +107,25 @@ class="torrent-poster-img-small show-poster" alt="@lang('torrent.poster')"> @endif - - @if ($torrent->category->image != null) - -
    - {{ $torrent->category->name }} -
    -
    - @else - -
    - -
    -
    - @endif - + + @if ($torrent->category->image != null) + +
    + {{ $torrent->category->name }} +
    +
    + @else + +
    + +
    +
    + @endif +
    diff --git a/resources/views/torrent/results_groupings.blade.php b/resources/views/torrent/results_groupings.blade.php index a1106b3481..dda4d21a3b 100644 --- a/resources/views/torrent/results_groupings.blade.php +++ b/resources/views/torrent/results_groupings.blade.php @@ -68,6 +68,7 @@ @lang('torrent.category') + @lang('torrent.type')/@lang('torrent.resolution') @lang('torrent.name') @@ -100,33 +101,35 @@ @else @endif - + @if ($current->category->image != null)
    {{ $current->category->name }} + alt="{{ $current->category->name }}">
    @else
    + data-original-title="{{ $current->category->name }} {{ strtolower(trans('torrent.torrent')) }}"">
    @endif -
    - - {{ $current->type->name }} + + +
    + + {{ $current->type->name }}
    -
    +
    - {{ $current->resolution->name }} + {{ $current->resolution->name }}
    diff --git a/resources/views/torrent/torrent.blade.php b/resources/views/torrent/torrent.blade.php index 53daf03a1f..f0d0556123 100644 --- a/resources/views/torrent/torrent.blade.php +++ b/resources/views/torrent/torrent.blade.php @@ -389,9 +389,8 @@ class="btn btn-xs btn-success" data-toggle="tooltip" @lang('torrent.category') {{ $torrent->category->name }} + data-toggle="tooltip" data-original-title="{{ $torrent->category->name }} @lang('torrent.torrent')"> + {{ $torrent->category->name }} @@ -400,6 +399,11 @@ class="btn btn-xs btn-success" data-toggle="tooltip" {{ $torrent->type->name }} + + @lang('torrent.resolution') + {{ $torrent->resolution->name }} + + @lang('torrent.stream-optimized')? From 53faae37fd36b7f6336dfa99f6639ac9c2f0469c Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sun, 7 Jun 2020 21:12:39 -0400 Subject: [PATCH 40/51] update: torrent requests views --- .../views/requests/add_request.blade.php | 16 +++++++++++-- .../views/requests/edit_request.blade.php | 14 +++++++++++ resources/views/requests/request.blade.php | 8 +++++++ resources/views/requests/requests.blade.php | 24 ++++++++++++++++--- resources/views/requests/results.blade.php | 19 +++++++++++---- 5 files changed, 71 insertions(+), 10 deletions(-) diff --git a/resources/views/requests/add_request.blade.php b/resources/views/requests/add_request.blade.php index b68e3593c3..03bf3ceaea 100644 --- a/resources/views/requests/add_request.blade.php +++ b/resources/views/requests/add_request.blade.php @@ -92,7 +92,7 @@
    + +
    + + +
    diff --git a/resources/views/requests/edit_request.blade.php b/resources/views/requests/edit_request.blade.php index 37858faf26..2eebb2d556 100644 --- a/resources/views/requests/edit_request.blade.php +++ b/resources/views/requests/edit_request.blade.php @@ -106,6 +106,20 @@
    + +
    + + +
    diff --git a/resources/views/requests/request.blade.php b/resources/views/requests/request.blade.php index e71f68a312..ee74d92b43 100644 --- a/resources/views/requests/request.blade.php +++ b/resources/views/requests/request.blade.php @@ -102,6 +102,14 @@ class="{{ config('other.font-awesome') }} fa-trash"> {{ $torrentRequest->type->name }} + + + @lang('torrent.resolution') + + + {{ $torrentRequest->resolution->name }} + + @lang('bon.bon') diff --git a/resources/views/requests/requests.blade.php b/resources/views/requests/requests.blade.php index 1e1cfb5183..e973c36ecf 100644 --- a/resources/views/requests/requests.blade.php +++ b/resources/views/requests/requests.blade.php @@ -69,7 +69,7 @@ class="form-horizontal form-condensed form-torrent-search form-bordered"> @foreach ($repository->categories() as $id => $category) @endforeach @@ -82,7 +82,20 @@ class="form-horizontal form-condensed form-torrent-search form-bordered"> @foreach ($repository->types() as $id => $type) + + @endforeach +
    +
    + +
    + +
    + @foreach ($repository->resolutions() as $id => $resolution) + + @endforeach @@ -227,6 +240,7 @@ function faceted(page) { var igdb = $("#igdb").val(); var categories = []; var types = []; + var resolutions = []; var sorting = $("#sorting").val(); var direction = $("#direction").val(); var qty = $("#qty").val(); @@ -276,6 +290,9 @@ function faceted(page) { $(".type:checked").each(function() { types.push($(this).val()); }); + $(".resolution:checked").each(function() { + resolutions.push($(this).val()); + }); if (xhr !== 'undefined') { xhr.abort(); @@ -293,6 +310,7 @@ function faceted(page) { igdb: igdb, categories: categories, types: types, + resolutions: resolutions, myrequests: myrequests, myclaims: myclaims, myvoted: myvoted, @@ -358,7 +376,7 @@ function faceted(page) {