Skip to content

Commit b611c49

Browse files
authored
Merge branch '8.x.x' into internal-perks-based-on-membership
2 parents f3bb4f1 + 16bcd62 commit b611c49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1834
-3057
lines changed

CHANGELOG.md

-2,060
This file was deleted.

FUNDING.yml

-5
This file was deleted.

README.md

+25-36
Original file line numberDiff line numberDiff line change
@@ -8,78 +8,67 @@
88
<a href="https://github.com/HDInnovations/UNIT3D-Community-Edition/actions/workflows/compile-assets-test.yml/badge.svg?branch=master"><img src="https://github.com/HDInnovations/UNIT3D-Community-Edition/actions/workflows/compile-assets-test.yml/badge.svg?branch=master" /></a>
99
<a href="https://github.com/HDInnovations/UNIT3D-Community-Edition/actions/workflows/larastan.yml/badge.svg?branch=master"><img src="https://github.com/HDInnovations/UNIT3D-Community-Edition/actions/workflows/larastan.yml/badge.svg?branch=master" /></a>
1010
<a href="https://github.com/HDInnovations/UNIT3D-Community-Edition/actions/workflows/prettier-blade.yml/badge.svg?branch=master"><img src="https://github.com/HDInnovations/UNIT3D-Community-Edition/actions/workflows/prettier-blade.yml/badge.svg?branch=master" /></a>
11-
<a href="https://polar.sh/HDInnovations"><img src="https://polar.sh/embed/seeks-funding-shield.svg?org=HDInnovations" /></a>
1211
</p>
1312

1413
<p align="center">
15-
🎉 <b>A Big Thanks To All Our <a href="https://github.com/HDInnovations/UNIT3D-Community-Edition/graphs/contributors">Contributors</a> and <a href="https://polar.sh/HDInnovations">Subscribers</a></b> 🎉
14+
🎉 <b>A Big Thanks To All Our <a href="https://github.com/HDInnovations/UNIT3D-Community-Edition/graphs/contributors">Contributors</a> and <a href="https://square.link/u/VjB1CNfm">Donors</a></b> 🎉
1615
</p>
1716

1817
## 📝 Table of Contents
1918

