@if (null !== ($user = \App\Models\User::find($peer['user_id'])))
@@ -103,6 +104,9 @@ class="nav-tab--active__link"
User not found
@endif
|
+
+ {{ implode('', array_map(fn ($char) => ctype_print($char) ? $char : '\x' . bin2hex($char), str_split(hex2bin(explode('-', $peerId)[1])))) }}
+ |
@if ($torrent === null)
Torrent size not available
From 198a7cbb1309b6bfcf6e6f526cd13c00e862f9cb Mon Sep 17 00:00:00 2001
From: Roardom
Date: Tue, 8 Oct 2024 10:11:57 +0000
Subject: [PATCH 04/11] add: message to staff page mentioning helpdesk for
account support
---
resources/views/page/staff.blade.php | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/resources/views/page/staff.blade.php b/resources/views/page/staff.blade.php
index 6d23b29ee9..52b66cdbf5 100644
--- a/resources/views/page/staff.blade.php
+++ b/resources/views/page/staff.blade.php
@@ -38,3 +38,20 @@ class="user-card"
@endforeach
@endsection
+
+@section('sidebar')
+
+ {{ __('common.info') }}
+ Please contact staff via the helpdesk for account support.
+
+
+@endsection
From 3e5f475a56f0e8d1975fe0d9c5df010d2e0b63e7 Mon Sep 17 00:00:00 2001
From: Roardom
Date: Tue, 8 Oct 2024 11:32:33 +0000
Subject: [PATCH 05/11] fix: broken api compatbility when no torrents found
There was always a null check here to return 404 when no torrents are found. But this null check was always comparing against a paginator instance... which would never be true. So when I changed it to an isEmpty when I changed the query from a database query to a meilisearch query, and thought that was the correct thing to do to make sure a 404 is still returned, that was incorrect, because a 404 was never returned in the first place. An empty array is proper here.
---
.../Controllers/API/TorrentController.php | 60 +++++++++----------
1 file changed, 28 insertions(+), 32 deletions(-)
diff --git a/app/Http/Controllers/API/TorrentController.php b/app/Http/Controllers/API/TorrentController.php
index d912435c08..63d9639c1b 100644
--- a/app/Http/Controllers/API/TorrentController.php
+++ b/app/Http/Controllers/API/TorrentController.php
@@ -658,39 +658,35 @@ function (Indexes $meilisearch, string $query, array $options) use ($request, $f
});
if ($isSqlAllowed) {
- if ($torrents !== null) {
- return new TorrentsResource($torrents);
- }
- } elseif ($torrents->isNotEmpty()) {
- $page = $request->integer('page') ?: 1;
- $perPage = min(100, $request->integer('perPage') ?: 25);
-
- // Auth keys must not be cached
- $torrents->through(function ($torrent) {
- $torrent['attributes']['download_link'] = route('torrent.download.rsskey', ['id' => $torrent['id'], 'rsskey' => auth('api')->user()->rsskey]);
- $torrent['attributes']['magnet_link'] = config('torrent.magnet') ? 'magnet:?dn='.$torrent['attributes']['name'].'&xt=urn:btih:'.$torrent['attributes']['info_hash'].'&as='.route('torrent.download.rsskey', ['id' => $torrent['id'], 'rsskey' => auth('api')->user()->rsskey]).'&tr='.route('announce', ['passkey' => auth('api')->user()->passkey]).'&xl='.$torrent['attributes']['size'] : null;
-
- return $torrent;
- });
-
- return response()->json([
- 'data' => $torrents->items(),
- 'links' => [
- 'first' => $request->fullUrlWithoutQuery(['page' => 1]),
- 'last' => null,
- 'prev' => $page === 1 ? null : $request->fullUrlWithQuery(['page' => $page - 1]),
- 'next' => $request->fullUrlWithQuery(['page' => $page + 1]),
- 'self' => $request->fullUrl(),
- ],
- 'meta' => [
- 'current_page' => $page,
- 'per_page' => $perPage,
- 'from' => ($page - 1) * $perPage + 1,
- 'to' => ($page - 1) * $perPage + \count($torrents->items()),
- ]
- ]);
+ return new TorrentsResource($torrents);
}
- return $this->sendResponse('404', 'No Torrents Found');
+ $page = $request->integer('page') ?: 1;
+ $perPage = min(100, $request->integer('perPage') ?: 25);
+
+ // Auth keys must not be cached
+ $torrents->through(function ($torrent) {
+ $torrent['attributes']['download_link'] = route('torrent.download.rsskey', ['id' => $torrent['id'], 'rsskey' => auth('api')->user()->rsskey]);
+ $torrent['attributes']['magnet_link'] = config('torrent.magnet') ? 'magnet:?dn='.$torrent['attributes']['name'].'&xt=urn:btih:'.$torrent['attributes']['info_hash'].'&as='.route('torrent.download.rsskey', ['id' => $torrent['id'], 'rsskey' => auth('api')->user()->rsskey]).'&tr='.route('announce', ['passkey' => auth('api')->user()->passkey]).'&xl='.$torrent['attributes']['size'] : null;
+
+ return $torrent;
+ });
+
+ return response()->json([
+ 'data' => $torrents->items(),
+ 'links' => [
+ 'first' => $request->fullUrlWithoutQuery(['page' => 1]),
+ 'last' => null,
+ 'prev' => $page === 1 ? null : $request->fullUrlWithQuery(['page' => $page - 1]),
+ 'next' => $request->fullUrlWithQuery(['page' => $page + 1]),
+ 'self' => $request->fullUrl(),
+ ],
+ 'meta' => [
+ 'current_page' => $page,
+ 'per_page' => $perPage,
+ 'from' => ($page - 1) * $perPage + 1,
+ 'to' => ($page - 1) * $perPage + \count($torrents->items()),
+ ]
+ ]);
}
}
From 5bfda30b753dc15e8dfcca244fe9942a61b58151 Mon Sep 17 00:00:00 2001
From: alpine
Date: Thu, 10 Oct 2024 15:12:39 +1100
Subject: [PATCH 06/11] Adds notification dot if reports are outstanding
---
resources/views/partials/top_nav.blade.php | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/resources/views/partials/top_nav.blade.php b/resources/views/partials/top_nav.blade.php
index f328e70954..7f615d09f6 100755
--- a/resources/views/partials/top_nav.blade.php
+++ b/resources/views/partials/top_nav.blade.php
@@ -394,6 +394,15 @@ class="top-nav--right__icon-link"
title="{{ __('staff.staff-dashboard') }}"
>
+ @php
+ $unsolvedReportsCount = DB::table('reports')
+ ->where('solved', '=', false)
+ ->count()
+ @endphp
+
+ @if ($unsolvedReportsCount > 0)
+
+ @endif
@endif
From 85eb7c366d5d2126c786d4d92b7d9d162c4114fe Mon Sep 17 00:00:00 2001
From: Roardom
Date: Tue, 8 Oct 2024 12:10:07 +0000
Subject: [PATCH 07/11] fix: provide null for next page when no more results
---
app/Http/Controllers/API/TorrentController.php | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/app/Http/Controllers/API/TorrentController.php b/app/Http/Controllers/API/TorrentController.php
index 63d9639c1b..17783916e6 100644
--- a/app/Http/Controllers/API/TorrentController.php
+++ b/app/Http/Controllers/API/TorrentController.php
@@ -519,8 +519,8 @@ public function filter(Request $request): TorrentsResource|\Illuminate\Http\Json
$queryString = http_build_query($queryParams);
$cacheKey = $url.'?'.$queryString;
- /** @phpstan-ignore argument.templateType (phpstan is unable to resolve type because it's returning a phpstan-ignored line) */
- $torrents = cache()->remember($cacheKey, 300, function () use ($request, $isSqlAllowed) {
+ /** @phpstan-ignore method.unresolvableReturnType (phpstan is unable to resolve type because it's returning a phpstan-ignored line) */
+ [$torrents, $hasMore] = cache()->remember($cacheKey, 300, function () use ($request, $isSqlAllowed) {
$eagerLoads = fn (Builder $query) => $query
->with(['user:id,username', 'category', 'type', 'resolution', 'distributor', 'region', 'files'])
->select('*')
@@ -580,6 +580,8 @@ public function filter(Request $request): TorrentsResource|\Illuminate\Http\Json
// See app/Traits/TorrentMeta.php
$this->scopeMeta($torrents);
+
+ $hasMore = $torrents->nextCursor() !== null;
} else {
$paginator = Torrent::search(
$request->filled('name') ? $request->string('name')->toString() : '',
@@ -598,6 +600,8 @@ function (Indexes $meilisearch, string $query, array $options) use ($request, $f
->query($eagerLoads)
->simplePaginateRaw(min($request->input('perPage') ?? $this->perPage, 100));
+ $hasMore = $paginator->hasMorePages();
+
/** @phpstan-ignore method.notFound (this method exists at time of writing) */
$results = $paginator->getCollection();
$torrents = collect();
@@ -654,7 +658,7 @@ function (Indexes $meilisearch, string $query, array $options) use ($request, $f
$torrents = $paginator->setCollection(collect($torrents));
}
- return $torrents;
+ return [$torrents, $hasMore];
});
if ($isSqlAllowed) {
@@ -678,7 +682,7 @@ function (Indexes $meilisearch, string $query, array $options) use ($request, $f
'first' => $request->fullUrlWithoutQuery(['page' => 1]),
'last' => null,
'prev' => $page === 1 ? null : $request->fullUrlWithQuery(['page' => $page - 1]),
- 'next' => $request->fullUrlWithQuery(['page' => $page + 1]),
+ 'next' => $hasMore ? $request->fullUrlWithQuery(['page' => $page + 1]) : null,
'self' => $request->fullUrl(),
],
'meta' => [
From 3a58fc1ef77bf907d7bb48498c97ed9bb5565708 Mon Sep 17 00:00:00 2001
From: Jay Sizzla
Date: Thu, 12 Sep 2024 15:30:23 +0200
Subject: [PATCH 08/11] Allow staff to set individual history entries to immune
---
app/Http/Livewire/UserTorrents.php | 17 +++++++++
.../views/livewire/user-torrents.blade.php | 37 ++++++++++++++++++-
2 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/app/Http/Livewire/UserTorrents.php b/app/Http/Livewire/UserTorrents.php
index 21626355a2..d67e289e8d 100644
--- a/app/Http/Livewire/UserTorrents.php
+++ b/app/Http/Livewire/UserTorrents.php
@@ -177,4 +177,21 @@ final public function render(): \Illuminate\Contracts\View\Factory|\Illuminate\C
'histories' => $this->history,
]);
}
+
+ /**
+ * Update History Immune.
+ */
+ final public function updateImmune(int $torrentId, bool $immune): void
+ {
+ abort_unless(auth()->user()->group->is_modo, 403);
+
+ $this->user
+ ->history()
+ ->where('torrent_id', '=', $torrentId)
+ ->update([
+ 'immune' => $immune,
+ ]);
+
+ $this->dispatch('success', type: 'success', message: 'Immunity has successfully been updated!');
+ }
}
diff --git a/resources/views/livewire/user-torrents.blade.php b/resources/views/livewire/user-torrents.blade.php
index dcfbb9fc8c..1d1f9934a4 100644
--- a/resources/views/livewire/user-torrents.blade.php
+++ b/resources/views/livewire/user-torrents.blade.php
@@ -427,7 +427,7 @@ class="user-torrents__status-header"
@foreach ($histories as $history)
-
+
|
- @if ($history->immune == 1)
+ @if ($history->immune)
user()->group->is_modo)
+ x-on:click.prevent="updateImmune(false)"
+ data-b64-deletion-message="{{ base64_encode('Are you sure you want to set this history record to not immune: ' . $history->name . '?') }}"
+ style="cursor: pointer"
+ @endif
>
@else
user()->group->is_modo)
+ x-on:click.prevent="updateImmune(true)"
+ data-b64-deletion-message="{{ base64_encode('Are you sure you want to set this history record to immune: ' . $history->name . '?') }}"
+ style="cursor: pointer"
+ @endif
>
@endif
|
@@ -744,5 +754,28 @@ function ternaryCheckbox() {
},
};
}
+
+ document.addEventListener('alpine:init', () => {
+ Alpine.data('userHistory', () => ({
+ updateImmune(immune) {
+ this.confirmAction(() =>
+ this.$wire.updateImmune(this.$root.dataset.historyId, immune),
+ );
+ },
+ confirmAction(onConfirm) {
+ Swal.fire({
+ title: 'Are you sure?',
+ text: atob(this.$el.dataset.b64DeletionMessage),
+ icon: 'warning',
+ showConfirmButton: true,
+ showCancelButton: true,
+ }).then((result) => {
+ if (result.isConfirmed) {
+ onConfirm();
+ }
+ });
+ },
+ }));
+ });
From 05b727f72286cc4fc65923e0c9d3748293f70a62 Mon Sep 17 00:00:00 2001
From: Jay Sizzla
Date: Thu, 10 Oct 2024 15:26:41 +0100
Subject: [PATCH 09/11] Change mediainfo to longtext
---
...update_mediainfo_from_text_to_longtext.php | 43 +++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 database/migrations/2024_10_10_140532_update_mediainfo_from_text_to_longtext.php
diff --git a/database/migrations/2024_10_10_140532_update_mediainfo_from_text_to_longtext.php b/database/migrations/2024_10_10_140532_update_mediainfo_from_text_to_longtext.php
new file mode 100644
index 0000000000..020822a7ec
--- /dev/null
+++ b/database/migrations/2024_10_10_140532_update_mediainfo_from_text_to_longtext.php
@@ -0,0 +1,43 @@
+
+ * @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;
+
+return new class () extends Migration {
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ Schema::table('torrents', function (Blueprint $table): void {
+ $table->longText('mediainfo')->nullable()->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down(): void
+ {
+ Schema::table('torrents', function (Blueprint $table): void {
+ $table->text('mediainfo')->nullable()->change();
+ });
+ }
+};
From 48e8b96868ab54e47c515fb36ba1c17208be8c93 Mon Sep 17 00:00:00 2001
From: HDVinnie
Date: Thu, 10 Oct 2024 20:01:01 -0400
Subject: [PATCH 10/11] update: unit3d config
- bump version
---
config/unit3d.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/unit3d.php b/config/unit3d.php
index 7051dcf188..401ff72f43 100755
--- a/config/unit3d.php
+++ b/config/unit3d.php
@@ -23,7 +23,7 @@
|
*/
- 'powered-by' => 'Powered By UNIT3D Community Edition v8.3.0',
+ 'powered-by' => 'Powered By UNIT3D Community Edition v8.3.1',
/*
|--------------------------------------------------------------------------
@@ -45,7 +45,7 @@
|
*/
- 'version' => 'v8.3.0',
+ 'version' => 'v8.3.1',
/*
|--------------------------------------------------------------------------
From 2b94479b224f3c9e1d8005ea77aa0ea28609b384 Mon Sep 17 00:00:00 2001
From: HDVinnie
Date: Thu, 10 Oct 2024 20:21:18 -0400
Subject: [PATCH 11/11] update: report notification blip
- exclude snoozed reports.
---
app/Http/Controllers/Staff/HomeController.php | 2 +-
resources/views/partials/top_nav.blade.php | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/Http/Controllers/Staff/HomeController.php b/app/Http/Controllers/Staff/HomeController.php
index dff6b79874..b923adb19d 100644
--- a/app/Http/Controllers/Staff/HomeController.php
+++ b/app/Http/Controllers/Staff/HomeController.php
@@ -71,7 +71,7 @@ public function index(Request $request): \Illuminate\Contracts\View\Factory|\Ill
->selectRaw('sum(seeder = 0 AND active = 1) as leechers')
->selectRaw('sum(seeder = 1 AND active = 1) as seeders')
->first()),
- 'unsolvedReportsCount' => DB::table('reports')->where('solved', '=', false)->count(),
+ 'unsolvedReportsCount' => DB::table('reports')->whereNull('snoozed_until')->where('solved', '=', false)->count(),
'pendingApplicationsCount' => DB::table('applications')->where('status', '=', 0)->count(),
'certificate' => $certificate,
'uptime' => $systemInformation->uptime(),
diff --git a/resources/views/partials/top_nav.blade.php b/resources/views/partials/top_nav.blade.php
index 7f615d09f6..efef6ed08f 100755
--- a/resources/views/partials/top_nav.blade.php
+++ b/resources/views/partials/top_nav.blade.php
@@ -267,7 +267,7 @@ class="progress-bar"
- Support UNIT3D Development (polar.sh)
+ Support UNIT3D Development
@@ -396,6 +396,7 @@ class="top-nav--right__icon-link"
@php
$unsolvedReportsCount = DB::table('reports')
+ ->whereNull('snoozed_until')
->where('solved', '=', false)
->count()
@endphp
|