mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-08 04:00:14 -05:00
Merge branch '7.x.x' into fix-migration-models
This commit is contained in:
@@ -1,90 +0,0 @@
|
||||
{
|
||||
"projectName": "UNIT3D-Community-Edition",
|
||||
"projectOwner": "HDInnovations",
|
||||
"repoType": "github",
|
||||
"repoHost": "https://github.com",
|
||||
"files": [
|
||||
"README.md"
|
||||
],
|
||||
"imageSize": 100,
|
||||
"commit": false,
|
||||
"contributors": [
|
||||
{
|
||||
"login": "HDVinnie",
|
||||
"name": "HDVinnie",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/12850699?v=4",
|
||||
"profile": "https://github.com/HDVinnie",
|
||||
"contributions": [
|
||||
"code",
|
||||
"design",
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "poppabear8883",
|
||||
"name": "Everett (Mike) Wiley",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/7263458?v=4",
|
||||
"profile": "https://github.com/poppabear8883",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "singularity43",
|
||||
"name": "singularity43",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/46550600?v=4",
|
||||
"profile": "https://github.com/singularity43",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "VerioPL",
|
||||
"name": "VerioPL",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/24521644?v=4",
|
||||
"profile": "https://github.com/VerioPL",
|
||||
"contributions": [
|
||||
"translation"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "pbodq2",
|
||||
"name": "Morgan Wong",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/25418300?v=4",
|
||||
"profile": "https://github.com/pbodq2",
|
||||
"contributions": [
|
||||
"translation"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "gyakkun",
|
||||
"name": "Gyakkun",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/5460071?v=4",
|
||||
"profile": "https://nyamori.moe",
|
||||
"contributions": [
|
||||
"translation"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "cbj4074",
|
||||
"name": "Ben Johnson",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/1236883?v=4",
|
||||
"profile": "https://indiehd.com",
|
||||
"contributions": [
|
||||
"test",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Oha-you",
|
||||
"name": "おはよう",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/82098328?v=4",
|
||||
"profile": "https://github.com/Oha-you",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
"skipCi": true
|
||||
}
|
||||
@@ -50,7 +50,7 @@ class CasinoBot
|
||||
*/
|
||||
public function __construct(private readonly ChatRepository $chatRepository)
|
||||
{
|
||||
$bot = Bot::where('id', '=', '3')->firstOrFail();
|
||||
$bot = Bot::findOrFail(3);
|
||||
$this->bot = $bot;
|
||||
$this->expiresAt = Carbon::now()->addMinutes(60);
|
||||
$this->current = Carbon::now();
|
||||
|
||||
@@ -54,7 +54,7 @@ class NerdBot
|
||||
*/
|
||||
public function __construct(private readonly ChatRepository $chatRepository)
|
||||
{
|
||||
$bot = Bot::where('id', '=', '2')->firstOrFail();
|
||||
$bot = Bot::findOrFail(2);
|
||||
$this->bot = $bot;
|
||||
$this->expiresAt = Carbon::now()->addMinutes(60);
|
||||
$this->current = Carbon::now();
|
||||
|
||||
@@ -46,7 +46,7 @@ class SystemBot
|
||||
*/
|
||||
public function __construct(private readonly ChatRepository $chatRepository)
|
||||
{
|
||||
$bot = Bot::where('is_systembot', '=', '1')->firstOrFail();
|
||||
$bot = Bot::where('is_systembot', '=', '1')->sole();
|
||||
$this->bot = $bot;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ class AutoBonAllocation extends Command
|
||||
|
||||
$array = [];
|
||||
|
||||
foreach ($dyingTorrent as $key => $value) {
|
||||
foreach ($dyingTorrent as $value) {
|
||||
if (\array_key_exists($value->user_id, $array)) {
|
||||
$array[$value->user_id] += $value->value * 2;
|
||||
} else {
|
||||
@@ -167,7 +167,7 @@ class AutoBonAllocation extends Command
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($legendaryTorrent as $key => $value) {
|
||||
foreach ($legendaryTorrent as $value) {
|
||||
if (\array_key_exists($value->user_id, $array)) {
|
||||
$array[$value->user_id] += $value->value * 1.5;
|
||||
} else {
|
||||
@@ -175,7 +175,7 @@ class AutoBonAllocation extends Command
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($oldTorrent as $key => $value) {
|
||||
foreach ($oldTorrent as $value) {
|
||||
if (\array_key_exists($value->user_id, $array)) {
|
||||
$array[$value->user_id] += $value->value * 1;
|
||||
} else {
|
||||
@@ -183,7 +183,7 @@ class AutoBonAllocation extends Command
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($hugeTorrent as $key => $value) {
|
||||
foreach ($hugeTorrent as $value) {
|
||||
if (\array_key_exists($value->user_id, $array)) {
|
||||
$array[$value->user_id] += $value->value * 0.75;
|
||||
} else {
|
||||
@@ -191,7 +191,7 @@ class AutoBonAllocation extends Command
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($largeTorrent as $key => $value) {
|
||||
foreach ($largeTorrent as $value) {
|
||||
if (\array_key_exists($value->user_id, $array)) {
|
||||
$array[$value->user_id] += $value->value * 0.50;
|
||||
} else {
|
||||
@@ -199,7 +199,7 @@ class AutoBonAllocation extends Command
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($regularTorrent as $key => $value) {
|
||||
foreach ($regularTorrent as $value) {
|
||||
if (\array_key_exists($value->user_id, $array)) {
|
||||
$array[$value->user_id] += $value->value * 0.25;
|
||||
} else {
|
||||
@@ -207,7 +207,7 @@ class AutoBonAllocation extends Command
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($participaintSeeder as $key => $value) {
|
||||
foreach ($participaintSeeder as $value) {
|
||||
if (\array_key_exists($value->user_id, $array)) {
|
||||
$array[$value->user_id] += $value->value * 0.25;
|
||||
} else {
|
||||
@@ -215,7 +215,7 @@ class AutoBonAllocation extends Command
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($teamplayerSeeder as $key => $value) {
|
||||
foreach ($teamplayerSeeder as $value) {
|
||||
if (\array_key_exists($value->user_id, $array)) {
|
||||
$array[$value->user_id] += $value->value * 0.50;
|
||||
} else {
|
||||
@@ -223,7 +223,7 @@ class AutoBonAllocation extends Command
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($commitedSeeder as $key => $value) {
|
||||
foreach ($commitedSeeder as $value) {
|
||||
if (\array_key_exists($value->user_id, $array)) {
|
||||
$array[$value->user_id] += $value->value * 0.75;
|
||||
} else {
|
||||
@@ -231,7 +231,7 @@ class AutoBonAllocation extends Command
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($mvpSeeder as $key => $value) {
|
||||
foreach ($mvpSeeder as $value) {
|
||||
if (\array_key_exists($value->user_id, $array)) {
|
||||
$array[$value->user_id] += $value->value * 1;
|
||||
} else {
|
||||
@@ -239,7 +239,7 @@ class AutoBonAllocation extends Command
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($legendarySeeder as $key => $value) {
|
||||
foreach ($legendarySeeder as $value) {
|
||||
if (\array_key_exists($value->user_id, $array)) {
|
||||
$array[$value->user_id] += $value->value * 2;
|
||||
} else {
|
||||
@@ -260,7 +260,7 @@ class AutoBonAllocation extends Command
|
||||
|
||||
//Move data from array to Users table
|
||||
foreach ($array as $key => $value) {
|
||||
$user = User::where('id', '=', $key)->first();
|
||||
$user = User::find($key);
|
||||
if ($user) {
|
||||
$user->seedbonus += $value;
|
||||
$user->save();
|
||||
|
||||
@@ -59,7 +59,7 @@ class AutoDisableInactiveUsers extends Command
|
||||
->all();
|
||||
|
||||
foreach ($users as $user) {
|
||||
if ($user->seedingTorrents()->count() === 0) {
|
||||
if ($user->seedingTorrents()->doesntExist()) {
|
||||
$user->group_id = $disabledGroup[0];
|
||||
$user->can_upload = 0;
|
||||
$user->can_download = 0;
|
||||
|
||||
@@ -55,9 +55,9 @@ class AutoGraveyard extends Command
|
||||
public function handle(): void
|
||||
{
|
||||
foreach (Graveyard::where('rewarded', '!=', 1)->oldest()->get() as $reward) {
|
||||
$user = User::where('id', '=', $reward->user_id)->first();
|
||||
$user = User::find($reward->user_id);
|
||||
|
||||
$torrent = Torrent::where('id', '=', $reward->torrent_id)->first();
|
||||
$torrent = Torrent::find($reward->torrent_id);
|
||||
|
||||
if (isset($user, $torrent)) {
|
||||
$history = History::where('torrent_id', '=', $torrent->id)
|
||||
|
||||
@@ -43,11 +43,14 @@ class AutoHighspeedTag extends Command
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$seedboxIps = Seedbox::pluck('ip')->filter(fn ($ip) => filter_var($ip, FILTER_VALIDATE_IP));
|
||||
$seedboxIps = Seedbox::all()
|
||||
->pluck('ip')
|
||||
->filter(fn ($ip) => filter_var($ip, FILTER_VALIDATE_IP));
|
||||
|
||||
Torrent::withAnyStatus()
|
||||
->leftJoinSub(
|
||||
Peer::distinct()
|
||||
Peer::where('seeder', '=', 1)
|
||||
->distinct()
|
||||
->select('torrent_id')
|
||||
->whereRaw("INET6_NTOA(ip) IN ('".$seedboxIps->implode("','")."')"),
|
||||
'highspeed_torrents',
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE.
|
||||
*
|
||||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D Community Edition
|
||||
*
|
||||
* @author HDVinnie <hdinnovations@protonmail.com>
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
||||
*/
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\History;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AutoRefundDownload extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'auto:refund_download';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Refunds Download To Users Based On Seed Time.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$now = Carbon::now();
|
||||
$MIN_SEEDTIME = config('hitrun.seedtime');
|
||||
$FULL_REFUND_SEEDTIME = 12 * 30 * 24 * 60 * 60 + $MIN_SEEDTIME;
|
||||
$COMMAND_RUN_PERIOD = 24 * 60 * 60; // This command is run every 24 hours
|
||||
|
||||
History::query()
|
||||
->selectRaw('LEAST(1, history.seedtime / ?) * torrents.size - history.refunded_download as refunded_download_delta', [$FULL_REFUND_SEEDTIME])
|
||||
->join('torrents', 'torrents.id', '=', 'history.torrent_id')
|
||||
->join('users', 'users.id', '=', 'history.user_id')
|
||||
->join('groups', 'groups.id', '=', 'users.group_id')
|
||||
->where('history.active', '=', 1)
|
||||
->where('history.seeder', '=', 1)
|
||||
->where('history.seedtime', '>=', $MIN_SEEDTIME)
|
||||
->where('history.seedtime', '<=', $FULL_REFUND_SEEDTIME + $MIN_SEEDTIME + $COMMAND_RUN_PERIOD)
|
||||
->where('history.created_at', '>=', $now->copy()->subSeconds($MIN_SEEDTIME))
|
||||
->whereColumn('torrents.user_id', '!=', 'history.user_id')
|
||||
->when(! config('other.refundable'), fn ($query) => $query->where(
|
||||
fn ($query) => $query
|
||||
->where('groups.is_refundable', '=', 1)
|
||||
->orWhere('torrents.refundable', '=', 1)
|
||||
))
|
||||
->update([
|
||||
'history.refunded_download' => DB::raw('history.refunded_download + (@delta := LEAST(1, history.seedtime / '.(int) $FULL_REFUND_SEEDTIME.') * torrents.size - history.refunded_download)'),
|
||||
'users.downloaded' => DB::raw('users.downloaded - @delta'),
|
||||
'history.updated_at' => DB::raw('history.updated_at'),
|
||||
]);
|
||||
|
||||
$this->comment('Automated Download Refund Command Complete');
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ class AutoRemoveFeaturedTorrent extends Command
|
||||
|
||||
foreach ($featuredTorrents as $featuredTorrent) {
|
||||
// Find The Torrent
|
||||
$torrent = Torrent::where('featured', '=', 1)->where('id', '=', $featuredTorrent->torrent_id)->first();
|
||||
$torrent = Torrent::where('featured', '=', 1)->find($featuredTorrent->torrent_id);
|
||||
if (isset($torrent)) {
|
||||
$torrent->free = 0;
|
||||
$torrent->doubleup = 0;
|
||||
|
||||
@@ -50,7 +50,7 @@ class DemoSeed extends Command
|
||||
|
||||
$abort = false;
|
||||
|
||||
foreach ($this->movie_ids() as $key => $id) {
|
||||
foreach ($this->movie_ids() as $id) {
|
||||
// Users
|
||||
$this->info('Creating User Account');
|
||||
|
||||
@@ -259,7 +259,7 @@ Menu
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->tv_ids() as $key => $id) {
|
||||
foreach ($this->tv_ids() as $id) {
|
||||
// Users
|
||||
$this->info('Creating User Account');
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class FetchReleaseYears extends Command
|
||||
foreach ($torrents as $torrent) {
|
||||
$meta = null;
|
||||
if ($torrent->category->tv_meta && $torrent->tmdb && $torrent->tmdb != 0) {
|
||||
$meta = Tv::where('id', '=', $torrent->tmdb)->first();
|
||||
$meta = Tv::find($torrent->tmdb);
|
||||
if (isset($meta->first_air_date) && substr($meta->first_air_date, 0, 4) > '1900') {
|
||||
$torrent->release_year = substr($meta->first_air_date, 0, 4);
|
||||
$torrent->save();
|
||||
@@ -75,7 +75,7 @@ class FetchReleaseYears extends Command
|
||||
}
|
||||
|
||||
if ($torrent->category->movie_meta && $torrent->tmdb && $torrent->tmdb != 0) {
|
||||
$meta = Movie::where('id', '=', $torrent->tmdb)->first();
|
||||
$meta = Movie::find($torrent->tmdb);
|
||||
if (isset($meta->release_date) && substr($meta->release_date, 0, 4) > '1900') {
|
||||
$torrent->release_year = substr($meta->release_date, 0, 4);
|
||||
$torrent->save();
|
||||
|
||||
@@ -46,6 +46,7 @@ class Kernel extends ConsoleKernel
|
||||
$schedule->command('auto:reset_user_flushes')->daily();
|
||||
$schedule->command('auto:stats_clients')->daily();
|
||||
$schedule->command('auto:remove_torrent_buffs')->hourly();
|
||||
$schedule->command('auto:refund_download')->daily();
|
||||
$schedule->command('auto:torrent_balance')->hourly();
|
||||
//$schedule->command('auto:ban_disposable_users')->weekends();
|
||||
//$schedule->command('backup:clean')->daily();
|
||||
|
||||
@@ -41,7 +41,7 @@ class TorrentHelper
|
||||
$appname = config('app.name');
|
||||
|
||||
Torrent::approve($id);
|
||||
$torrent = Torrent::with('user')->withAnyStatus()->where('id', '=', $id)->first();
|
||||
$torrent = Torrent::with('user')->withAnyStatus()->find($id);
|
||||
$torrent->created_at = Carbon::now();
|
||||
$torrent->bumped_at = Carbon::now();
|
||||
$torrent->save();
|
||||
|
||||
@@ -92,7 +92,7 @@ class TorrentTools
|
||||
{
|
||||
$size = 0;
|
||||
if (\array_key_exists('files', $decodedTorrent['info']) && (is_countable($decodedTorrent['info']['files']) ? \count($decodedTorrent['info']['files']) : 0)) {
|
||||
foreach ($decodedTorrent['info']['files'] as $k => $file) {
|
||||
foreach ($decodedTorrent['info']['files'] as $file) {
|
||||
$dir = '';
|
||||
$size += $file['length'];
|
||||
$count = is_countable($file['path']) ? \count($file['path']) : 0;
|
||||
@@ -143,7 +143,7 @@ class TorrentTools
|
||||
$filenames = [];
|
||||
|
||||
if (\array_key_exists('files', $decodedTorrent['info']) && (is_countable($decodedTorrent['info']['files']) ? \count($decodedTorrent['info']['files']) : 0)) {
|
||||
foreach ($decodedTorrent['info']['files'] as $k => $file) {
|
||||
foreach ($decodedTorrent['info']['files'] as $file) {
|
||||
$count = is_countable($file['path']) ? \count($file['path']) : 0;
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if (! \in_array($file['path'][$i], $filenames)) {
|
||||
|
||||
@@ -114,7 +114,7 @@ class ChatController extends Controller
|
||||
public function botMessages($botId): \Illuminate\Http\Resources\Json\AnonymousResourceCollection
|
||||
{
|
||||
$runbot = null;
|
||||
$bot = Bot::where('id', '=', $botId)->firstOrFail();
|
||||
$bot = Bot::findOrFail($botId);
|
||||
if ($bot->is_systembot) {
|
||||
$runbot = new SystemBot($this->chatRepository);
|
||||
} elseif ($bot->is_nerdbot) {
|
||||
@@ -168,7 +168,7 @@ class ChatController extends Controller
|
||||
$which = 'skip';
|
||||
$command = @explode(' ', (string) $message);
|
||||
if (\array_key_exists(1, $command)) {
|
||||
$receiverId = User::where('username', 'like', $command[1])->firstOrFail()->id;
|
||||
$receiverId = User::where('username', 'like', $command[1])->sole()->id;
|
||||
$clone = $command;
|
||||
array_shift($clone);
|
||||
array_shift($clone);
|
||||
@@ -249,7 +249,7 @@ class ChatController extends Controller
|
||||
}
|
||||
|
||||
$senderListening = false;
|
||||
foreach ($senderEchoes as $se => $senderEcho) {
|
||||
foreach ($senderEchoes as $senderEcho) {
|
||||
if ($senderEcho['target_id'] == $receiverId) {
|
||||
$senderListening = true;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ class ChatController extends Controller
|
||||
}
|
||||
|
||||
$receiverListening = false;
|
||||
foreach ($receiverEchoes as $se => $receiverEcho) {
|
||||
foreach ($receiverEchoes as $receiverEcho) {
|
||||
if ($receiverEcho['target_id'] == $userId) {
|
||||
$receiverListening = true;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ class ChatController extends Controller
|
||||
}
|
||||
|
||||
$senderListening = false;
|
||||
foreach ($senderAudibles as $se => $senderEcho) {
|
||||
foreach ($senderAudibles as $senderEcho) {
|
||||
if ($senderEcho['target_id'] == $receiverId) {
|
||||
$senderListening = true;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ class ChatController extends Controller
|
||||
}
|
||||
|
||||
$receiverListening = false;
|
||||
foreach ($receiverAudibles as $se => $receiverEcho) {
|
||||
foreach ($receiverAudibles as $receiverEcho) {
|
||||
if ($receiverEcho['target_id'] == $userId) {
|
||||
$receiverListening = true;
|
||||
}
|
||||
@@ -381,7 +381,7 @@ class ChatController extends Controller
|
||||
|
||||
public function deleteRoomEcho(Request $request, $userId): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
||||
{
|
||||
$echo = UserEcho::where('user_id', '=', $userId)->where('room_id', '=', $request->input('room_id'))->firstOrFail();
|
||||
$echo = UserEcho::where('user_id', '=', $userId)->where('room_id', '=', $request->input('room_id'))->sole();
|
||||
$echo->delete();
|
||||
|
||||
$user = User::with(['chatStatus', 'chatroom', 'group', 'echoes'])->findOrFail($userId);
|
||||
@@ -403,7 +403,7 @@ class ChatController extends Controller
|
||||
|
||||
public function deleteTargetEcho(Request $request, $userId): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
||||
{
|
||||
$echo = UserEcho::where('user_id', '=', $userId)->where('target_id', '=', $request->input('target_id'))->firstOrFail();
|
||||
$echo = UserEcho::where('user_id', '=', $userId)->where('target_id', '=', $request->input('target_id'))->sole();
|
||||
$echo->delete();
|
||||
|
||||
$user = User::with(['chatStatus', 'chatroom', 'group', 'echoes'])->findOrFail($userId);
|
||||
@@ -418,7 +418,7 @@ class ChatController extends Controller
|
||||
|
||||
public function deleteBotEcho(Request $request, $userId): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
||||
{
|
||||
$echo = UserEcho::where('user_id', '=', $userId)->where('bot_id', '=', $request->input('bot_id'))->firstOrFail();
|
||||
$echo = UserEcho::where('user_id', '=', $userId)->where('bot_id', '=', $request->input('bot_id'))->sole();
|
||||
$echo->delete();
|
||||
|
||||
$user = User::with(['chatStatus', 'chatroom', 'group', 'echoes'])->findOrFail($userId);
|
||||
@@ -433,7 +433,7 @@ class ChatController extends Controller
|
||||
|
||||
public function toggleRoomAudible(Request $request, $userId): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
||||
{
|
||||
$echo = UserAudible::where('user_id', '=', $userId)->where('room_id', '=', $request->input('room_id'))->firstOrFail();
|
||||
$echo = UserAudible::where('user_id', '=', $userId)->where('room_id', '=', $request->input('room_id'))->sole();
|
||||
$echo->status = ($echo->status == 1 ? 0 : 1);
|
||||
$echo->save();
|
||||
|
||||
@@ -449,7 +449,7 @@ class ChatController extends Controller
|
||||
|
||||
public function toggleTargetAudible(Request $request, $userId): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
||||
{
|
||||
$echo = UserAudible::where('user_id', '=', $userId)->where('target_id', '=', $request->input('target_id'))->firstOrFail();
|
||||
$echo = UserAudible::where('user_id', '=', $userId)->where('target_id', '=', $request->input('target_id'))->sole();
|
||||
$echo->status = ($echo->status == 1 ? 0 : 1);
|
||||
$echo->save();
|
||||
|
||||
@@ -465,7 +465,7 @@ class ChatController extends Controller
|
||||
|
||||
public function toggleBotAudible(Request $request, $userId): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
||||
{
|
||||
$echo = UserAudible::where('user_id', '=', $userId)->where('bot_id', '=', $request->input('bot_id'))->firstOrFail();
|
||||
$echo = UserAudible::where('user_id', '=', $userId)->where('bot_id', '=', $request->input('bot_id'))->sole();
|
||||
$echo->status = ($echo->status == 1 ? 0 : 1);
|
||||
$echo->save();
|
||||
|
||||
@@ -482,7 +482,7 @@ class ChatController extends Controller
|
||||
/* USERS */
|
||||
public function updateUserChatStatus(Request $request, $id): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
||||
{
|
||||
$systemUser = User::where('username', 'System')->firstOrFail();
|
||||
$systemUser = User::where('username', 'System')->sole();
|
||||
|
||||
$user = User::with(['chatStatus', 'chatroom', 'group', 'echoes'])->findOrFail($id);
|
||||
$status = $this->chatRepository->statusFindOrFail($request->input('status_id'));
|
||||
@@ -516,7 +516,7 @@ class ChatController extends Controller
|
||||
}
|
||||
|
||||
$senderListening = false;
|
||||
foreach ($senderEchoes as $se => $senderEcho) {
|
||||
foreach ($senderEchoes as $senderEcho) {
|
||||
if ($senderEcho['room_id'] == $room->id) {
|
||||
$senderListening = true;
|
||||
}
|
||||
|
||||
@@ -350,8 +350,7 @@ class AnnounceController extends Controller
|
||||
$group = cache()->remember('group:'.$user->group_id, 300, function () use ($user) {
|
||||
return Group::query()
|
||||
->select(['id', 'download_slots', 'is_immune', 'is_freeleech', 'is_double_upload'])
|
||||
->where('id', '=', $user->group_id)
|
||||
->first();
|
||||
->find($user->group_id);
|
||||
});
|
||||
|
||||
// If User Account Is Unactivated/Validating Return Error to Client
|
||||
|
||||
@@ -25,9 +25,9 @@ class ArticleController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$articles = Article::latest()->paginate(6);
|
||||
|
||||
return view('article.index', ['articles' => $articles]);
|
||||
return view('article.index', [
|
||||
'articles' => Article::latest()->paginate(6),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,8 +35,8 @@ class ArticleController extends Controller
|
||||
*/
|
||||
public function show(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$article = Article::with(['user', 'comments'])->findOrFail($id);
|
||||
|
||||
return view('article.show', ['article' => $article]);
|
||||
return view('article.show', [
|
||||
'article' => Article::with(['user', 'comments'])->findOrFail($id),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class ActivationController extends Controller
|
||||
$bannedGroup = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id'));
|
||||
$memberGroup = cache()->rememberForever('member_group', fn () => Group::where('slug', '=', 'user')->pluck('id'));
|
||||
|
||||
$activation = UserActivation::with('user')->where('token', '=', $token)->firstOrFail();
|
||||
$activation = UserActivation::with('user')->where('token', '=', $token)->sole();
|
||||
if ($activation->user->id && $activation->user->group->id != $bannedGroup[0]) {
|
||||
$activation->user->active = 1;
|
||||
$activation->user->can_upload = 1;
|
||||
|
||||
@@ -89,7 +89,7 @@ class BountyController extends Controller
|
||||
$requester->notify(new NewRequestBounty('torrent', $sender, $request->input('bonus_value'), $tr));
|
||||
}
|
||||
|
||||
return to_route('requests.show', ['id' => $request->input('request_id')])
|
||||
return to_route('requests.show', ['id' => $request->integer('request_id')])
|
||||
->withSuccess(trans('request.added-bonus'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ use App\Models\TorrentRequest;
|
||||
use App\Models\TorrentRequestClaim;
|
||||
use App\Notifications\NewRequestClaim;
|
||||
use App\Notifications\NewRequestUnclaim;
|
||||
use App\Repositories\ChatRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use Exception;
|
||||
|
||||
@@ -26,13 +25,6 @@ use Exception;
|
||||
*/
|
||||
class ClaimController extends Controller
|
||||
{
|
||||
/**
|
||||
* RequestController Constructor.
|
||||
*/
|
||||
public function __construct(private readonly ChatRepository $chatRepository)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Claim A Torrent Request.
|
||||
*/
|
||||
@@ -80,7 +72,7 @@ class ClaimController extends Controller
|
||||
abort_unless($user->group->is_modo || $user->username == $claimer->username, 403);
|
||||
|
||||
if ($torrentRequest->claimed == 1) {
|
||||
$requestClaim = TorrentRequestClaim::where('request_id', '=', $id)->firstOrFail();
|
||||
$requestClaim = TorrentRequestClaim::where('request_id', '=', $id)->sole();
|
||||
$isAnon = $requestClaim->anon;
|
||||
$requestClaim->delete();
|
||||
|
||||
|
||||
@@ -28,29 +28,18 @@ class ForumController extends Controller
|
||||
*/
|
||||
public function index(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
$categories = Forum::query()
|
||||
->with(['forums' => fn ($query) => $query
|
||||
->whereRelation('permissions', [['show_forum', '=', 1], ['group_id', '=', $user->group_id]])
|
||||
])
|
||||
->where('parent_id', '=', 0)
|
||||
->whereRelation('permissions', [['show_forum', '=', 1], ['group_id', '=', $user->group_id]])
|
||||
->orderBy('position')
|
||||
->get();
|
||||
|
||||
// Total Forums Count
|
||||
$numForums = Forum::count();
|
||||
// Total Posts Count
|
||||
$numPosts = Post::count();
|
||||
// Total Topics Count
|
||||
$numTopics = Topic::count();
|
||||
|
||||
return view('forum.index', [
|
||||
'categories' => $categories,
|
||||
'num_posts' => $numPosts,
|
||||
'num_forums' => $numForums,
|
||||
'num_topics' => $numTopics,
|
||||
'categories' => Forum::query()
|
||||
->with(['forums' => fn ($query) => $query
|
||||
->whereRelation('permissions', [['show_forum', '=', 1], ['group_id', '=', $request->user()->group_id]])
|
||||
])
|
||||
->where('parent_id', '=', 0)
|
||||
->whereRelation('permissions', [['show_forum', '=', 1], ['group_id', '=', $request->user()->group_id]])
|
||||
->orderBy('position')
|
||||
->get(),
|
||||
'num_posts' => Post::count(),
|
||||
'num_forums' => Forum::count(),
|
||||
'num_topics' => Topic::count(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ use App\Models\Tv;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Exception;
|
||||
|
||||
@@ -44,324 +43,406 @@ class HomeController extends Controller
|
||||
public function index(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// For Cache
|
||||
$current = Carbon::now();
|
||||
$expiresAt = $current->addMinutes(1);
|
||||
$expiresAt = now()->addMinutes(1);
|
||||
|
||||
// Authorized User
|
||||
$user = $request->user();
|
||||
|
||||
// Latest Articles/News Block
|
||||
$articles = cache()->remember('latest_article', $expiresAt, fn () => Article::latest()->take(1)->get());
|
||||
|
||||
foreach ($articles as $article) {
|
||||
$article->newNews = ($user->last_login->subDays(3)->getTimestamp() < $article->created_at->getTimestamp()) ? 1 : 0;
|
||||
}
|
||||
|
||||
// Latest Torrents Block
|
||||
$personalFreeleech = cache()->get('personal_freeleech:'.$user->id);
|
||||
|
||||
$newest = cache()->remember('newest_torrents', $expiresAt, function () {
|
||||
$newest = Torrent::with(['user', 'category', 'type', 'resolution'])
|
||||
->withExists([
|
||||
'bookmarks' => fn ($query) => $query->where('user_id', '=', auth()->id()),
|
||||
'freeleechTokens' => fn ($query) => $query->where('user_id', '=', auth()->id()),
|
||||
])
|
||||
->selectRaw("
|
||||
CASE
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `movie_meta` = 1) THEN 'movie'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `tv_meta` = 1) THEN 'tv'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `game_meta` = 1) THEN 'game'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `music_meta` = 1) THEN 'music'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `no_meta` = 1) THEN 'no'
|
||||
END as meta
|
||||
")
|
||||
->withCount(['thanks', 'comments'])
|
||||
->latest()
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
$movieIds = $newest->where('meta', '=', 'movie')->pluck('tmdb');
|
||||
$tvIds = $newest->where('meta', '=', 'tv')->pluck('tmdb');
|
||||
$gameIds = $newest->where('meta', '=', 'game')->pluck('igdb');
|
||||
|
||||
$movies = Movie::with('genres')->whereIntegerInRaw('id', $movieIds)->get()->keyBy('id');
|
||||
$tv = Tv::with('genres')->whereIntegerInRaw('id', $tvIds)->get()->keyBy('id');
|
||||
$games = [];
|
||||
|
||||
foreach ($gameIds as $gameId) {
|
||||
$games[$gameId] = \MarcReichel\IGDBLaravel\Models\Game::with(['cover' => ['url', 'image_id']])->find($gameId);
|
||||
}
|
||||
|
||||
$newest = $newest->map(function ($torrent) use ($movies, $tv, $games) {
|
||||
$torrent->meta = match ($torrent->meta) {
|
||||
'movie' => $movies[$torrent->tmdb] ?? null,
|
||||
'tv' => $tv[$torrent->tmdb] ?? null,
|
||||
'game' => $games[$torrent->igdb] ?? null,
|
||||
default => null,
|
||||
};
|
||||
|
||||
return $torrent;
|
||||
});
|
||||
|
||||
return $newest;
|
||||
});
|
||||
|
||||
$seeded = cache()->remember('seeded_torrents', $expiresAt, function () {
|
||||
$seeded = Torrent::with(['user', 'category', 'type', 'resolution'])
|
||||
->withExists([
|
||||
'bookmarks' => fn ($query) => $query->where('user_id', '=', auth()->id()),
|
||||
'freeleechTokens' => fn ($query) => $query->where('user_id', '=', auth()->id()),
|
||||
])
|
||||
->selectRaw("
|
||||
CASE
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `movie_meta` = 1) THEN 'movie'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `tv_meta` = 1) THEN 'tv'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `game_meta` = 1) THEN 'game'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `music_meta` = 1) THEN 'music'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `no_meta` = 1) THEN 'no'
|
||||
END as meta
|
||||
")
|
||||
->withCount(['thanks', 'comments'])
|
||||
->latest('seeders')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
$movieIds = $seeded->where('meta', '=', 'movie')->pluck('tmdb');
|
||||
$tvIds = $seeded->where('meta', '=', 'tv')->pluck('tmdb');
|
||||
$gameIds = $seeded->where('meta', '=', 'game')->pluck('igdb');
|
||||
|
||||
$movies = Movie::with('genres')->whereIntegerInRaw('id', $movieIds)->get()->keyBy('id');
|
||||
$tv = Tv::with('genres')->whereIntegerInRaw('id', $tvIds)->get()->keyBy('id');
|
||||
$games = [];
|
||||
|
||||
foreach ($gameIds as $gameId) {
|
||||
$games[$gameId] = \MarcReichel\IGDBLaravel\Models\Game::with(['cover' => ['url', 'image_id']])->find($gameId);
|
||||
}
|
||||
|
||||
$seeded = $seeded->map(function ($torrent) use ($movies, $tv, $games) {
|
||||
$torrent->meta = match ($torrent->meta) {
|
||||
'movie' => $movies[$torrent->tmdb] ?? null,
|
||||
'tv' => $tv[$torrent->tmdb] ?? null,
|
||||
'game' => $games[$torrent->igdb] ?? null,
|
||||
default => null,
|
||||
};
|
||||
|
||||
return $torrent;
|
||||
});
|
||||
|
||||
return $seeded;
|
||||
});
|
||||
|
||||
$leeched = cache()->remember('leeched_torrents', $expiresAt, function () {
|
||||
$leeched = Torrent::with(['user', 'category', 'type', 'resolution'])
|
||||
->withExists([
|
||||
'bookmarks' => fn ($query) => $query->where('user_id', '=', auth()->id()),
|
||||
'freeleechTokens' => fn ($query) => $query->where('user_id', '=', auth()->id()),
|
||||
])
|
||||
->selectRaw("
|
||||
CASE
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `movie_meta` = 1) THEN 'movie'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `tv_meta` = 1) THEN 'tv'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `game_meta` = 1) THEN 'game'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `music_meta` = 1) THEN 'music'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `no_meta` = 1) THEN 'no'
|
||||
END as meta
|
||||
")
|
||||
->withCount(['thanks', 'comments'])
|
||||
->latest('leechers')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
$movieIds = $leeched->where('meta', '=', 'movie')->pluck('tmdb');
|
||||
$tvIds = $leeched->where('meta', '=', 'tv')->pluck('tmdb');
|
||||
$gameIds = $leeched->where('meta', '=', 'game')->pluck('igdb');
|
||||
|
||||
$movies = Movie::with('genres')->whereIntegerInRaw('id', $movieIds)->get()->keyBy('id');
|
||||
$tv = Tv::with('genres')->whereIntegerInRaw('id', $tvIds)->get()->keyBy('id');
|
||||
$games = [];
|
||||
|
||||
foreach ($gameIds as $gameId) {
|
||||
$games[$gameId] = \MarcReichel\IGDBLaravel\Models\Game::with(['cover' => ['url', 'image_id']])->find($gameId);
|
||||
}
|
||||
|
||||
$leeched = $leeched->map(function ($torrent) use ($movies, $tv, $games) {
|
||||
$torrent->meta = match ($torrent->meta) {
|
||||
'movie' => $movies[$torrent->tmdb] ?? null,
|
||||
'tv' => $tv[$torrent->tmdb] ?? null,
|
||||
'game' => $games[$torrent->igdb] ?? null,
|
||||
default => null,
|
||||
};
|
||||
|
||||
return $torrent;
|
||||
});
|
||||
|
||||
return $leeched;
|
||||
});
|
||||
|
||||
$dying = cache()->remember('dying_torrents', $expiresAt, function () {
|
||||
$dying = Torrent::with(['user', 'category', 'type', 'resolution'])
|
||||
->withExists([
|
||||
'bookmarks' => fn ($query) => $query->where('user_id', '=', auth()->id()),
|
||||
'freeleechTokens' => fn ($query) => $query->where('user_id', '=', auth()->id()),
|
||||
])
|
||||
->selectRaw("
|
||||
CASE
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `movie_meta` = 1) THEN 'movie'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `tv_meta` = 1) THEN 'tv'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `game_meta` = 1) THEN 'game'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `music_meta` = 1) THEN 'music'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `no_meta` = 1) THEN 'no'
|
||||
END as meta
|
||||
")
|
||||
->withCount(['thanks', 'comments'])
|
||||
->where('seeders', '=', 1)
|
||||
->where('times_completed', '>=', 1)
|
||||
->latest('leechers')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
$movieIds = $dying->where('meta', '=', 'movie')->pluck('tmdb');
|
||||
$tvIds = $dying->where('meta', '=', 'tv')->pluck('tmdb');
|
||||
$gameIds = $dying->where('meta', '=', 'game')->pluck('igdb');
|
||||
|
||||
$movies = Movie::with('genres')->whereIntegerInRaw('id', $movieIds)->get()->keyBy('id');
|
||||
$tv = Tv::with('genres')->whereIntegerInRaw('id', $tvIds)->get()->keyBy('id');
|
||||
$games = [];
|
||||
|
||||
foreach ($gameIds as $gameId) {
|
||||
$games[$gameId] = \MarcReichel\IGDBLaravel\Models\Game::with(['cover' => ['url', 'image_id']])->find($gameId);
|
||||
}
|
||||
|
||||
$dying = $dying->map(function ($torrent) use ($movies, $tv, $games) {
|
||||
$torrent->meta = match ($torrent->meta) {
|
||||
'movie' => $movies[$torrent->tmdb] ?? null,
|
||||
'tv' => $tv[$torrent->tmdb] ?? null,
|
||||
'game' => $games[$torrent->igdb] ?? null,
|
||||
default => null,
|
||||
};
|
||||
|
||||
return $torrent;
|
||||
});
|
||||
|
||||
return $dying;
|
||||
});
|
||||
|
||||
$dead = cache()->remember('dead_torrents', $expiresAt, function () {
|
||||
$dead = Torrent::with(['user', 'category', 'type', 'resolution'])
|
||||
->withExists([
|
||||
'bookmarks' => fn ($query) => $query->where('user_id', '=', auth()->id()),
|
||||
'freeleechTokens' => fn ($query) => $query->where('user_id', '=', auth()->id()),
|
||||
])
|
||||
->selectRaw("
|
||||
CASE
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `movie_meta` = 1) THEN 'movie'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `tv_meta` = 1) THEN 'tv'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `game_meta` = 1) THEN 'game'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `music_meta` = 1) THEN 'music'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `no_meta` = 1) THEN 'no'
|
||||
END as meta
|
||||
")
|
||||
->withCount(['thanks', 'comments'])
|
||||
->where('seeders', '=', 0)
|
||||
->latest('leechers')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
$movieIds = $dead->where('meta', '=', 'movie')->pluck('tmdb');
|
||||
$tvIds = $dead->where('meta', '=', 'tv')->pluck('tmdb');
|
||||
$gameIds = $dead->where('meta', '=', 'game')->pluck('igdb');
|
||||
|
||||
$movies = Movie::with('genres')->whereIntegerInRaw('id', $movieIds)->get()->keyBy('id');
|
||||
$tv = Tv::with('genres')->whereIntegerInRaw('id', $tvIds)->get()->keyBy('id');
|
||||
$games = [];
|
||||
|
||||
foreach ($gameIds as $gameId) {
|
||||
$games[$gameId] = \MarcReichel\IGDBLaravel\Models\Game::with(['cover' => ['url', 'image_id']])->find($gameId);
|
||||
}
|
||||
|
||||
$dead = $dead->map(function ($torrent) use ($movies, $tv, $games) {
|
||||
$torrent->meta = match ($torrent->meta) {
|
||||
'movie' => $movies[$torrent->tmdb] ?? null,
|
||||
'tv' => $tv[$torrent->tmdb] ?? null,
|
||||
'game' => $games[$torrent->igdb] ?? null,
|
||||
default => null,
|
||||
};
|
||||
|
||||
return $torrent;
|
||||
});
|
||||
|
||||
return $dead;
|
||||
});
|
||||
|
||||
// Latest Topics Block
|
||||
$topics = cache()->remember('latest_topics', $expiresAt, fn () => Topic::with('forum')->latest()->take(5)->get());
|
||||
|
||||
// Latest Posts Block
|
||||
$posts = cache()->remember(
|
||||
'latest_posts',
|
||||
$expiresAt,
|
||||
fn () => Post::with('topic', 'user')
|
||||
->withCount('likes', 'dislikes', 'authorPosts', 'authorTopics')
|
||||
->latest()
|
||||
->take(5)
|
||||
->get()
|
||||
);
|
||||
|
||||
// Online Block
|
||||
$users = cache()->remember('online_users', $expiresAt, fn () => User::with('group', 'privacy')
|
||||
->withCount([
|
||||
'warnings' => function (Builder $query): void {
|
||||
$query->whereNotNull('torrent')->where('active', '1');
|
||||
},
|
||||
])
|
||||
->where('last_action', '>', now()->subMinutes(5))
|
||||
->get());
|
||||
|
||||
$groups = cache()->remember('user-groups', $expiresAt, fn () => Group::select(['name', 'color', 'effect', 'icon'])->oldest('position')->get());
|
||||
|
||||
// Featured Torrents Block
|
||||
$featured = cache()->remember('latest_featured', $expiresAt, fn () => FeaturedTorrent::with('torrent', 'torrent.resolution', 'torrent.type', 'torrent.category', 'user', 'user.group')->get());
|
||||
|
||||
// Latest Poll Block
|
||||
$poll = cache()->remember('latest_poll', $expiresAt, fn () => Poll::latest()->first());
|
||||
|
||||
// Top Uploaders Block
|
||||
$uploaders = cache()->remember('top_uploaders', $expiresAt, fn () => Torrent::with(['user', 'user.group'])
|
||||
->select(DB::raw('user_id, count(*) as value'))
|
||||
->groupBy('user_id')
|
||||
->latest('value')
|
||||
->take(10)
|
||||
->get());
|
||||
|
||||
$pastUploaders = cache()->remember('month_uploaders', $expiresAt, fn () => Torrent::with(['user', 'user.group'])
|
||||
->where('created_at', '>', $current->copy()->subDays(30)->toDateTimeString())
|
||||
->select(DB::raw('user_id, count(*) as value'))
|
||||
->groupBy('user_id')
|
||||
->latest('value')
|
||||
->take(10)
|
||||
->get());
|
||||
|
||||
$freeleechTokens = FreeleechToken::where('user_id', $user->id)->get();
|
||||
$bookmarks = Bookmark::where('user_id', $user->id)->get();
|
||||
|
||||
return view('home.index', [
|
||||
'user' => $user,
|
||||
'personal_freeleech' => $personalFreeleech,
|
||||
'users' => $users,
|
||||
'groups' => $groups,
|
||||
'articles' => $articles,
|
||||
'newest' => $newest,
|
||||
'seeded' => $seeded,
|
||||
'dying' => $dying,
|
||||
'leeched' => $leeched,
|
||||
'dead' => $dead,
|
||||
'topics' => $topics,
|
||||
'posts' => $posts,
|
||||
'featured' => $featured,
|
||||
'poll' => $poll,
|
||||
'uploaders' => $uploaders,
|
||||
'past_uploaders' => $pastUploaders,
|
||||
'freeleech_tokens' => $freeleechTokens,
|
||||
'bookmarks' => $bookmarks,
|
||||
'personal_freeleech' => cache()->get('personal_freeleech:'.$user->id),
|
||||
'users' => cache()->remember(
|
||||
'online_users',
|
||||
$expiresAt,
|
||||
fn () => User::with('group', 'privacy')
|
||||
->withCount([
|
||||
'warnings' => function (Builder $query): void {
|
||||
$query->whereNotNull('torrent')->where('active', '1');
|
||||
},
|
||||
])
|
||||
->where('last_action', '>', now()->subMinutes(5))
|
||||
->get()
|
||||
),
|
||||
'groups' => cache()->remember(
|
||||
'user-groups',
|
||||
$expiresAt,
|
||||
fn () => Group::select([
|
||||
'name',
|
||||
'color',
|
||||
'effect',
|
||||
'icon'
|
||||
])
|
||||
->oldest('position')
|
||||
->get()
|
||||
),
|
||||
'articles' => $articles,
|
||||
'newest' => cache()->remember(
|
||||
'newest_torrents',
|
||||
$expiresAt,
|
||||
function () use ($user) {
|
||||
$newest = Torrent::with(['user', 'category', 'type', 'resolution'])
|
||||
->withExists([
|
||||
'bookmarks' => fn ($query) => $query->where('user_id', '=', $user->id),
|
||||
'freeleechTokens' => fn ($query) => $query->where('user_id', '=', $user->id),
|
||||
'history as seeding' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 1)
|
||||
->where('seeder', '=', 1),
|
||||
'history as leeching' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 1)
|
||||
->where('seeder', '=', 0),
|
||||
'history as not_completed' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 0)
|
||||
->where('seeder', '=', 1)
|
||||
->whereNull('completed_at'),
|
||||
'history as not_seeding' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 0)
|
||||
->where('seeder', '=', 1)
|
||||
->whereNotNull('completed_at'),
|
||||
])
|
||||
->selectRaw("
|
||||
CASE
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `movie_meta` = 1) THEN 'movie'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `tv_meta` = 1) THEN 'tv'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `game_meta` = 1) THEN 'game'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `music_meta` = 1) THEN 'music'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `no_meta` = 1) THEN 'no'
|
||||
END as meta
|
||||
")
|
||||
->withCount(['thanks', 'comments'])
|
||||
->latest()
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
$movieIds = $newest->where('meta', '=', 'movie')->pluck('tmdb');
|
||||
$tvIds = $newest->where('meta', '=', 'tv')->pluck('tmdb');
|
||||
$gameIds = $newest->where('meta', '=', 'game')->pluck('igdb');
|
||||
|
||||
$movies = Movie::with('genres')->whereIntegerInRaw('id', $movieIds)->get()->keyBy('id');
|
||||
$tv = Tv::with('genres')->whereIntegerInRaw('id', $tvIds)->get()->keyBy('id');
|
||||
$games = [];
|
||||
|
||||
foreach ($gameIds as $gameId) {
|
||||
$games[$gameId] = \MarcReichel\IGDBLaravel\Models\Game::with(['cover' => ['url', 'image_id']])->find($gameId);
|
||||
}
|
||||
|
||||
$newest = $newest->map(function ($torrent) use ($movies, $tv, $games) {
|
||||
$torrent->meta = match ($torrent->meta) {
|
||||
'movie' => $movies[$torrent->tmdb] ?? null,
|
||||
'tv' => $tv[$torrent->tmdb] ?? null,
|
||||
'game' => $games[$torrent->igdb] ?? null,
|
||||
default => null,
|
||||
};
|
||||
|
||||
return $torrent;
|
||||
});
|
||||
|
||||
return $newest;
|
||||
}
|
||||
),
|
||||
'seeded' => cache()->remember(
|
||||
'seeded_torrents',
|
||||
$expiresAt,
|
||||
function () use ($user) {
|
||||
$seeded = Torrent::with(['user', 'category', 'type', 'resolution'])
|
||||
->withExists([
|
||||
'bookmarks' => fn ($query) => $query->where('user_id', '=', $user->id),
|
||||
'freeleechTokens' => fn ($query) => $query->where('user_id', '=', $user->id),
|
||||
'history as seeding' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 1)
|
||||
->where('seeder', '=', 1),
|
||||
'history as leeching' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 1)
|
||||
->where('seeder', '=', 0),
|
||||
'history as not_completed' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 0)
|
||||
->where('seeder', '=', 1)
|
||||
->whereNull('completed_at'),
|
||||
'history as not_seeding' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 0)
|
||||
->where('seeder', '=', 1)
|
||||
->whereNotNull('completed_at'),
|
||||
])
|
||||
->selectRaw("
|
||||
CASE
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `movie_meta` = 1) THEN 'movie'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `tv_meta` = 1) THEN 'tv'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `game_meta` = 1) THEN 'game'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `music_meta` = 1) THEN 'music'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `no_meta` = 1) THEN 'no'
|
||||
END as meta
|
||||
")
|
||||
->withCount(['thanks', 'comments'])
|
||||
->latest('seeders')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
$movieIds = $seeded->where('meta', '=', 'movie')->pluck('tmdb');
|
||||
$tvIds = $seeded->where('meta', '=', 'tv')->pluck('tmdb');
|
||||
$gameIds = $seeded->where('meta', '=', 'game')->pluck('igdb');
|
||||
|
||||
$movies = Movie::with('genres')->whereIntegerInRaw('id', $movieIds)->get()->keyBy('id');
|
||||
$tv = Tv::with('genres')->whereIntegerInRaw('id', $tvIds)->get()->keyBy('id');
|
||||
$games = [];
|
||||
|
||||
foreach ($gameIds as $gameId) {
|
||||
$games[$gameId] = \MarcReichel\IGDBLaravel\Models\Game::with(['cover' => ['url', 'image_id']])->find($gameId);
|
||||
}
|
||||
|
||||
$seeded = $seeded->map(function ($torrent) use ($movies, $tv, $games) {
|
||||
$torrent->meta = match ($torrent->meta) {
|
||||
'movie' => $movies[$torrent->tmdb] ?? null,
|
||||
'tv' => $tv[$torrent->tmdb] ?? null,
|
||||
'game' => $games[$torrent->igdb] ?? null,
|
||||
default => null,
|
||||
};
|
||||
|
||||
return $torrent;
|
||||
});
|
||||
|
||||
return $seeded;
|
||||
}
|
||||
),
|
||||
'dying' => cache()->remember(
|
||||
'dying_torrents',
|
||||
$expiresAt,
|
||||
function () use ($user) {
|
||||
$dying = Torrent::with(['user', 'category', 'type', 'resolution'])
|
||||
->withExists([
|
||||
'bookmarks' => fn ($query) => $query->where('user_id', '=', $user->id),
|
||||
'freeleechTokens' => fn ($query) => $query->where('user_id', '=', $user->id),
|
||||
'history as seeding' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 1)
|
||||
->where('seeder', '=', 1),
|
||||
'history as leeching' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 1)
|
||||
->where('seeder', '=', 0),
|
||||
'history as not_completed' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 0)
|
||||
->where('seeder', '=', 1)
|
||||
->whereNull('completed_at'),
|
||||
'history as not_seeding' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 0)
|
||||
->where('seeder', '=', 1)
|
||||
->whereNotNull('completed_at'),
|
||||
])
|
||||
->selectRaw("
|
||||
CASE
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `movie_meta` = 1) THEN 'movie'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `tv_meta` = 1) THEN 'tv'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `game_meta` = 1) THEN 'game'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `music_meta` = 1) THEN 'music'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `no_meta` = 1) THEN 'no'
|
||||
END as meta
|
||||
")
|
||||
->withCount(['thanks', 'comments'])
|
||||
->where('seeders', '=', 1)
|
||||
->where('times_completed', '>=', 1)
|
||||
->latest('leechers')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
$movieIds = $dying->where('meta', '=', 'movie')->pluck('tmdb');
|
||||
$tvIds = $dying->where('meta', '=', 'tv')->pluck('tmdb');
|
||||
$gameIds = $dying->where('meta', '=', 'game')->pluck('igdb');
|
||||
|
||||
$movies = Movie::with('genres')->whereIntegerInRaw('id', $movieIds)->get()->keyBy('id');
|
||||
$tv = Tv::with('genres')->whereIntegerInRaw('id', $tvIds)->get()->keyBy('id');
|
||||
$games = [];
|
||||
|
||||
foreach ($gameIds as $gameId) {
|
||||
$games[$gameId] = \MarcReichel\IGDBLaravel\Models\Game::with(['cover' => ['url', 'image_id']])->find($gameId);
|
||||
}
|
||||
|
||||
$dying = $dying->map(function ($torrent) use ($movies, $tv, $games) {
|
||||
$torrent->meta = match ($torrent->meta) {
|
||||
'movie' => $movies[$torrent->tmdb] ?? null,
|
||||
'tv' => $tv[$torrent->tmdb] ?? null,
|
||||
'game' => $games[$torrent->igdb] ?? null,
|
||||
default => null,
|
||||
};
|
||||
|
||||
return $torrent;
|
||||
});
|
||||
|
||||
return $dying;
|
||||
}
|
||||
),
|
||||
'leeched' => cache()->remember(
|
||||
'leeched_torrents',
|
||||
$expiresAt,
|
||||
function () use ($user) {
|
||||
$leeched = Torrent::with(['user', 'category', 'type', 'resolution'])
|
||||
->withExists([
|
||||
'bookmarks' => fn ($query) => $query->where('user_id', '=', $user->id),
|
||||
'freeleechTokens' => fn ($query) => $query->where('user_id', '=', $user->id),
|
||||
'history as seeding' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 1)
|
||||
->where('seeder', '=', 1),
|
||||
'history as leeching' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 1)
|
||||
->where('seeder', '=', 0),
|
||||
'history as not_completed' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 0)
|
||||
->where('seeder', '=', 1)
|
||||
->whereNull('completed_at'),
|
||||
'history as not_seeding' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 0)
|
||||
->where('seeder', '=', 1)
|
||||
->whereNotNull('completed_at'),
|
||||
])
|
||||
->selectRaw("
|
||||
CASE
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `movie_meta` = 1) THEN 'movie'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `tv_meta` = 1) THEN 'tv'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `game_meta` = 1) THEN 'game'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `music_meta` = 1) THEN 'music'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `no_meta` = 1) THEN 'no'
|
||||
END as meta
|
||||
")
|
||||
->withCount(['thanks', 'comments'])
|
||||
->latest('leechers')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
$movieIds = $leeched->where('meta', '=', 'movie')->pluck('tmdb');
|
||||
$tvIds = $leeched->where('meta', '=', 'tv')->pluck('tmdb');
|
||||
$gameIds = $leeched->where('meta', '=', 'game')->pluck('igdb');
|
||||
|
||||
$movies = Movie::with('genres')->whereIntegerInRaw('id', $movieIds)->get()->keyBy('id');
|
||||
$tv = Tv::with('genres')->whereIntegerInRaw('id', $tvIds)->get()->keyBy('id');
|
||||
$games = [];
|
||||
|
||||
foreach ($gameIds as $gameId) {
|
||||
$games[$gameId] = \MarcReichel\IGDBLaravel\Models\Game::with(['cover' => ['url', 'image_id']])->find($gameId);
|
||||
}
|
||||
|
||||
$leeched = $leeched->map(function ($torrent) use ($movies, $tv, $games) {
|
||||
$torrent->meta = match ($torrent->meta) {
|
||||
'movie' => $movies[$torrent->tmdb] ?? null,
|
||||
'tv' => $tv[$torrent->tmdb] ?? null,
|
||||
'game' => $games[$torrent->igdb] ?? null,
|
||||
default => null,
|
||||
};
|
||||
|
||||
return $torrent;
|
||||
});
|
||||
|
||||
return $leeched;
|
||||
}
|
||||
),
|
||||
'dead' => cache()->remember(
|
||||
'dead_torrents',
|
||||
$expiresAt,
|
||||
function () use ($user) {
|
||||
$dead = Torrent::with(['user', 'category', 'type', 'resolution'])
|
||||
->withExists([
|
||||
'bookmarks' => fn ($query) => $query->where('user_id', '=', $user->id),
|
||||
'freeleechTokens' => fn ($query) => $query->where('user_id', '=', $user->id),
|
||||
'history as seeding' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 1)
|
||||
->where('seeder', '=', 1),
|
||||
'history as leeching' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 1)
|
||||
->where('seeder', '=', 0),
|
||||
'history as not_completed' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 0)
|
||||
->where('seeder', '=', 1)
|
||||
->whereNull('completed_at'),
|
||||
'history as not_seeding' => fn ($query) => $query->where('user_id', '=', $user->id)
|
||||
->where('active', '=', 0)
|
||||
->where('seeder', '=', 1)
|
||||
->whereNotNull('completed_at'),
|
||||
])
|
||||
->selectRaw("
|
||||
CASE
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `movie_meta` = 1) THEN 'movie'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `tv_meta` = 1) THEN 'tv'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `game_meta` = 1) THEN 'game'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `music_meta` = 1) THEN 'music'
|
||||
WHEN category_id IN (SELECT `id` from `categories` where `no_meta` = 1) THEN 'no'
|
||||
END as meta
|
||||
")
|
||||
->withCount(['thanks', 'comments'])
|
||||
->where('seeders', '=', 0)
|
||||
->latest('leechers')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
$movieIds = $dead->where('meta', '=', 'movie')->pluck('tmdb');
|
||||
$tvIds = $dead->where('meta', '=', 'tv')->pluck('tmdb');
|
||||
$gameIds = $dead->where('meta', '=', 'game')->pluck('igdb');
|
||||
|
||||
$movies = Movie::with('genres')->whereIntegerInRaw('id', $movieIds)->get()->keyBy('id');
|
||||
$tv = Tv::with('genres')->whereIntegerInRaw('id', $tvIds)->get()->keyBy('id');
|
||||
$games = [];
|
||||
|
||||
foreach ($gameIds as $gameId) {
|
||||
$games[$gameId] = \MarcReichel\IGDBLaravel\Models\Game::with(['cover' => ['url', 'image_id']])->find($gameId);
|
||||
}
|
||||
|
||||
$dead = $dead->map(function ($torrent) use ($movies, $tv, $games) {
|
||||
$torrent->meta = match ($torrent->meta) {
|
||||
'movie' => $movies[$torrent->tmdb] ?? null,
|
||||
'tv' => $tv[$torrent->tmdb] ?? null,
|
||||
'game' => $games[$torrent->igdb] ?? null,
|
||||
default => null,
|
||||
};
|
||||
|
||||
return $torrent;
|
||||
});
|
||||
|
||||
return $dead;
|
||||
}
|
||||
),
|
||||
'topics' => cache()->remember(
|
||||
'latest_topics',
|
||||
$expiresAt,
|
||||
fn () => Topic::with('forum')->latest()->take(5)->get()
|
||||
),
|
||||
'posts' => cache()->remember(
|
||||
'latest_posts',
|
||||
$expiresAt,
|
||||
fn () => Post::with('topic', 'user')
|
||||
->withCount('likes', 'dislikes', 'authorPosts', 'authorTopics')
|
||||
->latest()
|
||||
->take(5)
|
||||
->get()
|
||||
),
|
||||
'featured' => cache()->remember(
|
||||
'latest_featured',
|
||||
$expiresAt,
|
||||
fn () => FeaturedTorrent::with([
|
||||
'torrent',
|
||||
'torrent.resolution',
|
||||
'torrent.type',
|
||||
'torrent.category',
|
||||
'user',
|
||||
'user.group'
|
||||
])->get()
|
||||
),
|
||||
'poll' => cache()->remember('latest_poll', $expiresAt, fn () => Poll::latest()->first()),
|
||||
'uploaders' => cache()->remember('top_uploaders', $expiresAt, fn () => Torrent::with(['user', 'user.group'])
|
||||
->select(DB::raw('user_id, count(*) as value'))
|
||||
->groupBy('user_id')
|
||||
->latest('value')
|
||||
->take(10)
|
||||
->get()),
|
||||
'past_uploaders' => cache()->remember('month_uploaders', $expiresAt, fn () => Torrent::with(['user', 'user.group'])
|
||||
->where('created_at', '>', now()->subDays(30)->toDateTimeString())
|
||||
->select(DB::raw('user_id, count(*) as value'))
|
||||
->groupBy('user_id')
|
||||
->latest('value')
|
||||
->take(10)
|
||||
->get()),
|
||||
'freeleech_tokens' => FreeleechToken::where('user_id', $user->id)->get(),
|
||||
'bookmarks' => Bookmark::where('user_id', $user->id)->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,8 @@ class CollectionController extends Controller
|
||||
*/
|
||||
public function show(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$collection = Collection::with(['movie' => fn ($query) => $query->has('torrents'), 'comments'])->findOrFail($id);
|
||||
|
||||
return view('mediahub.collection.show', [
|
||||
'collection' => $collection,
|
||||
'collection' => Collection::with(['movie' => fn ($query) => $query->has('torrents'), 'comments'])->findOrFail($id),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ class GenreController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$genres = Genre::withCount(['tv', 'movie'])->orderBy('name')->get();
|
||||
|
||||
return view('mediahub.genre.index', ['genres' => $genres]);
|
||||
return view('mediahub.genre.index', [
|
||||
'genres' => Genre::withCount(['tv', 'movie'])->orderBy('name')->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,25 +30,15 @@ class HomeController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$tv = Tv::count();
|
||||
$movies = Movie::count();
|
||||
$collections = Collection::count();
|
||||
$persons = Person::whereNotNull('still')->count();
|
||||
$genres = Genre::count();
|
||||
$networks = Network::count();
|
||||
$companies = Company::count();
|
||||
|
||||
$movieCategoryIds = Category::where('movie_meta', '=', 1)->pluck('id')->toArray();
|
||||
|
||||
return view('mediahub.index', [
|
||||
'tv' => $tv,
|
||||
'movies' => $movies,
|
||||
'movieCategoryIds' => $movieCategoryIds,
|
||||
'collections' => $collections,
|
||||
'persons' => $persons,
|
||||
'genres' => $genres,
|
||||
'networks' => $networks,
|
||||
'companies' => $companies,
|
||||
'tv' => Tv::count(),
|
||||
'movies' => Movie::count(),
|
||||
'movieCategoryIds' => Category::where('movie_meta', '=', 1)->pluck('id')->toArray(),
|
||||
'collections' => Collection::count(),
|
||||
'persons' => Person::whereNotNull('still')->count(),
|
||||
'genres' => Genre::count(),
|
||||
'networks' => Network::count(),
|
||||
'companies' => Company::count(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,21 +32,15 @@ class PersonController extends Controller
|
||||
*/
|
||||
public function show(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$person = Person::with([
|
||||
'tv' => fn ($query) => $query->has('torrents'),
|
||||
'tv.genres',
|
||||
'movie' => fn ($query) => $query->has('torrents'),
|
||||
'movie.genres'
|
||||
])->findOrFail($id);
|
||||
|
||||
|
||||
$movieCategoryIds = Category::where('movie_meta', '=', 1)->pluck('id')->toArray();
|
||||
$tvCategoryIds = Category::where('tv_meta', '=', 1)->pluck('id')->toArray();
|
||||
|
||||
return view('mediahub.person.show', [
|
||||
'person' => $person,
|
||||
'movieCategoryIds' => $movieCategoryIds,
|
||||
'tvCategoryIds' => $tvCategoryIds
|
||||
'person' => Person::with([
|
||||
'tv' => fn ($query) => $query->has('torrents'),
|
||||
'tv.genres',
|
||||
'movie' => fn ($query) => $query->has('torrents'),
|
||||
'movie.genres'
|
||||
])->findOrFail($id),
|
||||
'movieCategoryIds' => Category::where('movie_meta', '=', 1)->pluck('id')->toArray(),
|
||||
'tvCategoryIds' => Category::where('tv_meta', '=', 1)->pluck('id')->toArray()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,10 @@ class TvSeasonController extends Controller
|
||||
public function show(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$season = Season::with(['episodes', 'torrents'])->findOrFail($id);
|
||||
$show = Tv::where('id', '=', $season->tv_id)->first();
|
||||
|
||||
return view('mediahub.tv.season.show', [
|
||||
'season' => $season,
|
||||
'show' => $show,
|
||||
'show' => Tv::find($season->tv_id),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ class TvShowController extends Controller
|
||||
*/
|
||||
public function show(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$show = Tv::with(['seasons', 'genres', 'networks', 'companies', 'torrents'])->withCount('torrents')->findOrFail($id);
|
||||
|
||||
return view('mediahub.tv.show', [
|
||||
'show' => $show,
|
||||
'show' => Tv::with(['seasons', 'genres', 'networks', 'companies', 'torrents'])
|
||||
->withCount('torrents')
|
||||
->findOrFail($id),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ class PageController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$pages = Page::all();
|
||||
|
||||
return view('page.index', ['pages' => $pages]);
|
||||
return view('page.index', [
|
||||
'pages' => Page::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,9 +38,9 @@ class PageController extends Controller
|
||||
*/
|
||||
public function show(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$page = Page::findOrFail($id);
|
||||
|
||||
return view('page.page', ['page' => $page]);
|
||||
return view('page.page', [
|
||||
'page' => Page::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,14 +48,14 @@ class PageController extends Controller
|
||||
*/
|
||||
public function staff(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$staff = Group::query()
|
||||
->with('users:id,username,group_id,title')
|
||||
->where('is_modo', '=', 1)
|
||||
->orWhere('is_admin', '=', 1)
|
||||
->get()
|
||||
->sortByDesc('position');
|
||||
|
||||
return view('page.staff', ['staff' => $staff]);
|
||||
return view('page.staff', [
|
||||
'staff' => Group::query()
|
||||
->with('users:id,username,group_id,title')
|
||||
->where('is_modo', '=', 1)
|
||||
->orWhere('is_admin', '=', 1)
|
||||
->get()
|
||||
->sortByDesc('position'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,12 +63,12 @@ class PageController extends Controller
|
||||
*/
|
||||
public function internal(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$internals = Internal::query()
|
||||
->with('users')
|
||||
->get()
|
||||
->sortBy('name');
|
||||
|
||||
return view('page.internal', ['internals' => $internals]);
|
||||
return view('page.internal', [
|
||||
'internals' => Internal::query()
|
||||
->with('users')
|
||||
->orderBy('name')
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,9 +76,9 @@ class PageController extends Controller
|
||||
*/
|
||||
public function clientblacklist(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$clients = BlacklistClient::all();
|
||||
|
||||
return view('page.blacklist.client', ['clients' => $clients]);
|
||||
return view('page.blacklist.client', [
|
||||
'clients' => BlacklistClient::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,14 +43,21 @@ class PlaylistController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$playlists = Playlist::with(['user:id,username,group_id,image', 'user.group'])->withCount('torrents')->where(function ($query): void {
|
||||
$query->where('is_private', '=', 0)
|
||||
->orWhere(function ($query): void {
|
||||
$query->where('is_private', '=', 1)->where('user_id', '=', auth()->id());
|
||||
});
|
||||
})->oldest('name')->paginate(24);
|
||||
|
||||
return view('playlist.index', ['playlists' => $playlists]);
|
||||
return view('playlist.index', [
|
||||
'playlists' => Playlist::with([
|
||||
'user:id,username,group_id,image',
|
||||
'user.group'
|
||||
])
|
||||
->withCount('torrents')
|
||||
->where(function ($query): void {
|
||||
$query->where('is_private', '=', 0)
|
||||
->orWhere(function ($query): void {
|
||||
$query->where('is_private', '=', 1)->where('user_id', '=', auth()->id());
|
||||
});
|
||||
})
|
||||
->oldest('name')
|
||||
->paginate(24),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,30 +138,32 @@ class PlaylistController extends Controller
|
||||
$meta = null;
|
||||
|
||||
if (isset($random)) {
|
||||
$torrent = Torrent::where('id', '=', $random->torrent_id)->firstOrFail();
|
||||
$torrent = Torrent::findOrFail($random->torrent_id);
|
||||
|
||||
if ($torrent->category->tv_meta && ($torrent->tmdb || $torrent->tmdb != 0)) {
|
||||
$meta = Tv::with('genres', 'networks', 'seasons')->where('id', '=', $torrent->tmdb)->first();
|
||||
$meta = Tv::with('genres', 'networks', 'seasons')->find($torrent->tmdb);
|
||||
}
|
||||
|
||||
if ($torrent->category->movie_meta && ($torrent->tmdb || $torrent->tmdb != 0)) {
|
||||
$meta = Movie::with('genres', 'companies', 'collection')->where('id', '=', $torrent->tmdb)->first();
|
||||
$meta = Movie::with('genres', 'companies', 'collection')->find($torrent->tmdb);
|
||||
}
|
||||
}
|
||||
|
||||
$torrents = PlaylistTorrent::with(['torrent:id,name,category_id,resolution_id,type_id,tmdb,seeders,leechers,times_completed,size,anon,created_at'])
|
||||
->where('playlist_id', '=', $playlist->id)
|
||||
->whereHas('torrent')
|
||||
->orderBy(function ($query): void {
|
||||
$query->select('name')
|
||||
->from('torrents')
|
||||
->whereColumn('id', 'playlist_torrents.torrent_id')
|
||||
->latest()
|
||||
->limit(1);
|
||||
})
|
||||
->paginate(26);
|
||||
|
||||
return view('playlist.show', ['playlist' => $playlist, 'meta' => $meta, 'torrents' => $torrents]);
|
||||
return view('playlist.show', [
|
||||
'playlist' => $playlist,
|
||||
'meta' => $meta,
|
||||
'torrents' => PlaylistTorrent::with(['torrent:id,name,category_id,resolution_id,type_id,tmdb,seeders,leechers,times_completed,size,anon,created_at'])
|
||||
->where('playlist_id', '=', $playlist->id)
|
||||
->whereHas('torrent')
|
||||
->orderBy(function ($query): void {
|
||||
$query->select('name')
|
||||
->from('torrents')
|
||||
->whereColumn('id', 'playlist_torrents.torrent_id')
|
||||
->latest()
|
||||
->limit(1);
|
||||
})
|
||||
->paginate(26),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,14 +211,14 @@ class PlaylistController extends Controller
|
||||
]);
|
||||
|
||||
if ($v->fails()) {
|
||||
return to_route('playlists.edit', ['id' => $playlist->id])
|
||||
return to_route('playlists.edit', ['id' => $id])
|
||||
->withInput()
|
||||
->withErrors($v->errors());
|
||||
}
|
||||
|
||||
$playlist->save();
|
||||
|
||||
return to_route('playlists.show', ['id' => $playlist->id])
|
||||
return to_route('playlists.show', ['id' => $id])
|
||||
->withSuccess(trans('playlist.update-success'));
|
||||
}
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ class PollController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$polls = Poll::latest()->paginate(15);
|
||||
|
||||
return view('poll.latest', ['polls' => $polls]);
|
||||
return view('poll.latest', [
|
||||
'polls' => Poll::latest()->paginate(15),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,8 +48,7 @@ class PollController extends Controller
|
||||
public function show(Request $request, int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View|\Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$poll = Poll::findOrFail($id);
|
||||
$user = $request->user();
|
||||
$userHasVoted = $poll->voters->where('user_id', '=', $user->id)->isNotEmpty();
|
||||
$userHasVoted = $poll->voters->where('user_id', '=', $request->user()->id)->isNotEmpty();
|
||||
|
||||
if ($userHasVoted) {
|
||||
return to_route('poll_results', ['id' => $poll->id])
|
||||
@@ -102,11 +101,10 @@ class PollController extends Controller
|
||||
public function result(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$poll = Poll::findOrFail($id);
|
||||
$map = [
|
||||
|
||||
return view('poll.result', [
|
||||
'poll' => $poll,
|
||||
'total_votes' => $poll->totalVotes(),
|
||||
];
|
||||
|
||||
return view('poll.result', $map);
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ class ReportController extends Controller
|
||||
*/
|
||||
public function user(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$reportedUser = User::where('username', '=', $username)->firstOrFail();
|
||||
$reportedUser = User::where('username', '=', $username)->sole();
|
||||
$reportedBy = $request->user();
|
||||
|
||||
$v = validator($request->all(), [
|
||||
|
||||
@@ -77,8 +77,7 @@ class RequestController extends Controller
|
||||
'networks',
|
||||
'seasons'
|
||||
])
|
||||
->where('id', '=', $torrentRequest->tmdb)
|
||||
->first();
|
||||
->find($torrentRequest->tmdb);
|
||||
}
|
||||
|
||||
if ($torrentRequest->category->movie_meta && ($torrentRequest->tmdb || $torrentRequest->tmdb != 0)) {
|
||||
@@ -88,8 +87,7 @@ class RequestController extends Controller
|
||||
'companies',
|
||||
'collection'
|
||||
])
|
||||
->where('id', '=', $torrentRequest->tmdb)
|
||||
->first();
|
||||
->find($torrentRequest->tmdb);
|
||||
}
|
||||
|
||||
if ($torrentRequest->category->game_meta && ($torrentRequest->igdb || $torrentRequest->igdb != 0)) {
|
||||
@@ -119,13 +117,11 @@ class RequestController extends Controller
|
||||
*/
|
||||
public function create(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
return view('requests.create', [
|
||||
'categories' => Category::all()->sortBy('position'),
|
||||
'types' => Type::all()->sortBy('position'),
|
||||
'resolutions' => Resolution::all()->sortBy('position'),
|
||||
'user' => $user,
|
||||
'categories' => Category::orderBy('position')->get(),
|
||||
'types' => Type::orderBy('position')->get(),
|
||||
'resolutions' => Resolution::orderBy('position')->get(),
|
||||
'user' => $request->user(),
|
||||
'category_id' => $request->category_id,
|
||||
'title' => urldecode($request->title),
|
||||
'imdb' => $request->imdb,
|
||||
@@ -227,15 +223,13 @@ class RequestController extends Controller
|
||||
*/
|
||||
public function edit(Request $request, int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
$torrentRequest = TorrentRequest::findOrFail($id);
|
||||
|
||||
return view('requests.edit', [
|
||||
'categories' => Category::all()->sortBy('position'),
|
||||
'types' => Type::all()->sortBy('position'),
|
||||
'resolutions' => Resolution::all()->sortBy('position'),
|
||||
'user' => $user,
|
||||
'torrentRequest' => $torrentRequest, ]);
|
||||
'categories' => Category::orderBy('position')->get(),
|
||||
'types' => Type::orderBy('position')->get(),
|
||||
'resolutions' => Resolution::orderBy('position')->get(),
|
||||
'user' => $request->user(),
|
||||
'torrentRequest' => TorrentRequest::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -304,7 +298,7 @@ class RequestController extends Controller
|
||||
]);
|
||||
|
||||
$torrent_id = basename($request->torrent_id);
|
||||
$torrent = Torrent::withAnyStatus()->where('id', '=', $torrent_id)->first();
|
||||
$torrent = Torrent::withAnyStatus()->find($torrent_id);
|
||||
|
||||
if ($torrent->isApproved() === false) {
|
||||
return to_route('requests.show', ['id' => $request->input('request_id')])
|
||||
@@ -366,10 +360,12 @@ class RequestController extends Controller
|
||||
$filler->increment('seedbonus', $fillAmount);
|
||||
|
||||
// Achievements
|
||||
$filler->addProgress(new UserFilled25Requests(), 1);
|
||||
$filler->addProgress(new UserFilled50Requests(), 1);
|
||||
$filler->addProgress(new UserFilled75Requests(), 1);
|
||||
$filler->addProgress(new UserFilled100Requests(), 1);
|
||||
if (! $tr->filled_anon) {
|
||||
$filler->addProgress(new UserFilled25Requests(), 1);
|
||||
$filler->addProgress(new UserFilled50Requests(), 1);
|
||||
$filler->addProgress(new UserFilled75Requests(), 1);
|
||||
$filler->addProgress(new UserFilled100Requests(), 1);
|
||||
}
|
||||
|
||||
$requestUrl = href_request($tr);
|
||||
$userUrl = href_profile($filler);
|
||||
@@ -452,9 +448,7 @@ class RequestController extends Controller
|
||||
*/
|
||||
public function reset(Request $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
abort_unless($user->group->is_modo, 403);
|
||||
abort_unless($request->user()->group->is_modo, 403);
|
||||
|
||||
TorrentRequest::whereKey($id)->update([
|
||||
'filled_by' => null,
|
||||
|
||||
@@ -34,16 +34,11 @@ class RssController extends Controller
|
||||
*/
|
||||
public function index(Request $request, $hash = null): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
$publicRss = Rss::where('is_private', '=', 0)->oldest('position')->get();
|
||||
$privateRss = Rss::where('is_private', '=', 1)->where('user_id', '=', $user->id)->latest()->get();
|
||||
|
||||
return view('rss.index', [
|
||||
'hash' => $hash,
|
||||
'public_rss' => $publicRss,
|
||||
'private_rss' => $privateRss,
|
||||
'user' => $user,
|
||||
'public_rss' => Rss::where('is_private', '=', 0)->oldest('position')->get(),
|
||||
'private_rss' => Rss::where('is_private', '=', 1)->where('user_id', '=', $request->user()->id)->latest()->get(),
|
||||
'user' => $request->user(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -52,14 +47,12 @@ class RssController extends Controller
|
||||
*/
|
||||
public function create(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
return view('rss.create', [
|
||||
'categories' => Category::select(['id', 'name', 'position'])->get()->sortBy('position'),
|
||||
'types' => Type::select(['id', 'name', 'position'])->get()->sortBy('position'),
|
||||
'resolutions' => Resolution::select(['id', 'name', 'position'])->get()->sortBy('position'),
|
||||
'genres' => Genre::all()->sortBy('name'),
|
||||
'user' => $user,
|
||||
'categories' => Category::select(['id', 'name', 'position'])->orderBy('position')->get(),
|
||||
'types' => Type::select(['id', 'name', 'position'])->orderBy('position')->get(),
|
||||
'resolutions' => Resolution::select(['id', 'name', 'position'])->orderBy('position')->get(),
|
||||
'genres' => Genre::orderBy('name')->get(),
|
||||
'user' => $request->user(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -68,8 +61,6 @@ class RssController extends Controller
|
||||
*/
|
||||
public function store(Request $request): \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
$v = validator($request->all(), [
|
||||
'name' => 'required|min:3|max:255',
|
||||
'search' => 'max:255',
|
||||
@@ -113,13 +104,12 @@ class RssController extends Controller
|
||||
'dead',
|
||||
]);
|
||||
|
||||
$error = null;
|
||||
$success = null;
|
||||
|
||||
if ($v->passes()) {
|
||||
$rss = new Rss();
|
||||
$rss->name = $request->input('name');
|
||||
$rss->user_id = $user->id;
|
||||
$rss->user_id = $request->user()->id;
|
||||
$expected = $rss->expected_fields;
|
||||
$rss->json_torrent = array_merge($expected, $params);
|
||||
$rss->is_private = 1;
|
||||
@@ -148,7 +138,7 @@ class RssController extends Controller
|
||||
*/
|
||||
public function show(int $id, string $rsskey): array|\Illuminate\Http\Response
|
||||
{
|
||||
$user = User::where('rsskey', '=', $rsskey)->firstOrFail();
|
||||
$user = User::where('rsskey', '=', $rsskey)->sole();
|
||||
|
||||
$bannedGroup = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id'));
|
||||
$disabledGroup = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id'));
|
||||
@@ -156,13 +146,12 @@ class RssController extends Controller
|
||||
abort_if($user->group->id == $bannedGroup[0] || $user->group->id == $disabledGroup[0] || ! $user->active, 404);
|
||||
|
||||
$rss = Rss::query()
|
||||
->where('id', '=', $id)
|
||||
->where(
|
||||
fn ($query) => $query
|
||||
->where('user_id', '=', $user->id)
|
||||
->orWhere('is_private', '=', 0)
|
||||
)
|
||||
->firstOrFail();
|
||||
->findOrFail($id);
|
||||
|
||||
$search = $rss->object_torrent;
|
||||
|
||||
@@ -213,13 +202,14 @@ class RssController extends Controller
|
||||
{
|
||||
$user = $request->user();
|
||||
$rss = Rss::where('is_private', '=', 1)->findOrFail($id);
|
||||
|
||||
abort_unless($user->group->is_modo || $user->id === $rss->user_id, 403);
|
||||
|
||||
return view('rss.edit', [
|
||||
'categories' => Category::select(['id', 'name', 'position'])->get()->sortBy('position'),
|
||||
'types' => Type::select(['id', 'name', 'position'])->get()->sortBy('position'),
|
||||
'resolutions' => Resolution::select(['id', 'name', 'position'])->get()->sortBy('position'),
|
||||
'genres' => Genre::all()->sortBy('name'),
|
||||
'categories' => Category::select(['id', 'name', 'position'])->orderBy('position')->get(),
|
||||
'types' => Type::select(['id', 'name', 'position'])->orderBy('position')->get(),
|
||||
'resolutions' => Resolution::select(['id', 'name', 'position'])->orderBy('position')->get(),
|
||||
'genres' => Genre::orderBy('name')->get(),
|
||||
'user' => $user,
|
||||
'rss' => $rss,
|
||||
]);
|
||||
@@ -273,9 +263,8 @@ class RssController extends Controller
|
||||
'dead',
|
||||
]);
|
||||
|
||||
$error = null;
|
||||
$success = null;
|
||||
$redirect = null;
|
||||
|
||||
if ($v->passes()) {
|
||||
$expected = $rss->expected_fields;
|
||||
$push = array_merge($expected, $params);
|
||||
|
||||
@@ -35,12 +35,12 @@ class ApplicationController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$applications = Application::withAnyStatus()
|
||||
->with(['user', 'moderated', 'imageProofs', 'urlProofs'])
|
||||
->latest()
|
||||
->paginate(25);
|
||||
|
||||
return view('Staff.application.index', ['applications' => $applications]);
|
||||
return view('Staff.application.index', [
|
||||
'applications' => Application::withAnyStatus()
|
||||
->with(['user', 'moderated', 'imageProofs', 'urlProofs'])
|
||||
->latest()
|
||||
->paginate(25),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,9 +48,9 @@ class ApplicationController extends Controller
|
||||
*/
|
||||
public function show(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$application = Application::withAnyStatus()->with(['user', 'moderated', 'imageProofs', 'urlProofs'])->findOrFail($id);
|
||||
|
||||
return view('Staff.application.show', ['application' => $application]);
|
||||
return view('Staff.application.show', [
|
||||
'application' => Application::withAnyStatus()->with(['user', 'moderated', 'imageProofs', 'urlProofs'])->findOrFail($id)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,9 +30,9 @@ class ArticleController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$articles = Article::latest()->paginate(25);
|
||||
|
||||
return view('Staff.article.index', ['articles' => $articles]);
|
||||
return view('Staff.article.index', [
|
||||
'articles' => $articles = Article::latest()->paginate(25),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,9 +66,9 @@ class ArticleController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$article = Article::findOrFail($id);
|
||||
|
||||
return view('Staff.article.edit', ['article' => $article]);
|
||||
return view('Staff.article.edit', [
|
||||
'article' => Article::findOrFail($id)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +83,7 @@ class ArticleController extends Controller
|
||||
Image::make($image->getRealPath())->fit(75, 75)->encode('png', 100)->save($path);
|
||||
}
|
||||
|
||||
Article::where('id', '=', $id)->update(['image' => $filename ?? null,] + $request->validated());
|
||||
Article::findOrFail($id)->update(['image' => $filename ?? null,] + $request->validated());
|
||||
|
||||
return to_route('staff.articles.index')
|
||||
->withSuccess('Your article changes have successfully published!');
|
||||
|
||||
@@ -27,13 +27,7 @@ class AuditController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$audits = Audit::with('user')->latest()->paginate(50);
|
||||
|
||||
foreach ($audits as $audit) {
|
||||
$audit->values = json_decode($audit->record, true, 512, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
return view('Staff.audit.index', ['audits' => $audits]);
|
||||
return view('Staff.audit.index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
namespace App\Http\Controllers\Staff;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\FailedLoginAttempt;
|
||||
|
||||
/**
|
||||
* @see \Tests\Todo\Feature\Http\Controllers\Staff\AuthenticationControllerTest
|
||||
@@ -26,8 +25,6 @@ class AuthenticationController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$attempts = FailedLoginAttempt::latest()->paginate(25);
|
||||
|
||||
return view('Staff.authentication.index', ['attempts' => $attempts]);
|
||||
return view('Staff.authentication.index');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ class BanController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$bans = Ban::latest()->paginate(25);
|
||||
|
||||
return view('Staff.ban.index', ['bans' => $bans]);
|
||||
return view('Staff.ban.index', [
|
||||
'bans' => Ban::latest()->paginate(25),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ class BanController extends Controller
|
||||
*/
|
||||
public function store(StoreBanRequest $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
$user = User::where('username', '=', $username)->sole();
|
||||
$staff = $request->user();
|
||||
$bannedGroup = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id'));
|
||||
|
||||
@@ -75,7 +75,7 @@ class BanController extends Controller
|
||||
// Send Notifications
|
||||
$user->notify(new UserBan($ban));
|
||||
|
||||
return to_route('users.show', ['username' => $user->username])
|
||||
return to_route('users.show', ['username' => $username])
|
||||
->withSuccess('User Is Now Banned!');
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class BanController extends Controller
|
||||
*/
|
||||
public function update(UpdateBanRequest $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
$user = User::where('username', '=', $username)->sole();
|
||||
$staff = $request->user();
|
||||
|
||||
abort_if($user->group->is_modo || $request->user()->id == $user->id, 403);
|
||||
|
||||
@@ -29,9 +29,9 @@ class BlacklistClientController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$clients = BlacklistClient::latest()->get();
|
||||
|
||||
return view('Staff.blacklist.clients.index', ['clients' => $clients]);
|
||||
return view('Staff.blacklist.clients.index', [
|
||||
'clients' => BlacklistClient::latest()->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,9 +39,9 @@ class BlacklistClientController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$client = BlacklistClient::findOrFail($id);
|
||||
|
||||
return view('Staff.blacklist.clients.edit', ['client' => $client]);
|
||||
return view('Staff.blacklist.clients.edit', [
|
||||
'client' => BlacklistClient::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,9 +26,9 @@ class BonExchangeController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$bonExchanges = BonExchange::all()->sortBy('position');
|
||||
|
||||
return view('Staff.bon_exchange.index', ['bonExchanges' => $bonExchanges]);
|
||||
return view('Staff.bon_exchange.index', [
|
||||
'bonExchanges' => BonExchange::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,9 +61,9 @@ class BonExchangeController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$bonExchange = BonExchange::findOrFail($id);
|
||||
|
||||
return view('Staff.bon_exchange.edit', ['bonExchange' => $bonExchange]);
|
||||
return view('Staff.bon_exchange.edit', [
|
||||
'bonExchange' => BonExchange::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,7 @@ class BonExchangeController extends Controller
|
||||
*/
|
||||
public function update(UpdateBonExchangeRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
BonExchange::where('id', '=', $id)->update([
|
||||
BonExchange::findOrFail($id)->update([
|
||||
'upload' => $request->type === 'upload',
|
||||
'download' => $request->type === 'download',
|
||||
'personal_freeleech' => $request->type === 'personal_freeleech',
|
||||
|
||||
@@ -30,9 +30,9 @@ class CategoryController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$categories = Category::all()->sortBy('position');
|
||||
|
||||
return view('Staff.category.index', ['categories' => $categories]);
|
||||
return view('Staff.category.index', [
|
||||
'categories' => Category::orderBy('position')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,9 +73,9 @@ class CategoryController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$category = Category::findOrFail($id);
|
||||
|
||||
return view('Staff.category.edit', ['category' => $category]);
|
||||
return view('Staff.category.edit', [
|
||||
'category' => Category::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ class CategoryController extends Controller
|
||||
Image::make($image->getRealPath())->fit(50, 50)->encode('png', 100)->save($path);
|
||||
}
|
||||
|
||||
Category::where('id', '=', $id)->update([
|
||||
Category::findOrFail($id)->update([
|
||||
'image' => $filename ?? null,
|
||||
'no_meta' => $request->meta === 'no',
|
||||
'music_meta' => $request->meta === 'music',
|
||||
|
||||
@@ -29,10 +29,8 @@ class ChatBotController extends Controller
|
||||
*/
|
||||
public function index($hash = null): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$bots = Bot::oldest('position')->get();
|
||||
|
||||
return view('Staff.chat.bot.index', [
|
||||
'bots' => $bots,
|
||||
'bots' => Bot::oldest('position')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -41,12 +39,9 @@ class ChatBotController extends Controller
|
||||
*/
|
||||
public function edit(Request $request, int $id): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
$bot = Bot::findOrFail($id);
|
||||
|
||||
return view('Staff.chat.bot.edit', [
|
||||
'user' => $user,
|
||||
'bot' => $bot,
|
||||
'user' => $request->user(),
|
||||
'bot' => Bot::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -55,7 +50,7 @@ class ChatBotController extends Controller
|
||||
*/
|
||||
public function update(UpdateChatBotRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
Bot::where('id', '=', $id)->update($request->validated());
|
||||
Bot::findOrFail($id)->update($request->validated());
|
||||
|
||||
return to_route('staff.bots.edit', ['id' => $id])
|
||||
->withSuccess("The Bot Has Been Updated");
|
||||
|
||||
@@ -38,10 +38,8 @@ class ChatRoomController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$chatrooms = $this->chatRepository->rooms();
|
||||
|
||||
return view('Staff.chat.room.index', [
|
||||
'chatrooms' => $chatrooms,
|
||||
'chatrooms' => $this->chatRepository->rooms(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -69,9 +67,9 @@ class ChatRoomController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$chatroom = Chatroom::findOrFail($id);
|
||||
|
||||
return view('Staff.chat.room.edit', ['chatroom' => $chatroom]);
|
||||
return view('Staff.chat.room.edit', [
|
||||
'chatroom' => Chatroom::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +77,7 @@ class ChatRoomController extends Controller
|
||||
*/
|
||||
public function update(UpdateChatRoomRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
Chatroom::where('id', '=', $id)->update($request->validated());
|
||||
Chatroom::findOrFail($id)->update($request->validated());
|
||||
|
||||
return to_route('staff.rooms.index')
|
||||
->withSuccess('Chatroom Successfully Modified');
|
||||
|
||||
@@ -37,10 +37,8 @@ class ChatStatusController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$chatstatuses = $this->chatRepository->statuses();
|
||||
|
||||
return view('Staff.chat.status.index', [
|
||||
'chatstatuses' => $chatstatuses,
|
||||
'chatstatuses' => $this->chatRepository->statuses(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -78,7 +76,7 @@ class ChatStatusController extends Controller
|
||||
*/
|
||||
public function update(UpdateChatStatusRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
ChatStatus::where('id', '=', $id)->update($request->validated());
|
||||
ChatStatus::findOrFail($id)->update($request->validated());
|
||||
|
||||
return to_route('staff.statuses.index')
|
||||
->withSuccess('Chat Status Successfully Modified');
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace App\Http\Controllers\Staff;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Torrent;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CheatedTorrentController extends Controller
|
||||
@@ -25,41 +24,41 @@ class CheatedTorrentController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$cheatedTorrents = Torrent::query()
|
||||
->select([
|
||||
'torrents.id',
|
||||
'torrents.name',
|
||||
'torrents.seeders',
|
||||
'torrents.leechers',
|
||||
'torrents.times_completed',
|
||||
'torrents.size',
|
||||
'torrents.balance',
|
||||
'torrents.balance_offset',
|
||||
'torrents.created_at',
|
||||
])
|
||||
->selectRaw('MAX(history.completed_at) as last_completed')
|
||||
->selectRaw('MAX(history.created_at) as last_started')
|
||||
->selectRaw('balance + COALESCE(balance_offset, 0) AS current_balance')
|
||||
->selectRaw('(CAST((balance + COALESCE(balance_offset, 0)) AS float) / CAST((size + 1) AS float)) AS times_cheated')
|
||||
->join('history', 'history.torrent_id', '=', 'torrents.id')
|
||||
->groupBy([
|
||||
'torrents.id',
|
||||
'torrents.name',
|
||||
'torrents.seeders',
|
||||
'torrents.leechers',
|
||||
'torrents.times_completed',
|
||||
'torrents.size',
|
||||
'torrents.balance',
|
||||
'torrents.balance_offset',
|
||||
'torrents.created_at',
|
||||
])
|
||||
->having('current_balance', '<>', '0')
|
||||
->having('last_completed', '<', Carbon::now()->subHours(2))
|
||||
->having('last_started', '<', Carbon::now()->subHours(2))
|
||||
->orderByDesc('times_cheated')
|
||||
->paginate(25);
|
||||
|
||||
return view('Staff.cheated_torrent.index', ['torrents' => $cheatedTorrents]);
|
||||
return view('Staff.cheated_torrent.index', [
|
||||
'torrents' => Torrent::query()
|
||||
->select([
|
||||
'torrents.id',
|
||||
'torrents.name',
|
||||
'torrents.seeders',
|
||||
'torrents.leechers',
|
||||
'torrents.times_completed',
|
||||
'torrents.size',
|
||||
'torrents.balance',
|
||||
'torrents.balance_offset',
|
||||
'torrents.created_at',
|
||||
])
|
||||
->selectRaw('MAX(history.completed_at) as last_completed')
|
||||
->selectRaw('MAX(history.created_at) as last_started')
|
||||
->selectRaw('balance + COALESCE(balance_offset, 0) AS current_balance')
|
||||
->selectRaw('(CAST((balance + COALESCE(balance_offset, 0)) AS float) / CAST((size + 1) AS float)) AS times_cheated')
|
||||
->join('history', 'history.torrent_id', '=', 'torrents.id')
|
||||
->groupBy([
|
||||
'torrents.id',
|
||||
'torrents.name',
|
||||
'torrents.seeders',
|
||||
'torrents.leechers',
|
||||
'torrents.times_completed',
|
||||
'torrents.size',
|
||||
'torrents.balance',
|
||||
'torrents.balance_offset',
|
||||
'torrents.created_at',
|
||||
])
|
||||
->having('current_balance', '<>', '0')
|
||||
->having('last_completed', '<', now()->subHours(2))
|
||||
->having('last_started', '<', now()->subHours(2))
|
||||
->orderByDesc('times_cheated')
|
||||
->paginate(25),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +66,7 @@ class CheatedTorrentController extends Controller
|
||||
*/
|
||||
public function destroy(int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
Torrent::where('id', '=', $id)->update(['balance_offset' => DB::raw('balance * -1')]);
|
||||
Torrent::findOrFail($id)->update(['balance_offset' => DB::raw('balance * -1')]);
|
||||
|
||||
return to_route('staff.cheated_torrents.index')
|
||||
->withSuccess('Balance successfully reset');
|
||||
|
||||
@@ -29,20 +29,20 @@ class CheaterController extends Controller
|
||||
{
|
||||
$bannedGroup = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id'));
|
||||
|
||||
$cheaters = User::query()
|
||||
->whereHas('history', function ($query): void {
|
||||
$query->where('seeder', '=', 0);
|
||||
$query->where('active', '=', 0);
|
||||
$query->where('seedtime', '=', 0);
|
||||
$query->where('actual_downloaded', '=', 0);
|
||||
$query->where('actual_uploaded', '=', 0);
|
||||
$query->whereNull('completed_at');
|
||||
})
|
||||
->where('group_id', '!=', $bannedGroup[0]) // Banned Users
|
||||
->where('id', '!=', 1) // System
|
||||
->latest()
|
||||
->paginate(25);
|
||||
|
||||
return view('Staff.cheater.index', ['cheaters' => $cheaters]);
|
||||
return view('Staff.cheater.index', [
|
||||
'cheaters' => User::query()
|
||||
->whereHas('history', function ($query): void {
|
||||
$query->where('seeder', '=', 0);
|
||||
$query->where('active', '=', 0);
|
||||
$query->where('seedtime', '=', 0);
|
||||
$query->where('actual_downloaded', '=', 0);
|
||||
$query->where('actual_uploaded', '=', 0);
|
||||
$query->whereNull('completed_at');
|
||||
})
|
||||
->where('group_id', '!=', $bannedGroup[0]) // Banned Users
|
||||
->where('id', '!=', 1) // System
|
||||
->latest()
|
||||
->paginate(25),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ class DistributorController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$distributors = Distributor::all()->sortBy('position');
|
||||
|
||||
return view('Staff.distributor.index', ['distributors' => $distributors]);
|
||||
return view('Staff.distributor.index', [
|
||||
'distributors' => Distributor::orderBy('position')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,9 +57,9 @@ class DistributorController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$distributor = Distributor::findOrFail($id);
|
||||
|
||||
return view('Staff.distributor.edit', ['distributor' => $distributor]);
|
||||
return view('Staff.distributor.edit', [
|
||||
'distributor' => Distributor::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ class DistributorController extends Controller
|
||||
*/
|
||||
public function update(UpdateDistributorRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
Distributor::where('id', '=', $id)->update($request->validated());
|
||||
Distributor::findOrFail($id)->update($request->validated());
|
||||
|
||||
return to_route('staff.distributors.index')
|
||||
->withSuccess('Distributor Successfully Modified');
|
||||
@@ -78,10 +78,10 @@ class DistributorController extends Controller
|
||||
*/
|
||||
public function delete(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$distributors = Distributor::all()->sortBy('position');
|
||||
$distributor = Distributor::findOrFail($id);
|
||||
|
||||
return view('Staff.distributor.delete', ['distributors' => $distributors, 'distributor' => $distributor]);
|
||||
return view('Staff.distributor.delete', [
|
||||
'distributors' => Distributor::orderBy('position')->get(),
|
||||
'distributor' => Distributor::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,9 +32,9 @@ class ForumController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$categories = Forum::where('parent_id', '=', 0)->get()->sortBy('position');
|
||||
|
||||
return view('Staff.forum.index', ['categories' => $categories]);
|
||||
return view('Staff.forum.index', [
|
||||
'categories' => Forum::orderBy('position')->where('parent_id', '=', 0)->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,10 +42,10 @@ class ForumController extends Controller
|
||||
*/
|
||||
public function create(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$categories = Forum::where('parent_id', '=', 0)->get();
|
||||
$groups = Group::all();
|
||||
|
||||
return view('Staff.forum.create', ['categories' => $categories, 'groups' => $groups]);
|
||||
return view('Staff.forum.create', [
|
||||
'categories' => Forum::where('parent_id', '=', 0)->get(),
|
||||
'groups' => Group::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,7 @@ class ForumController extends Controller
|
||||
);
|
||||
|
||||
// Permissions
|
||||
foreach ($groups as $k => $group) {
|
||||
foreach ($groups as $group) {
|
||||
$perm = Permission::where('forum_id', '=', $forum->id)->where('group_id', '=', $group->id)->first();
|
||||
if ($perm == null) {
|
||||
$perm = new Permission();
|
||||
@@ -100,14 +100,10 @@ class ForumController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$forum = Forum::findOrFail($id);
|
||||
$categories = Forum::where('parent_id', '=', 0)->get();
|
||||
$groups = Group::all();
|
||||
|
||||
return view('Staff.forum.edit', [
|
||||
'categories' => $categories,
|
||||
'groups' => $groups,
|
||||
'forum' => $forum,
|
||||
'categories' => Forum::where('parent_id', '=', 0)->get(),
|
||||
'groups' => Group::all(),
|
||||
'forum' => Forum::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -118,7 +114,7 @@ class ForumController extends Controller
|
||||
{
|
||||
$groups = Group::all();
|
||||
|
||||
Forum::where('id', '=', $id)->update(
|
||||
Forum::findOrFail($id)->update(
|
||||
[
|
||||
'slug' => Str::slug($request->title),
|
||||
'parent_id' => $request->forum_type === 'category' ? 0 : $request->parent_id,
|
||||
@@ -127,7 +123,7 @@ class ForumController extends Controller
|
||||
);
|
||||
|
||||
// Permissions
|
||||
foreach ($groups as $k => $group) {
|
||||
foreach ($groups as $group) {
|
||||
$perm = Permission::where('forum_id', '=', $id)->where('group_id', '=', $group->id)->first();
|
||||
if ($perm == null) {
|
||||
$perm = new Permission();
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE.
|
||||
*
|
||||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D Community Edition
|
||||
*
|
||||
* @author HDVinnie <hdinnovations@protonmail.com>
|
||||
* @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\Http\Requests\Staff\StoreGiftRequest;
|
||||
use App\Models\PrivateMessage;
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
* @see \Tests\Feature\Http\Controllers\Staff\GiftControllerTest
|
||||
*/
|
||||
class GiftController extends Controller
|
||||
{
|
||||
/**
|
||||
* Send Gift Form.
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
return view('Staff.gift.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Send The Gift.
|
||||
*/
|
||||
public function store(StoreGiftRequest $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$staff = $request->user();
|
||||
$recipient = User::where('username', '=', $request->username)->sole();
|
||||
|
||||
$recipient->seedbonus += $request->seedbonus;
|
||||
$recipient->invites += $request->invites;
|
||||
$recipient->fl_tokens += $request->fl_tokens;
|
||||
$recipient->save();
|
||||
|
||||
PrivateMessage::create([
|
||||
'sender_id' => 1,
|
||||
'receiver_id' => $recipient->id,
|
||||
'subject' => 'You Have Received A System Generated Gift',
|
||||
'message' => sprintf('We just wanted to let you know that staff member, %s, has credited your account with %s Bonus Points, %s Invites and %s Freeleech Tokens.
|
||||
[color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]', $staff->username, $request->seedbonus, $request->invites, $request->fl_tokens)
|
||||
]);
|
||||
|
||||
return to_route('staff.gifts.index')
|
||||
->withSuccess('Gift Sent');
|
||||
}
|
||||
}
|
||||
@@ -33,9 +33,9 @@ class GroupController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$groups = Group::all()->sortBy('position');
|
||||
|
||||
return view('Staff.group.index', ['groups' => $groups]);
|
||||
return view('Staff.group.index', [
|
||||
'groups' => Group::orderBy('position')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,10 +57,10 @@ class GroupController extends Controller
|
||||
$permission = new Permission();
|
||||
$permission->forum_id = $collection;
|
||||
$permission->group_id = $group->id;
|
||||
$permission->show_forum = 1;
|
||||
$permission->read_topic = 1;
|
||||
$permission->reply_topic = 1;
|
||||
$permission->start_topic = 1;
|
||||
$permission->show_forum = 0;
|
||||
$permission->read_topic = 0;
|
||||
$permission->reply_topic = 0;
|
||||
$permission->start_topic = 0;
|
||||
$permission->save();
|
||||
}
|
||||
|
||||
@@ -73,9 +73,9 @@ class GroupController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$group = Group::findOrFail($id);
|
||||
|
||||
return view('Staff.group.edit', ['group' => $group]);
|
||||
return view('Staff.group.edit', [
|
||||
'group' => Group::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +83,7 @@ class GroupController extends Controller
|
||||
*/
|
||||
public function update(UpdateGroupRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
Group::where('id', '=', $id)->update(['slug' => Str::slug($request->name)] + $request->validated());
|
||||
Group::findOrFail($id)->update(['slug' => Str::slug($request->name)] + $request->validated());
|
||||
|
||||
cache()->forget('group:'.$id);
|
||||
|
||||
|
||||
@@ -36,42 +36,6 @@ class HomeController extends Controller
|
||||
// User Info
|
||||
$bannedGroup = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id'));
|
||||
$validatingGroup = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id'));
|
||||
$users = cache()->remember('dashboard_users', 300, function () use ($bannedGroup, $validatingGroup) {
|
||||
return DB::table('users')
|
||||
->selectRaw('count(*) as total')
|
||||
->selectRaw(sprintf('count(case when group_id = %s then 1 end) as banned', $bannedGroup[0]))
|
||||
->selectRaw(sprintf('count(case when group_id = %s then 1 end) as validating', $validatingGroup[0]))
|
||||
->first();
|
||||
});
|
||||
|
||||
// Torrent Info
|
||||
$torrents = cache()->remember('dashboard_torrents', 300, function () {
|
||||
return DB::table('torrents')
|
||||
->selectRaw('count(*) as total')
|
||||
->selectRaw('count(case when status = 0 then 1 end) as pending')
|
||||
->selectRaw('count(case when status = 2 then 1 end) as rejected')
|
||||
->selectRaw('count(case when status = 3 then 1 end) as postponed')
|
||||
->first();
|
||||
});
|
||||
|
||||
// Peers Info
|
||||
$peers = cache()->remember('dashboard_peers', 300, function () {
|
||||
return DB::table('peers')
|
||||
->selectRaw('count(*) as total')
|
||||
->selectRaw('count(case when seeder = 0 then 1 end) as leechers')
|
||||
->selectRaw('count(case when seeder = 1 then 1 end) as seeders')
|
||||
->first();
|
||||
});
|
||||
|
||||
// Reports Info
|
||||
$reports = DB::table('reports')
|
||||
->selectRaw('count(case when solved = 0 then 1 end) as unsolved')
|
||||
->first();
|
||||
|
||||
// Pending Applications Count
|
||||
$apps = DB::table('applications')
|
||||
->selectRaw('count(case when status = 0 then 1 end) as pending')
|
||||
->first();
|
||||
|
||||
// SSL Info
|
||||
try {
|
||||
@@ -82,28 +46,43 @@ class HomeController extends Controller
|
||||
|
||||
// System Information
|
||||
$systemInformation = new SystemInformation();
|
||||
$uptime = $systemInformation->uptime();
|
||||
$ram = $systemInformation->memory();
|
||||
$disk = $systemInformation->disk();
|
||||
$avg = $systemInformation->avg();
|
||||
$basic = $systemInformation->basic();
|
||||
|
||||
// Directory Permissions
|
||||
$filePermissions = $systemInformation->directoryPermissions();
|
||||
|
||||
return view('Staff.dashboard.index', [
|
||||
'users' => $users,
|
||||
'torrents' => $torrents,
|
||||
'peers' => $peers,
|
||||
'reports' => $reports,
|
||||
'apps' => $apps,
|
||||
'users' => cache()->remember('dashboard_users', 300, function () use ($bannedGroup, $validatingGroup) {
|
||||
return DB::table('users')
|
||||
->selectRaw('count(*) as total')
|
||||
->selectRaw(sprintf('count(case when group_id = %s then 1 end) as banned', $bannedGroup[0]))
|
||||
->selectRaw(sprintf('count(case when group_id = %s then 1 end) as validating', $validatingGroup[0]))
|
||||
->first();
|
||||
}),
|
||||
'torrents' => cache()->remember('dashboard_torrents', 300, function () {
|
||||
return DB::table('torrents')
|
||||
->selectRaw('count(*) as total')
|
||||
->selectRaw('count(case when status = 0 then 1 end) as pending')
|
||||
->selectRaw('count(case when status = 2 then 1 end) as rejected')
|
||||
->selectRaw('count(case when status = 3 then 1 end) as postponed')
|
||||
->first();
|
||||
}),
|
||||
'peers' => cache()->remember('dashboard_peers', 300, function () {
|
||||
return DB::table('peers')
|
||||
->selectRaw('count(*) as total')
|
||||
->selectRaw('count(case when seeder = 0 then 1 end) as leechers')
|
||||
->selectRaw('count(case when seeder = 1 then 1 end) as seeders')
|
||||
->first();
|
||||
}),
|
||||
'reports' => DB::table('reports')
|
||||
->selectRaw('count(case when solved = 0 then 1 end) as unsolved')
|
||||
->first(),
|
||||
'apps' => DB::table('applications')
|
||||
->selectRaw('count(case when status = 0 then 1 end) as pending')
|
||||
->first(),
|
||||
'certificate' => $certificate,
|
||||
'uptime' => $uptime,
|
||||
'ram' => $ram,
|
||||
'disk' => $disk,
|
||||
'avg' => $avg,
|
||||
'basic' => $basic,
|
||||
'file_permissions' => $filePermissions,
|
||||
'uptime' => $systemInformation->uptime(),
|
||||
'ram' => $systemInformation->memory(),
|
||||
'disk' => $systemInformation->disk(),
|
||||
'avg' => $systemInformation->avg(),
|
||||
'basic' => $systemInformation->basic(),
|
||||
'file_permissions' => $systemInformation->directoryPermissions(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ class InternalController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$internals = Internal::all()->sortBy('name');
|
||||
|
||||
return view('Staff.internals.index', ['internals' => $internals]);
|
||||
return view('Staff.internals.index', [
|
||||
'internals' => Internal::orderBy('name')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,9 +38,9 @@ class InternalController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$internal = Internal::findOrFail($id);
|
||||
|
||||
return view('Staff.internals.edit', ['internal' => $internal]);
|
||||
return view('Staff.internals.edit', [
|
||||
'internal' => Internal::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ class InternalController extends Controller
|
||||
*/
|
||||
public function update(UpdateInternalRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
Internal::where('id', '=', $id)->update($request->validated());
|
||||
Internal::findOrFail($id)->update($request->validated());
|
||||
|
||||
return to_route('staff.internals.index')
|
||||
->withSuccess('Internal Group Was Updated Successfully!');
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
namespace App\Http\Controllers\Staff;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Invite;
|
||||
|
||||
/**
|
||||
* @see \Tests\Todo\Feature\Http\Controllers\InviteControllerTest
|
||||
@@ -23,12 +22,11 @@ class InviteController extends Controller
|
||||
{
|
||||
/**
|
||||
* Invites Log.
|
||||
*
|
||||
* @see \app\Http\Livewire\InviteLogSearch
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$invites = Invite::latest()->paginate(25);
|
||||
$invitecount = Invite::count();
|
||||
|
||||
return view('Staff.invite.index', ['invites' => $invites, 'invitecount' => $invitecount]);
|
||||
return view('Staff.invite.index');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ class MediaLanguageController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$mediaLanguages = MediaLanguage::all()->sortBy('name');
|
||||
|
||||
return view('Staff.media_language.index', ['media_languages' => $mediaLanguages]);
|
||||
return view('Staff.media_language.index', [
|
||||
'media_languages' => MediaLanguage::orderBy('name')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,9 +55,9 @@ class MediaLanguageController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$mediaLanguage = MediaLanguage::findOrFail($id);
|
||||
|
||||
return view('Staff.media_language.edit', ['media_language' => $mediaLanguage]);
|
||||
return view('Staff.media_language.edit', [
|
||||
'media_language' => MediaLanguage::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +65,7 @@ class MediaLanguageController extends Controller
|
||||
*/
|
||||
public function update(UpdateMediaLanguageRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
MediaLanguage::where('id', '=', $id)->update($request->validated());
|
||||
MediaLanguage::findOrFail($id)->update($request->validated());
|
||||
|
||||
return to_route('staff.media_languages.index')
|
||||
->withSuccess('Media Language Successfully Updated');
|
||||
|
||||
@@ -20,7 +20,6 @@ use App\Models\PrivateMessage;
|
||||
use App\Models\Torrent;
|
||||
use App\Repositories\ChatRepository;
|
||||
use App\Services\Unit3dAnnounce;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @see \Tests\Todo\Feature\Http\Controllers\Staff\ModerationControllerTest
|
||||
@@ -39,16 +38,11 @@ class ModerationController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$current = Carbon::now();
|
||||
$pending = Torrent::with(['user:id,username,group_id', 'user.group', 'category', 'type'])->pending()->get();
|
||||
$postponed = Torrent::with(['user:id,username,group_id', 'user.group', 'category', 'type'])->postponed()->get();
|
||||
$rejected = Torrent::with(['user:id,username,group_id', 'user.group', 'category', 'type'])->rejected()->get();
|
||||
|
||||
return view('Staff.moderation.index', [
|
||||
'current' => $current,
|
||||
'pending' => $pending,
|
||||
'postponed' => $postponed,
|
||||
'rejected' => $rejected,
|
||||
'current' => now(),
|
||||
'pending' => Torrent::with(['user:id,username,group_id', 'user.group', 'category', 'type'])->pending()->get(),
|
||||
'postponed' => Torrent::with(['user:id,username,group_id', 'user.group', 'category', 'type'])->postponed()->get(),
|
||||
'rejected' => Torrent::with(['user:id,username,group_id', 'user.group', 'category', 'type'])->rejected()->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ class PageController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$pages = Page::all();
|
||||
|
||||
return view('Staff.page.index', ['pages' => $pages]);
|
||||
return view('Staff.page.index', [
|
||||
'pages' => Page::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,9 +58,9 @@ class PageController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$page = Page::findOrFail($id);
|
||||
|
||||
return view('Staff.page.edit', ['page' => $page]);
|
||||
return view('Staff.page.edit', [
|
||||
'page' => Page::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,7 @@ class PageController extends Controller
|
||||
*/
|
||||
public function update(UpdatePageRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
Page::where('id', '=', $id)->update($request->validated());
|
||||
Page::findOrFail($id)->update($request->validated());
|
||||
|
||||
return to_route('staff.pages.index')
|
||||
->withSuccess('Page has been edited successfully');
|
||||
|
||||
@@ -37,9 +37,9 @@ class PollController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$polls = Poll::latest()->paginate(25);
|
||||
|
||||
return view('Staff.poll.index', ['polls' => $polls]);
|
||||
return view('Staff.poll.index', [
|
||||
'polls' => Poll::latest()->paginate(25),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,9 +47,9 @@ class PollController extends Controller
|
||||
*/
|
||||
public function show(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$poll = Poll::where('id', '=', $id)->firstOrFail();
|
||||
|
||||
return view('Staff.poll.show', ['poll' => $poll]);
|
||||
return view('Staff.poll.show', [
|
||||
'poll' => Poll::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,9 +87,9 @@ class PollController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$poll = Poll::findOrFail($id);
|
||||
|
||||
return view('Staff.poll.edit', ['poll' => $poll]);
|
||||
return view('Staff.poll.edit', [
|
||||
'poll' => Poll::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,9 +28,9 @@ class RegionController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$regions = Region::all()->sortBy('position');
|
||||
|
||||
return view('Staff.region.index', ['regions' => $regions]);
|
||||
return view('Staff.region.index', [
|
||||
'regions' => Region::orderBy('position')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,9 +57,9 @@ class RegionController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$region = Region::findOrFail($id);
|
||||
|
||||
return view('Staff.region.edit', ['region' => $region]);
|
||||
return view('Staff.region.edit', [
|
||||
'region' => Region::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ class RegionController extends Controller
|
||||
*/
|
||||
public function update(UpdateRegionRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
Region::where('id', '=', $id)->update($request->validated());
|
||||
Region::findOrFail($id)->update($request->validated());
|
||||
|
||||
return to_route('staff.regions.index')
|
||||
->withSuccess('Region Successfully Modified');
|
||||
|
||||
@@ -28,9 +28,9 @@ class ReportController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$reports = Report::orderBy('solved')->latest()->paginate(25);
|
||||
|
||||
return view('Staff.report.index', ['reports' => $reports]);
|
||||
return view('Staff.report.index', [
|
||||
'reports' => Report::orderBy('solved')->latest()->paginate(25)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,9 +26,9 @@ class ResolutionController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$resolutions = Resolution::all()->sortBy('position');
|
||||
|
||||
return view('Staff.resolution.index', ['resolutions' => $resolutions]);
|
||||
return view('Staff.resolution.index', [
|
||||
'resolutions' => Resolution::orderBy('position')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,9 +55,9 @@ class ResolutionController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$resolution = Resolution::findOrFail($id);
|
||||
|
||||
return view('Staff.resolution.edit', ['resolution' => $resolution]);
|
||||
return view('Staff.resolution.edit', [
|
||||
'resolution' => Resolution::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +65,7 @@ class ResolutionController extends Controller
|
||||
*/
|
||||
public function update(UpdateResolutionRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
Resolution::where('id', '=', $id)->update($request->validated());
|
||||
Resolution::findOrFail($id)->update($request->validated());
|
||||
|
||||
return to_route('staff.resolutions.index')
|
||||
->withSuccess('Resolution Successfully Modified');
|
||||
|
||||
@@ -34,11 +34,9 @@ class RssController extends Controller
|
||||
*/
|
||||
public function index($hash = null): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$publicRss = Rss::where('is_private', '=', 0)->oldest('position')->get();
|
||||
|
||||
return view('Staff.rss.index', [
|
||||
'hash' => $hash,
|
||||
'public_rss' => $publicRss,
|
||||
'public_rss' => Rss::where('is_private', '=', 0)->oldest('position')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -47,14 +45,12 @@ class RssController extends Controller
|
||||
*/
|
||||
public function create(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
return view('Staff.rss.create', [
|
||||
'categories' => Category::select(['id', 'name', 'position'])->get()->sortBy('position'),
|
||||
'types' => Type::select(['id', 'name', 'position'])->get()->sortBy('position'),
|
||||
'resolutions' => Resolution::select(['id', 'name', 'position'])->get()->sortBy('position'),
|
||||
'genres' => Genre::all()->sortBy('name'),
|
||||
'user' => $user,
|
||||
'categories' => Category::select(['id', 'name', 'position'])->orderBy('position')->get(),
|
||||
'types' => Type::select(['id', 'name', 'position'])->orderBy('position')->get(),
|
||||
'resolutions' => Resolution::select(['id', 'name', 'position'])->orderBy('position')->get(),
|
||||
'genres' => Genre::orderBy('name')->get(),
|
||||
'user' => $request->user(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -63,11 +59,9 @@ class RssController extends Controller
|
||||
*/
|
||||
public function store(StoreRssRequest $request): \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
$rss = new Rss();
|
||||
$rss->name = $request->name;
|
||||
$rss->user_id = $user->id;
|
||||
$rss->user_id = $request->user()->id;
|
||||
$rss->json_torrent = array_merge($rss->expected_fields, $request->validated());
|
||||
$rss->is_private = 0;
|
||||
$rss->position = $request->position;
|
||||
@@ -82,16 +76,13 @@ class RssController extends Controller
|
||||
*/
|
||||
public function edit(Request $request, int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
$rss = Rss::where('is_private', '=', 0)->findOrFail($id);
|
||||
|
||||
return view('Staff.rss.edit', [
|
||||
'categories' => Category::select(['id', 'name', 'position'])->get()->sortBy('position'),
|
||||
'types' => Type::select(['id', 'name', 'position'])->get()->sortBy('position'),
|
||||
'resolutions' => Resolution::select(['id', 'name', 'position'])->get()->sortBy('position'),
|
||||
'genres' => Genre::all()->sortBy('name'),
|
||||
'user' => $user,
|
||||
'rss' => $rss,
|
||||
'categories' => Category::select(['id', 'name', 'position'])->orderBy('position')->get(),
|
||||
'types' => Type::select(['id', 'name', 'position'])->orderBy('position')->get(),
|
||||
'resolutions' => Resolution::select(['id', 'name', 'position'])->orderBy('position')->get(),
|
||||
'genres' => Genre::orderBy('name')->get(),
|
||||
'user' => $request->user(),
|
||||
'rss' => Rss::where('is_private', '=', 0)->findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ class SeedboxController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$seedboxes = Seedbox::with('user')->latest()->paginate(50);
|
||||
|
||||
return view('Staff.seedbox.index', ['seedboxes' => $seedboxes]);
|
||||
return view('Staff.seedbox.index', [
|
||||
'seedboxes' => Seedbox::with('user')->latest()->paginate(50),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,9 +29,9 @@ class TypeController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$types = Type::all()->sortBy('position');
|
||||
|
||||
return view('Staff.type.index', ['types' => $types]);
|
||||
return view('Staff.type.index', [
|
||||
'types' => $types = Type::orderBy('position')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,9 +58,9 @@ class TypeController extends Controller
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$type = Type::findOrFail($id);
|
||||
|
||||
return view('Staff.type.edit', ['type' => $type]);
|
||||
return view('Staff.type.edit', [
|
||||
'type' => Type::findOrFail($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,7 @@ class TypeController extends Controller
|
||||
*/
|
||||
public function update(UpdateTypeRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
Type::where('id', '=', $id)->update($request->validated());
|
||||
Type::findOrFail($id)->update($request->validated());
|
||||
|
||||
return to_route('staff.types.index')
|
||||
->withSuccess('Type Successfully Modified');
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Staff;
|
||||
|
||||
use App\Enums\UserGroups;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Staff\UpdateUserRequest;
|
||||
use App\Models\Comment;
|
||||
@@ -54,14 +55,10 @@ class UserController extends Controller
|
||||
*/
|
||||
public function settings(string $username): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = User::withTrashed()->where('username', '=', $username)->firstOrFail();
|
||||
$groups = Group::all();
|
||||
$internals = Internal::all();
|
||||
|
||||
return view('Staff.user.edit', [
|
||||
'user' => $user,
|
||||
'groups' => $groups,
|
||||
'internals' => $internals,
|
||||
'user' => User::withTrashed()->where('username', '=', $username)->sole(),
|
||||
'groups' => Group::all(),
|
||||
'internals' => Internal::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -70,7 +67,7 @@ class UserController extends Controller
|
||||
*/
|
||||
public function edit(UpdateUserRequest $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::with('group')->where('username', '=', $username)->firstOrFail();
|
||||
$user = User::with('group')->where('username', '=', $username)->sole();
|
||||
$staff = $request->user();
|
||||
$group = Group::findOrFail($request->group_id);
|
||||
|
||||
@@ -81,7 +78,7 @@ class UserController extends Controller
|
||||
cache()->forget('user:'.$user->passkey);
|
||||
Unit3dAnnounce::addUser($user);
|
||||
|
||||
return to_route('users.show', ['username' => $user->username])
|
||||
return to_route('users.show', ['username' => $username])
|
||||
->withSuccess('Account Was Updated Successfully!');
|
||||
}
|
||||
|
||||
@@ -90,7 +87,7 @@ class UserController extends Controller
|
||||
*/
|
||||
public function permissions(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
$user = User::where('username', '=', $username)->sole();
|
||||
$user->can_upload = $request->input('can_upload');
|
||||
$user->can_download = $request->input('can_download');
|
||||
$user->can_comment = $request->input('can_comment');
|
||||
@@ -102,7 +99,7 @@ class UserController extends Controller
|
||||
cache()->forget('user:'.$user->passkey);
|
||||
Unit3dAnnounce::addUser($user);
|
||||
|
||||
return to_route('users.show', ['username' => $user->username])
|
||||
return to_route('users.show', ['username' => $username])
|
||||
->withSuccess('Account Permissions Successfully Edited');
|
||||
}
|
||||
|
||||
@@ -111,10 +108,20 @@ class UserController extends Controller
|
||||
*/
|
||||
protected function destroy(string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
$user = User::where('username', '=', $username)->sole();
|
||||
|
||||
abort_if($user->group->is_modo || auth()->user()->id == $user->id, 403);
|
||||
|
||||
$user->can_upload = 0;
|
||||
$user->can_download = 0;
|
||||
$user->can_comment = 0;
|
||||
$user->can_invite = 0;
|
||||
$user->can_request = 0;
|
||||
$user->can_chat = 0;
|
||||
$user->group_id = UserGroups::PRUNED;
|
||||
$user->deleted_by = auth()->user()->id;
|
||||
$user->save();
|
||||
|
||||
// Removes UserID from Torrents if any and replaces with System UserID (1)
|
||||
foreach (Torrent::withAnyStatus()->where('user_id', '=', $user->id)->get() as $tor) {
|
||||
$tor->user_id = 1;
|
||||
@@ -226,7 +233,7 @@ class UserController extends Controller
|
||||
*/
|
||||
protected function warnUser(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
$user = User::where('username', '=', $username)->sole();
|
||||
$carbon = new Carbon();
|
||||
$warning = new Warning();
|
||||
$warning->user_id = $user->id;
|
||||
@@ -245,7 +252,7 @@ class UserController extends Controller
|
||||
$pm->message = 'You have received a [b]warning[/b]. Reason: '.$request->input('message');
|
||||
$pm->save();
|
||||
|
||||
return to_route('users.show', ['username' => $user->username])
|
||||
return to_route('users.show', ['username' => $username])
|
||||
->withSuccess('Warning issued successfully!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
namespace App\Http\Controllers\Staff;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use JsonException;
|
||||
|
||||
/**
|
||||
@@ -37,13 +37,11 @@ class VersionController extends Controller
|
||||
*/
|
||||
public function checkVersion(): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
||||
{
|
||||
$client = new Client();
|
||||
$response = json_decode((string) $client->get('//api.github.com/repos/HDInnovations/UNIT3D/releases')->getBody(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$lastestVersion = $response[0]['tag_name'];
|
||||
$latestVersion = Http::get('//api.github.com/repos/HDInnovations/UNIT3D/releases')[0]['tag_name'];
|
||||
|
||||
return response([
|
||||
'updated' => ! version_compare($this->versionController, $lastestVersion, '<'),
|
||||
'latestversion' => $lastestVersion,
|
||||
'updated' => ! version_compare($this->versionController, $latestVersion, '<'),
|
||||
'latestversion' => $latestVersion,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
namespace App\Http\Controllers\Staff;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Warning;
|
||||
|
||||
/**
|
||||
* @see \Tests\Todo\Feature\Http\Controllers\WarningControllerTest
|
||||
@@ -23,12 +22,11 @@ class WarningController extends Controller
|
||||
{
|
||||
/**
|
||||
* Warnings Log.
|
||||
*
|
||||
* @see \app\Http\Livewire\WarningLogSearch
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$warnings = Warning::with(['torrenttitle', 'warneduser'])->latest()->paginate(25);
|
||||
$warningcount = Warning::count();
|
||||
|
||||
return view('Staff.warning.index', ['warnings' => $warnings, 'warningcount' => $warningcount]);
|
||||
return view('Staff.warning.index');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class WatchlistController extends Controller
|
||||
*/
|
||||
final public function store(StoreWatchedUserRequest $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('id', '=', $id)->sole();
|
||||
$user = User::findOrFail($id);
|
||||
|
||||
Watchlist::create(['user_id' => $user->id, 'staff_id' => $request->user()->id] + $request->validated());
|
||||
|
||||
|
||||
@@ -47,64 +47,18 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Total Members Count (All Groups)
|
||||
$allUser = cache()->remember('all_user', $this->carbon, fn () => User::withTrashed()->count());
|
||||
|
||||
// Total Active Members Count (Not Validating, Banned, Disabled, Pruned)
|
||||
$activeUser = cache()->remember('active_user', $this->carbon, function () {
|
||||
$bannedGroup = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id'));
|
||||
$validatingGroup = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id'));
|
||||
$disabledGroup = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id'));
|
||||
$prunedGroup = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id'));
|
||||
|
||||
return User::whereIntegerNotInRaw('group_id', [$validatingGroup[0], $bannedGroup[0], $disabledGroup[0], $prunedGroup[0]])->count();
|
||||
});
|
||||
|
||||
// Total Disabled Members Count
|
||||
$disabledUser = cache()->remember('disabled_user', $this->carbon, function () {
|
||||
$disabledGroup = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id'));
|
||||
|
||||
return User::where('group_id', '=', $disabledGroup[0])->count();
|
||||
});
|
||||
|
||||
// Total Pruned Members Count
|
||||
$prunedUser = cache()->remember('pruned_user', $this->carbon, function () {
|
||||
$prunedGroup = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id'));
|
||||
|
||||
return User::onlyTrashed()->where('group_id', '=', $prunedGroup[0])->count();
|
||||
});
|
||||
|
||||
// Total Banned Members Count
|
||||
$bannedUser = cache()->remember('banned_user', $this->carbon, function () {
|
||||
$bannedGroup = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id'));
|
||||
|
||||
return User::where('group_id', '=', $bannedGroup[0])->count();
|
||||
});
|
||||
|
||||
// Total Torrents Count
|
||||
$numTorrent = cache()->remember('num_torrent', $this->carbon, fn () => Torrent::count());
|
||||
|
||||
// Total Categories With Torrent Count
|
||||
$categories = Category::withCount('torrents')->get()->sortBy('position');
|
||||
|
||||
// Total HD Count
|
||||
$numHd = cache()->remember('num_hd', $this->carbon, fn () => Torrent::where('sd', '=', 0)->count());
|
||||
|
||||
// Total SD Count
|
||||
$numSd = cache()->remember('num_sd', $this->carbon, fn () => Torrent::where('sd', '=', 1)->count());
|
||||
|
||||
// Total Torrent Size
|
||||
$torrentSize = cache()->remember('torrent_size', $this->carbon, fn () => Torrent::sum('size'));
|
||||
|
||||
// Total Seeders
|
||||
$numSeeders = cache()->remember('num_seeders', $this->carbon, fn () => Peer::where('seeder', '=', 1)->count());
|
||||
|
||||
// Total Leechers
|
||||
$numLeechers = cache()->remember('num_leechers', $this->carbon, fn () => Peer::where('seeder', '=', 0)->count());
|
||||
|
||||
// Total Peers
|
||||
$numPeers = cache()->remember('num_peers', $this->carbon, fn () => Peer::count());
|
||||
|
||||
//Total Upload Traffic Without Double Upload
|
||||
$actualUpload = cache()->remember('actual_upload', $this->carbon, fn () => History::sum('actual_uploaded'));
|
||||
|
||||
@@ -117,32 +71,51 @@ class StatsController extends Controller
|
||||
//Total Download Traffic With Freeleech
|
||||
$creditedDownload = cache()->remember('credited_download', $this->carbon, fn () => History::sum('downloaded'));
|
||||
|
||||
//Total Up/Down Traffic without perks
|
||||
$actualUpDown = $actualUpload + $actualDownload;
|
||||
|
||||
//Total Up/Down Traffic with perks
|
||||
$creditedUpDown = $creditedUpload + $creditedDownload;
|
||||
$bannedGroup = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id'));
|
||||
$validatingGroup = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id'));
|
||||
$disabledGroup = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id'));
|
||||
$prunedGroup = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id'));
|
||||
|
||||
return view('stats.index', [
|
||||
'all_user' => $allUser,
|
||||
'active_user' => $activeUser,
|
||||
'disabled_user' => $disabledUser,
|
||||
'pruned_user' => $prunedUser,
|
||||
'banned_user' => $bannedUser,
|
||||
'all_user' => cache()->remember(
|
||||
'all_user',
|
||||
$this->carbon,
|
||||
fn () => User::withTrashed()->count()
|
||||
),
|
||||
'active_user' => cache()->remember(
|
||||
'active_user',
|
||||
$this->carbon,
|
||||
fn () => User::whereIntegerNotInRaw('group_id', [$validatingGroup[0], $bannedGroup[0], $disabledGroup[0], $prunedGroup[0]])->count()
|
||||
),
|
||||
'disabled_user' => cache()->remember(
|
||||
'disabled_user',
|
||||
$this->carbon,
|
||||
fn () => User::where('group_id', '=', $disabledGroup[0])->count()
|
||||
),
|
||||
'pruned_user' => cache()->remember(
|
||||
'pruned_user',
|
||||
$this->carbon,
|
||||
fn () => User::onlyTrashed()->where('group_id', '=', $prunedGroup[0])->count()
|
||||
),
|
||||
'banned_user' => cache()->remember(
|
||||
'banned_user',
|
||||
$this->carbon,
|
||||
fn () => User::where('group_id', '=', $bannedGroup[0])->count()
|
||||
),
|
||||
'num_torrent' => $numTorrent,
|
||||
'categories' => $categories,
|
||||
'num_hd' => $numHd,
|
||||
'categories' => Category::withCount('torrents')->orderBy('position')->get(),
|
||||
'num_hd' => $numTorrent - $numSd,
|
||||
'num_sd' => $numSd,
|
||||
'torrent_size' => $torrentSize,
|
||||
'torrent_size' => cache()->remember('torrent_size', $this->carbon, fn () => Torrent::sum('size')),
|
||||
'num_seeders' => $numSeeders,
|
||||
'num_leechers' => $numLeechers,
|
||||
'num_peers' => $numPeers,
|
||||
'num_peers' => $numSeeders + $numLeechers,
|
||||
'actual_upload' => $actualUpload,
|
||||
'actual_download' => $actualDownload,
|
||||
'actual_up_down' => $actualUpDown,
|
||||
'actual_up_down' => $actualUpload + $actualDownload,
|
||||
'credited_upload' => $creditedUpload,
|
||||
'credited_download' => $creditedDownload,
|
||||
'credited_up_down' => $creditedUpDown,
|
||||
'credited_up_down' => $creditedUpload + $creditedDownload,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -158,10 +131,12 @@ class StatsController extends Controller
|
||||
$disabledGroup = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id'));
|
||||
$prunedGroup = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id'));
|
||||
|
||||
// Fetch Top Uploaders
|
||||
$uploaded = User::latest('uploaded')->whereIntegerNotInRaw('group_id', [$validatingGroup[0], $bannedGroup[0], $disabledGroup[0], $prunedGroup[0]])->take(100)->get();
|
||||
|
||||
return view('stats.users.uploaded', ['uploaded' => $uploaded]);
|
||||
return view('stats.users.uploaded', [
|
||||
'uploaded' => User::orderByDesc('uploaded')
|
||||
->whereIntegerNotInRaw('group_id', [$validatingGroup[0], $bannedGroup[0], $disabledGroup[0], $prunedGroup[0]])
|
||||
->take(100)
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,10 +151,12 @@ class StatsController extends Controller
|
||||
$disabledGroup = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id'));
|
||||
$prunedGroup = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id'));
|
||||
|
||||
// Fetch Top Downloaders
|
||||
$downloaded = User::latest('downloaded')->whereIntegerNotInRaw('group_id', [$validatingGroup[0], $bannedGroup[0], $disabledGroup[0], $prunedGroup[0]])->take(100)->get();
|
||||
|
||||
return view('stats.users.downloaded', ['downloaded' => $downloaded]);
|
||||
return view('stats.users.downloaded', [
|
||||
'downloaded' => User::orderByDesc('downloaded')
|
||||
->whereIntegerNotInRaw('group_id', [$validatingGroup[0], $bannedGroup[0], $disabledGroup[0], $prunedGroup[0]])
|
||||
->take(100)
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,10 +164,15 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function seeders(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Top Seeders
|
||||
$seeders = Peer::with('user')->select(DB::raw('user_id, count(distinct torrent_id) as value'))->where('seeder', '=', 1)->groupBy('user_id')->latest('value')->take(100)->get();
|
||||
|
||||
return view('stats.users.seeders', ['seeders' => $seeders]);
|
||||
return view('stats.users.seeders', [
|
||||
'seeders' => Peer::with('user')
|
||||
->select(DB::raw('user_id, count(distinct torrent_id) as value'))
|
||||
->where('seeder', '=', 1)
|
||||
->groupBy('user_id')
|
||||
->orderByDesc('value')
|
||||
->take(100)
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,10 +180,15 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function leechers(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Top Leechers
|
||||
$leechers = Peer::with('user')->select(DB::raw('user_id, count(*) as value'))->where('seeder', '=', 0)->groupBy('user_id')->latest('value')->take(100)->get();
|
||||
|
||||
return view('stats.users.leechers', ['leechers' => $leechers]);
|
||||
return view('stats.users.leechers', [
|
||||
'leechers' => Peer::with('user')
|
||||
->select(DB::raw('user_id, count(*) as value'))
|
||||
->where('seeder', '=', 0)
|
||||
->groupBy('user_id')
|
||||
->orderByDesc('value')
|
||||
->take(100)
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,10 +196,15 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function uploaders(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Top Uploaders
|
||||
$uploaders = Torrent::with('user')->where('anon', '=', 0)->select(DB::raw('user_id, count(*) as value'))->groupBy('user_id')->latest('value')->take(100)->get();
|
||||
|
||||
return view('stats.users.uploaders', ['uploaders' => $uploaders]);
|
||||
return view('stats.users.uploaders', [
|
||||
'uploaders' => Torrent::with('user')
|
||||
->where('anon', '=', 0)
|
||||
->select(DB::raw('user_id, count(*) as value'))
|
||||
->groupBy('user_id')
|
||||
->orderByDesc('value')
|
||||
->take(100)
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,10 +219,12 @@ class StatsController extends Controller
|
||||
$disabledGroup = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id'));
|
||||
$prunedGroup = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id'));
|
||||
|
||||
// Fetch Top Bankers
|
||||
$bankers = User::latest('seedbonus')->whereIntegerNotInRaw('group_id', [$validatingGroup[0], $bannedGroup[0], $disabledGroup[0], $prunedGroup[0]])->take(100)->get();
|
||||
|
||||
return view('stats.users.bankers', ['bankers' => $bankers]);
|
||||
return view('stats.users.bankers', [
|
||||
'bankers' => User::orderByDesc('seedbonus')
|
||||
->whereIntegerNotInRaw('group_id', [$validatingGroup[0], $bannedGroup[0], $disabledGroup[0], $prunedGroup[0]])
|
||||
->take(100)
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,10 +232,12 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function seedtime(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Top Total Seedtime
|
||||
$users = User::withSum('history as seedtime', 'seedtime')->orderByDesc('seedtime')->take(100)->get();
|
||||
|
||||
return view('stats.users.seedtime', ['users' => $users]);
|
||||
return view('stats.users.seedtime', [
|
||||
'users' => User::withSum('history as seedtime', 'seedtime')
|
||||
->orderByDesc('seedtime')
|
||||
->take(100)
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,10 +245,12 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function seedsize(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Top Total Seedsize Users
|
||||
$users = User::withSum('seedingTorrents as seedsize', 'size')->orderByDesc('seedsize')->take(100)->get();
|
||||
|
||||
return view('stats.users.seedsize', ['users' => $users]);
|
||||
return view('stats.users.seedsize', [
|
||||
'users' => User::withSum('seedingTorrents as seedsize', 'size')
|
||||
->orderByDesc('seedsize')
|
||||
->take(100)
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,10 +258,9 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function seeded(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Top Seeded
|
||||
$seeded = Torrent::latest('seeders')->take(100)->get();
|
||||
|
||||
return view('stats.torrents.seeded', ['seeded' => $seeded]);
|
||||
return view('stats.torrents.seeded', [
|
||||
'seeded' => Torrent::orderByDesc('seeders')->take(100)->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,10 +268,9 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function leeched(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Top Leeched
|
||||
$leeched = Torrent::latest('leechers')->take(100)->get();
|
||||
|
||||
return view('stats.torrents.leeched', ['leeched' => $leeched]);
|
||||
return view('stats.torrents.leeched', [
|
||||
'leeched' => Torrent::orderByDesc('leechers')->take(100)->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,10 +278,9 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function completed(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Top Completed
|
||||
$completed = Torrent::latest('times_completed')->take(100)->get();
|
||||
|
||||
return view('stats.torrents.completed', ['completed' => $completed]);
|
||||
return view('stats.torrents.completed', [
|
||||
'completed' => Torrent::orderByDesc('times_completed')->take(100)->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -293,10 +288,13 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function dying(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Top Dying
|
||||
$dying = Torrent::where('seeders', '=', 1)->where('times_completed', '>=', '1')->latest('leechers')->take(100)->get();
|
||||
|
||||
return view('stats.torrents.dying', ['dying' => $dying]);
|
||||
return view('stats.torrents.dying', [
|
||||
'dying' => Torrent::where('seeders', '=', 1)
|
||||
->where('times_completed', '>=', '1')
|
||||
->orderByDesc('leechers')
|
||||
->take(100)
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -304,10 +302,12 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function dead(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Top Dead
|
||||
$dead = Torrent::where('seeders', '=', 0)->latest('leechers')->take(100)->get();
|
||||
|
||||
return view('stats.torrents.dead', ['dead' => $dead]);
|
||||
return view('stats.torrents.dead', [
|
||||
'dead' => Torrent::where('seeders', '=', 0)
|
||||
->orderByDesc('leechers')
|
||||
->take(100)
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -315,10 +315,9 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function bountied(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Top Bountied
|
||||
$bountied = TorrentRequest::latest('bounty')->take(100)->get();
|
||||
|
||||
return view('stats.requests.bountied', ['bountied' => $bountied]);
|
||||
return view('stats.requests.bountied', [
|
||||
'bountied' => TorrentRequest::orderByDesc('bounty')->take(100)->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -326,10 +325,9 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function groups(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Groups User Counts
|
||||
$groups = Group::oldest('position')->get();
|
||||
|
||||
return view('stats.groups.groups', ['groups' => $groups]);
|
||||
return view('stats.groups.groups', [
|
||||
'groups' => Group::orderBy('position')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,11 +335,12 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function group(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch Users In Group
|
||||
$group = Group::findOrFail($id);
|
||||
$users = User::withTrashed()->where('group_id', '=', $group->id)->latest()->paginate(100);
|
||||
|
||||
return view('stats.groups.group', ['users' => $users, 'group' => $group]);
|
||||
return view('stats.groups.group', [
|
||||
'users' => User::withTrashed()->where('group_id', '=', $group->id)->latest()->paginate(100),
|
||||
'group' => $group,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -349,10 +348,9 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function languages(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
// Fetch All Languages
|
||||
$languages = Language::allowed();
|
||||
|
||||
return view('stats.languages.languages', ['languages' => $languages]);
|
||||
return view('stats.languages.languages', [
|
||||
'languages' => Language::allowed(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,7 +364,9 @@ class StatsController extends Controller
|
||||
$clients = cache()->get('stats:clients');
|
||||
}
|
||||
|
||||
return view('stats.clients.clients', ['clients' => $clients]);
|
||||
return view('stats.clients.clients', [
|
||||
'clients' => $clients,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -374,16 +374,21 @@ class StatsController extends Controller
|
||||
*/
|
||||
public function themes(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$siteThemes = User::select(DB::raw('style, count(*) as value'))->groupBy('style')->latest('value')->get();
|
||||
$customThemes = User::where('custom_css', '!=', '')->select(DB::raw('custom_css, count(*) as value'))->groupBy('custom_css')->latest('value')->get();
|
||||
$standaloneThemes = User::whereNotNull('standalone_css')->select(DB::raw('standalone_css, count(*) as value'))->groupBy('standalone_css')->latest('value')->get();
|
||||
|
||||
|
||||
|
||||
return view('stats.themes.index', [
|
||||
'siteThemes' => $siteThemes,
|
||||
'customThemes' => $customThemes,
|
||||
'standaloneThemes' => $standaloneThemes,
|
||||
'siteThemes' => User::select(DB::raw('style, count(*) as value'))
|
||||
->groupBy('style')
|
||||
->orderByDesc('value')
|
||||
->get(),
|
||||
'customThemes' => User::where('custom_css', '!=', '')
|
||||
->select(DB::raw('custom_css, count(*) as value'))
|
||||
->groupBy('custom_css')
|
||||
->orderByDesc('value')
|
||||
->get(),
|
||||
'standaloneThemes' => User::whereNotNull('standalone_css')
|
||||
->select(DB::raw('standalone_css, count(*) as value'))
|
||||
->groupBy('standalone_css')
|
||||
->orderByDesc('value')
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,10 +56,10 @@ class SubtitleController extends Controller
|
||||
*/
|
||||
public function create(int $torrentId): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$torrent = Torrent::withAnyStatus()->findOrFail($torrentId);
|
||||
$mediaLanguages = MediaLanguage::all()->sortBy('name');
|
||||
|
||||
return view('subtitle.create', ['torrent' => $torrent, 'media_languages' => $mediaLanguages]);
|
||||
return view('subtitle.create', [
|
||||
'torrent' => Torrent::withAnyStatus()->findOrFail($torrentId),
|
||||
'media_languages' => MediaLanguage::orderBy('name')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,7 +184,7 @@ class SubtitleController extends Controller
|
||||
|
||||
$subtitle->delete();
|
||||
|
||||
return to_route('torrent', ['id' => $request->input('torrent_id')])
|
||||
return to_route('torrent', ['id' => $request->integer('torrent_id')])
|
||||
->withSuccess('Subtitle Successfully Deleted');
|
||||
}
|
||||
|
||||
|
||||
@@ -34,12 +34,9 @@ class TicketController extends Controller
|
||||
*/
|
||||
final public function create(): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$categories = TicketCategory::all()->sortBy('position');
|
||||
$priorities = TicketPriority::all()->sortBy('position');
|
||||
|
||||
return view('ticket.create', [
|
||||
'categories' => $categories,
|
||||
'priorities' => $priorities,
|
||||
'categories' => TicketCategory::orderBy('position')->get(),
|
||||
'priorities' => TicketPriority::orderBy('position')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -199,7 +196,7 @@ class TicketController extends Controller
|
||||
$ticket->closed_at = now();
|
||||
$ticket->save();
|
||||
|
||||
return to_route('tickets.show', ['id' => $ticket->id])
|
||||
return to_route('tickets.index')
|
||||
->withSuccess(trans('ticket.closed-success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ class TorrentBuffController extends Controller
|
||||
|
||||
abort_unless($user->group->is_modo, 403);
|
||||
|
||||
$featured_torrent = FeaturedTorrent::where('torrent_id', '=', $id)->firstOrFail();
|
||||
$featured_torrent = FeaturedTorrent::where('torrent_id', '=', $id)->sole();
|
||||
|
||||
$torrent = Torrent::withAnyStatus()->findOrFail($id);
|
||||
$torrent->free = '0';
|
||||
@@ -262,4 +262,35 @@ class TorrentBuffController extends Controller
|
||||
return to_route('torrent', ['id' => $torrent->id])
|
||||
->withErrors('You Dont Have Enough Freeleech Tokens Or Already Have One Activated On This Torrent.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Torrents Refudable Status.
|
||||
*/
|
||||
public function setRefundable(Request $request, $id)
|
||||
{
|
||||
$user = $request->user();
|
||||
abort_unless($user->group->is_modo || $user->group->is_internal, 403);
|
||||
|
||||
$torrent = Torrent::withAnyStatus()->findOrFail($id);
|
||||
$torrent_url = href_torrent($torrent);
|
||||
|
||||
if ($torrent->refundable == 0) {
|
||||
$torrent->refundable = 1;
|
||||
|
||||
$this->chatRepository->systemMessage(
|
||||
sprintf('Ladies and Gents, [url=%s]%s[/url] is now refundable! Grab It While You Can! :fire:', $torrent_url, $torrent->name)
|
||||
);
|
||||
} else {
|
||||
$torrent->refundable = 0;
|
||||
|
||||
$this->chatRepository->systemMessage(
|
||||
sprintf('Ladies and Gents, [url=%s]%s[/url] is no longer refundable! :poop:', $torrent_url, $torrent->name)
|
||||
);
|
||||
}
|
||||
|
||||
$torrent->save();
|
||||
|
||||
return to_route('torrent', ['id' => $torrent->id])
|
||||
->withSuccess('Torrent\'s Refundable Status Has Been Adjusted!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,16 +87,11 @@ class TorrentController extends Controller
|
||||
->with(['user', 'comments', 'category', 'type', 'resolution', 'subtitles', 'playlists'])
|
||||
->withExists(['bookmarks' => fn ($query) => $query->where('user_id', '=', $user->id)])
|
||||
->findOrFail($id);
|
||||
$freeleechToken = cache()->get('freeleech_token:'.$user->id.':'.$torrent->id);
|
||||
$personalFreeleech = cache()->get('personal_freeleech:'.$user->id);
|
||||
$totalTips = BonTransactions::where('torrent_id', '=', $id)->sum('cost');
|
||||
$userTips = BonTransactions::where('torrent_id', '=', $id)->where('sender', '=', $user->id)->sum('cost');
|
||||
$lastSeedActivity = History::where('torrent_id', '=', $torrent->id)->where('seeder', '=', 1)->latest('updated_at')->first();
|
||||
$audits = Audit::with('user')->where('model_entry_id', '=', $torrent->id)->where('model_name', '=', 'Torrent')->latest()->get();
|
||||
|
||||
$meta = null;
|
||||
$trailer = null;
|
||||
$platforms = null;
|
||||
|
||||
if ($torrent->category->tv_meta && $torrent->tmdb && $torrent->tmdb != 0) {
|
||||
$meta = Tv::with([
|
||||
'genres',
|
||||
@@ -104,7 +99,7 @@ class TorrentController extends Controller
|
||||
'companies',
|
||||
'networks',
|
||||
'recommendations'
|
||||
])->where('id', '=', $torrent->tmdb)->first();
|
||||
])->find($torrent->tmdb);
|
||||
$trailer = ( new \App\Services\Tmdb\Client\TV($torrent->tmdb))->get_trailer();
|
||||
}
|
||||
|
||||
@@ -116,7 +111,7 @@ class TorrentController extends Controller
|
||||
'collection',
|
||||
'recommendations'
|
||||
])
|
||||
->where('id', '=', $torrent->tmdb)->first();
|
||||
->find($torrent->tmdb);
|
||||
$trailer = ( new \App\Services\Tmdb\Client\Movie($torrent->tmdb))->get_trailer();
|
||||
}
|
||||
|
||||
@@ -135,30 +130,21 @@ class TorrentController extends Controller
|
||||
$platforms = PlatformLogo::whereIn('id', collect($meta->platforms)->pluck('platform_logo')->toArray())->get();
|
||||
}
|
||||
|
||||
$featured = $torrent->featured == 1 ? FeaturedTorrent::where('torrent_id', '=', $id)->first() : null;
|
||||
|
||||
$mediaInfo = null;
|
||||
if ($torrent->mediainfo !== null) {
|
||||
$mediaInfo = (new MediaInfo())->parse($torrent->mediainfo);
|
||||
}
|
||||
|
||||
$playlists = $user->playlists;
|
||||
|
||||
return view('torrent.show', [
|
||||
'torrent' => $torrent,
|
||||
'user' => $user,
|
||||
'personal_freeleech' => $personalFreeleech,
|
||||
'freeleech_token' => $freeleechToken,
|
||||
'personal_freeleech' => cache()->get('personal_freeleech:'.$user->id),
|
||||
'freeleech_token' => cache()->get('freeleech_token:'.$user->id.':'.$torrent->id),
|
||||
'meta' => $meta,
|
||||
'trailer' => $trailer,
|
||||
'platforms' => $platforms,
|
||||
'total_tips' => $totalTips,
|
||||
'user_tips' => $userTips,
|
||||
'featured' => $featured,
|
||||
'mediaInfo' => $mediaInfo,
|
||||
'last_seed_activity' => $lastSeedActivity,
|
||||
'playlists' => $playlists,
|
||||
'audits' => $audits,
|
||||
'total_tips' => BonTransactions::where('torrent_id', '=', $id)->sum('cost'),
|
||||
'user_tips' => BonTransactions::where('torrent_id', '=', $id)->where('sender', '=', $user->id)->sum('cost'),
|
||||
'featured' => $torrent->featured == 1 ? FeaturedTorrent::where('torrent_id', '=', $id)->first() : null,
|
||||
'mediaInfo' => $torrent->mediainfo !== null ? (new MediaInfo())->parse($torrent->mediainfo) : null,
|
||||
'last_seed_activity' => History::where('torrent_id', '=', $torrent->id)->where('seeder', '=', 1)->latest('updated_at')->first(),
|
||||
'playlists' => $user->playlists,
|
||||
'audits' => Audit::with('user')->where('model_entry_id', '=', $torrent->id)->where('model_name', '=', 'Torrent')->latest()->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -169,30 +155,29 @@ class TorrentController extends Controller
|
||||
{
|
||||
$user = $request->user();
|
||||
$torrent = Torrent::withAnyStatus()->findOrFail($id);
|
||||
$categories = Category::all()
|
||||
->sortBy('position')
|
||||
->mapWithKeys(fn ($cat) => [
|
||||
$cat['id'] => [
|
||||
'name' => $cat['name'],
|
||||
'type' => match (1) {
|
||||
$cat->movie_meta => 'movie',
|
||||
$cat->tv_meta => 'tv',
|
||||
$cat->game_meta => 'game',
|
||||
$cat->music_meta => 'music',
|
||||
$cat->no_meta => 'no'
|
||||
},
|
||||
]
|
||||
]);
|
||||
$types = Type::all()->sortBy('position')->mapWithKeys(fn ($type) => [$type['id'] => ['name' => $type['name']]]);
|
||||
|
||||
abort_unless($user->group->is_modo || $user->id === $torrent->user_id, 403);
|
||||
|
||||
return view('torrent.edit', [
|
||||
'categories' => $categories,
|
||||
'types' => $types,
|
||||
'resolutions' => Resolution::all()->sortBy('position'),
|
||||
'regions' => Region::all()->sortBy('position'),
|
||||
'distributors' => Distributor::all()->sortBy('position'),
|
||||
'categories' => Category::query()
|
||||
->orderBy('position')
|
||||
->get()
|
||||
->mapWithKeys(fn ($cat) => [
|
||||
$cat['id'] => [
|
||||
'name' => $cat['name'],
|
||||
'type' => match (1) {
|
||||
$cat->movie_meta => 'movie',
|
||||
$cat->tv_meta => 'tv',
|
||||
$cat->game_meta => 'game',
|
||||
$cat->music_meta => 'music',
|
||||
$cat->no_meta => 'no'
|
||||
},
|
||||
]
|
||||
]),
|
||||
'types' => Type::orderBy('position')->get()->mapWithKeys(fn ($type) => [$type['id'] => ['name' => $type['name']]]),
|
||||
'resolutions' => Resolution::orderBy('position')->get(),
|
||||
'regions' => Region::orderBy('position')->get(),
|
||||
'distributors' => Distributor::orderBy('position')->get(),
|
||||
'keywords' => Keyword::where('torrent_id', '=', $torrent->id)->pluck('name'),
|
||||
'torrent' => $torrent,
|
||||
'user' => $user,
|
||||
@@ -402,7 +387,8 @@ class TorrentController extends Controller
|
||||
{
|
||||
$user = $request->user();
|
||||
$categories = [];
|
||||
foreach (Category::all()->sortBy('position') as $cat) {
|
||||
|
||||
foreach (Category::orderBy('position')->get() as $cat) {
|
||||
$temp = [
|
||||
'name' => $cat->name,
|
||||
];
|
||||
@@ -419,10 +405,10 @@ class TorrentController extends Controller
|
||||
|
||||
return view('torrent.create', [
|
||||
'categories' => $categories,
|
||||
'types' => Type::all()->sortBy('position'),
|
||||
'resolutions' => Resolution::all()->sortBy('position'),
|
||||
'regions' => Region::all()->sortBy('position'),
|
||||
'distributors' => Distributor::all()->sortBy('position'),
|
||||
'types' => Type::orderBy('position')->get(),
|
||||
'resolutions' => Resolution::orderBy('position')->get(),
|
||||
'regions' => Region::orderBy('position')->get(),
|
||||
'distributors' => Distributor::orderBy('position')->get(),
|
||||
'user' => $user,
|
||||
'category_id' => $request->category_id,
|
||||
'title' => urldecode($request->title),
|
||||
@@ -445,6 +431,7 @@ class TorrentController extends Controller
|
||||
$category = Category::withCount('torrents')->findOrFail($request->input('category_id'));
|
||||
|
||||
$requestFile = $request->file('torrent');
|
||||
|
||||
if (! $request->hasFile('torrent')) {
|
||||
return to_route('upload_form', ['category_id' => $category->id])
|
||||
->withErrors('You Must Provide A Torrent File For Upload!')->withInput();
|
||||
@@ -460,6 +447,7 @@ class TorrentController extends Controller
|
||||
$infohash = Bencode::get_infohash($decodedTorrent);
|
||||
|
||||
$v2 = Bencode::is_v2_or_hybrid($decodedTorrent);
|
||||
|
||||
if ($v2) {
|
||||
return to_route('upload_form', ['category_id' => $category->id])
|
||||
->withErrors('BitTorrent v2 (BEP 52) is not supported!')->withInput();
|
||||
@@ -515,18 +503,22 @@ class TorrentController extends Controller
|
||||
$torrent->moderated_at = Carbon::now();
|
||||
$torrent->moderated_by = 1; //System ID
|
||||
$torrent->free = $user->group->is_modo || $user->group->is_internal ? $request->input('free') : 0;
|
||||
$torrent->refundable = $user->group->is_modo || $user->group->is_internal ? $request->input('refundable') : 0;
|
||||
|
||||
$resolutionRule = 'nullable|exists:resolutions,id';
|
||||
|
||||
if ($category->movie_meta || $category->tv_meta) {
|
||||
$resolutionRule = 'required|exists:resolutions,id';
|
||||
}
|
||||
|
||||
$episodeRule = 'nullable|numeric';
|
||||
|
||||
if ($category->tv_meta) {
|
||||
$episodeRule = 'required|numeric';
|
||||
}
|
||||
|
||||
$seasonRule = 'nullable|numeric';
|
||||
|
||||
if ($category->tv_meta) {
|
||||
$seasonRule = 'required|numeric';
|
||||
}
|
||||
@@ -557,6 +549,7 @@ class TorrentController extends Controller
|
||||
'stream' => 'required',
|
||||
'sd' => 'required',
|
||||
'free' => 'sometimes|between:0,100',
|
||||
'refundable' => 'sometimes|bool',
|
||||
]);
|
||||
|
||||
if ($v->fails()) {
|
||||
@@ -587,6 +580,7 @@ class TorrentController extends Controller
|
||||
|
||||
// TMDB Meta
|
||||
$tmdbScraper = new TMDBScraper();
|
||||
|
||||
if ($torrent->category->tv_meta !== 0 && ($torrent->tmdb || $torrent->tmdb != 0)) {
|
||||
$tmdbScraper->tv($torrent->tmdb);
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ class TorrentDownloadController extends Controller
|
||||
*/
|
||||
public function show(Request $request, int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$torrent = Torrent::withAnyStatus()->findOrFail($id);
|
||||
$user = $request->user();
|
||||
|
||||
return view('torrent.download_check', ['torrent' => $torrent, 'user' => $user]);
|
||||
return view('torrent.download_check', [
|
||||
'torrent' => Torrent::withAnyStatus()->findOrFail($id),
|
||||
'user' => $request->user(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,7 +39,7 @@ class TorrentDownloadController extends Controller
|
||||
{
|
||||
$user = $request->user();
|
||||
if (! $user && $rsskey) {
|
||||
$user = User::where('rsskey', '=', $rsskey)->firstOrFail();
|
||||
$user = User::where('rsskey', '=', $rsskey)->sole();
|
||||
}
|
||||
$torrent = Torrent::withAnyStatus()->findOrFail($id);
|
||||
$hasHistory = $user->history()->where([['torrent_id', '=', $torrent->id], ['seeder', '=', 1]])->exists();
|
||||
|
||||
@@ -23,9 +23,9 @@ class TorrentHistoryController extends Controller
|
||||
*/
|
||||
public function index(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$torrent = Torrent::withAnyStatus()->findOrFail($id);
|
||||
$history = History::with(['user'])->where('torrent_id', '=', $id)->latest()->get();
|
||||
|
||||
return view('torrent.history', ['torrent' => $torrent, 'history' => $history]);
|
||||
return view('torrent.history', [
|
||||
'torrent' => Torrent::withAnyStatus()->findOrFail($id),
|
||||
'histories' => History::with(['user'])->where('torrent_id', '=', $id)->latest()->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,24 +24,26 @@ class TorrentPeerController extends Controller
|
||||
public function index(int $id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$torrent = Torrent::withAnyStatus()->findOrFail($id);
|
||||
$peers = Peer::query()
|
||||
->with('user')
|
||||
->select(['torrent_id', 'user_id', 'uploaded', 'downloaded', 'left', 'port', 'agent', 'created_at', 'updated_at', 'seeder'])
|
||||
->selectRaw('INET6_NTOA(ip) as ip')
|
||||
->where('torrent_id', '=', $id)
|
||||
->latest('seeder')
|
||||
->get()
|
||||
->map(function ($peer) use ($torrent) {
|
||||
$progress = 100 * (1 - $peer->left / $torrent->size);
|
||||
$peer['progress'] = match (true) {
|
||||
0 < $progress && $progress < 1 => 1,
|
||||
99 < $progress && $progress < 100 => 99,
|
||||
default => round($progress),
|
||||
};
|
||||
|
||||
return $peer;
|
||||
});
|
||||
return view('torrent.peers', [
|
||||
'torrent' => $torrent,
|
||||
'peers' => Peer::query()
|
||||
->with('user')
|
||||
->select(['torrent_id', 'user_id', 'uploaded', 'downloaded', 'left', 'port', 'agent', 'created_at', 'updated_at', 'seeder'])
|
||||
->selectRaw('INET6_NTOA(ip) as ip')
|
||||
->where('torrent_id', '=', $id)
|
||||
->latest('seeder')
|
||||
->get()
|
||||
->map(function ($peer) use ($torrent) {
|
||||
$progress = 100 * (1 - $peer->left / $torrent->size);
|
||||
$peer['progress'] = match (true) {
|
||||
0 < $progress && $progress < 1 => 1,
|
||||
99 < $progress && $progress < 100 => 99,
|
||||
default => round($progress),
|
||||
};
|
||||
|
||||
return view('torrent.peers', ['torrent' => $torrent, 'peers' => $peers]);
|
||||
return $peer;
|
||||
}),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,14 +26,11 @@ class AchievementsController extends Controller
|
||||
*/
|
||||
public function index(User $user): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$achievements = $user->unlockedAchievements();
|
||||
$pending = $user->inProgressAchievements();
|
||||
|
||||
return view('user.achievement.index', [
|
||||
'route' => 'achievement',
|
||||
'user' => $user,
|
||||
'achievements' => $achievements,
|
||||
'pending' => $pending,
|
||||
'achievements' => $user->unlockedAchievements(),
|
||||
'pending' => $user->inProgressAchievements(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,8 @@ class FollowController extends Controller
|
||||
*/
|
||||
public function index(User $user): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$followers = $user->followers()->orderByPivot('created_at', 'desc')->paginate(25);
|
||||
|
||||
return view('user.follower.index', [
|
||||
'followers' => $followers,
|
||||
'followers' => $user->followers()->orderByPivot('created_at', 'desc')->paginate(25),
|
||||
'user' => $user,
|
||||
]);
|
||||
}
|
||||
|
||||
+6
-11
@@ -15,22 +15,17 @@ namespace App\Http\Controllers\User;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BanController extends Controller
|
||||
class FollowingController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show user bans.
|
||||
* User Followers.
|
||||
*/
|
||||
public function index(Request $request, User $user): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
public function index(User $user): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
abort_unless($request->user()->group->is_modo, 403);
|
||||
|
||||
$bans = $user->userban()->latest()->get();
|
||||
|
||||
return view('user.ban.index', [
|
||||
'bans' => $bans,
|
||||
'user' => $user,
|
||||
return view('user.following.index', [
|
||||
'followings' => $user->following()->orderByPivot('created_at', 'desc')->paginate(25),
|
||||
'user' => $user,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -39,35 +39,27 @@ class GiftController extends Controller
|
||||
|
||||
abort_unless($request->user()->id === $user->id || $request->user()->group->is_modo, 403);
|
||||
|
||||
$userbon = $user->getSeedbonus();
|
||||
|
||||
$gifttransactions = BonTransactions::query()
|
||||
->with(['senderObj', 'receiverObj'])
|
||||
->where(
|
||||
fn ($query) => $query
|
||||
->where('sender', '=', $user->id)
|
||||
->orwhere('receiver', '=', $user->id)
|
||||
)
|
||||
->where('name', '=', 'gift')
|
||||
->latest('date_actioned')
|
||||
->paginate(25);
|
||||
|
||||
$giftsSent = BonTransactions::query()
|
||||
->where('sender', '=', $user->id)
|
||||
->where('name', '=', 'gift')
|
||||
->sum('cost');
|
||||
|
||||
$giftsReceived = BonTransactions::query()
|
||||
->where('receiver', '=', $user->id)
|
||||
->where('name', '=', 'gift')
|
||||
->sum('cost');
|
||||
|
||||
return view('user.gift.index', [
|
||||
'user' => $user,
|
||||
'gifttransactions' => $gifttransactions,
|
||||
'userbon' => $userbon,
|
||||
'gifts_sent' => $giftsSent,
|
||||
'gifts_received' => $giftsReceived,
|
||||
'gifttransactions' => BonTransactions::query()
|
||||
->with(['senderObj', 'receiverObj'])
|
||||
->where(
|
||||
fn ($query) => $query
|
||||
->where('sender', '=', $user->id)
|
||||
->orwhere('receiver', '=', $user->id)
|
||||
)
|
||||
->where('name', '=', 'gift')
|
||||
->latest('date_actioned')
|
||||
->paginate(25),
|
||||
'userbon' => $user->getSeedbonus(),
|
||||
'gifts_sent' => BonTransactions::query()
|
||||
->where('sender', '=', $user->id)
|
||||
->where('name', '=', 'gift')
|
||||
->sum('cost'),
|
||||
'gifts_received' => BonTransactions::query()
|
||||
->where('receiver', '=', $user->id)
|
||||
->where('name', '=', 'gift')
|
||||
->sum('cost'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -80,11 +72,9 @@ class GiftController extends Controller
|
||||
|
||||
abort_unless($request->user()->id === $user->id, 403);
|
||||
|
||||
$userbon = $user->getSeedbonus();
|
||||
|
||||
return view('user.gift.create', [
|
||||
'user' => $user,
|
||||
'userbon' => $userbon,
|
||||
'userbon' => $user->getSeedbonus(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,18 +27,16 @@ class HistoryController extends Controller
|
||||
{
|
||||
abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403);
|
||||
|
||||
$history = DB::table('history')
|
||||
->where('user_id', '=', $user->id)
|
||||
->where('created_at', '>', $user->created_at)
|
||||
->selectRaw('sum(actual_uploaded) as upload')
|
||||
->selectRaw('sum(uploaded) as credited_upload')
|
||||
->selectRaw('sum(actual_downloaded) as download')
|
||||
->selectRaw('sum(downloaded) as credited_download')
|
||||
->first();
|
||||
|
||||
return view('user.history.index', [
|
||||
'user' => $user,
|
||||
'history' => $history,
|
||||
'history' => DB::table('history')
|
||||
->where('user_id', '=', $user->id)
|
||||
->where('created_at', '>', $user->created_at)
|
||||
->selectRaw('sum(actual_uploaded) as upload')
|
||||
->selectRaw('sum(uploaded) as credited_upload')
|
||||
->selectRaw('sum(actual_downloaded) as download')
|
||||
->selectRaw('sum(downloaded) as credited_download')
|
||||
->first(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,12 +35,14 @@ class InviteController extends Controller
|
||||
public function index(Request $request, string $username): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
$owner = User::where('username', '=', $username)->firstOrFail();
|
||||
$owner = User::where('username', '=', $username)->sole();
|
||||
|
||||
abort_unless($user->group->is_modo || $user->id === $owner->id, 403);
|
||||
|
||||
$invites = Invite::with(['sender', 'receiver'])->where('user_id', '=', $owner->id)->latest()->paginate(25);
|
||||
|
||||
return view('user.invite.index', ['user' => $owner, 'invites' => $invites, 'route' => 'invite']);
|
||||
return view('user.invite.index', [
|
||||
'user' => $owner,
|
||||
'invites' => Invite::withTrashed()->with(['sender', 'receiver'])->where('user_id', '=', $owner->id)->latest()->paginate(25),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +67,7 @@ class InviteController extends Controller
|
||||
->withErrors(trans('user.invites-disabled-group'));
|
||||
}
|
||||
|
||||
return view('user.invite.create', ['user' => $user, 'route' => 'invite']);
|
||||
return view('user.invite.create', ['user' => $user]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,6 +140,32 @@ class InviteController extends Controller
|
||||
->withSuccess(trans('user.invite-sent-success'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retract a sent invite.
|
||||
*/
|
||||
public function destroy(Request $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = $request->user();
|
||||
$invite = Invite::findOrFail($id);
|
||||
|
||||
abort_unless($user->group->is_modo || $invite->user->id === $user->id, 403);
|
||||
|
||||
if ($invite->accepted_by !== null) {
|
||||
return to_route('invites.index', ['username' => $user->username])
|
||||
->withErrors(trans('user.invite-already-used'));
|
||||
}
|
||||
|
||||
if ($invite->expires_on < now()) {
|
||||
return to_route('invites.index', ['username' => $user->username])
|
||||
->withErrors(trans('user.invite-expired'));
|
||||
}
|
||||
|
||||
$invite->delete();
|
||||
|
||||
return to_route('invites.index', ['username' => $user->username])
|
||||
->withSuccess('Invite deleted successfully.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Resend Invite.
|
||||
*/
|
||||
@@ -153,6 +181,11 @@ class InviteController extends Controller
|
||||
->withErrors(trans('user.invite-already-used'));
|
||||
}
|
||||
|
||||
if ($invite->expires_on < now()) {
|
||||
return to_route('invites.index', ['username' => $user->username])
|
||||
->withErrors(trans('user.invite-expired'));
|
||||
}
|
||||
|
||||
Mail::to($invite->email)->send(new InviteUser($invite));
|
||||
|
||||
return to_route('invites.index', ['username' => $user->username])
|
||||
|
||||
@@ -48,7 +48,7 @@ class NotificationController extends Controller
|
||||
*/
|
||||
public function update(Request $request, string $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$notification = $request->user()->notifications()->where('id', '=', $id)->first();
|
||||
$notification = $request->user()->notifications()->findOrFail($id);
|
||||
|
||||
if (! $notification) {
|
||||
return to_route('notifications.index')
|
||||
|
||||
@@ -133,16 +133,17 @@ class NotificationSettingController extends Controller
|
||||
{
|
||||
abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$groups = Group::query()
|
||||
->where('is_modo', '=', '0')
|
||||
->where('is_admin', '=', '0')
|
||||
->where('id', '!=', UserGroups::VALIDATING)
|
||||
->where('id', '!=', UserGroups::PRUNED)
|
||||
->where('id', '!=', UserGroups::BANNED)
|
||||
->where('id', '!=', UserGroups::DISABLED)
|
||||
->latest('level')
|
||||
->get();
|
||||
|
||||
return view('user.notification_setting.edit', ['user' => $user, 'groups' => $groups]);
|
||||
return view('user.notification_setting.edit', [
|
||||
'user' => $user,
|
||||
'groups' => Group::query()
|
||||
->where('is_modo', '=', '0')
|
||||
->where('is_admin', '=', '0')
|
||||
->where('id', '!=', UserGroups::VALIDATING)
|
||||
->where('id', '!=', UserGroups::PRUNED)
|
||||
->where('id', '!=', UserGroups::BANNED)
|
||||
->where('id', '!=', UserGroups::DISABLED)
|
||||
->latest('level')
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,18 +28,16 @@ class PeerController extends Controller
|
||||
{
|
||||
abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403);
|
||||
|
||||
$history = DB::table('history')
|
||||
->where('user_id', '=', $user->id)
|
||||
->where('created_at', '>', $user->created_at)
|
||||
->selectRaw('sum(actual_uploaded) as upload')
|
||||
->selectRaw('sum(uploaded) as credited_upload')
|
||||
->selectRaw('sum(actual_downloaded) as download')
|
||||
->selectRaw('sum(downloaded) as credited_download')
|
||||
->first();
|
||||
|
||||
return view('user.peer.index', [
|
||||
'user' => $user,
|
||||
'history' => $history,
|
||||
'history' => DB::table('history')
|
||||
->where('user_id', '=', $user->id)
|
||||
->where('created_at', '>', $user->created_at)
|
||||
->selectRaw('sum(actual_uploaded) as upload')
|
||||
->selectRaw('sum(uploaded) as credited_upload')
|
||||
->selectRaw('sum(actual_downloaded) as download')
|
||||
->selectRaw('sum(downloaded) as credited_download')
|
||||
->first(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,31 +24,29 @@ class PostController extends Controller
|
||||
*/
|
||||
public function index(User $user): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$posts = $user->posts()
|
||||
->with('user', 'user.group', 'topic:id,name')
|
||||
->withCount('likes', 'dislikes', 'authorPosts', 'authorTopics')
|
||||
->withSum('tips', 'cost')
|
||||
->whereNotIn(
|
||||
'topic_id',
|
||||
Topic::query()
|
||||
->whereRelation(
|
||||
'forumPermissions',
|
||||
fn ($query) => $query
|
||||
->where('group_id', '=', auth()->user()->group_id)
|
||||
->where(
|
||||
fn ($query) => $query
|
||||
->where('show_forum', '!=', 1)
|
||||
->orWhere('read_topic', '!=', 1)
|
||||
)
|
||||
)
|
||||
->select('id')
|
||||
)
|
||||
->latest()
|
||||
->paginate(25);
|
||||
|
||||
return view('user.post.index', [
|
||||
'posts' => $posts,
|
||||
'user' => $user,
|
||||
'posts' => $user->posts()
|
||||
->with('user', 'user.group', 'topic:id,name')
|
||||
->withCount('likes', 'dislikes', 'authorPosts', 'authorTopics')
|
||||
->withSum('tips', 'cost')
|
||||
->whereNotIn(
|
||||
'topic_id',
|
||||
Topic::query()
|
||||
->whereRelation(
|
||||
'forumPermissions',
|
||||
fn ($query) => $query
|
||||
->where('group_id', '=', auth()->user()->group_id)
|
||||
->where(
|
||||
fn ($query) => $query
|
||||
->where('show_forum', '!=', 1)
|
||||
->orWhere('read_topic', '!=', 1)
|
||||
)
|
||||
)
|
||||
->select('id')
|
||||
)
|
||||
->latest()
|
||||
->paginate(25),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,16 +148,17 @@ class PrivacySettingController extends Controller
|
||||
{
|
||||
abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$groups = Group::query()
|
||||
->where('is_modo', '=', '0')
|
||||
->where('is_admin', '=', '0')
|
||||
->where('id', '!=', UserGroups::VALIDATING)
|
||||
->where('id', '!=', UserGroups::PRUNED)
|
||||
->where('id', '!=', UserGroups::BANNED)
|
||||
->where('id', '!=', UserGroups::DISABLED)
|
||||
->latest('level')
|
||||
->get();
|
||||
|
||||
return view('user.privacy_setting.edit', ['user' => $user, 'groups' => $groups]);
|
||||
return view('user.privacy_setting.edit', [
|
||||
'user' => $user,
|
||||
'groups' => Group::query()
|
||||
->where('is_modo', '=', '0')
|
||||
->where('is_admin', '=', '0')
|
||||
->where('id', '!=', UserGroups::VALIDATING)
|
||||
->where('id', '!=', UserGroups::PRUNED)
|
||||
->where('id', '!=', UserGroups::BANNED)
|
||||
->where('id', '!=', UserGroups::DISABLED)
|
||||
->latest('level')
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,12 +29,14 @@ class PrivateMessageController extends Controller
|
||||
*/
|
||||
public function searchPMInbox(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
$pms = PrivateMessage::where('receiver_id', '=', $user->id)->where([
|
||||
['subject', 'like', '%'.$request->input('subject').'%'],
|
||||
])->latest()->paginate(20);
|
||||
|
||||
return view('user.pm.index', ['pms' => $pms, 'user' => $user]);
|
||||
return view('user.pm.index', [
|
||||
'user' => $request->user(),
|
||||
'pms' => $request->user()
|
||||
->pm_receiver()
|
||||
->where('subject', 'like', '%'.$request->string('subject').'%')
|
||||
->latest()
|
||||
->paginate(20),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,12 +44,14 @@ class PrivateMessageController extends Controller
|
||||
*/
|
||||
public function searchPMOutbox(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
$pms = PrivateMessage::where('sender_id', '=', $user->id)->where([
|
||||
['subject', 'like', '%'.$request->input('subject').'%'],
|
||||
])->latest()->paginate(20);
|
||||
|
||||
return view('user.pm.outbox', ['pms' => $pms, 'user' => $user]);
|
||||
return view('user.pm.outbox', [
|
||||
'user' => $request->user(),
|
||||
'pms' => $request->user()
|
||||
->pm_sender()
|
||||
->where('subject', 'like', '%'.$request->string('subject').'%')
|
||||
->latest()
|
||||
->paginate(20),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,10 +59,10 @@ class PrivateMessageController extends Controller
|
||||
*/
|
||||
public function getPrivateMessages(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
$pms = PrivateMessage::where('receiver_id', '=', $user->id)->latest()->paginate(25);
|
||||
|
||||
return view('user.pm.index', ['pms' => $pms, 'user' => $user]);
|
||||
return view('user.pm.index', [
|
||||
'user' => $request->user(),
|
||||
'pms' => $request->user()->pm_receiver()->latest()->paginate(25),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,10 +70,10 @@ class PrivateMessageController extends Controller
|
||||
*/
|
||||
public function getPrivateMessagesSent(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
$pms = PrivateMessage::where('sender_id', '=', $user->id)->latest()->paginate(20);
|
||||
|
||||
return view('user.pm.outbox', ['pms' => $pms, 'user' => $user]);
|
||||
return view('user.pm.outbox', [
|
||||
'user' => $request->user(),
|
||||
'pms' => $request->user()->pm_sender()->latest()->paginate(25),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +90,10 @@ class PrivateMessageController extends Controller
|
||||
$pm->save();
|
||||
}
|
||||
|
||||
return view('user.pm.show', ['pm' => $pm, 'user' => $user]);
|
||||
return view('user.pm.show', [
|
||||
'pm' => $pm,
|
||||
'user' => $user
|
||||
]);
|
||||
}
|
||||
|
||||
return to_route('inbox')
|
||||
@@ -98,9 +105,11 @@ class PrivateMessageController extends Controller
|
||||
*/
|
||||
public function makePrivateMessage(Request $request, string $receiverId = '', string $username = ''): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
return view('user.pm.create', ['user' => $user, 'receiver_id' => $receiverId, 'username' => $username]);
|
||||
return view('user.pm.create', [
|
||||
'user' => $request->user(),
|
||||
'receiver_id' => $receiverId,
|
||||
'username' => $username
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,7 +126,7 @@ class PrivateMessageController extends Controller
|
||||
}
|
||||
|
||||
if ($request->has('receiver_id')) {
|
||||
$recipient = User::where('username', '=', $request->input('receiver_id'))->firstOrFail();
|
||||
$recipient = User::where('username', '=', $request->input('receiver_id'))->sole();
|
||||
} else {
|
||||
return to_route('create', ['username' => $request->user()->username, 'id' => $request->user()->id])
|
||||
->withErrors("The recipient doesn't exist");
|
||||
@@ -165,7 +174,7 @@ class PrivateMessageController extends Controller
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
$message = PrivateMessage::where('id', '=', $id)->firstOrFail();
|
||||
$message = PrivateMessage::findOrFail($id);
|
||||
|
||||
$privateMessage = new PrivateMessage();
|
||||
$privateMessage->sender_id = $user->id;
|
||||
@@ -203,7 +212,7 @@ class PrivateMessageController extends Controller
|
||||
public function deletePrivateMessage(Request $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = $request->user();
|
||||
$pm = PrivateMessage::where('id', '=', $id)->firstOrFail();
|
||||
$pm = PrivateMessage::findOrFail($id);
|
||||
|
||||
$dest = 'default';
|
||||
if ($request->has('dest') && $request->input('dest') == 'outbox') {
|
||||
|
||||
@@ -30,13 +30,14 @@ class SeedboxController extends Controller
|
||||
*/
|
||||
public function index(Request $request, string $username): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
$user = User::where('username', '=', $username)->sole();
|
||||
|
||||
abort_unless(($request->user()->group->is_modo || $request->user()->id == $user->id), 403);
|
||||
|
||||
$seedboxes = Seedbox::where('user_id', '=', $user->id)->paginate(25);
|
||||
|
||||
return view('user.seedbox.index', ['user' => $user, 'seedboxes' => $seedboxes]);
|
||||
return view('user.seedbox.index', [
|
||||
'user' => $user,
|
||||
'seedboxes' => Seedbox::where('user_id', '=', $user->id)->paginate(25),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,34 +37,27 @@ class TipController extends Controller
|
||||
|
||||
abort_unless($request->user()->id === $user->id || $request->user()->group->is_modo, 403);
|
||||
|
||||
$userbon = $user->getSeedbonus();
|
||||
$bontransactions = BonTransactions::query()
|
||||
->with(['senderObj', 'receiverObj'])
|
||||
->where(
|
||||
fn ($query) => $query
|
||||
->where('sender', '=', $user->id)
|
||||
->orwhere('receiver', '=', $user->id)
|
||||
)
|
||||
->where('name', '=', 'tip')
|
||||
->latest('date_actioned')
|
||||
->paginate(25);
|
||||
|
||||
$tipsSent = BonTransactions::query()
|
||||
->where('sender', '=', $user->id)
|
||||
->where('name', '=', 'tip')
|
||||
->sum('cost');
|
||||
|
||||
$tipsReceived = BonTransactions::query()
|
||||
->where('receiver', '=', $user->id)
|
||||
->where('name', '=', 'tip')
|
||||
->sum('cost');
|
||||
|
||||
return view('user.tip.index', [
|
||||
'user' => $user,
|
||||
'bontransactions' => $bontransactions,
|
||||
'userbon' => $userbon,
|
||||
'tips_sent' => $tipsSent,
|
||||
'tips_received' => $tipsReceived,
|
||||
'bontransactions' => BonTransactions::query()
|
||||
->with(['senderObj', 'receiverObj'])
|
||||
->where(
|
||||
fn ($query) => $query
|
||||
->where('sender', '=', $user->id)
|
||||
->orwhere('receiver', '=', $user->id)
|
||||
)
|
||||
->where('name', '=', 'tip')
|
||||
->latest('date_actioned')
|
||||
->paginate(25),
|
||||
'userbon' => $user->getSeedbonus(),
|
||||
'tips_sent' => BonTransactions::query()
|
||||
->where('sender', '=', $user->id)
|
||||
->where('name', '=', 'tip')
|
||||
->sum('cost'),
|
||||
'tips_received' => BonTransactions::query()
|
||||
->where('receiver', '=', $user->id)
|
||||
->where('name', '=', 'tip')
|
||||
->sum('cost'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,12 @@ class TopicController extends Controller
|
||||
*/
|
||||
public function index(User $user): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$topics = $user->topics()
|
||||
->whereRelation('forumPermissions', [['show_forum', '=', 1], ['group_id', '=', auth()->user()->group_id]])
|
||||
->latest()
|
||||
->paginate(25);
|
||||
|
||||
return view('user.topic.index', [
|
||||
'topics' => $topics,
|
||||
'user' => $user,
|
||||
'topics' => $user->topics()
|
||||
->whereRelation('forumPermissions', [['show_forum', '=', 1], ['group_id', '=', auth()->user()->group_id]])
|
||||
->latest()
|
||||
->paginate(25),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,18 +27,16 @@ class TorrentController extends Controller
|
||||
{
|
||||
abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403);
|
||||
|
||||
$history = DB::table('history')
|
||||
->where('user_id', '=', $user->id)
|
||||
->where('created_at', '>', $user->created_at)
|
||||
->selectRaw('sum(actual_uploaded) as upload')
|
||||
->selectRaw('sum(uploaded) as credited_upload')
|
||||
->selectRaw('sum(actual_downloaded) as download')
|
||||
->selectRaw('sum(downloaded) as credited_download')
|
||||
->first();
|
||||
|
||||
return view('user.torrent.index', [
|
||||
'user' => $user,
|
||||
'history' => $history,
|
||||
'history' => DB::table('history')
|
||||
->where('user_id', '=', $user->id)
|
||||
->where('created_at', '>', $user->created_at)
|
||||
->selectRaw('sum(actual_uploaded) as upload')
|
||||
->selectRaw('sum(uploaded) as credited_upload')
|
||||
->selectRaw('sum(actual_downloaded) as download')
|
||||
->selectRaw('sum(downloaded) as credited_download')
|
||||
->first(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,15 +46,11 @@ class TransactionController extends Controller
|
||||
|
||||
abort_unless($request->user()->id === $user->id, 403);
|
||||
|
||||
$userbon = $user->getSeedbonus();
|
||||
$activefl = $user->personalFreeleeches()->exists();
|
||||
$items = BonExchange::all();
|
||||
|
||||
return view('user.transaction.create', [
|
||||
'user' => $user,
|
||||
'userbon' => $userbon,
|
||||
'activefl' => $activefl,
|
||||
'items' => $items,
|
||||
'userbon' => $user->getSeedbonus(),
|
||||
'activefl' => $user->personalFreeleeches()->exists(),
|
||||
'items' => BonExchange::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -109,7 +105,7 @@ class TransactionController extends Controller
|
||||
|
||||
$user->decrement('seedbonus', $item->cost);
|
||||
|
||||
return to_route('transactions.create', ['username' => $user->username])
|
||||
return to_route('transactions.create', ['username' => $username])
|
||||
->withSuccess(trans('bon.success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,69 +50,49 @@ class UserController extends Controller
|
||||
->when(auth()->user()->group->is_modo == true, fn ($query) => $query->withTrashed())
|
||||
->sole();
|
||||
|
||||
$followers = $user->followers()->latest()->limit(25)->get();
|
||||
|
||||
$warnings = $user
|
||||
->userwarning()
|
||||
->latest()
|
||||
->paginate(2, ['*'], 'warningsPage');
|
||||
|
||||
$softDeletedWarnings = $user
|
||||
->userwarning()
|
||||
->with(['torrenttitle', 'warneduser'])
|
||||
->latest('created_at')
|
||||
->onlyTrashed()
|
||||
->paginate(2, ['*'], 'deletedWarningsPage');
|
||||
|
||||
$watch = $user->watchlist;
|
||||
|
||||
$boughtUpload = BonTransactions::where('sender', '=', $user->id)->where([['name', 'like', '%Upload%']])->sum('cost');
|
||||
//$boughtDownload = BonTransactions::where('sender', '=', $user->id)->where([['name', 'like', '%Download%']])->sum('cost');
|
||||
|
||||
$history = DB::table('history')
|
||||
->where('user_id', '=', $user->id)
|
||||
->where('created_at', '>', $user->created_at)
|
||||
->selectRaw('SUM(actual_uploaded) as upload_sum')
|
||||
->selectRaw('SUM(uploaded) as credited_upload_sum')
|
||||
->selectRaw('SUM(actual_downloaded) as download_sum')
|
||||
->selectRaw('SUM(downloaded) as credited_download_sum')
|
||||
->selectRaw('SUM(seedtime) as seedtime_sum')
|
||||
->selectRaw('SUM(actual_downloaded > 0) as download_count')
|
||||
->selectRaw('COUNT(*) as count')
|
||||
->first();
|
||||
|
||||
$peers = Peer::query()
|
||||
->selectRaw('SUM(seeder = 0) as leeching')
|
||||
->selectRaw('SUM(seeder = 1) as seeding')
|
||||
->where('user_id', '=', $user->id)
|
||||
->first();
|
||||
|
||||
$invitedBy = Invite::where('accepted_by', '=', $user->id)->first();
|
||||
|
||||
$clients = $user->peers()
|
||||
->select('agent', 'port')
|
||||
->selectRaw('INET6_NTOA(ip) as ip, MIN(created_at) as created_at, MAX(updated_at) as updated_at, COUNT(*) as num_peers')
|
||||
->groupBy(['ip', 'port', 'agent'])
|
||||
->get();
|
||||
|
||||
$achievements = AchievementProgress::with('details')
|
||||
->where('achiever_id', '=', $user->id)
|
||||
->whereNotNull('unlocked_at')
|
||||
->get();
|
||||
|
||||
return view('user.profile.show', [
|
||||
'user' => $user,
|
||||
'followers' => $followers,
|
||||
'history' => $history,
|
||||
'warnings' => $warnings,
|
||||
'softDeletedWarnings' => $softDeletedWarnings,
|
||||
'boughtUpload' => $boughtUpload,
|
||||
// 'boughtDownload' => $boughtDownload,
|
||||
'invitedBy' => $invitedBy,
|
||||
'clients' => $clients,
|
||||
'achievements' => $achievements,
|
||||
'peers' => $peers,
|
||||
'watch' => $watch,
|
||||
'user' => $user,
|
||||
'followers' => $user->followers()->latest()->limit(25)->get(),
|
||||
'history' => DB::table('history')
|
||||
->where('user_id', '=', $user->id)
|
||||
->where('created_at', '>', $user->created_at)
|
||||
->selectRaw('SUM(actual_uploaded) as upload_sum')
|
||||
->selectRaw('SUM(uploaded) as credited_upload_sum')
|
||||
->selectRaw('SUM(actual_downloaded) as download_sum')
|
||||
->selectRaw('SUM(downloaded) as credited_download_sum')
|
||||
->selectRaw('SUM(refunded_download) as refunded_download_sum')
|
||||
->selectRaw('SUM(seedtime) as seedtime_sum')
|
||||
->selectRaw('SUM(actual_downloaded > 0) as download_count')
|
||||
->selectRaw('COUNT(*) as count')
|
||||
->first(),
|
||||
'warnings' => $user
|
||||
->userwarning()
|
||||
->latest()
|
||||
->paginate(10, ['*'], 'warningsPage'),
|
||||
'softDeletedWarnings' => $user
|
||||
->userwarning()
|
||||
->with(['torrenttitle', 'warneduser'])
|
||||
->latest('created_at')
|
||||
->onlyTrashed()
|
||||
->paginate(10, ['*'], 'deletedWarningsPage'),
|
||||
'boughtUpload' => BonTransactions::where('sender', '=', $user->id)->where([['name', 'like', '%Upload%']])->sum('cost'),
|
||||
// 'boughtDownload' => BonTransactions::where('sender', '=', $user->id)->where([['name', 'like', '%Download%']])->sum('cost'),
|
||||
'invitedBy' => Invite::where('accepted_by', '=', $user->id)->first(),
|
||||
'clients' => $user->peers()
|
||||
->select('agent', 'port')
|
||||
->selectRaw('INET6_NTOA(ip) as ip, MIN(created_at) as created_at, MAX(updated_at) as updated_at, COUNT(*) as num_peers')
|
||||
->groupBy(['ip', 'port', 'agent'])
|
||||
->get(),
|
||||
'achievements' => AchievementProgress::with('details')
|
||||
->where('achiever_id', '=', $user->id)
|
||||
->whereNotNull('unlocked_at')
|
||||
->get(),
|
||||
'peers' => Peer::query()
|
||||
->selectRaw('SUM(seeder = 0) as leeching')
|
||||
->selectRaw('SUM(seeder = 1) as seeding')
|
||||
->where('user_id', '=', $user->id)
|
||||
->first(),
|
||||
'watch' => $user->watchlist,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -121,11 +101,13 @@ class UserController extends Controller
|
||||
*/
|
||||
public function editProfileForm(Request $request, string $username): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
$user = User::where('username', '=', $username)->sole();
|
||||
|
||||
abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
return view('user.profile.edit', ['user' => $user, 'route' => 'edit']);
|
||||
return view('user.profile.edit', [
|
||||
'user' => $user,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +115,7 @@ class UserController extends Controller
|
||||
*/
|
||||
public function editProfile(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
$user = User::where('username', '=', $username)->sole();
|
||||
|
||||
abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
@@ -180,7 +162,7 @@ class UserController extends Controller
|
||||
$user->signature = $request->input('signature');
|
||||
$user->save();
|
||||
|
||||
return to_route('user_edit_profile_form', ['username' => $user->username])
|
||||
return to_route('user_edit_profile_form', ['username' => $username])
|
||||
->withSuccess('Your Account Was Updated Successfully!');
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class WarningController extends Controller
|
||||
{
|
||||
abort_unless($request->user()->group->is_modo, 403);
|
||||
$staff = $request->user();
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
$user = User::where('username', '=', $username)->sole();
|
||||
|
||||
foreach (Warning::where('user_id', '=', $user->id)->get() as $warning) {
|
||||
$warning->expires_on = Carbon::now();
|
||||
@@ -114,7 +114,7 @@ class WarningController extends Controller
|
||||
abort_unless($request->user()->group->is_modo, 403);
|
||||
|
||||
$staff = $request->user();
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
$user = User::where('username', '=', $username)->sole();
|
||||
|
||||
foreach (Warning::where('user_id', '=', $user->id)->get() as $warning) {
|
||||
$warning->deleted_by = $staff->id;
|
||||
|
||||
@@ -37,15 +37,13 @@ class WishController extends Controller
|
||||
*/
|
||||
public function index(Request $request, string $username): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = User::with('wishes')->where('username', '=', $username)->firstOrFail();
|
||||
$user = User::with('wishes')->where('username', '=', $username)->sole();
|
||||
|
||||
abort_unless(($request->user()->group->is_modo || $request->user()->id == $user->id), 403);
|
||||
|
||||
$wishes = $user->wishes()->latest()->paginate(25);
|
||||
|
||||
return view('user.wish.index', [
|
||||
'user' => $user,
|
||||
'wishes' => $wishes,
|
||||
'wishes' => $user->wishes()->latest()->paginate(25),
|
||||
'route' => 'wish',
|
||||
]);
|
||||
}
|
||||
@@ -96,11 +94,9 @@ class WishController extends Controller
|
||||
*/
|
||||
public function destroy(Request $request, int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
$this->wish->delete($id);
|
||||
|
||||
return to_route('wishes.index', ['username' => $user->username])
|
||||
return to_route('wishes.index', ['username' => $request->user()->username])
|
||||
->withSuccess('Wish Successfully Removed!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE.
|
||||
*
|
||||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D Community Edition
|
||||
*
|
||||
* @author HDVinnie <hdinnovations@protonmail.com>
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
||||
*/
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\Audit;
|
||||
use App\Models\User;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
class AuditLogSearch extends Component
|
||||
{
|
||||
use WithPagination;
|
||||
|
||||
public string $username = '';
|
||||
|
||||
public string $modelName = '';
|
||||
public string $modelId = '';
|
||||
|
||||
public string $action = '';
|
||||
|
||||
public string $record = '';
|
||||
|
||||
public int $perPage = 25;
|
||||
|
||||
public string $sortField = 'created_at';
|
||||
|
||||
public string $sortDirection = 'desc';
|
||||
|
||||
protected $queryString = [
|
||||
'username' => ['except' => ''],
|
||||
'modelName' => ['except' => ''],
|
||||
'modelId' => ['except' => ''],
|
||||
'action' => ['except' => ''],
|
||||
'record' => ['except' => ''],
|
||||
'page' => ['except' => 1],
|
||||
'perPage' => ['except' => ''],
|
||||
];
|
||||
|
||||
final public function updatedPage(): void
|
||||
{
|
||||
$this->emit('paginationChanged');
|
||||
}
|
||||
|
||||
final public function getModelNamesProperty()
|
||||
{
|
||||
$modelList = [];
|
||||
$path = app_path()."/Models";
|
||||
$results = scandir($path);
|
||||
|
||||
foreach ($results as $result) {
|
||||
if ($result === '.' || $result === '..') {
|
||||
continue;
|
||||
}
|
||||
$filename = $result;
|
||||
|
||||
$modelList[] = substr($filename, 0, -4);
|
||||
}
|
||||
|
||||
return $modelList;
|
||||
}
|
||||
|
||||
final public function getAuditsProperty(): \Illuminate\Contracts\Pagination\LengthAwarePaginator
|
||||
{
|
||||
$audits = Audit::with('user')
|
||||
->when($this->username, fn ($query) => $query->whereIn('user_id', User::select('id')->where('username', '=', $this->username)))
|
||||
->when($this->modelName, fn ($query) => $query->where('model_name', '=', $this->modelName))
|
||||
->when($this->modelId, fn ($query) => $query->where('model_entry_id', '=', $this->modelId))
|
||||
->when($this->action, fn ($query) => $query->where('action', '=', $this->action))
|
||||
->when($this->record, fn ($query) => $query->where('record', 'LIKE', '%'.$this->record.'%'))
|
||||
->latest()
|
||||
->paginate($this->perPage);
|
||||
|
||||
foreach ($audits as $audit) {
|
||||
$audit->values = json_decode($audit->record, true, 512, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
return $audits;
|
||||
}
|
||||
|
||||
final public function render(): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application
|
||||
{
|
||||
return view('livewire.audit-log-search', [
|
||||
'audits' => $this->audits,
|
||||
'modelNames' => $this->modelNames,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -23,11 +23,6 @@ class CollectionSearch extends Component
|
||||
|
||||
public $search;
|
||||
|
||||
final public function paginationView(): string
|
||||
{
|
||||
return 'vendor.pagination.livewire-pagination';
|
||||
}
|
||||
|
||||
final public function updatedPage(): void
|
||||
{
|
||||
$this->emit('paginationChanged');
|
||||
|
||||
@@ -133,22 +133,6 @@ class Comment extends Component
|
||||
$reply->anon = $this->anon;
|
||||
$reply->save();
|
||||
|
||||
// Achievements
|
||||
if ($reply->anon == 0) {
|
||||
$this->user->unlock(new UserMadeComment());
|
||||
$this->user->addProgress(new UserMadeTenComments(), 1);
|
||||
$this->user->addProgress(new UserMade50Comments(), 1);
|
||||
$this->user->addProgress(new UserMade100Comments(), 1);
|
||||
$this->user->addProgress(new UserMade200Comments(), 1);
|
||||
$this->user->addProgress(new UserMade300Comments(), 1);
|
||||
$this->user->addProgress(new UserMade400Comments(), 1);
|
||||
$this->user->addProgress(new UserMade500Comments(), 1);
|
||||
$this->user->addProgress(new UserMade600Comments(), 1);
|
||||
$this->user->addProgress(new UserMade700Comments(), 1);
|
||||
$this->user->addProgress(new UserMade800Comments(), 1);
|
||||
$this->user->addProgress(new UserMade900Comments(), 1);
|
||||
}
|
||||
|
||||
// Set Polymorphic Model Name
|
||||
$modelName = str()->snake(class_basename($this->comment->commentable_type), ' ');
|
||||
|
||||
@@ -220,6 +204,22 @@ class Comment extends Component
|
||||
}
|
||||
}
|
||||
|
||||
// Achievements
|
||||
if ($reply->anon == 0 && $modelName !== 'ticket') {
|
||||
$this->user->unlock(new UserMadeComment());
|
||||
$this->user->addProgress(new UserMadeTenComments(), 1);
|
||||
$this->user->addProgress(new UserMade50Comments(), 1);
|
||||
$this->user->addProgress(new UserMade100Comments(), 1);
|
||||
$this->user->addProgress(new UserMade200Comments(), 1);
|
||||
$this->user->addProgress(new UserMade300Comments(), 1);
|
||||
$this->user->addProgress(new UserMade400Comments(), 1);
|
||||
$this->user->addProgress(new UserMade500Comments(), 1);
|
||||
$this->user->addProgress(new UserMade600Comments(), 1);
|
||||
$this->user->addProgress(new UserMade700Comments(), 1);
|
||||
$this->user->addProgress(new UserMade800Comments(), 1);
|
||||
$this->user->addProgress(new UserMade900Comments(), 1);
|
||||
}
|
||||
|
||||
$this->replyState = [
|
||||
'content' => '',
|
||||
];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user