2019
1. [Introduction](#introduction)
2120
2. [Installation](#installation)
2221
3. [Updating](#updating)
23-
4. [Support UNIT3D](#support)
24-
5. [Funding Issues/Requests](#funding)
25-
6. [Special Thanks](#thanks)
22+
4. [Contributing](#contributing)
23+
5. [License](#license)
24+
6. [Services](#services)
25+
7. [Donations](#donations)
26+
8. [Discord Support](#discord)
27+
9. [Special Thanks](#thanks)
2628

2729

2830
## <a name="introduction"></a> 🧐 Introduction
2931

30-
We have been developing a Private Torrent Tracker Software called `UNIT3D`. This is a PHP software based on Laravel 11, Livewire and AlpineJS. It is MySQL Strict Mode Compliant, and PHP 8.3 Ready. The code is well-designed and follows the PSR-2 coding style. It uses an MVC Architecture to ensure clarity between logic and presentation. As a hashing algorithm of Bcrypt or Argon2 is used, to ensure a safe and proper way to store the passwords for the users. A lightweight Blade Templating Engine. Caching System Supporting: "apc,” "array,” "database,” "file," "memcached," and "redis" methods. Eloquent and much more!
32+
We have been developing a Private Torrent Tracker Software called `UNIT3D`. This is a PHP software based on Laravel 11, Livewire and AlpineJS. It is MySQL Strict Mode Compliant, and PHP 8.3 Ready. It uses an MVC Architecture to ensure clarity between logic and presentation.
3133

3234
## <a name="installation"></a> 🖥️ Installation
3335

3436
Check it out here for more information: https://github.com/HDInnovations/UNIT3D-Installer
3537

36-
### Demo Data
37-
38-
Use this command to generate demo users and torrents for testing purposes in a dev environment:
38+
## <a name="updating"></a> 🖥️ Updating
3939

40-
`php artisan demo:seed`
40+
To update your installation to the latest version, run the following command. This will pull the latest changes from the repository and update your instance:
4141

42-
## <a name="updating"></a> 🖥️ Updating
4342
`php artisan git:update`
4443

44+
## <a name="contributing"></a> 🤝 Contributing
4545

46-
## <a name="support"></a> ✨ Support UNIT3D
46+
Please read [CONTRIBUTING.md](https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
4747

48-
You can support our work if you are enjoying UNIT3D. Sponsors will recieve an email with a Discord invite link to UNIT3Ds Discord server which is used for support and more.
48+
## <a name="license"></a> 📜 License
4949

50-
<a href="https://polar.sh/HDInnovations"><picture><source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/embed/subscribe.svg?org=HDInnovations&label=Subscribe&darkmode"><img alt="Subscribe on Polar" src="https://polar.sh/embed/subscribe.svg?org=HDInnovations&label=Subscribe"></picture></a>
50+
This project is licensed under the AGPL v3.0 License - see the [LICENSE](https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/master/LICENSE.md) file for details.
5151

52-
Some folks have asked me if it's possible to do a donation via Crypto. Yes!
53-
```
54-
Monero (XMR) - 85WrXRzmbF9fTp9UHLHhhEVeF5VBCHSen9suSvK4FkKqcyhXeikS1zM4u5gfa5gyQV9dS8yuoDwMGBJ1rQ8w1CWkJXN9kSo
52+
## <a name="services"></a> 🛠️ Services
5553

56-
Bitcoin (BTC) - 3HUVkv3Q8b5nbxa9DtXG1dm4RdTJaTFRfc
54+
HDInnovations offers a variety of services to help you with your UNIT3D instance. We offer services such as installation, updating, server tuning, dependency tuning, themes and custom plugin development. For more information, please visit our email us at [hdinnovations@protonmail.com](mailto:hdinnovations@protonmail.com?subject=[Services]%20UNIT3D%20)
5755

58-
Bitcoin Cash (BCH) - qp3wgpnwzpj4v9sq90wflsca8p5s75glrvga9tweu2
56+
## <a name="donations"></a> 💰 Donations
5957

60-
Ether (ETH) - 0x5eFF42F65234aD9c6A0CA5B9495f3c6D205bBC27
58+
If you would like to support the development of UNIT3D, please consider donating to keep the project alive. For more information, please email us at [hdinnovations@protonmail.com](mailto:hdinnovations@protonmail.com?subject=[Funding]%20UNIT3D%20)
6159

62-
ETC - 0xd644C7C7009eC3824f3305ff6C7E2Ee90497d56e
60+
<a href="https://square.link/u/VjB1CNfm" target="_blank"><img alt="unit3d-donate.png" src="public/img/unit3d-donate.png" width="200px"/></a>&nbsp;&nbsp;&nbsp;
61+
<img alt="unit3d-qr-code.png" src="public/img/unit3d-qr-code.png" width="169px"/>
6362

64-
Litecoin (LTC) - MDLKyHzupt1mchuo8mrjW9mihkKp1LD4nG
63+
## <a name="discord"></a> 📞 Discord Community
6564

66-
USDC - 0xB32102d9104d2bfd0D4E3E4069618ADD985a4e2E
65+
We have a Discord server for support and general discussion. This is a private server, and you will need to be invited to join. There is a small fee to join the server to help support the development of UNIT3D. For more information, please email us at [hdinnovations@protonmail.com](mailto:hdinnovations@protonmail.com?subject=[Discord]%20UNIT3D%20)
6766

68-
USDT (ERC-20) - 0x24c79c41EEAd9d81203ee567fE4bA3a6c81374DB
67+
## <a name="thanks"></a> 🎉 Shoutouts
6968

70-
DOGE - DJ78fQspiu879y3adLbTZVSFABKhKqHE7B
71-
```
69+
<a href="https://scoutapm.com/?utm_source=github&utm_medium=referral&utm_campaign=opensource_referral"><img src="https://i.postimg.cc/g29XCJDh/Logo-rounded-square-495x495-1.png" height="50px;"></a>
70+
<a href="https://www.jetbrains.com/?from=UNIT3D"><img src="https://i.imgur.com/KgDXZV8.png" height="50px;"></a>
7271

73-
## <a name="funding"></a> ✨ Funding issues and feature requests
7472

75-
<a href="https://polar.sh/HDInnovations"><img src="https://polar.sh/embed/fund-our-backlog.svg?org=HDInnovations" /></a>
7673

77-
## <a name="thanks"></a> 🎉 Special Thanks
7874

79-
<a href="https://scoutapm.com/?utm_source=github&utm_medium=referral&utm_campaign=opensource_referral"><img src="https://i.postimg.cc/g29XCJDh/Logo-rounded-square-495x495-1.png" height="50px;"></a>
80-
<a href="https://www.jetbrains.com/?from=UNIT3D"><img src="https://i.imgur.com/KgDXZV8.png" height="50px;"></a>
81-
<a href="https://www.themoviedb.org/"><img src="https://www.themoviedb.org/assets/2/v4/logos/v2/blue_square_2-d537fb228cf3ded904ef09b136fe3fec72548ebc1fea3fbbd1ad9e36364db38b.svg" height="50px;"></a>
82-
<a href="https://github.com"><img src="https://i.imgur.com/NVWhzrU.png" height="50px;"></a>
83-
<a href="https://laravel.com"><img src="https://i.postimg.cc/cCDBswfK/1200px-Laravel-svg.png" height="50px;"></a>
84-
<a href="https://laravel-livewire.com"><img src="https://i.postimg.cc/jjsNyBbh/Livewire.png" height="50px;"></a>
85-
<a href="https://alpinejs.dev"><img src="https://i.postimg.cc/28pWk0M1/alpinejs-logo.png" height="50px;"></a>

app/Console/Commands/AutoSyncPeopleToMeilisearch.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function handle(): void
4747
$start = now();
4848

4949
$client = new Client(config('scout.meilisearch.host'), config('scout.meilisearch.key'));
50-
$index = $client->index('people');
50+
$index = $client->index(config('scout.prefix').'people');
5151

5252
$people = Person::all(['id', 'name', 'birthday', 'still']);
5353

app/Console/Commands/AutoSyncTorrentsToMeilisearch.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function handle(): void
4848

4949
$client = new Client(config('scout.meilisearch.host'), config('scout.meilisearch.key'));
5050

51-
$index = $client->getIndex('torrents');
51+
$index = $client->getIndex(config('scout.prefix').'torrents');
5252

5353
$index->updatePagination([
5454
'maxTotalHits' => max(1, Torrent::query()->count()) + 1000,

app/Enums/Occupation.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* NOTICE OF LICENSE.
45
*

app/Enums/UserGroup.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* NOTICE OF LICENSE.
45
*

app/Http/Controllers/API/QuickSearchController.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function index(Request $request): \Illuminate\Http\JsonResponse
5959
// Prepare the search queries
6060
$searchQueries = [
6161
(new SearchQuery())
62-
->setIndexUid('torrents')
62+
->setIndexUid(config('scout.prefix').'torrents')
6363
->setQuery($searchById ? '' : $query)
6464
->setFilter($filters)
6565
->setDistinct('imdb')
@@ -68,7 +68,7 @@ public function index(Request $request): \Illuminate\Http\JsonResponse
6868
// Add the people search query only if it's not an ID search
6969
if (!$searchById) {
7070
$searchQueries[] = (new SearchQuery())
71-
->setIndexUid('people')
71+
->setIndexUid(config('scout.prefix').'people')
7272
->setQuery($query);
7373
//->setFederationOptions((new FederationOptions())->setWeight(0.9));
7474
}
@@ -80,7 +80,7 @@ public function index(Request $request): \Illuminate\Http\JsonResponse
8080

8181
// Process the hits from the multiSearchResults
8282
foreach ($multiSearchResults['hits'] as $hit) {
83-
if ($hit['_federation']['indexUid'] === 'torrents') {
83+
if ($hit['_federation']['indexUid'] === config('scout.prefix').'torrents') {
8484
$type = $hit['category']['movie_meta'] === true ? 'movie' : 'tv';
8585

8686
$results[] = [
@@ -91,7 +91,7 @@ public function index(Request $request): \Illuminate\Http\JsonResponse
9191
'url' => route('torrents.similar', ['category_id' => $hit['category']['id'], 'tmdb' => $hit['tmdb']]),
9292
'type' => $type === 'movie' ? 'Movie' : 'TV Series',
9393
];
94-
} elseif ($hit['_federation']['indexUid'] === 'people') {
94+
} elseif ($hit['_federation']['indexUid'] === config('scout.prefix').'people') {
9595
$results[] = [
9696
'id' => $hit['id'],
9797
'name' => $hit['name'],

app/Http/Controllers/AnnounceController.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* NOTICE OF LICENSE.
45
*

app/Http/Controllers/HomeController.php

+12
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
namespace App\Http\Controllers;
1818

1919
use App\Models\Article;
20+
use App\Models\Comment;
2021
use App\Models\FeaturedTorrent;
2122
use App\Models\Group;
2223
use App\Models\Poll;
@@ -104,6 +105,17 @@ public function index(Request $request): \Illuminate\Contracts\View\Factory|\Ill
104105
->take(5)
105106
->get(),
106107
),
108+
'comments' => cache()->remember(
109+
'latest_comments',
110+
$expiresAt,
111+
fn () => Comment::query()
112+
->with('user', 'user.group', 'commentable')
113+
->whereHasMorph('commentable', [\App\Models\Torrent::class])
114+
->orWhereHasMorph('commentable', [\App\Models\TorrentRequest::class])
115+
->latest()
116+
->take(5)
117+
->get(),
118+
),
107119
'featured' => cache()->remember(
108120
'latest_featured',
109121
$expiresAt,

app/Http/Controllers/Staff/GroupController.php

+22-16
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
use App\Http\Controllers\Controller;
2020
use App\Http\Requests\Staff\StoreGroupRequest;
2121
use App\Http\Requests\Staff\UpdateGroupRequest;
22-
use App\Models\Forum;
22+
use App\Models\ForumCategory;
2323
use App\Models\Group;
24-
use App\Models\ForumPermission;
2524
use App\Services\Unit3dAnnounce;
2625
use Illuminate\Support\Str;
2726

@@ -45,25 +44,24 @@ public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\Vie
4544
*/
4645
public function create(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
4746
{
48-
return view('Staff.group.create');
47+
return view('Staff.group.create', [
48+
'forumCategories' => ForumCategory::query()
49+
->with([
50+
'forums' => fn ($query) => $query->orderBy('position')
51+
])
52+
->orderBy('position')
53+
->get(),
54+
]);
4955
}
5056

5157
/**
5258
* Store A New Group.
5359
*/
5460
public function store(StoreGroupRequest $request): \Illuminate\Http\RedirectResponse
5561
{
56-
$group = Group::create(['slug' => Str::slug($request->name)] + $request->validated());
57-
58-
foreach (Forum::pluck('id') as $collection) {
59-
ForumPermission::create([
60-
'forum_id' => $collection,
61-
'group_id' => $group->id,
62-
'read_topic' => false,
63-
'reply_topic' => false,
64-
'start_topic' => false,
65-
]);
66-
}
62+
$group = Group::create(['slug' => Str::slug($request->validated('group.name'))] + $request->validated('group'));
63+
64+
$group->permissions()->upsert($request->validated('permissions'), ['forum_id', 'group_id']);
6765

6866
Unit3dAnnounce::addGroup($group);
6967

@@ -77,7 +75,13 @@ public function store(StoreGroupRequest $request): \Illuminate\Http\RedirectResp
7775
public function edit(Group $group): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
7876
{
7977
return view('Staff.group.edit', [
80-
'group' => $group,
78+
'group' => $group,
79+
'forumCategories' => ForumCategory::query()
80+
->with([
81+
'forums' => fn ($query) => $query->orderBy('position')
82+
])
83+
->orderBy('position')
84+
->get(),
8185
]);
8286
}
8387

@@ -86,7 +90,9 @@ public function edit(Group $group): \Illuminate\Contracts\View\Factory|\Illumina
8690
*/
8791
public function update(UpdateGroupRequest $request, Group $group): \Illuminate\Http\RedirectResponse
8892
{
89-
$group->update(['slug' => Str::slug($request->name)] + $request->validated());
93+
$group->update(['slug' => Str::slug($request->validated('group.name'))] + $request->validated('group'));
94+
95+
$group->permissions()->upsert($request->validated('permissions'), ['forum_id', 'group_id']);
9096

9197
cache()->forget('group:'.$group->id);
9298

app/Http/Controllers/User/TorrentZipController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function show(Request $request, User $user): \Illuminate\Http\RedirectRes
3535
set_time_limit(1200);
3636

3737
// Extend The Maximum Memory Limit
38-
ini_set('memory_limit', '1024M');
38+
ini_set('memory_limit', '2048M');
3939

4040
// Authorized User
4141
abort_unless($request->user()->is($user), 403);

app/Http/Livewire/LaravelLogViewer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ final public function logFiles()
6464
}
6565

6666
/**
67-
* @return \Illuminate\Pagination\LengthAwarePaginator<\Illuminate\Support\Collection<string|int, mixed>>
67+
* @return LengthAwarePaginator<\Illuminate\Support\Collection<string|int, mixed>>
6868
*/
6969
#[Computed]
7070
final public function entries(): LengthAwarePaginator

app/Http/Livewire/PersonCredit.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ function ($tv) {
285285
}
286286

287287
/**
288-
* @param \Illuminate\Support\Collection<int, \App\Models\Torrent> $torrents
289-
* @return \Illuminate\Support\Collection<string, \Illuminate\Support\Collection<int, \App\Models\Torrent>>
288+
* @param \Illuminate\Support\Collection<int, Torrent> $torrents
289+
* @return \Illuminate\Support\Collection<string, \Illuminate\Support\Collection<int, Torrent>>
290290
*/
291291
private function groupByTypeAndSort($torrents): \Illuminate\Support\Collection
292292
{

app/Http/Livewire/SimilarTorrent.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ final public function torrents(): \Illuminate\Support\Collection
355355
}
356356

357357
/**
358-
* @param \Illuminate\Support\Collection<int, \App\Models\Torrent> $torrents
359-
* @return \Illuminate\Support\Collection<string, \Illuminate\Support\Collection<int, \App\Models\Torrent>>
358+
* @param \Illuminate\Support\Collection<int, Torrent> $torrents
359+
* @return \Illuminate\Support\Collection<string, \Illuminate\Support\Collection<int, Torrent>>
360360
*/
361361
private function groupByTypeAndSort(\Illuminate\Support\Collection $torrents): \Illuminate\Support\Collection
362362
{
@@ -423,9 +423,9 @@ final public function deleteRecords(): void
423423
$names = [];
424424
$users = [];
425425
$title = match (true) {
426-
$this->category->movie_meta => ($movie = Movie::find($this->tmdbId))->title.' ('.$movie->release_date.')',
427-
$this->category->tv_meta => ($tv = Tv::find($this->tmdbId))->name.' ('.$tv->first_air_date.')',
428-
$this->category->game_meta => ($game = Game::find($this->igdbId))->name.' ('.$game->first_release_date.')',
426+
$this->category->movie_meta => ($movie = Movie::find($this->tmdbId))->title.' ('.$movie->release_date->format('Y').')',
427+
$this->category->tv_meta => ($tv = Tv::find($this->tmdbId))->name.' ('.$tv->first_air_date->format('Y').')',
428+
$this->category->game_meta => ($game = Game::find($this->igdbId))->name.' ('.$game->first_release_date->format('Y').')',
429429
default => $torrents->pluck('name')->join(', '),
430430
};
431431

0 commit comments

Comments
 (0)