From f3e5100d5dc032cd4efbd1521888d1f60d4a46d5 Mon Sep 17 00:00:00 2001 From: w33b Date: Sat, 18 Apr 2026 14:18:52 +0200 Subject: [PATCH] Pint --- app/Console/Commands/AutoStats.php | 5 +- app/Console/Commands/GenerateSitemap.php | 3 +- app/Console/Commands/GetFileSize.php | 5 +- app/Console/Commands/ResetUserDownloads.php | 3 +- app/Helpers/CacheHelper.php | 35 +++++----- app/Helpers/GitHelper.php | 2 +- .../Controllers/Admin/AlertController.php | 2 +- .../Controllers/Admin/ContactController.php | 2 +- .../Controllers/Admin/EpisodeController.php | 17 ++--- .../Controllers/Admin/ReleaseController.php | 13 ++-- .../Admin/SiteBackgroundController.php | 42 ++++++------ .../Controllers/Admin/SubtitleController.php | 8 +-- app/Http/Controllers/Admin/UserController.php | 9 ++- .../Controllers/Api/AdminApiController.php | 2 +- .../Controllers/Api/DownloadApiController.php | 16 ++--- .../Controllers/Api/HentaiApiController.php | 13 ++-- .../Controllers/Api/StreamApiController.php | 22 +++---- .../Controllers/Api/UserApiController.php | 10 ++- .../Auth/DiscordAuthController.php | 14 ++-- .../Controllers/Auth/PasswordController.php | 3 +- .../Auth/RegisteredUserController.php | 5 +- app/Http/Controllers/ContactController.php | 11 ++-- app/Http/Controllers/HomeController.php | 46 +++++++------ app/Http/Controllers/MatrixController.php | 4 +- .../Controllers/NotificationController.php | 5 +- app/Http/Controllers/PlaylistController.php | 40 ++++++------ app/Http/Controllers/ProfileController.php | 24 ++++--- app/Http/Controllers/StreamController.php | 45 ++++++------- app/Http/Middleware/IsAdmin.php | 19 +++--- app/Http/Middleware/IsBanned.php | 16 ++--- app/Http/Middleware/IsModerator.php | 7 +- app/Http/Middleware/SetLocale.php | 2 + app/Http/Requests/Auth/LoginRequest.php | 5 +- app/Http/Requests/MatrixRegisterRequest.php | 3 +- app/Http/Requests/ProfileUpdateRequest.php | 2 +- app/Jobs/DiscordReleaseNotification.php | 22 +++---- app/Jobs/GetFileSizeFromCDN.php | 13 ++-- app/Livewire/AdminCommentSearch.php | 3 +- app/Livewire/AdminUserSearch.php | 7 +- app/Livewire/BackgroundImages.php | 19 +++--- app/Livewire/Comment.php | 45 +++++++------ app/Livewire/Comments.php | 18 ++--- app/Livewire/DownloadButton.php | 4 +- app/Livewire/DownloadsFree.php | 12 ++-- app/Livewire/DownloadsSearch.php | 29 +++++---- app/Livewire/LikeButton.php | 4 +- app/Livewire/LiveSearch.php | 41 +++++++----- app/Livewire/NavLiveSearch.php | 8 +-- app/Livewire/PlaylistOverview.php | 8 +-- app/Livewire/Playlists.php | 7 +- app/Livewire/UserComments.php | 4 +- app/Livewire/UserLikes.php | 41 +++++++----- app/Livewire/Watched.php | 7 +- app/Models/Comment.php | 13 ++-- app/Models/Downloads.php | 2 +- app/Models/Episode.php | 65 +++++++++---------- app/Models/Hentai.php | 17 +++-- app/Models/Playlist.php | 2 +- app/Models/PlaylistEpisode.php | 2 +- app/Models/PopularDaily.php | 2 +- app/Models/PopularMonthly.php | 2 +- app/Models/PopularWeekly.php | 2 +- app/Models/Presenters/CommentPresenter.php | 2 +- app/Models/SiteBackground.php | 7 +- app/Models/Studios.php | 4 +- app/Models/User.php | 18 ++--- app/Models/UserDownload.php | 2 +- app/Models/Watched.php | 2 +- app/Notifications/CommentNotification.php | 10 +-- app/Policies/CommentPolicy.php | 4 +- app/Services/DownloadService.php | 16 ++--- app/Services/EpisodeService.php | 19 +++--- app/Services/GalleryService.php | 16 ++--- app/Services/MatrixRegistrationService.php | 12 ++-- config/app.php | 2 +- config/discord-alerts.php | 4 +- config/discord.php | 6 +- config/hstream.php | 36 +++++----- config/image.php | 2 +- config/scout.php | 16 ++--- config/services.php | 8 +-- config/sweetalert.php | 1 - config/tagging.php | 2 +- database/factories/EpisodeFactory.php | 27 ++++---- database/factories/HentaiFactory.php | 4 +- database/factories/StudiosFactory.php | 4 +- .../2014_10_12_000000_create_users_table.php | 2 +- ...023_08_10_190926_update_hstream_tables.php | 12 ++-- ...2023_10_03_230727_migrate_4k_downloads.php | 8 +-- .../2024_02_18_110521_optimization.php | 3 +- ...23805_add_description_to_episode_table.php | 2 +- ...24_07_29_134619_create_downloads_table.php | 14 ++-- .../2024_07_30_194424_fix_slugs.php | 5 +- ...317_add_title_search_to_epiosdes_table.php | 2 +- ..._143357_fix_playlist_episode_positions.php | 2 +- ...d_unique_constraint_to_downloads_table.php | 7 +- .../2025_09_22_113103_drop_torrents_table.php | 1 - ..._01_06_161620_fix_discord_oauth_system.php | 4 +- ...26_01_08_213625_fix_database_structure.php | 6 +- ...26_01_10_120521_migrate_comments_table.php | 2 +- ...01_11_151205_add_locale_to_users_table.php | 4 +- ...026_01_11_184725_migrate_to_user_roles.php | 6 +- ...17_222326_add_matrix_id_to_users_table.php | 4 +- database/seeders/DatabaseSeeder.php | 2 +- database/seeders/DeletedUserSeeder.php | 6 +- lang/de/home.php | 30 ++++----- lang/de/nav.php | 30 ++++----- lang/de/playlist.php | 10 +-- lang/de/search.php | 18 ++--- lang/de/stream.php | 16 ++--- lang/en/home.php | 30 ++++----- lang/en/nav.php | 30 ++++----- lang/en/playlist.php | 10 +-- lang/en/search.php | 18 ++--- lang/en/stream.php | 16 ++--- lang/fr/home.php | 30 ++++----- lang/fr/nav.php | 30 ++++----- lang/fr/playlist.php | 10 +-- lang/fr/search.php | 18 ++--- lang/fr/stream.php | 16 ++--- pint.json | 3 + routes/admin.php | 8 +-- routes/api.php | 6 +- routes/user.php | 8 +-- routes/web.php | 10 ++- tests/Feature/GalleryServiceTest.php | 16 ++--- 126 files changed, 743 insertions(+), 795 deletions(-) create mode 100644 pint.json diff --git a/app/Console/Commands/AutoStats.php b/app/Console/Commands/AutoStats.php index a166ab8..080a4ab 100644 --- a/app/Console/Commands/AutoStats.php +++ b/app/Console/Commands/AutoStats.php @@ -3,11 +3,10 @@ namespace App\Console\Commands; use App\Models\PopularDaily; -use App\Models\PopularWeekly; use App\Models\PopularMonthly; - -use Illuminate\Support\Carbon; +use App\Models\PopularWeekly; use Illuminate\Console\Command; +use Illuminate\Support\Carbon; class AutoStats extends Command { diff --git a/app/Console/Commands/GenerateSitemap.php b/app/Console/Commands/GenerateSitemap.php index 6090d55..b4e718a 100644 --- a/app/Console/Commands/GenerateSitemap.php +++ b/app/Console/Commands/GenerateSitemap.php @@ -4,7 +4,6 @@ namespace App\Console\Commands; use App\Models\Episode; use App\Models\Hentai; - use Illuminate\Console\Command; use Illuminate\Support\Carbon; use Spatie\Sitemap\Sitemap; @@ -45,7 +44,7 @@ class GenerateSitemap extends Command ->setLastModificationDate(Carbon::create('2023', '8', '1'))) ->add(Episode::all()) ->add(Hentai::all()); - + $sitemap->writeToFile(public_path('sitemap.xml')); } } diff --git a/app/Console/Commands/GetFileSize.php b/app/Console/Commands/GetFileSize.php index 41ad275..b736a3b 100644 --- a/app/Console/Commands/GetFileSize.php +++ b/app/Console/Commands/GetFileSize.php @@ -2,9 +2,8 @@ namespace App\Console\Commands; -use App\Models\Downloads; use App\Jobs\GetFileSizeFromCDN; - +use App\Models\Downloads; use Illuminate\Console\Command; class GetFileSize extends Command @@ -28,7 +27,7 @@ class GetFileSize extends Command */ public function handle() { - foreach(Downloads::whereNull('size')->get() as $download) { + foreach (Downloads::whereNull('size')->get() as $download) { GetFileSizeFromCDN::dispatch($download->id); } diff --git a/app/Console/Commands/ResetUserDownloads.php b/app/Console/Commands/ResetUserDownloads.php index b60c826..16db0fd 100644 --- a/app/Console/Commands/ResetUserDownloads.php +++ b/app/Console/Commands/ResetUserDownloads.php @@ -4,9 +4,8 @@ namespace App\Console\Commands; use App\Models\User; use App\Models\UserDownload; - -use Illuminate\Support\Carbon; use Illuminate\Console\Command; +use Illuminate\Support\Carbon; class ResetUserDownloads extends Command { diff --git a/app/Helpers/CacheHelper.php b/app/Helpers/CacheHelper.php index cde2cee..1c8b3a2 100644 --- a/app/Helpers/CacheHelper.php +++ b/app/Helpers/CacheHelper.php @@ -5,21 +5,20 @@ namespace App\Helpers; use App\Models\Comment; use App\Models\Episode; use App\Models\Hentai; +use App\Models\PopularDaily; use App\Models\PopularMonthly; use App\Models\PopularWeekly; -use App\Models\PopularDaily; - use Conner\Tagging\Model\Tag; - -use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Facades\DB; class CacheHelper { public static function getRecentlyReleased(bool $guest) { $guestString = $guest ? 'guest' : 'authed'; - return Cache::remember("recently_released_".$guestString, now()->addMinutes(60), function () use ($guest) { + + return Cache::remember('recently_released_'.$guestString, now()->addMinutes(60), function () use ($guest) { return Episode::with('gallery') ->when($guest, fn ($query) => $query->withoutTags(['loli', 'shota'])) ->orderBy('release_date', 'desc') @@ -31,7 +30,8 @@ class CacheHelper public static function getRecentlyUploaded(bool $guest) { $guestString = $guest ? 'guest' : 'authed'; - return Cache::remember("recently_uploaded".$guestString, now()->addMinutes(5), function () use ($guest) { + + return Cache::remember('recently_uploaded'.$guestString, now()->addMinutes(5), function () use ($guest) { return Episode::with('gallery') ->when($guest, fn ($query) => $query->withoutTags(['loli', 'shota'])) ->orderBy('created_at', 'desc') @@ -42,21 +42,21 @@ class CacheHelper public static function getTotalViewCount() { - return Cache::remember("total_view_count", now()->addMinutes(60), function () { + return Cache::remember('total_view_count', now()->addMinutes(60), function () { return Episode::sum('view_count'); }); } public static function getTotalEpisodeCount() { - return Cache::remember("total_episode_count", now()->addMinutes(60), function () { + return Cache::remember('total_episode_count', now()->addMinutes(60), function () { return Episode::count(); }); } public static function getTotalHentaiCount() { - return Cache::remember("total_hentai_count", now()->addMinutes(60), function () { + return Cache::remember('total_hentai_count', now()->addMinutes(60), function () { return Hentai::count(); }); } @@ -64,10 +64,11 @@ class CacheHelper public static function getPopularAllTime(bool $guest) { $guestString = $guest ? 'guest' : 'authed'; - return Cache::remember("top_hentai_alltime".$guestString, now()->addMinutes(360), function () use ($guest) { + + return Cache::remember('top_hentai_alltime'.$guestString, now()->addMinutes(360), function () use ($guest) { return Episode::with('gallery') ->when($guest, fn ($query) => $query->withoutTags(['loli', 'shota'])) - ->orderBy('view_count','desc') + ->orderBy('view_count', 'desc') ->limit(16) ->get(); }); @@ -75,7 +76,7 @@ class CacheHelper public static function getPopularMonthly() { - return Cache::remember("top_hentai_monthly", now()->addMinutes(360), function () { + return Cache::remember('top_hentai_monthly', now()->addMinutes(360), function () { return PopularMonthly::groupBy('episode_id') ->select('episode_id', DB::raw('count(*) as total')) ->with('episode.gallery') @@ -87,7 +88,7 @@ class CacheHelper public static function getPopularWeekly() { - return Cache::remember("top_hentai_weekly", now()->addMinutes(360), function () { + return Cache::remember('top_hentai_weekly', now()->addMinutes(360), function () { return PopularWeekly::groupBy('episode_id') ->select('episode_id', DB::raw('count(*) as total')) ->with('episode.gallery') @@ -100,7 +101,7 @@ class CacheHelper public static function getPopularDaily() { - return Cache::remember("top_hentai_daily", now()->addMinutes(30), function () { + return Cache::remember('top_hentai_daily', now()->addMinutes(30), function () { return PopularDaily::groupBy('episode_id') ->select('episode_id', DB::raw('count(*) as total')) ->with('episode.gallery') @@ -112,21 +113,21 @@ class CacheHelper public static function getMostLikes() { - return Cache::remember("top_likes", now()->addMinutes(30), function () { + return Cache::remember('top_likes', now()->addMinutes(30), function () { return DB::table('markable_likes')->groupBy('markable_id')->select('markable_id', DB::raw('count(*) as total'))->orderBy('total', 'desc')->limit(16)->get(); }); } public static function getAllTags() { - return Cache::remember("all_tags", now()->addMinutes(10080), function () { + return Cache::remember('all_tags', now()->addMinutes(10080), function () { return Tag::where('count', '>', 0)->orderBy('slug', 'ASC')->get(); }); } public static function getLatestComments() { - return Cache::remember("latest_comments", now()->addMinutes(60), function () { + return Cache::remember('latest_comments', now()->addMinutes(60), function () { return Comment::latest()->take(10)->get(); }); } diff --git a/app/Helpers/GitHelper.php b/app/Helpers/GitHelper.php index 5fea9f8..e737098 100644 --- a/app/Helpers/GitHelper.php +++ b/app/Helpers/GitHelper.php @@ -8,7 +8,7 @@ class GitHelper { public static function shortCommit() { - return Cache::remember("git_commit", now()->addMinutes(60), function () { + return Cache::remember('git_commit', now()->addMinutes(60), function () { try { return trim(exec('git rev-parse --short HEAD')); } catch (\Exception $e) { diff --git a/app/Http/Controllers/Admin/AlertController.php b/app/Http/Controllers/Admin/AlertController.php index 50f5bc9..5c0c0af 100644 --- a/app/Http/Controllers/Admin/AlertController.php +++ b/app/Http/Controllers/Admin/AlertController.php @@ -8,7 +8,7 @@ use Illuminate\Http\Request; class AlertController extends Controller { - /** + /** * Display alert index page */ public function index(): \Illuminate\View\View diff --git a/app/Http/Controllers/Admin/ContactController.php b/app/Http/Controllers/Admin/ContactController.php index 3bc3ffa..589be85 100644 --- a/app/Http/Controllers/Admin/ContactController.php +++ b/app/Http/Controllers/Admin/ContactController.php @@ -15,7 +15,7 @@ class ContactController extends Controller $contacts = Contact::orderBy('created_at', 'DESC')->get(); return view('admin.contact.index', [ - 'contacts' => $contacts + 'contacts' => $contacts, ]); } diff --git a/app/Http/Controllers/Admin/EpisodeController.php b/app/Http/Controllers/Admin/EpisodeController.php index 0d82bd5..70e0acc 100644 --- a/app/Http/Controllers/Admin/EpisodeController.php +++ b/app/Http/Controllers/Admin/EpisodeController.php @@ -3,9 +3,8 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; -use App\Models\Episode; - use App\Jobs\DiscordReleaseNotification; +use App\Models\Episode; use App\Services\DownloadService; use App\Services\EpisodeService; use App\Services\GalleryService; @@ -14,14 +13,16 @@ use Illuminate\Http\Request; class EpisodeController extends Controller { protected EpisodeService $episodeService; + protected GalleryService $galleryService; + protected DownloadService $downloadService; public function __construct( - EpisodeService $episodeService, - GalleryService $galleryService, + EpisodeService $episodeService, + GalleryService $galleryService, DownloadService $downloadService - ) { + ) { $this->episodeService = $episodeService; $this->galleryService = $galleryService; $this->downloadService = $downloadService; @@ -43,7 +44,7 @@ class EpisodeController extends Controller // Discord Alert if ($request->has('censored')) { - DiscordReleaseNotification::dispatch($referenceEpisode->title." - ".$episodeNumber, 'release-censored'); + DiscordReleaseNotification::dispatch($referenceEpisode->title.' - '.$episodeNumber, 'release-censored'); } else { DiscordReleaseNotification::dispatch($episode->slug, 'release'); } @@ -51,7 +52,7 @@ class EpisodeController extends Controller cache()->flush(); return to_route('hentai.index', [ - 'title' => $episode->slug + 'title' => $episode->slug, ]); } @@ -87,7 +88,7 @@ class EpisodeController extends Controller cache()->flush(); return to_route('hentai.index', [ - 'title' => $episode->slug + 'title' => $episode->slug, ]); } } diff --git a/app/Http/Controllers/Admin/ReleaseController.php b/app/Http/Controllers/Admin/ReleaseController.php index b2beecf..8df7445 100644 --- a/app/Http/Controllers/Admin/ReleaseController.php +++ b/app/Http/Controllers/Admin/ReleaseController.php @@ -3,9 +3,8 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; -use App\Models\Hentai; - use App\Jobs\DiscordReleaseNotification; +use App\Models\Hentai; use App\Services\DownloadService; use App\Services\EpisodeService; use App\Services\GalleryService; @@ -14,20 +13,22 @@ use Illuminate\Http\Request; class ReleaseController extends Controller { protected EpisodeService $episodeService; + protected GalleryService $galleryService; + protected DownloadService $downloadService; public function __construct( - EpisodeService $episodeService, - GalleryService $galleryService, + EpisodeService $episodeService, + GalleryService $galleryService, DownloadService $downloadService - ) { + ) { $this->episodeService = $episodeService; $this->galleryService = $galleryService; $this->downloadService = $downloadService; } - /** + /** * Display release page */ public function index(): \Illuminate\View\View diff --git a/app/Http/Controllers/Admin/SiteBackgroundController.php b/app/Http/Controllers/Admin/SiteBackgroundController.php index 134de2a..9fc0810 100644 --- a/app/Http/Controllers/Admin/SiteBackgroundController.php +++ b/app/Http/Controllers/Admin/SiteBackgroundController.php @@ -3,19 +3,17 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; - use App\Models\SiteBackground; - use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; -use Illuminate\Support\Facades\File; +use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Log; -use Intervention\Image\Laravel\Facades\Image; use Intervention\Image\Encoders\WebpEncoder; +use Intervention\Image\Laravel\Facades\Image; class SiteBackgroundController extends Controller { - /** + /** * Display admin index page */ public function index(): \Illuminate\View\View @@ -31,12 +29,12 @@ class SiteBackgroundController extends Controller public function create(Request $request): \Illuminate\Http\RedirectResponse { $request->validate([ - 'images' => 'required', - 'date_start' => 'required', - 'date_end' => 'required', + 'images' => 'required', + 'date_start' => 'required', + 'date_end' => 'required', ]); - - foreach($request->file('images') as $file) { + + foreach ($request->file('images') as $file) { // Initiating a database transaction in case something goes wrong. DB::beginTransaction(); @@ -44,24 +42,25 @@ class SiteBackgroundController extends Controller $bg = SiteBackground::create(array_merge( $request->only(['date_start', 'date_end']), [ - 'default' => (bool) $request->input('default', false) + 'default' => (bool) $request->input('default', false), ] )); - + $resolutions = [1440, 1080, 720, 640]; - foreach($resolutions as $resolution) { + foreach ($resolutions as $resolution) { // /images/background/1-2560p.webp $targetPath = "/images/background/{$bg->id}-{$resolution}p.webp"; - + Image::read($file->getRealPath()) ->scaleDown(height: $resolution) - ->encode(new WebpEncoder()) + ->encode(new WebpEncoder) ->save(public_path($targetPath)); } } catch (\Exception $e) { DB::rollBack(); Log::error($e->getMessage()); + return redirect()->back(); } @@ -77,15 +76,15 @@ class SiteBackgroundController extends Controller public function update(Request $request): \Illuminate\Http\RedirectResponse { $request->validate([ - 'id' => 'required|exists:site_backgrounds,id', - 'date_start' => 'required', - 'date_end' => 'required', + 'id' => 'required|exists:site_backgrounds,id', + 'date_start' => 'required', + 'date_end' => 'required', ]); SiteBackground::where('id', $request->input('id'))->update(array_merge( $request->only(['date_start', 'date_end']), [ - 'default' => (bool) $request->input('default', false) + 'default' => (bool) $request->input('default', false), ] )); @@ -109,16 +108,17 @@ class SiteBackgroundController extends Controller $resolutions = [1440, 1080, 720, 640]; try { - foreach($resolutions as $resolution) { + foreach ($resolutions as $resolution) { $targetPath = "/images/background/{$id}-{$resolution}p.webp"; File::delete(public_path($targetPath)); } } catch (\Exception $e) { DB::rollBack(); Log::error($e->getMessage()); + return redirect()->back(); } - + // Committing the database transaction. DB::commit(); diff --git a/app/Http/Controllers/Admin/SubtitleController.php b/app/Http/Controllers/Admin/SubtitleController.php index 86a57a9..4c01035 100644 --- a/app/Http/Controllers/Admin/SubtitleController.php +++ b/app/Http/Controllers/Admin/SubtitleController.php @@ -2,10 +2,10 @@ namespace App\Http\Controllers\Admin; +use App\Http\Controllers\Controller; use App\Models\Episode; use App\Models\EpisodeSubtitle; use App\Models\Subtitle; -use App\Http\Controllers\Controller; use Illuminate\Http\Request; class SubtitleController extends Controller @@ -16,8 +16,8 @@ class SubtitleController extends Controller public function store(Request $request): \Illuminate\Http\RedirectResponse { $subtitle = Subtitle::create([ - 'name' => $request->name, - 'slug' => $request->slug, + 'name' => $request->name, + 'slug' => $request->slug, ]); // Add to Episode @@ -37,7 +37,7 @@ class SubtitleController extends Controller $episode = Episode::where('id', $request->input('episode_id'))->firstOrFail(); // Clear everything - foreach($episode->subtitles as $sub) { + foreach ($episode->subtitles as $sub) { $sub->delete(); } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index b4d5365..9ada166 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -3,8 +3,8 @@ namespace App\Http\Controllers\Admin; use App\Enums\UserRole; -use App\Models\User; use App\Http\Controllers\Controller; +use App\Models\User; use Illuminate\Http\Request; class UserController extends Controller @@ -23,10 +23,9 @@ class UserController extends Controller public function update(Request $request) { $validated = $request->validate([ - 'id' => 'required|exists:users,id', - 'action' => 'required', + 'id' => 'required|exists:users,id', + 'action' => 'required', ]); - $user = User::findOrFail($validated['id']); @@ -40,7 +39,7 @@ class UserController extends Controller alert()->success('Unbanned', 'User has been unbanned.'); break; default: - alert()->error('Error','Invalid action provided'); + alert()->error('Error', 'Invalid action provided'); } return redirect()->back(); diff --git a/app/Http/Controllers/Api/AdminApiController.php b/app/Http/Controllers/Api/AdminApiController.php index 02b8f3f..09541e6 100644 --- a/app/Http/Controllers/Api/AdminApiController.php +++ b/app/Http/Controllers/Api/AdminApiController.php @@ -3,10 +3,10 @@ namespace App\Http\Controllers\Api; use App\Helpers\CacheHelper; +use App\Http\Controllers\Controller; use App\Models\Episode; use App\Models\Studios; use App\Models\Subtitle; -use App\Http\Controllers\Controller; class AdminApiController extends Controller { diff --git a/app/Http/Controllers/Api/DownloadApiController.php b/app/Http/Controllers/Api/DownloadApiController.php index 0a30c67..2a351d5 100644 --- a/app/Http/Controllers/Api/DownloadApiController.php +++ b/app/Http/Controllers/Api/DownloadApiController.php @@ -2,13 +2,11 @@ namespace App\Http\Controllers\Api; +use App\Http\Controllers\Controller; use App\Models\Downloads; use App\Models\Episode; - -use Illuminate\Http\Request; -use App\Http\Controllers\Controller; - use GrantHolle\Altcha\Rules\ValidAltcha; +use Illuminate\Http\Request; class DownloadApiController extends Controller { @@ -18,8 +16,8 @@ class DownloadApiController extends Controller public function getDownload(Request $request) { $validated = $request->validate([ - 'episode_id' => ['required'], - 'captcha' => ['required', new ValidAltcha], + 'episode_id' => ['required'], + 'captcha' => ['required', new ValidAltcha], ]); $episode = Episode::where('id', $request->input('episode_id')) @@ -33,9 +31,9 @@ class DownloadApiController extends Controller $download->save(); return response()->json([ - 'message' => 'success', - 'download_url' => $download->url, - 'download_count' => $oldCount, + 'message' => 'success', + 'download_url' => $download->url, + 'download_count' => $oldCount, ], 200); } } diff --git a/app/Http/Controllers/Api/HentaiApiController.php b/app/Http/Controllers/Api/HentaiApiController.php index c346e8a..09aaae8 100644 --- a/app/Http/Controllers/Api/HentaiApiController.php +++ b/app/Http/Controllers/Api/HentaiApiController.php @@ -2,12 +2,11 @@ namespace App\Http\Controllers\Api; +use App\Http\Controllers\Controller; use App\Models\Hentai; use App\Models\PopularMonthly; use Carbon\Carbon; - use Illuminate\Support\Facades\Cache; -use App\Http\Controllers\Controller; class HentaiApiController extends Controller { @@ -23,13 +22,13 @@ class HentaiApiController extends Controller ->get() ->map(function ($hentai) { return [ - 'title' => $hentai->episodes[0]->title, + 'title' => $hentai->episodes[0]->title, 'title_jpn' => $hentai->episodes[0]->title_jpn, - 'slug' => $hentai->slug, - 'episodes' => $hentai->episodes->map(function ($ep) { + 'slug' => $hentai->slug, + 'episodes' => $hentai->episodes->map(function ($ep) { return [ - 'episode' => $ep->episode, - 'slug' => $ep->slug, + 'episode' => $ep->episode, + 'slug' => $ep->slug, ]; }), ]; diff --git a/app/Http/Controllers/Api/StreamApiController.php b/app/Http/Controllers/Api/StreamApiController.php index 8801fd5..b215eed 100644 --- a/app/Http/Controllers/Api/StreamApiController.php +++ b/app/Http/Controllers/Api/StreamApiController.php @@ -3,9 +3,7 @@ namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; - use App\Models\Episode; - use Illuminate\Http\Request; class StreamApiController extends Controller @@ -16,24 +14,24 @@ class StreamApiController extends Controller public function getStream(Request $request) { $validated = $request->validate([ - 'episode_id' => 'required', + 'episode_id' => 'required', ]); $episode = Episode::where('id', $request->input('episode_id'))->firstOrFail(); $subtitles = $episode->subtitles - ->mapWithKeys(fn($sub) => [$sub->subtitle->slug => $sub->subtitle->name]) + ->mapWithKeys(fn ($sub) => [$sub->subtitle->slug => $sub->subtitle->name]) ->toArray(); return response()->json([ - 'title' => $episode->title.' - '.$episode->episode, - 'poster' => $episode->gallery()->first()->image_url, - 'interpolated' => $episode->interpolated, - 'interpolated_uhd' => $episode->interpolated_uhd, - 'stream_url' => $episode->dmca_takedown ? 'stuff/dmca' : $episode->url, - 'stream_domains' => config('hstream.stream_domain'), - 'asia_stream_domains' => config('hstream.asia_stream_domain'), - 'extra_subtitles' => $subtitles + 'title' => $episode->title.' - '.$episode->episode, + 'poster' => $episode->gallery()->first()->image_url, + 'interpolated' => $episode->interpolated, + 'interpolated_uhd' => $episode->interpolated_uhd, + 'stream_url' => $episode->dmca_takedown ? 'stuff/dmca' : $episode->url, + 'stream_domains' => config('hstream.stream_domain'), + 'asia_stream_domains' => config('hstream.asia_stream_domain'), + 'extra_subtitles' => $subtitles, ], 200); } } diff --git a/app/Http/Controllers/Api/UserApiController.php b/app/Http/Controllers/Api/UserApiController.php index 74c5062..711bce7 100644 --- a/app/Http/Controllers/Api/UserApiController.php +++ b/app/Http/Controllers/Api/UserApiController.php @@ -4,9 +4,8 @@ namespace App\Http\Controllers\Api; use App\Helpers\CacheHelper; use App\Http\Controllers\Controller; -use Illuminate\Http\Request; - use Conner\Tagging\Model\Tag; +use Illuminate\Http\Request; class UserApiController extends Controller { @@ -33,11 +32,10 @@ class UserApiController extends Controller } } - return response()->json([ - 'message' => 'success', - 'tags' => $tagWhiteList, - 'usertags' => $tagBlackList + 'message' => 'success', + 'tags' => $tagWhiteList, + 'usertags' => $tagBlackList, ], 200); } } diff --git a/app/Http/Controllers/Auth/DiscordAuthController.php b/app/Http/Controllers/Auth/DiscordAuthController.php index 634ecce..9c357b2 100644 --- a/app/Http/Controllers/Auth/DiscordAuthController.php +++ b/app/Http/Controllers/Auth/DiscordAuthController.php @@ -3,11 +3,9 @@ namespace App\Http\Controllers\Auth; use App\Enums\UserRole; -use App\Models\User; - use App\Http\Controllers\Controller; +use App\Models\User; use Illuminate\Http\RedirectResponse; -use Illuminate\Support\Str; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; @@ -32,7 +30,7 @@ class DiscordAuthController extends Controller $user = User::where('discord_id', $discordUser->id)->first(); - if (!$user) { + if (! $user) { // link by email if it already exists $user = User::where('email', $discordUser->email)->first(); @@ -77,7 +75,7 @@ class DiscordAuthController extends Controller private function checkDiscordRoles(User $user): void { // Should not ever happen - if (!$user->discord_id) { + if (! $user->discord_id) { return; } @@ -90,6 +88,7 @@ class DiscordAuthController extends Controller // User is not in the guild if ($response->status() === 404) { $user->removeRole(UserRole::SUPPORTER); + return; } @@ -109,11 +108,12 @@ class DiscordAuthController extends Controller $patreonRoles = config('discord.patreon_roles', []); // If intersect of array is empty, then the user doesn't have the role - $hasSupporterRole = !empty(array_intersect($discordRoles, $patreonRoles)); + $hasSupporterRole = ! empty(array_intersect($discordRoles, $patreonRoles)); - if (!$hasSupporterRole) { + if (! $hasSupporterRole) { // Remove role if not found $user->removeRole(UserRole::SUPPORTER); + return; } diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/Auth/PasswordController.php index 56112b8..11b61b2 100644 --- a/app/Http/Controllers/Auth/PasswordController.php +++ b/app/Http/Controllers/Auth/PasswordController.php @@ -16,8 +16,7 @@ class PasswordController extends Controller public function update(Request $request): RedirectResponse { // If user logged in with Discord and has not yet a password, allow to set password - if ($request->user()->discord_id && is_null($request->user()->password)) - { + if ($request->user()->discord_id && is_null($request->user()->password)) { $validated = $request->validateWithBag('updatePassword', [ 'password' => ['required', Password::defaults(), 'confirmed'], ]); diff --git a/app/Http/Controllers/Auth/RegisteredUserController.php b/app/Http/Controllers/Auth/RegisteredUserController.php index 33bb10b..5c22d9f 100644 --- a/app/Http/Controllers/Auth/RegisteredUserController.php +++ b/app/Http/Controllers/Auth/RegisteredUserController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use App\Models\User; +use GrantHolle\Altcha\Rules\ValidAltcha; use Illuminate\Auth\Events\Registered; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; @@ -11,8 +12,6 @@ use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; use Illuminate\Validation\Rules; -use GrantHolle\Altcha\Rules\ValidAltcha; - class RegisteredUserController extends Controller { /** @@ -26,7 +25,7 @@ class RegisteredUserController extends Controller 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class], 'password' => ['required', 'confirmed', Rules\Password::defaults()], - 'altcha' => ['required', new ValidAltcha], + 'altcha' => ['required', new ValidAltcha], ]); $user = User::create([ diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index e22814a..74eadcf 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -3,9 +3,8 @@ namespace App\Http\Controllers; use App\Models\Contact; -use Illuminate\Http\Request; - use GrantHolle\Altcha\Rules\ValidAltcha; +use Illuminate\Http\Request; class ContactController extends Controller { @@ -23,14 +22,14 @@ class ContactController extends Controller public function store(Request $request): \Illuminate\Http\RedirectResponse { $validated = $request->validate([ - 'name' => 'required|max:30', - 'email' => 'required|max:50', + 'name' => 'required|max:30', + 'email' => 'required|max:50', 'message' => 'required|max:1000', 'subject' => 'required|max:50', - 'altcha' => ['required', new ValidAltcha], + 'altcha' => ['required', new ValidAltcha], ]); - $contact = new Contact(); + $contact = new Contact; $contact->name = $request->input('name'); $contact->email = $request->input('email'); $contact->message = $request->input('message'); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index a5844a3..4d7fa3d 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -2,11 +2,10 @@ namespace App\Http\Controllers; -use App\Models\Episode; use App\Helpers\CacheHelper; +use App\Models\Episode; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Cookie; class HomeController extends Controller { @@ -19,28 +18,27 @@ class HomeController extends Controller $guestString = $guest ? 'guest' : 'authed'; - $mostLikes = \cache()->remember('mostLikes'.$guestString, 300, fn () => - Episode::with('gallery') - ->when($guest, fn ($query) => $query->withoutTags(['loli', 'shota'])) - ->whereIn('id', function($query) { - $mostLikesIds = CacheHelper::getMostLikes()->pluck('markable_id')->toArray(); - $query->selectRaw('id') - ->from('episodes') - ->whereIn('id', $mostLikesIds) - ->orderByRaw("FIELD(id, " . implode(',', $mostLikesIds) . ")"); - }) - ->get() + $mostLikes = \cache()->remember('mostLikes'.$guestString, 300, fn () => Episode::with('gallery') + ->when($guest, fn ($query) => $query->withoutTags(['loli', 'shota'])) + ->whereIn('id', function ($query) { + $mostLikesIds = CacheHelper::getMostLikes()->pluck('markable_id')->toArray(); + $query->selectRaw('id') + ->from('episodes') + ->whereIn('id', $mostLikesIds) + ->orderByRaw('FIELD(id, '.implode(',', $mostLikesIds).')'); + }) + ->get() ); return view('home.index', [ - 'recentlyReleased' => CacheHelper::getRecentlyReleased($guest), - 'recentlyUploaded' => CacheHelper::getRecentlyUploaded($guest), - 'popularAllTime' => CacheHelper::getPopularAllTime($guest), - 'popularMonthly' => CacheHelper::getPopularMonthly(), - 'popularWeekly' => CacheHelper::getPopularWeekly(), - 'popularDaily' => CacheHelper::getPopularDaily(), - 'mostLikes' => $mostLikes, - 'latestComments' => CacheHelper::getLatestComments(), + 'recentlyReleased' => CacheHelper::getRecentlyReleased($guest), + 'recentlyUploaded' => CacheHelper::getRecentlyUploaded($guest), + 'popularAllTime' => CacheHelper::getPopularAllTime($guest), + 'popularMonthly' => CacheHelper::getPopularMonthly(), + 'popularWeekly' => CacheHelper::getPopularWeekly(), + 'popularDaily' => CacheHelper::getPopularDaily(), + 'mostLikes' => $mostLikes, + 'latestComments' => CacheHelper::getLatestComments(), ]); } @@ -100,9 +98,9 @@ class HomeController extends Controller public function stats(): \Illuminate\View\View { return view('home.stats', [ - 'viewCount' => CacheHelper::getTotalViewCount(), - 'episodeCount' => CacheHelper::getTotalEpisodeCount(), - 'hentaiCount' => CacheHelper::getTotalHentaiCount(), + 'viewCount' => CacheHelper::getTotalViewCount(), + 'episodeCount' => CacheHelper::getTotalEpisodeCount(), + 'hentaiCount' => CacheHelper::getTotalHentaiCount(), ]); } diff --git a/app/Http/Controllers/MatrixController.php b/app/Http/Controllers/MatrixController.php index d0974d1..b072040 100644 --- a/app/Http/Controllers/MatrixController.php +++ b/app/Http/Controllers/MatrixController.php @@ -17,7 +17,7 @@ class MatrixController extends Controller ['name' => '🏠 General', 'description' => 'Our main chat.', 'alias' => 'https://matrix.to/#/#general:hstream.moe'], ['name' => '📡 Releases', 'description' => 'Were we @everyone for new releases.', 'alias' => 'https://matrix.to/#/#releases:hstream.moe'], ['name' => '👗 NSFW 2D', 'description' => 'Channel for R18 2D Media.', 'alias' => 'https://matrix.to/#/#nsfw:hstream.moe'], - ['name' => '👗 NSFW IRL', 'description' => 'Channel for R18 IRL Media.', 'alias' => 'https://matrix.to/#/#nsfw-irl:hstream.moe'] + ['name' => '👗 NSFW IRL', 'description' => 'Channel for R18 IRL Media.', 'alias' => 'https://matrix.to/#/#nsfw-irl:hstream.moe'], ]; return view('matrix.index', [ @@ -49,7 +49,7 @@ class MatrixController extends Controller } catch (\Exception $e) { return back() ->withErrors([ - 'username' => $e->getMessage() + 'username' => $e->getMessage(), ]) ->withInput(); } diff --git a/app/Http/Controllers/NotificationController.php b/app/Http/Controllers/NotificationController.php index 78ed78a..edc2a6c 100644 --- a/app/Http/Controllers/NotificationController.php +++ b/app/Http/Controllers/NotificationController.php @@ -3,7 +3,6 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; -use Illuminate\Support\Facades\DB; class NotificationController extends Controller { @@ -13,7 +12,7 @@ class NotificationController extends Controller public function index(Request $request): \Illuminate\View\View { return view('profile.notifications', [ - 'user' => $request->user(), + 'user' => $request->user(), 'notifications' => $request->user()->unreadNotifications, ]); } @@ -24,7 +23,7 @@ class NotificationController extends Controller public function delete(Request $request): \Illuminate\Http\RedirectResponse { $request->validate([ - 'id' => 'required|exists:notifications,id', + 'id' => 'required|exists:notifications,id', ]); $notification = $request->user() diff --git a/app/Http/Controllers/PlaylistController.php b/app/Http/Controllers/PlaylistController.php index 7bc1916..1ad2e22 100644 --- a/app/Http/Controllers/PlaylistController.php +++ b/app/Http/Controllers/PlaylistController.php @@ -7,7 +7,6 @@ use App\Models\Playlist; use App\Models\PlaylistEpisode; use App\Services\PlaylistService; use Illuminate\Http\Request; -use RealRashid\SweetAlert\Facades\Alert; class PlaylistController extends Controller { @@ -31,7 +30,7 @@ class PlaylistController extends Controller */ public function show($playlist_id): \Illuminate\View\View { - if (!is_numeric($playlist_id)) { + if (! is_numeric($playlist_id)) { abort(404); } @@ -42,18 +41,17 @@ class PlaylistController extends Controller ]); } - /** * Display the user's playlists page. */ public function playlists(Request $request): \Illuminate\View\View { $title = 'Delete Playlist!'; - $text = "Are you sure you want to delete?"; + $text = 'Are you sure you want to delete?'; confirmDelete($title, $text); return view('profile.playlists', [ - 'user' => $request->user(), + 'user' => $request->user(), 'playlists' => $request->user()->playlists, ]); } @@ -63,7 +61,7 @@ class PlaylistController extends Controller */ public function showPlaylist(Request $request, $playlist_id): \Illuminate\View\View { - if (!is_numeric($playlist_id)) { + if (! is_numeric($playlist_id)) { abort(404); } @@ -82,10 +80,10 @@ class PlaylistController extends Controller public function createPlaylist(Request $request): \Illuminate\Http\RedirectResponse { $validated = $request->validate([ - 'name' => 'required|max:30', + 'name' => 'required|max:30', ]); - $playlist = new Playlist(); + $playlist = new Playlist; $playlist->user_id = $request->user()->id; $playlist->name = $request->input('name'); $playlist->is_private = $request->input('visiblity') === 'private'; @@ -99,7 +97,7 @@ class PlaylistController extends Controller */ public function deletePlaylist(Request $request, $playlist_id): \Illuminate\Http\RedirectResponse { - if (!is_numeric($playlist_id)) { + if (! is_numeric($playlist_id)) { abort(404); } @@ -119,10 +117,10 @@ class PlaylistController extends Controller */ public function deleteEpisodeFromPlaylist(Request $request): \Illuminate\Http\JsonResponse { - if (!is_numeric($request->input('playlist')) || !is_numeric($request->input('episode'))) { + if (! is_numeric($request->input('playlist')) || ! is_numeric($request->input('episode'))) { return response()->json([ 'message' => 'not-numeric', - 'user' => $request->user(), + 'user' => $request->user(), ], 404); } @@ -133,12 +131,12 @@ class PlaylistController extends Controller PlaylistEpisode::where('playlist_id', $playlist->id) ->where('episode_id', (int) $request->input('episode')) ->delete(); - + $this->playlistService->reorderPositions($playlist); return response()->json([ 'message' => 'success', - 'user' => $request->user(), + 'user' => $request->user(), ], 200); } @@ -150,8 +148,8 @@ class PlaylistController extends Controller $user = $request->user(); $validated = $request->validate([ - 'playlist' => 'required|max:30', - 'episode_id' => 'required' + 'playlist' => 'required|max:30', + 'episode_id' => 'required', ]); $playlist = Playlist::where('user_id', $user->id)->where('id', $request->input('playlist'))->firstOrFail(); @@ -161,7 +159,7 @@ class PlaylistController extends Controller $exists = PlaylistEpisode::where('playlist_id', $playlist->id)->where('episode_id', $episode->id)->exists(); if ($exists) { return response()->json([ - 'message' => 'already-added' + 'message' => 'already-added', ], 200); } @@ -175,7 +173,7 @@ class PlaylistController extends Controller ]); return response()->json([ - 'message' => 'success' + 'message' => 'success', ], 200); } @@ -185,18 +183,18 @@ class PlaylistController extends Controller public function createPlaylistApi(Request $request): \Illuminate\Http\JsonResponse { $validated = $request->validate([ - 'name' => 'required|max:30', + 'name' => 'required|max:30', ]); - $playlist = new Playlist(); + $playlist = new Playlist; $playlist->user_id = $request->user()->id; $playlist->name = $request->input('name'); $playlist->is_private = $request->input('visiblity') === 'private'; $playlist->save(); return response()->json([ - 'message' => 'success', - 'playlist_id' => $playlist->id + 'message' => 'success', + 'playlist_id' => $playlist->id, ], 200); } } diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 10a4c76..7fa1659 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -2,22 +2,20 @@ namespace App\Http\Controllers; +use App\Http\Requests\ProfileUpdateRequest; use App\Models\Episode; use App\Models\User; -use App\Http\Requests\ProfileUpdateRequest; +use Conner\Tagging\Model\Tag; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\Support\Str; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Storage; +use Illuminate\Support\Str; use Illuminate\View\View; - use Intervention\Image\Laravel\Facades\Image; -use Conner\Tagging\Model\Tag; - class ProfileController extends Controller { /** @@ -38,8 +36,8 @@ class ProfileController extends Controller $example = Episode::where('title', 'Succubus Yondara Gibo ga Kita!?')->first(); return view('profile.settings', [ - 'user' => $request->user(), - 'example' => $example, + 'user' => $request->user(), + 'example' => $example, ]); } @@ -92,7 +90,7 @@ class ProfileController extends Controller public function likes(Request $request): View { return view('profile.likes', [ - 'user' => $request->user(), + 'user' => $request->user(), ]); } @@ -118,9 +116,10 @@ class ProfileController extends Controller $user = $request->user(); $tags = json_decode($request->input('tags')); - if (!$tags) { + if (! $tags) { $user->tag_blacklist = null; $user->save(); + return Redirect::route('profile.settings')->with('status', 'blacklist-updated'); } @@ -144,7 +143,7 @@ class ProfileController extends Controller $user = $request->user(); // Verify password if user has password - if (!is_null($user->password)) { + if (! is_null($user->password)) { $request->validateWithBag('userDeletion', [ 'password' => ['required', 'current_password'], ]); @@ -177,8 +176,8 @@ class ProfileController extends Controller protected function storeAvatar(\Illuminate\Http\UploadedFile $file, User $user): void { // Create Folder for Image Upload - if (! Storage::disk('public')->exists("/images/avatars")) { - Storage::disk('public')->makeDirectory("/images/avatars"); + if (! Storage::disk('public')->exists('/images/avatars')) { + Storage::disk('public')->makeDirectory('/images/avatars'); } // Delete old avatar if it exists @@ -196,5 +195,4 @@ class ProfileController extends Controller $user->avatar = $filename; } - } diff --git a/app/Http/Controllers/StreamController.php b/app/Http/Controllers/StreamController.php index ad45d32..e9f7944 100644 --- a/app/Http/Controllers/StreamController.php +++ b/app/Http/Controllers/StreamController.php @@ -2,20 +2,18 @@ namespace App\Http\Controllers; +use App\Helpers\CacheHelper; use App\Models\Episode; use App\Models\Gallery; use App\Models\Hentai; use App\Models\Playlist; use App\Models\PlaylistEpisode; use App\Models\Watched; -use App\Helpers\CacheHelper; - +use hisorange\BrowserDetect\Facade as Browser; use Illuminate\Http\Request; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Auth; -use hisorange\BrowserDetect\Facade as Browser; - class StreamController extends Controller { /** @@ -32,12 +30,11 @@ class StreamController extends Controller } return view('series.index', [ - 'hentai' => $hentai, + 'hentai' => $hentai, 'popularWeekly' => CacheHelper::getPopularWeekly(), ]); } - $episode = Episode::where('slug', $title)->firstOrFail(); $gallery = Gallery::where('episode_id', $episode->id)->get(); $moreEpisodes = Episode::with(['gallery', 'studio'])->where('hentai_id', $episode->hentai_id)->whereNot('id', $episode->id)->get(); @@ -54,15 +51,15 @@ class StreamController extends Controller // Increment Popular Count $episode->incrementPopularCount(); - if (!Auth::guest()) { + if (! Auth::guest()) { $user = Auth::user(); // Add to user watched list $time = Carbon::now()->subHour(1); $alreadyWatched = Watched::where('user_id', $user->id)->where('episode_id', $episode->id)->where('created_at', '>=', $time)->exists(); - if (!$alreadyWatched) { + if (! $alreadyWatched) { Watched::create(['user_id' => $user->id, 'episode_id' => $episode->id]); - cache()->forget('user' . $user->id . 'watched' . $episode->id); + cache()->forget('user'.$user->id.'watched'.$episode->id); } } @@ -81,29 +78,29 @@ class StreamController extends Controller $playlistEpisodes = $playlist->episodes()->orderBy('position')->get(); // Check if authorized - if ($playlist->is_private && (Auth::guest() || (!Auth::guest() && Auth::user()->id != $playlist->user_id))) { + if ($playlist->is_private && (Auth::guest() || (! Auth::guest() && Auth::user()->id != $playlist->user_id))) { abort(404); } return view('stream.index', [ - 'episode' => $episode, - 'moreEpisodes' => $moreEpisodes, - 'studioEpisodes' => $studioEpisodes, - 'gallery' => $gallery, - 'playlist' => $playlist, - 'playlistEpisodes' => $playlistEpisodes, - 'popularWeekly' => CacheHelper::getPopularWeekly(), - 'isMobile' => $isMobile, + 'episode' => $episode, + 'moreEpisodes' => $moreEpisodes, + 'studioEpisodes' => $studioEpisodes, + 'gallery' => $gallery, + 'playlist' => $playlist, + 'playlistEpisodes' => $playlistEpisodes, + 'popularWeekly' => CacheHelper::getPopularWeekly(), + 'isMobile' => $isMobile, ]); } return view('stream.index', [ - 'episode' => $episode, - 'moreEpisodes' => $moreEpisodes, - 'studioEpisodes' => $studioEpisodes, - 'gallery' => $gallery, - 'popularWeekly' => CacheHelper::getPopularWeekly(), - 'isMobile' => $isMobile, + 'episode' => $episode, + 'moreEpisodes' => $moreEpisodes, + 'studioEpisodes' => $studioEpisodes, + 'gallery' => $gallery, + 'popularWeekly' => CacheHelper::getPopularWeekly(), + 'isMobile' => $isMobile, ]); } } diff --git a/app/Http/Middleware/IsAdmin.php b/app/Http/Middleware/IsAdmin.php index 690688d..b1a015e 100644 --- a/app/Http/Middleware/IsAdmin.php +++ b/app/Http/Middleware/IsAdmin.php @@ -1,29 +1,28 @@ -hasRole(UserRole::ADMINISTRATOR)) - { + if (Auth::check() && Auth::user()->hasRole(UserRole::ADMINISTRATOR)) { return $next($request); } - session()->flash('error_msg','This resource is restricted to Administrators!'); - return redirect()->route('home.index'); + session()->flash('error_msg', 'This resource is restricted to Administrators!'); + + return redirect()->route('home.index'); } } diff --git a/app/Http/Middleware/IsBanned.php b/app/Http/Middleware/IsBanned.php index d0ec686..4a6e7c7 100644 --- a/app/Http/Middleware/IsBanned.php +++ b/app/Http/Middleware/IsBanned.php @@ -1,32 +1,30 @@ -hasRole(UserRole::BANNED)) - { + if (Auth::check() && Auth::user()->hasRole(UserRole::BANNED)) { Auth::logout(); $request->session()->invalidate(); $request->session()->regenerateToken(); + return redirect()->route('home.banned'); } return $next($request); } - } diff --git a/app/Http/Middleware/IsModerator.php b/app/Http/Middleware/IsModerator.php index e168141..197b816 100644 --- a/app/Http/Middleware/IsModerator.php +++ b/app/Http/Middleware/IsModerator.php @@ -3,7 +3,6 @@ namespace App\Http\Middleware; use App\Enums\UserRole; - use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -18,12 +17,12 @@ class IsModerator */ public function handle(Request $request, Closure $next): Response { - if (Auth::check() && Auth::user()->hasRole(UserRole::MODERATOR)) - { + if (Auth::check() && Auth::user()->hasRole(UserRole::MODERATOR)) { return $next($request); } - session()->flash('error_msg','This resource is restricted to Administrators!'); + session()->flash('error_msg', 'This resource is restricted to Administrators!'); + return redirect()->route('home.index'); } } diff --git a/app/Http/Middleware/SetLocale.php b/app/Http/Middleware/SetLocale.php index 7627f1f..21ae42b 100644 --- a/app/Http/Middleware/SetLocale.php +++ b/app/Http/Middleware/SetLocale.php @@ -20,12 +20,14 @@ class SetLocale // 1. Logged-in user preference if (Auth::check() && Auth::user()->locale) { App::setLocale(Auth::user()->locale); + return $next($request); } // 2. Session (guest or user override) if (session()->has('locale') && in_array($request->language, config('app.supported_locales'), true)) { App::setLocale(session('locale')); + return $next($request); } diff --git a/app/Http/Requests/Auth/LoginRequest.php b/app/Http/Requests/Auth/LoginRequest.php index a5da0d6..769a9e4 100644 --- a/app/Http/Requests/Auth/LoginRequest.php +++ b/app/Http/Requests/Auth/LoginRequest.php @@ -2,6 +2,7 @@ namespace App\Http\Requests\Auth; +use GrantHolle\Altcha\Rules\ValidAltcha; use Illuminate\Auth\Events\Lockout; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Support\Facades\Auth; @@ -9,8 +10,6 @@ use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Str; use Illuminate\Validation\ValidationException; -use GrantHolle\Altcha\Rules\ValidAltcha; - class LoginRequest extends FormRequest { /** @@ -31,7 +30,7 @@ class LoginRequest extends FormRequest return [ 'email' => ['required', 'string', 'email'], 'password' => ['required', 'string'], - 'altcha' => ['required', new ValidAltcha], + 'altcha' => ['required', new ValidAltcha], ]; } diff --git a/app/Http/Requests/MatrixRegisterRequest.php b/app/Http/Requests/MatrixRegisterRequest.php index d2951ef..fbf8221 100644 --- a/app/Http/Requests/MatrixRegisterRequest.php +++ b/app/Http/Requests/MatrixRegisterRequest.php @@ -12,7 +12,8 @@ class MatrixRegisterRequest extends FormRequest public function authorize(): bool { $isOldEnough = $this->user()->created_at->lt(now()->subMonth()); - $noAccount = !$this->user()->matrix_id; + $noAccount = ! $this->user()->matrix_id; + return $isOldEnough && $noAccount; } diff --git a/app/Http/Requests/ProfileUpdateRequest.php b/app/Http/Requests/ProfileUpdateRequest.php index d3cdaa8..8bf4946 100644 --- a/app/Http/Requests/ProfileUpdateRequest.php +++ b/app/Http/Requests/ProfileUpdateRequest.php @@ -21,7 +21,7 @@ class ProfileUpdateRequest extends FormRequest 'nullable', 'image', 'mimes:jpg,png,jpeg,webp,gif', - 'max:8192' + 'max:8192', ], 'email' => [ 'required', diff --git a/app/Jobs/DiscordReleaseNotification.php b/app/Jobs/DiscordReleaseNotification.php index 7397c1d..b3b3b6a 100644 --- a/app/Jobs/DiscordReleaseNotification.php +++ b/app/Jobs/DiscordReleaseNotification.php @@ -7,7 +7,6 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; - use Spatie\DiscordAlerts\Facades\DiscordAlert; class DiscordReleaseNotification implements ShouldQueue @@ -32,26 +31,25 @@ class DiscordReleaseNotification implements ShouldQueue */ public function handle(): void { - switch($this->messageType) - { + switch ($this->messageType) { case 'release': - DiscordAlert::message("<@&868457842250764289> (´• ω •`)ノ New **4k** Release! Check it out here: https://hstream.moe/hentai/".$this->slug); + DiscordAlert::message('<@&868457842250764289> (´• ω •`)ノ New **4k** Release! Check it out here: https://hstream.moe/hentai/'.$this->slug); break; case 'release-censored': - # Because Discord TOS - DiscordAlert::message("<@&868457842250764289> (´• ω •`)ノ New **4k** Release: ".$this->slug." - *No link here because of* :pLoli:"); + // Because Discord TOS + DiscordAlert::message('<@&868457842250764289> (´• ω •`)ノ New **4k** Release: '.$this->slug.' - *No link here because of* :pLoli:'); break; case 'update': - # 1080p 48fps added - DiscordAlert::to('update')->message("<@&1283518462584426598> (´• ω •`)ノ Added **48fps** to Release! Check it out here: https://hstream.moe/hentai/".$this->slug); + // 1080p 48fps added + DiscordAlert::to('update')->message('<@&1283518462584426598> (´• ω •`)ノ Added **48fps** to Release! Check it out here: https://hstream.moe/hentai/'.$this->slug); break; case 'updateUHD': - # 4k 48fps added - DiscordAlert::to('update')->message("<@&1326860920902778963> (´• ω •`)ノ Added **48fps 4k** to Release! Check it out here: https://hstream.moe/hentai/".$this->slug); + // 4k 48fps added + DiscordAlert::to('update')->message('<@&1326860920902778963> (´• ω •`)ノ Added **48fps 4k** to Release! Check it out here: https://hstream.moe/hentai/'.$this->slug); break; case 'v2': - # v2 re-release - DiscordAlert::to('rerelease')->message("<@&1425505303075754035> (´• ω •`)ノ **v2 Re-**Release! Check it out here: https://hstream.moe/hentai/".$this->slug); + // v2 re-release + DiscordAlert::to('rerelease')->message('<@&1425505303075754035> (´• ω •`)ノ **v2 Re-**Release! Check it out here: https://hstream.moe/hentai/'.$this->slug); break; default: break; diff --git a/app/Jobs/GetFileSizeFromCDN.php b/app/Jobs/GetFileSizeFromCDN.php index c935431..f1205c5 100644 --- a/app/Jobs/GetFileSizeFromCDN.php +++ b/app/Jobs/GetFileSizeFromCDN.php @@ -7,12 +7,12 @@ use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Http\Client\RequestException; +use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Queue\SerializesModels; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; -use Illuminate\Queue\InteractsWithQueue; -use Illuminate\Queue\SerializesModels; class GetFileSizeFromCDN implements ShouldQueue { @@ -35,8 +35,9 @@ class GetFileSizeFromCDN implements ShouldQueue { // Retrieve the download record, return if not found $download = Downloads::find($this->downloadId); - if (!$download) { + if (! $download) { Log::error("Download not found for ID: {$this->downloadId}"); + return; } @@ -52,7 +53,7 @@ class GetFileSizeFromCDN implements ShouldQueue try { // Send HTTP request to the endpoint - $response = Http::get($endpoint . '/getSize/' . $file . '/' . $expire); + $response = Http::get($endpoint.'/getSize/'.$file.'/'.$expire); // Check if response is successful if ($response->successful()) { @@ -67,9 +68,9 @@ class GetFileSizeFromCDN implements ShouldQueue Log::error("Failed to retrieve size for download ID: {$this->downloadId}, HTTP status: {$response->status()}"); } } catch (RequestException $e) { - Log::error("HTTP request failed for download ID: {$this->downloadId}, error: " . $e->getMessage()); + Log::error("HTTP request failed for download ID: {$this->downloadId}, error: ".$e->getMessage()); } catch (\Exception $e) { - Log::error("An error occurred for download ID: {$this->downloadId}, error: " . $e->getMessage()); + Log::error("An error occurred for download ID: {$this->downloadId}, error: ".$e->getMessage()); } } } diff --git a/app/Livewire/AdminCommentSearch.php b/app/Livewire/AdminCommentSearch.php index 54e5381..eac49d1 100644 --- a/app/Livewire/AdminCommentSearch.php +++ b/app/Livewire/AdminCommentSearch.php @@ -5,7 +5,6 @@ namespace App\Livewire; use App\Models\Comment; use Livewire\Component; use Livewire\WithPagination; -use Illuminate\Support\Facades\DB; class AdminCommentSearch extends Component { @@ -41,7 +40,7 @@ class AdminCommentSearch extends Component ->paginate(12); return view('livewire.admin-comment-search', [ - 'comments' => $comments + 'comments' => $comments, ]); } } diff --git a/app/Livewire/AdminUserSearch.php b/app/Livewire/AdminUserSearch.php index 16cfccd..e8ffae2 100644 --- a/app/Livewire/AdminUserSearch.php +++ b/app/Livewire/AdminUserSearch.php @@ -5,10 +5,9 @@ namespace App\Livewire; use App\Enums\UserRole; use App\Models\Comment; use App\Models\User; - +use Livewire\Attributes\Url; use Livewire\Component; use Livewire\WithPagination; -use Livewire\Attributes\Url; class AdminUserSearch extends Component { @@ -41,12 +40,12 @@ class AdminUserSearch extends Component { $users = User::when($this->patreon !== [], fn ($query) => $query->whereJsonContains('roles', UserRole::SUPPORTER->value)) ->when($this->banned !== [], fn ($query) => $query->whereJsonContains('roles', UserRole::BANNED->value)) - ->when($this->search !== '', fn ($query) => $query->where('name', 'like', '%'.$this->search.'%')) + ->when($this->search !== '', fn ($query) => $query->where('name', 'like', '%'.$this->search.'%')) ->when($this->discordId !== '', fn ($query) => $query->where('discord_id', '=', $this->discordId)) ->paginate(20); return view('livewire.admin-user-search', [ - 'users' => $users + 'users' => $users, ]); } } diff --git a/app/Livewire/BackgroundImages.php b/app/Livewire/BackgroundImages.php index 0b663bf..17ee633 100644 --- a/app/Livewire/BackgroundImages.php +++ b/app/Livewire/BackgroundImages.php @@ -2,12 +2,11 @@ namespace App\Livewire; -use Livewire\Component; -use Livewire\WithPagination; -use Livewire\Attributes\Url; - use App\Models\SiteBackground; use Illuminate\Support\Carbon; +use Livewire\Attributes\Url; +use Livewire\Component; +use Livewire\WithPagination; class BackgroundImages extends Component { @@ -19,17 +18,15 @@ class BackgroundImages extends Component public function render() { $now = Carbon::now(); - - $images = SiteBackground::when($this->filter === 'active', fn ($query) => - $query->whereDate('date_start', '<=', $now)->whereDate('date_end', '>=', $now) - ) - ->when($this->filter === 'inactive', fn ($query) => - $query->whereDate('date_start', '>', $now)->orWhereDate('date_end', '<', $now) + + $images = SiteBackground::when($this->filter === 'active', fn ($query) => $query->whereDate('date_start', '<=', $now)->whereDate('date_end', '>=', $now) + ) + ->when($this->filter === 'inactive', fn ($query) => $query->whereDate('date_start', '>', $now)->orWhereDate('date_end', '<', $now) ) ->paginate(10); return view('livewire.background-images', [ - 'images' => $images + 'images' => $images, ]); } } diff --git a/app/Livewire/Comment.php b/app/Livewire/Comment.php index 9fe9bf8..9bb3c91 100644 --- a/app/Livewire/Comment.php +++ b/app/Livewire/Comment.php @@ -1,20 +1,16 @@ '' + 'body' => '', ]; public $isEditing = false; public $editState = [ - 'body' => '' + 'body' => '', ]; protected $listeners = [ - 'refresh' => '$refresh' + 'refresh' => '$refresh', ]; protected $validationAttributes = [ - 'replyState.body' => 'reply' + 'replyState.body' => 'reply', ]; public function updatedIsEditing($isEditing) @@ -54,7 +50,7 @@ class Comment extends Component } $this->editState = [ - 'body' => $this->comment->body + 'body' => $this->comment->body, ]; } @@ -73,13 +69,14 @@ class Comment extends Component $this->comment->delete(); - $this->dispatch('refresh'); + $this->dispatch('refresh'); } public function postReply() { - if (!($this->comment->depth() < 2)) { - $this->addError('replyState.body', "Too many sub comments."); + if (! ($this->comment->depth() < 2)) { + $this->addError('replyState.body', 'Too many sub comments.'); + return; } @@ -91,13 +88,14 @@ class Comment extends Component $seconds = RateLimiter::availableIn($rateLimitKey); $this->addError('replyState.body', "Too many comments. Try again in {$seconds} seconds."); + return; } RateLimiter::hit($rateLimitKey, $rateLimitMinutes); $this->validate([ - 'replyState.body' => 'required' + 'replyState.body' => 'required', ]); $reply = $this->comment->children()->make($this->replyState); @@ -110,25 +108,25 @@ class Comment extends Component if ($reply->commentable_type == Episode::class && $user->id !== $reply->parent->user->id) { $episode = Episode::where('id', $reply->commentable_id) ->firstOrFail(); - + $url = route('hentai.index', ['title' => $episode->slug]); $reply->parent->user->notify( new CommentNotification( - "{$user->name} replied to your comment.", - Str::limit($reply->body, 50), + "{$user->name} replied to your comment.", + Str::limit($reply->body, 50), "{$url}#comment-{$reply->id}" ) ); } $this->replyState = [ - 'body' => '' + 'body' => '', ]; $this->isReplying = false; - $this->dispatch('refresh')->self(); + $this->dispatch('refresh')->self(); } public function like() @@ -144,6 +142,7 @@ class Comment extends Component if ($this->liked) { $this->liked = false; $this->likeCount--; + return; } @@ -163,4 +162,4 @@ class Comment extends Component { return view('livewire.comment'); } -} \ No newline at end of file +} diff --git a/app/Livewire/Comments.php b/app/Livewire/Comments.php index 156ef60..c26a34d 100644 --- a/app/Livewire/Comments.php +++ b/app/Livewire/Comments.php @@ -2,11 +2,10 @@ namespace App\Livewire; +use Illuminate\Support\Facades\RateLimiter; use Livewire\Component; use Livewire\WithPagination; -use Illuminate\Support\Facades\RateLimiter; - class Comments extends Component { use WithPagination; @@ -14,21 +13,21 @@ class Comments extends Component public $model; public $newCommentState = [ - 'body' => '' + 'body' => '', ]; protected $validationAttributes = [ - 'newCommentState.body' => 'comment' + 'newCommentState.body' => 'comment', ]; protected $listeners = [ - 'refresh' => '$refresh' + 'refresh' => '$refresh', ]; public function postComment() { $this->validate([ - 'newCommentState.body' => 'required' + 'newCommentState.body' => 'required', ]); $user = auth()->user(); @@ -39,6 +38,7 @@ class Comments extends Component $seconds = RateLimiter::availableIn($rateLimitKey); $this->addError('newCommentState.body', "Too many comments. Try again in {$seconds} seconds."); + return; } @@ -49,7 +49,7 @@ class Comments extends Component $comment->save(); $this->newCommentState = [ - 'body' => '' + 'body' => '', ]; $this->resetPage(); @@ -65,7 +65,7 @@ class Comments extends Component ->paginate(50); return view('livewire.comments', [ - 'comments' => $comments + 'comments' => $comments, ]); } -} \ No newline at end of file +} diff --git a/app/Livewire/DownloadButton.php b/app/Livewire/DownloadButton.php index 9bd680f..a02f62e 100644 --- a/app/Livewire/DownloadButton.php +++ b/app/Livewire/DownloadButton.php @@ -18,7 +18,7 @@ class DownloadButton extends Component public $fillNumbers; public $fileSize; - + public $background = 'bg-rose-600'; public $fileExtension = 'HEVC'; @@ -33,7 +33,7 @@ class DownloadButton extends Component public function clicked($downloadId) { $download = Downloads::find($downloadId); - if (!$download) { + if (! $download) { return; } diff --git a/app/Livewire/DownloadsFree.php b/app/Livewire/DownloadsFree.php index a27a385..944d230 100644 --- a/app/Livewire/DownloadsFree.php +++ b/app/Livewire/DownloadsFree.php @@ -5,11 +5,9 @@ namespace App\Livewire; use App\Models\Episode; use App\Models\User; use App\Models\UserDownload; - -use Livewire\Component; - use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Auth; +use Livewire\Component; class DownloadsFree extends Component { @@ -51,6 +49,7 @@ class DownloadsFree extends Component if (Carbon::parse($alreadyDownloaded->created_at)->addHours(6) <= Carbon::now()) { // Already expired $alreadyDownloaded->delete(); + return; } @@ -65,6 +64,7 @@ class DownloadsFree extends Component if ($user->downloads_left <= 0) { // Daily limit reached $this->granted = 3; + return; } @@ -75,9 +75,9 @@ class DownloadsFree extends Component $this->granted = 1; UserDownload::create([ - 'user_id' => $user->id, - 'episode_id' => $this->episodeId, - 'interpolated' => $this->interpolated, + 'user_id' => $user->id, + 'episode_id' => $this->episodeId, + 'interpolated' => $this->interpolated, ]); } diff --git a/app/Livewire/DownloadsSearch.php b/app/Livewire/DownloadsSearch.php index 6de27e8..8b91890 100644 --- a/app/Livewire/DownloadsSearch.php +++ b/app/Livewire/DownloadsSearch.php @@ -3,9 +3,9 @@ namespace App\Livewire; use App\Models\Downloads; +use Livewire\Attributes\Url; use Livewire\Component; use Livewire\WithPagination; -use Livewire\Attributes\Url; class DownloadsSearch extends Component { @@ -17,7 +17,7 @@ class DownloadsSearch extends Component public $order = 'created_at_desc'; public $options = [ - 'FHD' => true, + 'FHD' => true, 'FHD 48fps' => true, ]; @@ -25,24 +25,25 @@ class DownloadsSearch extends Component #[Url(history: true)] public $studios = []; + public $studiosCopy = []; // To toggle individual option selection public function toggleOption($option) { - $this->options[$option] = !$this->options[$option]; + $this->options[$option] = ! $this->options[$option]; $this->resetPage(); } // To toggle dropdown visibility public function toggleDropdown() { - $this->isOpen = !$this->isOpen; + $this->isOpen = ! $this->isOpen; } protected $queryString = [ - 'fileSearch' => ['except' => '', 'as' => 'fS'], - 'order' => ['except' => '', 'as' => 'order'], + 'fileSearch' => ['except' => '', 'as' => 'fS'], + 'order' => ['except' => '', 'as' => 'order'], ]; public function updatingFileSearch() @@ -87,7 +88,7 @@ class DownloadsSearch extends Component public function clicked($downloadId) { $download = Downloads::find($downloadId); - if (!$download) { + if (! $download) { return; } @@ -96,9 +97,9 @@ class DownloadsSearch extends Component cache()->forget("episode_{$download->episode->id}_download_{$download->type}"); } - public function mount() + public function mount() { - if (!auth()->user()->hasRole(\App\Enums\UserRole::SUPPORTER)) { + if (! auth()->user()->hasRole(\App\Enums\UserRole::SUPPORTER)) { return; } @@ -144,15 +145,17 @@ class DownloadsSearch extends Component $downloads = Downloads::when($this->fileSearch != '', fn ($query) => $query->where('url', 'like', '%'.$this->fileSearch.'%')) ->whereIn('type', $this->getSelectedTypes()) - ->when($this->studios !== [], fn ($q) => $q->whereHas('episode', fn ($query) => $query->whereHas('studio', function ($query) { $query->whereIn('slug', $this->studios); }))) + ->when($this->studios !== [], fn ($q) => $q->whereHas('episode', fn ($query) => $query->whereHas('studio', function ($query) { + $query->whereIn('slug', $this->studios); + }))) ->whereNotNull('size') ->orderBy($orderby, $orderdirection) ->paginate(20); return view('livewire.downloads-search', [ - 'downloads' => $downloads, - 'query' => $this->fileSearch, - 'studiocount' => is_array($this->studios) ? count($this->studios) : 0, + 'downloads' => $downloads, + 'query' => $this->fileSearch, + 'studiocount' => is_array($this->studios) ? count($this->studios) : 0, ]); } } diff --git a/app/Livewire/LikeButton.php b/app/Livewire/LikeButton.php index cf51f65..c07f12e 100644 --- a/app/Livewire/LikeButton.php +++ b/app/Livewire/LikeButton.php @@ -4,10 +4,9 @@ namespace App\Livewire; use App\Models\Episode; use App\Models\User; -use Livewire\Component; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Cache; - +use Livewire\Component; use Maize\Markable\Models\Like; class LikeButton extends Component @@ -52,6 +51,7 @@ class LikeButton extends Component if ($this->liked) { $this->liked = false; $this->likeCount--; + return; } diff --git a/app/Livewire/LiveSearch.php b/app/Livewire/LiveSearch.php index f83559a..acb5c80 100644 --- a/app/Livewire/LiveSearch.php +++ b/app/Livewire/LiveSearch.php @@ -3,10 +3,10 @@ namespace App\Livewire; use App\Models\Episode; +use Illuminate\Support\Facades\Auth; +use Livewire\Attributes\Url; use Livewire\Component; use Livewire\WithPagination; -use Livewire\Attributes\Url; -use Illuminate\Support\Facades\Auth; class LiveSearch extends Component { @@ -20,14 +20,17 @@ class LiveSearch extends Component #[Url(history: true)] public $tags = []; + public $tagsCopy = []; #[Url(history: true)] public $studios = []; + public $studiosCopy = []; #[Url(history: true)] public $blacklist = []; + public $blacklistCopy = []; #[Url(history: true)] @@ -72,7 +75,7 @@ class LiveSearch extends Component public function mount() { // User blacklist - if (Auth::check() && empty($this->blacklist) && !empty(auth()->user()->tag_blacklist)) { + if (Auth::check() && empty($this->blacklist) && ! empty(auth()->user()->tag_blacklist)) { $this->blacklist = auth()->user()->tag_blacklist; } @@ -118,11 +121,15 @@ class LiveSearch extends Component } $user_id = Auth::check() ? auth()->user()->id : 0; - $episodes = Episode::with('gallery')->when($this->search != '', fn ($query) => $query->where(function($query) { $query->where('title', 'like', '%'.$this->search.'%')->orWhere('title_search', 'like', '%'.$this->search.'%')->orWhere('title_jpn', 'like', '%'.$this->search.'%'); })) - ->when($this->tags !== [], fn ($query) => $query->withAllTags($this->tags)) - ->when($this->blacklist !== [], fn ($query) => $query->withoutTags($this->blacklist)) - ->when($this->studios !== [], fn ($query) => $query->whereHas('studio', function ($query) { $query->whereIn('slug', $this->studios); })) - ->when($this->hideWatched !== [] && Auth::check(), fn ($query) => $query->whereDoesntHave('watched', function ($query) use ($user_id) { + $episodes = Episode::with('gallery')->when($this->search != '', fn ($query) => $query->where(function ($query) { + $query->where('title', 'like', '%'.$this->search.'%')->orWhere('title_search', 'like', '%'.$this->search.'%')->orWhere('title_jpn', 'like', '%'.$this->search.'%'); + })) + ->when($this->tags !== [], fn ($query) => $query->withAllTags($this->tags)) + ->when($this->blacklist !== [], fn ($query) => $query->withoutTags($this->blacklist)) + ->when($this->studios !== [], fn ($query) => $query->whereHas('studio', function ($query) { + $query->whereIn('slug', $this->studios); + })) + ->when($this->hideWatched !== [] && Auth::check(), fn ($query) => $query->whereDoesntHave('watched', function ($query) use ($user_id) { $query->where('user_id', $user_id); })) ->when(Auth::guest(), fn ($query) => $query->withoutTags(['loli', 'shota'])) @@ -140,16 +147,16 @@ class LiveSearch extends Component $this->dispatch('contentChanged'); return view('livewire.live-search', [ - 'episodes' => $episodes, - 'tagcount' => is_array($this->tags) ? count($this->tags) : 0, - 'studiocount' => is_array($this->studios) ? count($this->studios) : 0, - 'blacklistcount' => is_array($this->blacklist) ? count($this->blacklist) : 0, - 'query' => $this->search, - 'selectedtags' => $this->tags, - 'selectedstudios' => $this->studios, + 'episodes' => $episodes, + 'tagcount' => is_array($this->tags) ? count($this->tags) : 0, + 'studiocount' => is_array($this->studios) ? count($this->studios) : 0, + 'blacklistcount' => is_array($this->blacklist) ? count($this->blacklist) : 0, + 'query' => $this->search, + 'selectedtags' => $this->tags, + 'selectedstudios' => $this->studios, 'selectedblacklist' => $this->blacklist, - 'searchIsJpn' => $searchIsJpn, - 'view' => $this->view, + 'searchIsJpn' => $searchIsJpn, + 'view' => $this->view, ]); } } diff --git a/app/Livewire/NavLiveSearch.php b/app/Livewire/NavLiveSearch.php index e1996da..12f9cf7 100644 --- a/app/Livewire/NavLiveSearch.php +++ b/app/Livewire/NavLiveSearch.php @@ -3,8 +3,8 @@ namespace App\Livewire; use App\Models\Episode; -use Livewire\Component; use Illuminate\Support\Facades\Auth; +use Livewire\Component; class NavLiveSearch extends Component { @@ -25,9 +25,9 @@ class NavLiveSearch extends Component } return view('livewire.nav-live-search', [ - 'episodes' => $episodes, - 'query' => $this->navSearch, - 'hide' => empty($this->navSearch), + 'episodes' => $episodes, + 'query' => $this->navSearch, + 'hide' => empty($this->navSearch), ]); } } diff --git a/app/Livewire/PlaylistOverview.php b/app/Livewire/PlaylistOverview.php index 6cf6b4c..a07e867 100644 --- a/app/Livewire/PlaylistOverview.php +++ b/app/Livewire/PlaylistOverview.php @@ -5,13 +5,11 @@ namespace App\Livewire; use App\Models\Playlist; use App\Models\PlaylistEpisode; use App\Services\PlaylistService; - +use Illuminate\Database\Eloquent\Collection; +use Illuminate\Support\Facades\Auth; +use Livewire\Attributes\Url; use Livewire\Component; use Livewire\WithPagination; -use Livewire\Attributes\Url; - -use Illuminate\Support\Facades\Auth; -use Illuminate\Database\Eloquent\Collection; class PlaylistOverview extends Component { diff --git a/app/Livewire/Playlists.php b/app/Livewire/Playlists.php index 2ca5878..e676cd5 100644 --- a/app/Livewire/Playlists.php +++ b/app/Livewire/Playlists.php @@ -3,10 +3,9 @@ namespace App\Livewire; use App\Models\Playlist; - +use Livewire\Attributes\Url; use Livewire\Component; use Livewire\WithPagination; -use Livewire\Attributes\Url; class Playlists extends Component { @@ -54,12 +53,12 @@ class Playlists extends Component $playlists = Playlist::where('is_private', 0) ->withCount('episodes') ->having('episodes_count', '>', 1) - ->when($this->search != '', fn($query) => $query->where('name', 'like', '%' . $this->search . '%')) + ->when($this->search != '', fn ($query) => $query->where('name', 'like', '%'.$this->search.'%')) ->orderBy($orderby, $orderdirection) ->paginate($this->pagination); return view('livewire.playlists', [ - 'playlists' => $playlists + 'playlists' => $playlists, ]); } } diff --git a/app/Livewire/UserComments.php b/app/Livewire/UserComments.php index 010dfbb..3fcc377 100644 --- a/app/Livewire/UserComments.php +++ b/app/Livewire/UserComments.php @@ -3,7 +3,6 @@ namespace App\Livewire; use App\Models\Comment; - use Livewire\Component; use Livewire\WithPagination; @@ -36,14 +35,13 @@ class UserComments extends Component $orderdirection = 'desc'; } - $comments = Comment::where('user_id', $this->model->id) ->when($this->commentSearch != '', fn ($query) => $query->where('body', 'like', '%'.$this->commentSearch.'%')) ->orderBy($orderby, $orderdirection) ->paginate(10); return view('livewire.user-comments', [ - 'comments' => $comments + 'comments' => $comments, ]); } } diff --git a/app/Livewire/UserLikes.php b/app/Livewire/UserLikes.php index 4efc17b..199213a 100644 --- a/app/Livewire/UserLikes.php +++ b/app/Livewire/UserLikes.php @@ -3,10 +3,10 @@ namespace App\Livewire; use App\Models\Episode; +use Illuminate\Support\Facades\Auth; +use Livewire\Attributes\Url; use Livewire\Component; use Livewire\WithPagination; -use Livewire\Attributes\Url; -use Illuminate\Support\Facades\Auth; class UserLikes extends Component { @@ -20,14 +20,17 @@ class UserLikes extends Component #[Url(history: true)] public $tags = []; + public $tagsCopy = []; #[Url(history: true)] public $studios = []; + public $studiosCopy = []; #[Url(history: true)] public $blacklist = []; + public $blacklistCopy = []; #[Url(history: true)] @@ -72,7 +75,7 @@ class UserLikes extends Component public function mount() { // User blacklist - if (Auth::check() && empty($this->blacklist) && !empty(auth()->user()->tag_blacklist)) { + if (Auth::check() && empty($this->blacklist) && ! empty(auth()->user()->tag_blacklist)) { $this->blacklist = auth()->user()->tag_blacklist; } @@ -119,11 +122,15 @@ class UserLikes extends Component $user_id = Auth::check() ? auth()->user()->id : 0; $episodes = Episode::whereHasLike(auth()->user()) - ->when($this->search !== '', fn ($query) => $query->where(function($query) { $query->where('title', 'like', '%'.$this->search.'%')->orWhere('title_search', 'like', '%'.$this->search.'%')->orWhere('title_jpn', 'like', '%'.$this->search.'%'); })) - ->when($this->tags !== [], fn ($query) => $query->withAllTags($this->tags)) - ->when($this->blacklist !== [], fn ($query) => $query->withoutTags($this->blacklist)) - ->when($this->studios !== [], fn ($query) => $query->whereHas('studio', function ($query) { $query->whereIn('slug', $this->studios); })) - ->when($this->hideWatched !== [] && Auth::check(), fn ($query) => $query->whereDoesntHave('watched', function ($query) use ($user_id) { + ->when($this->search !== '', fn ($query) => $query->where(function ($query) { + $query->where('title', 'like', '%'.$this->search.'%')->orWhere('title_search', 'like', '%'.$this->search.'%')->orWhere('title_jpn', 'like', '%'.$this->search.'%'); + })) + ->when($this->tags !== [], fn ($query) => $query->withAllTags($this->tags)) + ->when($this->blacklist !== [], fn ($query) => $query->withoutTags($this->blacklist)) + ->when($this->studios !== [], fn ($query) => $query->whereHas('studio', function ($query) { + $query->whereIn('slug', $this->studios); + })) + ->when($this->hideWatched !== [] && Auth::check(), fn ($query) => $query->whereDoesntHave('watched', function ($query) use ($user_id) { $query->where('user_id', $user_id); })) ->orderBy($orderby, $orderdirection) @@ -137,16 +144,16 @@ class UserLikes extends Component } return view('livewire.user-likes', [ - 'episodes' => $episodes, - 'tagcount' => is_array($this->tags) ? count($this->tags) : 0, - 'studiocount' => is_array($this->studios) ? count($this->studios) : 0, - 'blacklistcount' => is_array($this->blacklist) ? count($this->blacklist) : 0, - 'query' => $this->search, - 'selectedtags' => $this->tags, - 'selectedstudios' => $this->studios, + 'episodes' => $episodes, + 'tagcount' => is_array($this->tags) ? count($this->tags) : 0, + 'studiocount' => is_array($this->studios) ? count($this->studios) : 0, + 'blacklistcount' => is_array($this->blacklist) ? count($this->blacklist) : 0, + 'query' => $this->search, + 'selectedtags' => $this->tags, + 'selectedstudios' => $this->studios, 'selectedblacklist' => $this->blacklist, - 'searchIsJpn' => $searchIsJpn, - 'view' => $this->view, + 'searchIsJpn' => $searchIsJpn, + 'view' => $this->view, ]); } } diff --git a/app/Livewire/Watched.php b/app/Livewire/Watched.php index bff5591..ada16bc 100644 --- a/app/Livewire/Watched.php +++ b/app/Livewire/Watched.php @@ -3,7 +3,6 @@ namespace App\Livewire; use App\Models\Watched as UserWatched; -use App\Models\User; use Illuminate\Support\Carbon; use Livewire\Component; use Livewire\WithPagination; @@ -14,7 +13,7 @@ class Watched extends Component public $userId; - public function mount($user) + public function mount($user) { $this->userId = $user ? $user->id : auth()->user()->id; } @@ -27,8 +26,8 @@ class Watched extends Component }); return view('livewire.watched', [ - 'watched' => $watched, - 'watchedGrouped' => $watchedGrouped, + 'watched' => $watched, + 'watchedGrouped' => $watchedGrouped, ]); } } diff --git a/app/Models/Comment.php b/app/Models/Comment.php index cc92d83..2baaa16 100644 --- a/app/Models/Comment.php +++ b/app/Models/Comment.php @@ -4,19 +4,18 @@ namespace App\Models; use App\Models\Presenters\CommentPresenter; use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Eloquent\SoftDeletes; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Factories\HasFactory; - +use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\SoftDeletes; use Maize\Markable\Markable; use Maize\Markable\Models\Like; class Comment extends Model { - use HasFactory, SoftDeletes, Markable; + use HasFactory, Markable, SoftDeletes; protected static $marks = [ - Like::class + Like::class, ]; /** @@ -25,7 +24,7 @@ class Comment extends Model * @var string[] */ protected $fillable = [ - 'body' + 'body', ]; public function presenter() @@ -71,6 +70,6 @@ class Comment extends Model */ public function likeCount(): int { - return cache()->remember('commentLikes' . $this->id, 300, fn() => $this->likes->count()); + return cache()->remember('commentLikes'.$this->id, 300, fn () => $this->likes->count()); } } diff --git a/app/Models/Downloads.php b/app/Models/Downloads.php index fe3b3ea..38ac060 100644 --- a/app/Models/Downloads.php +++ b/app/Models/Downloads.php @@ -39,7 +39,7 @@ class Downloads extends Model $bytes /= 1024; } - return round($bytes, 2) . ' ' . $units[$i]; + return round($bytes, 2).' '.$units[$i]; } /** diff --git a/app/Models/Episode.php b/app/Models/Episode.php index 31ef83d..e7580ea 100644 --- a/app/Models/Episode.php +++ b/app/Models/Episode.php @@ -2,35 +2,28 @@ namespace App\Models; -use App\Models\Downloads; -use App\Models\PopularMonthly; -use App\Models\PopularWeekly; -use App\Models\PopularDaily; - use Conner\Tagging\Taggable; -use Laravel\Scout\Searchable; -use Maize\Markable\Markable; -use Maize\Markable\Models\Like; - -use Spatie\Sitemap\Contracts\Sitemapable; -use Spatie\Sitemap\Tags\Url; - -use Illuminate\Support\Carbon; -use Illuminate\Support\Facades\Cache; -use Illuminate\Support\Facades\DB; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Support\Carbon; +use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Facades\DB; +use Laravel\Scout\Searchable; +use Maize\Markable\Markable; +use Maize\Markable\Models\Like; +use Spatie\Sitemap\Contracts\Sitemapable; +use Spatie\Sitemap\Tags\Url; class Episode extends Model implements Sitemapable { - use Markable, Taggable; use HasFactory; + use Markable, Taggable; use Searchable; protected static $marks = [ - Like::class + Like::class, ]; /** @@ -49,14 +42,14 @@ class Episode extends Model implements Sitemapable public function toSearchableArray() { return [ - 'title' => $this->title, - 'title_search' => $this->title_search, - 'title_jpn' => $this->title_jpn, - 'slug' => $this->slug, - 'description' => $this->description, - 'tags' => $this->tagNames(), - 'release_date' => $this->release_date, - 'created_at' => $this->created_at, + 'title' => $this->title, + 'title_search' => $this->title_search, + 'title_jpn' => $this->title_jpn, + 'slug' => $this->slug, + 'description' => $this->description, + 'tags' => $this->tagNames(), + 'release_date' => $this->release_date, + 'created_at' => $this->created_at, ]; } @@ -125,7 +118,7 @@ class Episode extends Model implements Sitemapable */ public function viewCount(): int { - return cache()->remember('episodeViews' . $this->id, 300, fn() => $this->view_count); + return cache()->remember('episodeViews'.$this->id, 300, fn () => $this->view_count); } /** @@ -141,7 +134,7 @@ class Episode extends Model implements Sitemapable $index = floor(log($this->viewCount(), 1000)); $shortNumber = $this->viewCount() / pow(1000, $index); - return round($shortNumber, 0) . $units[$index - 1]; + return round($shortNumber, 0).$units[$index - 1]; } /** @@ -149,7 +142,7 @@ class Episode extends Model implements Sitemapable */ public function likeCount(): int { - return cache()->remember('episodeLikes' . $this->id, 300, fn() => $this->likes->count()); + return cache()->remember('episodeLikes'.$this->id, 300, fn () => $this->likes->count()); } /** @@ -157,7 +150,7 @@ class Episode extends Model implements Sitemapable */ public function commentCount(): int { - return cache()->remember('episodeComments' . $this->id, 300, fn() => $this->comments->count()); + return cache()->remember('episodeComments'.$this->id, 300, fn () => $this->comments->count()); } public function comments() @@ -180,6 +173,7 @@ class Episode extends Model implements Sitemapable $problematicResults .= $pTag; } + return $problematicResults; } @@ -202,17 +196,17 @@ class Episode extends Model implements Sitemapable */ public function hasAutoTrans(): bool { - return cache()->remember('mt' . $this->id, 900, fn() => $this->subtitles()->exists()); + return cache()->remember('mt'.$this->id, 900, fn () => $this->subtitles()->exists()); } public function is48Fps(): bool { - return cache()->remember('48fps' . $this->id, 900, fn() => $this->interpolated); + return cache()->remember('48fps'.$this->id, 900, fn () => $this->interpolated); } public function isUHD48Fps(): bool { - return cache()->remember('48fpsUHD' . $this->id, 900, fn() => $this->interpolated_uhd); + return cache()->remember('48fpsUHD'.$this->id, 900, fn () => $this->interpolated_uhd); } public function getResolution(): string @@ -226,7 +220,7 @@ class Episode extends Model implements Sitemapable public function userWatched(int $user_id): bool { - return cache()->remember('user' . $user_id . 'watched' . $this->id, 300, fn() => Watched::where('user_id', $user_id)->where('episode_id', $this->id)->exists()); + return cache()->remember('user'.$user_id.'watched'.$this->id, 300, fn () => Watched::where('user_id', $user_id)->where('episode_id', $this->id)->exists()); } public function watched(): HasMany @@ -234,15 +228,16 @@ class Episode extends Model implements Sitemapable return $this->hasMany(Watched::class); } - public function getDownloadByType(string $type): Downloads | null + public function getDownloadByType(string $type): ?Downloads { $cacheKey = "episode_{$this->id}_download_{$type}"; + return Cache::remember($cacheKey, now()->addMinutes(10), function () use ($type) { return $this->downloads()->where('type', $type)->first(); }); } - public function toSitemapTag(): Url | string | array + public function toSitemapTag(): Url|string|array { return Url::create(route('hentai.index', $this->slug)) ->setLastModificationDate(Carbon::create($this->created_at)); diff --git a/app/Models/Hentai.php b/app/Models/Hentai.php index 2c5430a..9cd68c5 100644 --- a/app/Models/Hentai.php +++ b/app/Models/Hentai.php @@ -2,19 +2,18 @@ namespace App\Models; +use Conner\Tagging\Taggable; +use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Carbon; +use Illuminate\Support\Facades\Cache; use Spatie\Sitemap\Contracts\Sitemapable; use Spatie\Sitemap\Tags\Url; -use Illuminate\Support\Facades\Cache; -use Illuminate\Support\Carbon; -use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Model; -use Conner\Tagging\Taggable; - class Hentai extends Model implements Sitemapable { - use Taggable; use HasFactory; + use Taggable; /** * The attributes that are mass assignable. @@ -31,7 +30,7 @@ class Hentai extends Model implements Sitemapable return $this->hasMany(Episode::class, 'hentai_id'); } - public function title(): String + public function title(): string { return $this->episodes->first()->title; } @@ -63,7 +62,7 @@ class Hentai extends Model implements Sitemapable ); } - public function toSitemapTag(): Url | string | array + public function toSitemapTag(): Url|string|array { return Url::create(route('hentai.index', $this->slug)) ->setLastModificationDate(Carbon::create($this->created_at)); diff --git a/app/Models/Playlist.php b/app/Models/Playlist.php index ece040b..e353e3d 100644 --- a/app/Models/Playlist.php +++ b/app/Models/Playlist.php @@ -2,8 +2,8 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\HasMany; class Playlist extends Model { diff --git a/app/Models/PlaylistEpisode.php b/app/Models/PlaylistEpisode.php index 3c12bf8..ebfa928 100644 --- a/app/Models/PlaylistEpisode.php +++ b/app/Models/PlaylistEpisode.php @@ -2,8 +2,8 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class PlaylistEpisode extends Model { diff --git a/app/Models/PopularDaily.php b/app/Models/PopularDaily.php index d35918e..3bafb27 100644 --- a/app/Models/PopularDaily.php +++ b/app/Models/PopularDaily.php @@ -13,7 +13,7 @@ class PopularDaily extends Model * * @var string[] */ - protected $fillable = [ 'episode_id' ]; + protected $fillable = ['episode_id']; /** * Get the Episode. diff --git a/app/Models/PopularMonthly.php b/app/Models/PopularMonthly.php index 82d8b9a..6abb567 100644 --- a/app/Models/PopularMonthly.php +++ b/app/Models/PopularMonthly.php @@ -13,7 +13,7 @@ class PopularMonthly extends Model * * @var string[] */ - protected $fillable = [ 'episode_id' ]; + protected $fillable = ['episode_id']; /** * Get the Episode. diff --git a/app/Models/PopularWeekly.php b/app/Models/PopularWeekly.php index 0b97c9d..44deec4 100644 --- a/app/Models/PopularWeekly.php +++ b/app/Models/PopularWeekly.php @@ -13,7 +13,7 @@ class PopularWeekly extends Model * * @var string[] */ - protected $fillable = [ 'episode_id' ]; + protected $fillable = ['episode_id']; /** * Get the Episode. diff --git a/app/Models/Presenters/CommentPresenter.php b/app/Models/Presenters/CommentPresenter.php index 645f85f..a0787a8 100644 --- a/app/Models/Presenters/CommentPresenter.php +++ b/app/Models/Presenters/CommentPresenter.php @@ -25,4 +25,4 @@ class CommentPresenter { return $this->comment->created_at->diffForHumans(); } -} \ No newline at end of file +} diff --git a/app/Models/SiteBackground.php b/app/Models/SiteBackground.php index bb66e6e..c958d43 100644 --- a/app/Models/SiteBackground.php +++ b/app/Models/SiteBackground.php @@ -4,7 +4,6 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Carbon; -use Illuminate\Support\Collection; class SiteBackground extends Model { @@ -16,19 +15,19 @@ class SiteBackground extends Model protected $fillable = [ 'date_start', 'date_end', - 'default' + 'default', ]; /** * Returns the current IDs of active wallpaper */ - public function getImages(): ? \Illuminate\Support\Collection + public function getImages(): ?\Illuminate\Support\Collection { $now = Carbon::now(); $byDates = $this->whereDate('date_start', '<=', $now)->whereDate('date_end', '>=', $now)->get()->pluck('id'); $default = $this->where('default', true)->get()->pluck('id'); - + return $byDates->isEmpty() ? $default : $byDates; } } diff --git a/app/Models/Studios.php b/app/Models/Studios.php index 1f0ac81..75a86d1 100644 --- a/app/Models/Studios.php +++ b/app/Models/Studios.php @@ -3,13 +3,13 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\HasMany; class Studios extends Model { use HasFactory; - + /** * The attributes that are mass assignable. * diff --git a/app/Models/User.php b/app/Models/User.php index a78ddf1..7375f9b 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2,16 +2,15 @@ namespace App\Models; -//use Illuminate\Contracts\Auth\MustVerifyEmail; +// use Illuminate\Contracts\Auth\MustVerifyEmail; use App\Enums\UserRole; -use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; -use Illuminate\Support\Facades\Storage; - use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Storage; class User extends Authenticatable { @@ -62,7 +61,6 @@ class User extends Authenticatable 'discord_avatar' => 'string', ]; - /** * Has Many Playlists. */ @@ -100,7 +98,7 @@ class User extends Authenticatable */ public function commentCount(): int { - return cache()->remember('userComments' . $this->id, 300, fn() => $this->comments->count()); + return cache()->remember('userComments'.$this->id, 300, fn () => $this->comments->count()); } /** @@ -108,13 +106,11 @@ class User extends Authenticatable */ public function getAvatar(): string { - if ($this->discord_id && $this->discord_avatar && !$this->avatar) - { + if ($this->discord_id && $this->discord_avatar && ! $this->avatar) { return "https://external-content.duckduckgo.com/iu/?u={$this->discord_avatar}"; } - if ($this->avatar) - { + if ($this->avatar) { return Storage::url($this->avatar); } @@ -153,7 +149,7 @@ class User extends Authenticatable */ public function removeRole(UserRole $role): void { - if (!$this->hasRole($role)) { + if (! $this->hasRole($role)) { return; } diff --git a/app/Models/UserDownload.php b/app/Models/UserDownload.php index 40f5d70..0854ea7 100644 --- a/app/Models/UserDownload.php +++ b/app/Models/UserDownload.php @@ -2,8 +2,8 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class UserDownload extends Model { diff --git a/app/Models/Watched.php b/app/Models/Watched.php index 2fdb8d8..c128b7c 100644 --- a/app/Models/Watched.php +++ b/app/Models/Watched.php @@ -2,8 +2,8 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class Watched extends Model { diff --git a/app/Notifications/CommentNotification.php b/app/Notifications/CommentNotification.php index 1e8f202..8364c68 100644 --- a/app/Notifications/CommentNotification.php +++ b/app/Notifications/CommentNotification.php @@ -3,8 +3,6 @@ namespace App\Notifications; use Illuminate\Bus\Queueable; -use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; class CommentNotification extends Notification @@ -12,7 +10,9 @@ class CommentNotification extends Notification use Queueable; protected $type; + protected $message; + protected $url; /** @@ -38,9 +38,9 @@ class CommentNotification extends Notification public function toDatabase($notifiable) { return [ - 'type' => $this->type, - 'message' => $this->message, - 'url' => $this->url, + 'type' => $this->type, + 'message' => $this->message, + 'url' => $this->url, ]; } } diff --git a/app/Policies/CommentPolicy.php b/app/Policies/CommentPolicy.php index 4f52686..09784d2 100644 --- a/app/Policies/CommentPolicy.php +++ b/app/Policies/CommentPolicy.php @@ -2,8 +2,8 @@ namespace App\Policies; -use App\Models\User; use App\Models\Comment; +use App\Models\User; use Illuminate\Auth\Access\HandlesAuthorization; class CommentPolicy @@ -19,4 +19,4 @@ class CommentPolicy { return $user->id === $comment->user_id; } -} \ No newline at end of file +} diff --git a/app/Services/DownloadService.php b/app/Services/DownloadService.php index 449751a..fbb3d12 100644 --- a/app/Services/DownloadService.php +++ b/app/Services/DownloadService.php @@ -2,11 +2,9 @@ namespace App\Services; +use App\Jobs\GetFileSizeFromCDN; use App\Models\Downloads; use App\Models\Episode; - -use App\Jobs\GetFileSizeFromCDN; - use Illuminate\Http\Request; class DownloadService @@ -14,10 +12,10 @@ class DownloadService public function createOrUpdateDownloads(Request $request, Episode $episode, int $index): void { $downloadTypes = [ - 'episodedlurl' => 'FHD', - 'episodedlurlinterpolated' => 'FHDi', - 'episodedlurl4k' => 'UHD', - 'downloadUHDi' => 'UHDi', + 'episodedlurl' => 'FHD', + 'episodedlurlinterpolated' => 'FHDi', + 'episodedlurl4k' => 'UHD', + 'downloadUHDi' => 'UHDi', ]; foreach ($downloadTypes as $inputField => $type) { @@ -25,9 +23,9 @@ class DownloadService if ($request->filled($fieldName)) { $download = Downloads::updateOrCreate([ 'episode_id' => $episode->id, - 'type' => $type, + 'type' => $type, ], [ - 'url' => $request->input($fieldName), + 'url' => $request->input($fieldName), ]); // Dispatch Job to get File Size from CDN diff --git a/app/Services/EpisodeService.php b/app/Services/EpisodeService.php index c0b3e73..2be96e7 100644 --- a/app/Services/EpisodeService.php +++ b/app/Services/EpisodeService.php @@ -5,14 +5,12 @@ namespace App\Services; use App\Models\Episode; use App\Models\Hentai; use App\Models\Studios; - use Illuminate\Http\Request; use Illuminate\Support\Carbon; -use Illuminate\Support\Str; use Illuminate\Support\Facades\Storage; - -use Intervention\Image\Laravel\Facades\Image; +use Illuminate\Support\Str; use Intervention\Image\Encoders\WebpEncoder; +use Intervention\Image\Laravel\Facades\Image; class EpisodeService { @@ -24,6 +22,7 @@ class EpisodeService if (is_numeric($lastPart) && $lastPart < 1000) { $slugParts[array_key_last($slugParts)] = 's'.$lastPart; + return implode('-', $slugParts); } @@ -31,16 +30,15 @@ class EpisodeService } public function createEpisode( - Request $request, + Request $request, Hentai $hentai, int $episodeNumber, ?Studios $studio = null, ?Episode $referenceEpisode = null - ): Episode - { - $episode = new Episode(); + ): Episode { + $episode = new Episode; $episode->title = $referenceEpisode->title ?? $request->input('title'); - $episode->title_search = preg_replace("/[^A-Za-z0-9 ]/", '', $episode->title); + $episode->title_search = preg_replace('/[^A-Za-z0-9 ]/', '', $episode->title); $episode->title_jpn = $referenceEpisode->title_jpn ?? $request->input('title_jpn'); $episode->slug = "{$hentai->slug}-{$episodeNumber}"; $episode->hentai_id = $hentai->id; @@ -96,7 +94,6 @@ class EpisodeService ); } - public function createOrUpdateCover(Request $request, Episode $episode, string $slug, int $episodeNumber): void { if (! $request->hasFile("episodecover{$episodeNumber}")) { @@ -111,7 +108,7 @@ class EpisodeService // Encode and save cover image Image::read($request->file("episodecover{$episodeNumber}")->getRealPath()) ->cover(268, 394) - ->encode(new WebpEncoder()) + ->encode(new WebpEncoder) ->save(Storage::disk('public')->path($episode->cover_url)); } } diff --git a/app/Services/GalleryService.php b/app/Services/GalleryService.php index 50af35c..8d100c4 100644 --- a/app/Services/GalleryService.php +++ b/app/Services/GalleryService.php @@ -5,29 +5,25 @@ namespace App\Services; use App\Models\Episode; use App\Models\Gallery; use App\Models\Hentai; - use Illuminate\Http\Request; -use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Storage; - -use Intervention\Image\Laravel\Facades\Image; use Intervention\Image\Encoders\WebpEncoder; +use Intervention\Image\Laravel\Facades\Image; class GalleryService { - public function createOrUpdateGallery(Request $request, Hentai $hentai, Episode $episode, int $episodeNumber, bool $override = false): void { $galleryInputNumber = $override ? 1 : $episodeNumber; - if($request->hasFile('episodegallery'.$galleryInputNumber)) { + if ($request->hasFile('episodegallery'.$galleryInputNumber)) { $this->deleteOldGallery($episode); $this->createGalleryFolder($hentai); $counter = 0; - foreach($request->file('episodegallery'.$galleryInputNumber) as $file) { + foreach ($request->file('episodegallery'.$galleryInputNumber) as $file) { $gallery = $this->createGallery($hentai, $episode, $episodeNumber, $counter); $this->saveGalleryImage($gallery, $file); $counter += 1; @@ -45,7 +41,7 @@ class GalleryService private function createGallery(Hentai $hentai, Episode $episode, int $episodeNumber, int $counter): Gallery { - $gallery = new Gallery(); + $gallery = new Gallery; $gallery->hentai_id = $hentai->id; $gallery->episode_id = $episode->id; $gallery->image_url = "/images/hentai/{$hentai->slug}/gallery-ep-{$episodeNumber}-{$counter}.webp"; @@ -59,12 +55,12 @@ class GalleryService { Image::read($sourceImage->getRealPath()) ->cover(1920, 1080) - ->encode(new WebpEncoder()) + ->encode(new WebpEncoder) ->save(Storage::disk('public')->path($gallery->image_url)); Image::read($sourceImage->getRealPath()) ->cover(960, 540) - ->encode(new WebpEncoder()) + ->encode(new WebpEncoder) ->save(Storage::disk('public')->path($gallery->thumbnail_url)); } diff --git a/app/Services/MatrixRegistrationService.php b/app/Services/MatrixRegistrationService.php index 524e2cc..7a32973 100644 --- a/app/Services/MatrixRegistrationService.php +++ b/app/Services/MatrixRegistrationService.php @@ -14,8 +14,8 @@ class MatrixRegistrationService // Get nonce from Synapse $nonceResponse = Http::get("$server/_synapse/admin/v1/register"); - if (!$nonceResponse->ok()) { - throw new \Exception("Could not fetch nonce from Matrix."); + if (! $nonceResponse->ok()) { + throw new \Exception('Could not fetch nonce from Matrix.'); } $nonce = $nonceResponse->json()['nonce']; @@ -23,10 +23,10 @@ class MatrixRegistrationService // Generate MAC $mac = hash_hmac( 'sha1', - $nonce . "\0" . - $username . "\0" . - $password . "\0" . - "notadmin", + $nonce."\0". + $username."\0". + $password."\0". + 'notadmin', $secret ); diff --git a/config/app.php b/config/app.php index be4adc8..196de12 100644 --- a/config/app.php +++ b/config/app.php @@ -116,7 +116,7 @@ return [ | Supported Locales |-------------------------------------------------------------------------- | - | This is used to display the supported locales by this app, it also is + | This is used to display the supported locales by this app, it also is | used to verify session data and requests in the SetLocale Middleware | */ diff --git a/config/discord-alerts.php b/config/discord-alerts.php index db6ac22..f636d12 100644 --- a/config/discord-alerts.php +++ b/config/discord-alerts.php @@ -5,8 +5,8 @@ return [ * The webhook URLs that we'll use to send a message to Discord. */ 'webhook_urls' => [ - 'default' => env('DISCORD_ALERT_WEBHOOK'), - 'update' => env('DISCORD_ALERT_UPDATE_WEBHOOK'), + 'default' => env('DISCORD_ALERT_WEBHOOK'), + 'update' => env('DISCORD_ALERT_UPDATE_WEBHOOK'), 'rerelease' => env('DISCORD_ALERT_RERELEASE_WEBHOOK'), ], diff --git a/config/discord.php b/config/discord.php index 091023a..15b4318 100644 --- a/config/discord.php +++ b/config/discord.php @@ -1,9 +1,9 @@ 'https://discord.gg/yAqgVKNgG5', + 'invite_link' => 'https://discord.gg/yAqgVKNgG5', - 'guild_id' => 802233383710228550, + 'guild_id' => 802233383710228550, 'patreon_roles' => [ '841798154999169054', // ???? @@ -12,7 +12,7 @@ return [ '803325441942356059', // Tier-3 '803322725576736858', // Tier-2 '802270568912519198', // Tier-1 - '802234830384267315' // admin + '802234830384267315', // admin ], 'discord_bot_token' => env('DISCORD_BOT_TOKEN'), diff --git a/config/hstream.php b/config/hstream.php index c4b703c..d3ec50e 100644 --- a/config/hstream.php +++ b/config/hstream.php @@ -2,42 +2,42 @@ return [ // Download Domain - 'download_domain' => [ - 'https://imoto-ddl.ane-h.xyz', - 'https://chibi-ddl.imoto-h.xyz', - 'https://koneko-ddl.musume-h.xyz', + 'download_domain' => [ + 'https://imoto-ddl.ane-h.xyz', + 'https://chibi-ddl.imoto-h.xyz', + 'https://koneko-ddl.musume-h.xyz', 'https://shinobu-ddl.rorikon-h.xyz', 'https://oppai-ddl.shoujo-h.org', ], // 4k Download Domain - 'download_domain_4k' => [ - 'https://imoto-ddlp.ane-h.xyz', - 'https://chibi-ddlp.imoto-h.xyz', - 'https://koneko-ddlp.musume-h.xyz', + 'download_domain_4k' => [ + 'https://imoto-ddlp.ane-h.xyz', + 'https://chibi-ddlp.imoto-h.xyz', + 'https://koneko-ddlp.musume-h.xyz', 'https://shinobu-ddlp.rorikon-h.xyz', 'https://oppai-ddlp.shoujo-h.org', ], // Stream Domain - 'stream_domain' => [ - 'https://imoto-str.ane-h.xyz', - 'https://chibi-str.imoto-h.xyz', - 'https://koneko-str.musume-h.xyz', + 'stream_domain' => [ + 'https://imoto-str.ane-h.xyz', + 'https://chibi-str.imoto-h.xyz', + 'https://koneko-str.musume-h.xyz', 'https://shinobu-str.rorikon-h.xyz', 'https://oppai-str.shoujo-h.org', ], // Asia Fallback (HTTP) - 'asia_download_domain' => [ - 'https://komako-b-ddl.musume-h.xyz' + 'asia_download_domain' => [ + 'https://komako-b-ddl.musume-h.xyz', ], - 'asia_stream_domain' => [ - 'https://komako-b-str.musume-h.xyz' + 'asia_stream_domain' => [ + 'https://komako-b-str.musume-h.xyz', ], // Free 4k Downloads - 'free_downloads' => true, - 'free_downloads_count' => 10, + 'free_downloads' => true, + 'free_downloads_count' => 10, ]; diff --git a/config/image.php b/config/image.php index 503ec76..48d71cd 100644 --- a/config/image.php +++ b/config/image.php @@ -38,5 +38,5 @@ return [ 'autoOrientation' => true, 'decodeAnimation' => true, 'blendingColor' => 'ffffff', - ] + ], ]; diff --git a/config/scout.php b/config/scout.php index e2398bc..e2f60ac 100644 --- a/config/scout.php +++ b/config/scout.php @@ -143,18 +143,18 @@ return [ 'key' => env('MEILISEARCH_KEY'), 'index-settings' => [ Episode::class => [ - 'filterableAttributes' => [ - 'title', + 'filterableAttributes' => [ + 'title', 'title_search', 'title_jpn', - 'slug', - 'description', - 'tags' + 'slug', + 'description', + 'tags', ], - 'sortableAttributes' => [ - 'created_at', + 'sortableAttributes' => [ + 'created_at', 'release_date', - 'title' + 'title', ], ], ], diff --git a/config/services.php b/config/services.php index 5622ee9..9cf8b55 100644 --- a/config/services.php +++ b/config/services.php @@ -37,11 +37,11 @@ return [ |-------------------------------------------------------------------------- */ - 'discord' => [ - 'client_id' => env('DISCORD_CLIENT_ID'), - 'client_secret' => env('DISCORD_CLIENT_SECRET'), + 'discord' => [ + 'client_id' => env('DISCORD_CLIENT_ID'), + 'client_secret' => env('DISCORD_CLIENT_SECRET'), 'redirect' => '/auth/discord/callback', - + // optional 'allow_gif_avatars' => (bool) env('DISCORD_AVATAR_GIF', true), 'avatar_default_extension' => env('DISCORD_EXTENSION_DEFAULT', 'webp'), // only pick from jpg, png, webp diff --git a/config/sweetalert.php b/config/sweetalert.php index 6053051..182d8a4 100644 --- a/config/sweetalert.php +++ b/config/sweetalert.php @@ -263,5 +263,4 @@ return [ 'confirm_delete_icon' => env('SWEET_ALERT_CONFIRM_DELETE_ICON', 'warning'), 'confirm_delete_show_loader_on_confirm' => env('SWEET_ALERT_CONFIRM_DELETE_SHOW_LOADER_ON_CONFIRM', true), - ]; diff --git a/config/tagging.php b/config/tagging.php index 3b21e77..6b2ef6a 100644 --- a/config/tagging.php +++ b/config/tagging.php @@ -12,7 +12,7 @@ return [ 'displayer' => '\Illuminate\Support\Str::title', // Database connection for Conner\Taggable\Tag model to use -// 'connection' => 'mysql', + // 'connection' => 'mysql', // When deleting a model, remove all the tags first 'untag_on_delete' => true, diff --git a/database/factories/EpisodeFactory.php b/database/factories/EpisodeFactory.php index 03fd615..91157eb 100644 --- a/database/factories/EpisodeFactory.php +++ b/database/factories/EpisodeFactory.php @@ -2,7 +2,6 @@ namespace Database\Factories; -use App\Models\Studios; use Illuminate\Database\Eloquent\Factories\Factory; /** @@ -18,19 +17,19 @@ class EpisodeFactory extends Factory public function definition(): array { return [ - 'title' => $this->faker->title(), - 'title_search' => $this->faker->title(), - 'title_jpn' => $this->faker->title(), - 'slug' => $this->faker->slug, - 'episode' => $this->faker->randomDigit(), - 'description' => $this->faker->text(), - 'url' => $this->faker->url(), - 'cover_url' => $this->faker->url(), - 'view_count' => $this->faker->randomNumber(), - 'interpolated' => $this->faker->boolean(), - 'interpolated_uhd' => $this->faker->boolean(), - 'release_date' => $this->faker->date(), - 'is_dvd_aspect' => $this->faker->boolean(), + 'title' => $this->faker->title(), + 'title_search' => $this->faker->title(), + 'title_jpn' => $this->faker->title(), + 'slug' => $this->faker->slug, + 'episode' => $this->faker->randomDigit(), + 'description' => $this->faker->text(), + 'url' => $this->faker->url(), + 'cover_url' => $this->faker->url(), + 'view_count' => $this->faker->randomNumber(), + 'interpolated' => $this->faker->boolean(), + 'interpolated_uhd' => $this->faker->boolean(), + 'release_date' => $this->faker->date(), + 'is_dvd_aspect' => $this->faker->boolean(), ]; } } diff --git a/database/factories/HentaiFactory.php b/database/factories/HentaiFactory.php index 24e199a..03b21c7 100644 --- a/database/factories/HentaiFactory.php +++ b/database/factories/HentaiFactory.php @@ -17,8 +17,8 @@ class HentaiFactory extends Factory public function definition(): array { return [ - 'slug' => $this->faker->slug, - 'description' => $this->faker->text(), + 'slug' => $this->faker->slug, + 'description' => $this->faker->text(), ]; } } diff --git a/database/factories/StudiosFactory.php b/database/factories/StudiosFactory.php index 90dfa13..d6be523 100644 --- a/database/factories/StudiosFactory.php +++ b/database/factories/StudiosFactory.php @@ -17,8 +17,8 @@ class StudiosFactory extends Factory public function definition(): array { return [ - 'name' => $this->faker->company(), - 'slug' => $this->faker->slug, + 'name' => $this->faker->company(), + 'slug' => $this->faker->slug, ]; } } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 3aaa83b..6485aa7 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -32,4 +32,4 @@ return new class extends Migration { Schema::dropIfExists('users'); } -}; \ No newline at end of file +}; diff --git a/database/migrations/2023_08_10_190926_update_hstream_tables.php b/database/migrations/2023_08_10_190926_update_hstream_tables.php index 90c730a..98e0792 100644 --- a/database/migrations/2023_08_10_190926_update_hstream_tables.php +++ b/database/migrations/2023_08_10_190926_update_hstream_tables.php @@ -5,8 +5,8 @@ use App\Models\Hentai; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Carbon; -use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Schema; return new class extends Migration { @@ -17,16 +17,16 @@ return new class extends Migration { // Change Tagging from Hentai to Episode $hentai = DB::table('hentai')->get(); - foreach($hentai as $h) { + foreach ($hentai as $h) { $episodes = Episode::where('hentai_id', $h->id)->get(); - foreach($episodes as $episode) { + foreach ($episodes as $episode) { $episode->tag($h->tagNames()); - } + } } // Delete Hentai Tags - foreach($hentai as $h) { + foreach ($hentai as $h) { $h->untag(); } @@ -39,7 +39,7 @@ return new class extends Migration }); $episodes = DB::table('episode')->get(); - foreach($episodes as $episode) { + foreach ($episodes as $episode) { $hentai = Hentai::where('id', $episode->hentai_id)->first(); $episode->title = $hentai->title; diff --git a/database/migrations/2023_10_03_230727_migrate_4k_downloads.php b/database/migrations/2023_10_03_230727_migrate_4k_downloads.php index d1c5d96..320001e 100644 --- a/database/migrations/2023_10_03_230727_migrate_4k_downloads.php +++ b/database/migrations/2023_10_03_230727_migrate_4k_downloads.php @@ -12,11 +12,11 @@ return new class extends Migration public function up(): void { $episodes = DB::table('episode')->whereNull('download_url_4k') - ->where('legacy_stream', 0) - ->where('resolution', '4k') - ->get(); + ->where('legacy_stream', 0) + ->where('resolution', '4k') + ->get(); - foreach($episodes as $episode) { + foreach ($episodes as $episode) { $episode->download_url_4k = Str::replace('1080p', '2160p', $episode->download_url); $episode->save(); } diff --git a/database/migrations/2024_02_18_110521_optimization.php b/database/migrations/2024_02_18_110521_optimization.php index deb05e5..d2fee43 100644 --- a/database/migrations/2024_02_18_110521_optimization.php +++ b/database/migrations/2024_02_18_110521_optimization.php @@ -22,8 +22,7 @@ return new class extends Migration */ public function down() { - Schema::table('gallery', function (Blueprint $table) - { + Schema::table('gallery', function (Blueprint $table) { $table->dropIndex(['episode_id', 'hentai_id']); }); } diff --git a/database/migrations/2024_04_05_123805_add_description_to_episode_table.php b/database/migrations/2024_04_05_123805_add_description_to_episode_table.php index 8fa835e..6a7a127 100644 --- a/database/migrations/2024_04_05_123805_add_description_to_episode_table.php +++ b/database/migrations/2024_04_05_123805_add_description_to_episode_table.php @@ -2,8 +2,8 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Schema; return new class extends Migration { diff --git a/database/migrations/2024_07_29_134619_create_downloads_table.php b/database/migrations/2024_07_29_134619_create_downloads_table.php index 11927df..49c59c7 100644 --- a/database/migrations/2024_07_29_134619_create_downloads_table.php +++ b/database/migrations/2024_07_29_134619_create_downloads_table.php @@ -23,13 +23,13 @@ return new class extends Migration }); // Migrate old entries - foreach(Episode::all() as $episode) { + foreach (Episode::all() as $episode) { // 1080p if (! empty($episode->download_url)) { Downloads::create([ 'episode_id' => $episode->id, - 'type' => 'FHD', - 'url' => $episode->download_url + 'type' => 'FHD', + 'url' => $episode->download_url, ]); } @@ -37,8 +37,8 @@ return new class extends Migration if (! empty($episode->download_url_interpolated)) { Downloads::create([ 'episode_id' => $episode->id, - 'type' => 'FHDi', - 'url' => $episode->download_url_interpolated + 'type' => 'FHDi', + 'url' => $episode->download_url_interpolated, ]); } @@ -46,8 +46,8 @@ return new class extends Migration if (! empty($episode->download_url_4k)) { Downloads::create([ 'episode_id' => $episode->id, - 'type' => 'UHD', - 'url' => $episode->download_url_4k + 'type' => 'UHD', + 'url' => $episode->download_url_4k, ]); } } diff --git a/database/migrations/2024_07_30_194424_fix_slugs.php b/database/migrations/2024_07_30_194424_fix_slugs.php index 49dbd7b..8ca7df1 100644 --- a/database/migrations/2024_07_30_194424_fix_slugs.php +++ b/database/migrations/2024_07_30_194424_fix_slugs.php @@ -2,7 +2,6 @@ use App\Models\Episode; use App\Models\Hentai; - use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; @@ -13,10 +12,10 @@ return new class extends Migration */ public function up(): void { - foreach (Hentai::all() as $hentai) { + foreach (Hentai::all() as $hentai) { $slugParts = explode('-', $hentai->slug); $lastPart = $slugParts[array_key_last($slugParts)]; - if (is_numeric($lastPart) && $lastPart < 1000) { + if (is_numeric($lastPart) && $lastPart < 1000) { $slugParts[array_key_last($slugParts)] = 's'.$lastPart; $newSlug = implode('-', $slugParts); diff --git a/database/migrations/2024_10_21_194317_add_title_search_to_epiosdes_table.php b/database/migrations/2024_10_21_194317_add_title_search_to_epiosdes_table.php index 3d8fada..13e2b90 100644 --- a/database/migrations/2024_10_21_194317_add_title_search_to_epiosdes_table.php +++ b/database/migrations/2024_10_21_194317_add_title_search_to_epiosdes_table.php @@ -18,7 +18,7 @@ return new class extends Migration // Update the title_search field with sanitized titles DB::table('episodes')->update([ - 'title_search' => DB::raw("REGEXP_REPLACE(title, '[^A-Za-z0-9 ]', '')") + 'title_search' => DB::raw("REGEXP_REPLACE(title, '[^A-Za-z0-9 ]', '')"), ]); } diff --git a/database/migrations/2025_04_25_143357_fix_playlist_episode_positions.php b/database/migrations/2025_04_25_143357_fix_playlist_episode_positions.php index 8a2c9fa..7c9e829 100644 --- a/database/migrations/2025_04_25_143357_fix_playlist_episode_positions.php +++ b/database/migrations/2025_04_25_143357_fix_playlist_episode_positions.php @@ -2,8 +2,8 @@ use App\Models\Playlist; use App\Models\PlaylistEpisode; -use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2025_09_21_215923_add_unique_constraint_to_downloads_table.php b/database/migrations/2025_09_21_215923_add_unique_constraint_to_downloads_table.php index f62f990..84349b9 100644 --- a/database/migrations/2025_09_21_215923_add_unique_constraint_to_downloads_table.php +++ b/database/migrations/2025_09_21_215923_add_unique_constraint_to_downloads_table.php @@ -1,11 +1,10 @@ delete(); - # Remove duplicate entries + // Remove duplicate entries $duplicates = DB::table('downloads') ->select('episode_id', 'type', DB::raw('COUNT(*) as count')) ->groupBy('episode_id', 'type') diff --git a/database/migrations/2025_09_22_113103_drop_torrents_table.php b/database/migrations/2025_09_22_113103_drop_torrents_table.php index 88a6743..372a312 100644 --- a/database/migrations/2025_09_22_113103_drop_torrents_table.php +++ b/database/migrations/2025_09_22_113103_drop_torrents_table.php @@ -1,7 +1,6 @@ rememberToken()->after('password'); }); - /** * -------------------------------------------------------------------- * Fix Discord Profile Pictures @@ -54,8 +53,7 @@ return new class extends Migration * The oauth package by socialite now returns a full url of the avatar. * Meaning all the old entries have to be fixed. */ - foreach (User::whereNotNull('discord_avatar')->get() as $user) - { + foreach (User::whereNotNull('discord_avatar')->get() as $user) { $isGif = preg_match('/a_.+/m', $user->discord_avatar) === 1; $extension = $isGif ? 'gif' : 'webp'; $user->discord_avatar = sprintf('https://cdn.discordapp.com/avatars/%s/%s.%s', $user->id, $user->discord_avatar, $extension); diff --git a/database/migrations/2026_01_08_213625_fix_database_structure.php b/database/migrations/2026_01_08_213625_fix_database_structure.php index 304c3c7..eb2745e 100644 --- a/database/migrations/2026_01_08_213625_fix_database_structure.php +++ b/database/migrations/2026_01_08_213625_fix_database_structure.php @@ -3,8 +3,8 @@ use App\Models\Playlist; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Schema; return new class extends Migration { @@ -136,7 +136,7 @@ return new class extends Migration } /** - * Due to incorrect handling of user deletes, + * Due to incorrect handling of user deletes, * we have unreferenced data */ private function deleteUnreferencedData(): void @@ -150,7 +150,7 @@ return new class extends Migration $playlists = Playlist::where('user_id', '>', 1_000_000) ->get(); - foreach($playlists as $playlist) { + foreach ($playlists as $playlist) { DB::table('playlist_episodes') ->where('playlist_id', '=', $playlist->id) ->delete(); diff --git a/database/migrations/2026_01_10_120521_migrate_comments_table.php b/database/migrations/2026_01_10_120521_migrate_comments_table.php index 94278fc..56cc0f7 100644 --- a/database/migrations/2026_01_10_120521_migrate_comments_table.php +++ b/database/migrations/2026_01_10_120521_migrate_comments_table.php @@ -69,7 +69,7 @@ return new class extends Migration // Re-Add foreign key constraint and index Schema::table('comments', function (Blueprint $table) { $table->foreign('child_id')->references('id')->on('comments')->onDelete('cascade'); - $table->index(["commenter_id", "commenter_type"]); + $table->index(['commenter_id', 'commenter_type']); }); } }; diff --git a/database/migrations/2026_01_11_151205_add_locale_to_users_table.php b/database/migrations/2026_01_11_151205_add_locale_to_users_table.php index 5bc874f..19dc394 100644 --- a/database/migrations/2026_01_11_151205_add_locale_to_users_table.php +++ b/database/migrations/2026_01_11_151205_add_locale_to_users_table.php @@ -13,8 +13,8 @@ return new class extends Migration { Schema::table('users', function (Blueprint $table) { $table->string('locale', 10) - ->nullable() - ->after('discord_avatar'); + ->nullable() + ->after('discord_avatar'); }); } diff --git a/database/migrations/2026_01_11_184725_migrate_to_user_roles.php b/database/migrations/2026_01_11_184725_migrate_to_user_roles.php index b9721dc..f9bde82 100644 --- a/database/migrations/2026_01_11_184725_migrate_to_user_roles.php +++ b/database/migrations/2026_01_11_184725_migrate_to_user_roles.php @@ -14,17 +14,17 @@ return new class extends Migration { // Migrate supporters DB::table('users')->where('is_patreon', 1)->update([ - 'roles' => DB::raw("JSON_ARRAY('supporter')") + 'roles' => DB::raw("JSON_ARRAY('supporter')"), ]); // Migrate banned DB::table('users')->where('is_banned', 1)->update([ - 'roles' => DB::raw("JSON_ARRAY('banned')") + 'roles' => DB::raw("JSON_ARRAY('banned')"), ]); // Migrate admins DB::table('users')->where('is_admin', 1)->update([ - 'roles' => DB::raw("JSON_ARRAY('admin')") + 'roles' => DB::raw("JSON_ARRAY('admin')"), ]); // Drop columns diff --git a/database/migrations/2026_02_17_222326_add_matrix_id_to_users_table.php b/database/migrations/2026_02_17_222326_add_matrix_id_to_users_table.php index 2d1f4f1..e14f6bf 100644 --- a/database/migrations/2026_02_17_222326_add_matrix_id_to_users_table.php +++ b/database/migrations/2026_02_17_222326_add_matrix_id_to_users_table.php @@ -13,8 +13,8 @@ return new class extends Migration { Schema::table('users', function (Blueprint $table) { $table->string('matrix_id') - ->nullable() - ->after('discord_id'); + ->nullable() + ->after('discord_id'); }); } diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 440a041..44e38c4 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -13,7 +13,7 @@ class DatabaseSeeder extends Seeder public function run(): void { $this->call([ - DeletedUserSeeder::class + DeletedUserSeeder::class, ]); } } diff --git a/database/seeders/DeletedUserSeeder.php b/database/seeders/DeletedUserSeeder.php index 3da08d5..04ec4b5 100644 --- a/database/seeders/DeletedUserSeeder.php +++ b/database/seeders/DeletedUserSeeder.php @@ -3,11 +3,9 @@ namespace Database\Seeders; use App\Models\User; +use Illuminate\Database\Seeder; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\DB; -use Illuminate\Database\Console\Seeds\WithoutModelEvents; -use Illuminate\Database\Seeder; - class DeletedUserSeeder extends Seeder { @@ -18,7 +16,7 @@ class DeletedUserSeeder extends Seeder { $userexists = User::where('id', '=', 1)->first(); - if (!$userexists) { + if (! $userexists) { DB::table('users')->insert([ 'id' => 1, 'username' => 'deleted', diff --git a/lang/de/home.php b/lang/de/home.php index 991254f..7c451bf 100644 --- a/lang/de/home.php +++ b/lang/de/home.php @@ -1,19 +1,19 @@ 'Qualitäts-Hentai kostenlos in 4k!', - 'recently-uploaded' => 'Kürzlich hochgeladen', - 'recently-released' => 'Kürzlich veröffentlicht', - 'trending' => 'Trending', - 'show-more-recently-uploaded' => 'Zeige mehr kürzlich hochgeladene', - 'show-more-recently-released' => 'Zeige mehr kürzlich veröffentlicht', - 'show-more' => 'Mehr anzeigen', - 'most-views' => 'Meiste Aufrufe', - 'most-likes' => 'Meiste Likes', - 'popular-weekly' => 'Wöchentlich beliebt', - 'popular-monthly' => 'Monatlich beliebt', - 'show-more-with-most-views' => 'Zeige mehr mit den meisten Aufrufen', - 'categories' => 'Kategorien', - 'latest-comments' => 'Neueste Kommentare', - 'episodes' => 'Episoden', + 'branding' => 'Qualitäts-Hentai kostenlos in 4k!', + 'recently-uploaded' => 'Kürzlich hochgeladen', + 'recently-released' => 'Kürzlich veröffentlicht', + 'trending' => 'Trending', + 'show-more-recently-uploaded' => 'Zeige mehr kürzlich hochgeladene', + 'show-more-recently-released' => 'Zeige mehr kürzlich veröffentlicht', + 'show-more' => 'Mehr anzeigen', + 'most-views' => 'Meiste Aufrufe', + 'most-likes' => 'Meiste Likes', + 'popular-weekly' => 'Wöchentlich beliebt', + 'popular-monthly' => 'Monatlich beliebt', + 'show-more-with-most-views' => 'Zeige mehr mit den meisten Aufrufen', + 'categories' => 'Kategorien', + 'latest-comments' => 'Neueste Kommentare', + 'episodes' => 'Episoden', ]; diff --git a/lang/de/nav.php b/lang/de/nav.php index bc287f3..1c7a806 100644 --- a/lang/de/nav.php +++ b/lang/de/nav.php @@ -1,19 +1,19 @@ 'Startseite', - 'search' => 'Suche', - 'public-playlists' => 'Öffentliche Playlisten', - 'downloads' => 'Downloads', - 'our-discord-server' => 'Unser Discord Server', - 'theme' => 'Theme', - 'please-login' => 'Bitte einloggen', - 'comments' => 'Kommentare', - 'likes' => 'Likes', - 'playlists' => 'Playlisten', - 'watched' => 'Gesehen', - 'settings' => 'Einstellungen', - 'logout' => 'Ausloggen', - 'login' => 'Einloggen', - 'profile' => 'Profil', + 'home' => 'Startseite', + 'search' => 'Suche', + 'public-playlists' => 'Öffentliche Playlisten', + 'downloads' => 'Downloads', + 'our-discord-server' => 'Unser Discord Server', + 'theme' => 'Theme', + 'please-login' => 'Bitte einloggen', + 'comments' => 'Kommentare', + 'likes' => 'Likes', + 'playlists' => 'Playlisten', + 'watched' => 'Gesehen', + 'settings' => 'Einstellungen', + 'logout' => 'Ausloggen', + 'login' => 'Einloggen', + 'profile' => 'Profil', ]; diff --git a/lang/de/playlist.php b/lang/de/playlist.php index 1dbc83d..af9d9b2 100644 --- a/lang/de/playlist.php +++ b/lang/de/playlist.php @@ -1,9 +1,9 @@ 'Keine Playlisten gefunden!', - 'personal-playlists' => 'Persönliche Playlisten', - 'create-on-personal-page' => 'Du kannst einen in deiner persönlichen Playlisten Seite erstellen.', - 'play' => 'Abspielen', - 'playlist' => 'Playlist', + 'no-playlist-found' => 'Keine Playlisten gefunden!', + 'personal-playlists' => 'Persönliche Playlisten', + 'create-on-personal-page' => 'Du kannst einen in deiner persönlichen Playlisten Seite erstellen.', + 'play' => 'Abspielen', + 'playlist' => 'Playlist', ]; diff --git a/lang/de/search.php b/lang/de/search.php index 49a7565..6d4b0e7 100644 --- a/lang/de/search.php +++ b/lang/de/search.php @@ -1,13 +1,13 @@ 'Zeige', - 'to' => 'bis', - 'of' => 'von', - 'results' => 'Resultaten', - 'oldest-uploads' => 'Älteste Uploads', - 'oldest-releases' => 'Älteste Releases', - 'view-count' => 'Anzahl wiedergaben', - 'search-hentai' => 'Suche Hentai...', - 'search' => 'Suchen', + 'showing' => 'Zeige', + 'to' => 'bis', + 'of' => 'von', + 'results' => 'Resultaten', + 'oldest-uploads' => 'Älteste Uploads', + 'oldest-releases' => 'Älteste Releases', + 'view-count' => 'Anzahl wiedergaben', + 'search-hentai' => 'Suche Hentai...', + 'search' => 'Suchen', ]; diff --git a/lang/de/stream.php b/lang/de/stream.php index 8765ab7..b7bcb9c 100644 --- a/lang/de/stream.php +++ b/lang/de/stream.php @@ -1,12 +1,12 @@ 'Download', - 'share' => 'Teilen', - 'more-from-studio' => 'Mehr von Studio', - 'more-from' => 'Mehr von', - 'description' => 'Beschreibung', - 'genres' => 'Genres', - 'gallery' => 'Gallerie', - 'show-less' => 'Weniger anzeigen', + 'download' => 'Download', + 'share' => 'Teilen', + 'more-from-studio' => 'Mehr von Studio', + 'more-from' => 'Mehr von', + 'description' => 'Beschreibung', + 'genres' => 'Genres', + 'gallery' => 'Gallerie', + 'show-less' => 'Weniger anzeigen', ]; diff --git a/lang/en/home.php b/lang/en/home.php index 3b8ae45..294e09c 100644 --- a/lang/en/home.php +++ b/lang/en/home.php @@ -1,19 +1,19 @@ 'Quality Hentai for free in 4k!', - 'recently-uploaded' => 'Recently Uploaded', - 'recently-released' => 'Recently Released', - 'trending' => 'Trending', - 'show-more-recently-uploaded' => 'Show More Recently Uploaded', - 'show-more-recently-released' => 'Show More Recently Released', - 'show-more' => 'Show More', - 'most-views' => 'Most Views', - 'most-likes' => 'Most Likes', - 'popular-weekly' => 'Popular Weekly', - 'popular-monthly' => 'Popular Monthly', - 'show-more-with-most-views' => 'Show More With Most Views', - 'categories' => 'Categories', - 'latest-comments' => 'Latest Comments', - 'episodes' => 'Episodes', + 'branding' => 'Quality Hentai for free in 4k!', + 'recently-uploaded' => 'Recently Uploaded', + 'recently-released' => 'Recently Released', + 'trending' => 'Trending', + 'show-more-recently-uploaded' => 'Show More Recently Uploaded', + 'show-more-recently-released' => 'Show More Recently Released', + 'show-more' => 'Show More', + 'most-views' => 'Most Views', + 'most-likes' => 'Most Likes', + 'popular-weekly' => 'Popular Weekly', + 'popular-monthly' => 'Popular Monthly', + 'show-more-with-most-views' => 'Show More With Most Views', + 'categories' => 'Categories', + 'latest-comments' => 'Latest Comments', + 'episodes' => 'Episodes', ]; diff --git a/lang/en/nav.php b/lang/en/nav.php index dc85fe2..3d256bb 100644 --- a/lang/en/nav.php +++ b/lang/en/nav.php @@ -1,19 +1,19 @@ 'Home', - 'search' => 'Search', - 'public-playlists' => 'Public Playlists', - 'downloads' => 'Downloads', - 'our-discord-server' => 'Our Discord Server', - 'theme' => 'Theme', - 'please-login' => 'Please Login', - 'comments' => 'Comments', - 'likes' => 'Likes', - 'playlists' => 'Playlists', - 'watched' => 'Watched', - 'settings' => 'Settings', - 'logout' => 'Logout', - 'login' => 'Login', - 'profile' => 'Profile', + 'home' => 'Home', + 'search' => 'Search', + 'public-playlists' => 'Public Playlists', + 'downloads' => 'Downloads', + 'our-discord-server' => 'Our Discord Server', + 'theme' => 'Theme', + 'please-login' => 'Please Login', + 'comments' => 'Comments', + 'likes' => 'Likes', + 'playlists' => 'Playlists', + 'watched' => 'Watched', + 'settings' => 'Settings', + 'logout' => 'Logout', + 'login' => 'Login', + 'profile' => 'Profile', ]; diff --git a/lang/en/playlist.php b/lang/en/playlist.php index 3796fdd..d48a9e3 100644 --- a/lang/en/playlist.php +++ b/lang/en/playlist.php @@ -1,9 +1,9 @@ 'No Playlist found!', - 'personal-playlists' => 'Personal Playlists', - 'create-on-personal-page' => 'You can create one in your personal playlists page.', - 'play' => 'Play', - 'playlist' => 'Playlist', + 'no-playlist-found' => 'No Playlist found!', + 'personal-playlists' => 'Personal Playlists', + 'create-on-personal-page' => 'You can create one in your personal playlists page.', + 'play' => 'Play', + 'playlist' => 'Playlist', ]; diff --git a/lang/en/search.php b/lang/en/search.php index a579d84..7535f13 100644 --- a/lang/en/search.php +++ b/lang/en/search.php @@ -1,13 +1,13 @@ 'Showing', - 'to' => 'to', - 'of' => 'of', - 'results' => 'results', - 'oldest-uploads' => 'Oldest Uploads', - 'oldest-releases' => 'Oldest Releases', - 'view-count' => 'View Count', - 'search-hentai' => 'Search Hentai...', - 'search' => 'Search', + 'showing' => 'Showing', + 'to' => 'to', + 'of' => 'of', + 'results' => 'results', + 'oldest-uploads' => 'Oldest Uploads', + 'oldest-releases' => 'Oldest Releases', + 'view-count' => 'View Count', + 'search-hentai' => 'Search Hentai...', + 'search' => 'Search', ]; diff --git a/lang/en/stream.php b/lang/en/stream.php index e67a62f..95a8be2 100644 --- a/lang/en/stream.php +++ b/lang/en/stream.php @@ -1,12 +1,12 @@ 'Download', - 'share' => 'Share', - 'more-from-studio' => 'More from Studio', - 'more-from' => 'More from', - 'description' => 'Description', - 'genres' => 'Genres', - 'gallery' => 'Gallery', - 'show-less' => 'Show less', + 'download' => 'Download', + 'share' => 'Share', + 'more-from-studio' => 'More from Studio', + 'more-from' => 'More from', + 'description' => 'Description', + 'genres' => 'Genres', + 'gallery' => 'Gallery', + 'show-less' => 'Show less', ]; diff --git a/lang/fr/home.php b/lang/fr/home.php index 3d0599a..ed24d43 100644 --- a/lang/fr/home.php +++ b/lang/fr/home.php @@ -1,19 +1,19 @@ 'Hentai de qualité et gratuit en 4k!', - 'recently-uploaded' => 'Récemment mis en ligne', - 'recently-released' => 'Récemment publié', - 'trending' => 'Trending', - 'show-more-recently-uploaded' => 'Afficher plus Récemment mis en ligne', - 'show-more-recently-released' => 'Afficher plus Récemment publié', - 'show-more' => 'Afficher plus', - 'most-views' => 'Le plus de vues', - 'most-likes' => 'Les plus aimés', - 'popular-weekly' => 'Populaire hebdomadaire', - 'popular-monthly' => 'Populaire mensuellement', - 'show-more-with-most-views' => 'Afficher plus avec le plus grand nombre de vues', - 'categories' => 'Catégories', - 'latest-comments' => 'Derniers commentaires', - 'episodes' => 'Épisodes', + 'branding' => 'Hentai de qualité et gratuit en 4k!', + 'recently-uploaded' => 'Récemment mis en ligne', + 'recently-released' => 'Récemment publié', + 'trending' => 'Trending', + 'show-more-recently-uploaded' => 'Afficher plus Récemment mis en ligne', + 'show-more-recently-released' => 'Afficher plus Récemment publié', + 'show-more' => 'Afficher plus', + 'most-views' => 'Le plus de vues', + 'most-likes' => 'Les plus aimés', + 'popular-weekly' => 'Populaire hebdomadaire', + 'popular-monthly' => 'Populaire mensuellement', + 'show-more-with-most-views' => 'Afficher plus avec le plus grand nombre de vues', + 'categories' => 'Catégories', + 'latest-comments' => 'Derniers commentaires', + 'episodes' => 'Épisodes', ]; diff --git a/lang/fr/nav.php b/lang/fr/nav.php index 22ee946..bfb5817 100644 --- a/lang/fr/nav.php +++ b/lang/fr/nav.php @@ -1,19 +1,19 @@ 'Accueil', - 'search' => 'Recherche', - 'public-playlists' => 'Playlists publiques', - 'downloads' => 'Téléchargements', - 'our-discord-server' => 'Notre serveur Discord', - 'theme' => 'Thème', - 'please-login' => 'Veuillez vous connecter', - 'comments' => 'Commentaires', - 'likes' => 'Likes', - 'playlists' => 'Playlists', - 'watched' => 'Regardé', - 'settings' => 'Paramètres', - 'logout' => 'Déconnexion', - 'login' => 'Connexion', - 'profile' => 'Profil', + 'home' => 'Accueil', + 'search' => 'Recherche', + 'public-playlists' => 'Playlists publiques', + 'downloads' => 'Téléchargements', + 'our-discord-server' => 'Notre serveur Discord', + 'theme' => 'Thème', + 'please-login' => 'Veuillez vous connecter', + 'comments' => 'Commentaires', + 'likes' => 'Likes', + 'playlists' => 'Playlists', + 'watched' => 'Regardé', + 'settings' => 'Paramètres', + 'logout' => 'Déconnexion', + 'login' => 'Connexion', + 'profile' => 'Profil', ]; diff --git a/lang/fr/playlist.php b/lang/fr/playlist.php index ebbb2f9..3ee8a8d 100644 --- a/lang/fr/playlist.php +++ b/lang/fr/playlist.php @@ -1,9 +1,9 @@ 'Aucune playlist n\'a été trouvée!', - 'personal-playlists' => 'Playlists personnelles', - 'create-on-personal-page' => 'Vous pouvez en créer une dans votre page de playlists personnelles.', - 'play' => 'Lire', - 'playlist' => 'Playlist', + 'no-playlist-found' => 'Aucune playlist n\'a été trouvée!', + 'personal-playlists' => 'Playlists personnelles', + 'create-on-personal-page' => 'Vous pouvez en créer une dans votre page de playlists personnelles.', + 'play' => 'Lire', + 'playlist' => 'Playlist', ]; diff --git a/lang/fr/search.php b/lang/fr/search.php index 0f39347..89f0039 100644 --- a/lang/fr/search.php +++ b/lang/fr/search.php @@ -1,13 +1,13 @@ 'Affiche', - 'to' => 'à', - 'of' => 'de', - 'results' => 'résultats', - 'oldest-uploads' => 'Le plus ancien téléchargé', - 'oldest-releases' => 'Publications les plus anciennes', - 'view-count' => 'Nombre de lectures', - 'search-hentai' => 'Recherche hentai...', - 'search' => 'Recherche', + 'showing' => 'Affiche', + 'to' => 'à', + 'of' => 'de', + 'results' => 'résultats', + 'oldest-uploads' => 'Le plus ancien téléchargé', + 'oldest-releases' => 'Publications les plus anciennes', + 'view-count' => 'Nombre de lectures', + 'search-hentai' => 'Recherche hentai...', + 'search' => 'Recherche', ]; diff --git a/lang/fr/stream.php b/lang/fr/stream.php index 67a16a8..fe0993a 100644 --- a/lang/fr/stream.php +++ b/lang/fr/stream.php @@ -1,12 +1,12 @@ 'Télécharger', - 'share' => 'Partager', - 'more-from-studio' => 'Plus de Studio', - 'more-from' => 'Plus de', - 'description' => 'Description', - 'genres' => 'Genres', - 'gallery' => 'Galerie', - 'show-less' => 'Montrer moins', + 'download' => 'Télécharger', + 'share' => 'Partager', + 'more-from-studio' => 'Plus de Studio', + 'more-from' => 'Plus de', + 'description' => 'Description', + 'genres' => 'Genres', + 'gallery' => 'Galerie', + 'show-less' => 'Montrer moins', ]; diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..661e522 --- /dev/null +++ b/pint.json @@ -0,0 +1,3 @@ +{ + "preset": "laravel" +} \ No newline at end of file diff --git a/routes/admin.php b/routes/admin.php index 8dc3a1a..ded82ac 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -1,13 +1,13 @@ ['auth', 'auth.admin']], function () { Route::get('/admin/subtitles/{episode_id}', [AdminApiController::class, 'getSubtitles'])->name('admin.subtitles'); Route::post('/admin/add-new-subtitle', [SubtitleController::class, 'store'])->name('admin.add.new.subtitle'); Route::post('/admin/update-subtitles', [SubtitleController::class, 'update'])->name('admin.update.subtitles'); -}); \ No newline at end of file +}); diff --git a/routes/api.php b/routes/api.php index 132a795..f7e9aa6 100644 --- a/routes/api.php +++ b/routes/api.php @@ -14,8 +14,6 @@ use Illuminate\Support\Facades\Route; | */ -//Route::middleware('auth:sanctum')->get('/user', function (Request $request) { +// Route::middleware('auth:sanctum')->get('/user', function (Request $request) { // return $request->user(); -//}); - - +// }); diff --git a/routes/user.php b/routes/user.php index 2514b37..14b31f3 100644 --- a/routes/user.php +++ b/routes/user.php @@ -1,9 +1,9 @@ group(function () { // Download Page Route::get('/download-search', [HomeController::class, 'downloadSearch'])->name('download.search'); -}); \ No newline at end of file +}); diff --git a/routes/web.php b/routes/web.php index 77b1674..4a8ecab 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,14 +1,12 @@ galleryService = new GalleryService(); + $this->galleryService = new GalleryService; } public function test_create_or_update_gallery() @@ -38,7 +38,7 @@ class GalleryServiceTest extends TestCase $file = UploadedFile::fake()->image('test_image.jpg'); // Create a request with the fake file - $request = new \Illuminate\Http\Request(); + $request = new \Illuminate\Http\Request; $request->files->add(['episodegallery1' => [$file]]); // Call the method to test @@ -51,7 +51,7 @@ class GalleryServiceTest extends TestCase $this->assertDatabaseHas('gallery', [ 'hentai_id' => $hentai->id, 'episode_id' => $episode->id, - 'image_url' => $imageURL, + 'image_url' => $imageURL, 'thumbnail_url' => $thumbnailURL, ]); @@ -59,4 +59,4 @@ class GalleryServiceTest extends TestCase $this->assertTrue(Storage::disk('public')->exists($imageURL)); $this->assertTrue(Storage::disk('public')->exists($thumbnailURL)); } -} \ No newline at end of file +}