Compare commits
6 Commits
35a0d61437
...
main
Author | SHA1 | Date | |
---|---|---|---|
444feac1e0 | |||
c034c94db5 | |||
ca52584da9 | |||
dca4924e9a | |||
9ad7c7afc2 | |||
6c8d34b030 |
@@ -44,7 +44,7 @@ class HentaiApiController extends Controller
|
||||
public function getMonthlyViews()
|
||||
{
|
||||
// Cache for 60 minutes
|
||||
$data = Cache::remember('api_hentai_list', now()->addMinutes(60), function () {
|
||||
$data = Cache::remember('api_monthly_views', now()->addMinutes(60), function () {
|
||||
return PopularMonthly::selectRaw('DATE(created_at) as date, COUNT(*) as count')
|
||||
->groupBy('date')
|
||||
->orderBy('date', 'asc')
|
||||
|
@@ -52,6 +52,22 @@ class HomeController extends Controller
|
||||
return view('auth.banned');
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirects to a random Hentai episode
|
||||
* Done due to performance reasons
|
||||
*/
|
||||
public function random(): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$random = Episode::inRandomOrder()
|
||||
->limit(1)
|
||||
->pluck('slug')
|
||||
->first();
|
||||
|
||||
return redirect()->route('hentai.index', [
|
||||
'title' => $random,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Search Page.
|
||||
*/
|
||||
|
@@ -51,7 +51,7 @@ class DiscordReleaseNotification implements ShouldQueue
|
||||
break;
|
||||
case 'v2':
|
||||
# v2 re-release
|
||||
DiscordAlert::to('update')->message("<@&1425505303075754035> (´• ω •`)ノ **v2 Re-**Release! Check it out here: https://hstream.moe/hentai/".$this->slug);
|
||||
DiscordAlert::to('rerelease')->message("<@&1425505303075754035> (´• ω •`)ノ **v2 Re-**Release! Check it out here: https://hstream.moe/hentai/".$this->slug);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@@ -7,6 +7,7 @@ return [
|
||||
'webhook_urls' => [
|
||||
'default' => env('DISCORD_ALERT_WEBHOOK'),
|
||||
'update' => env('DISCORD_ALERT_UPDATE_WEBHOOK'),
|
||||
'rerelease' => env('DISCORD_ALERT_RERELEASE_WEBHOOK'),
|
||||
],
|
||||
|
||||
/*
|
||||
|
@@ -24,9 +24,8 @@
|
||||
@include('home.partials.random')
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Comments -->
|
||||
<div class="mx-auto pt-6 sm:px-6 lg:px-8 space-y-6 max-w-[100%] xl:max-w-[95%] 2xl:max-w-[85%]">
|
||||
<div class="mx-auto pt-6 sm:px-6 lg:px-8 space-y-6 max-w-[100%] xl:max-w-[95%] 2xl:max-w-[85%] pb-2">
|
||||
@include('home.partials.comments')
|
||||
</div>
|
||||
</x-app-layout>
|
@@ -1,8 +1,12 @@
|
||||
<p class="leading-normal font-bold text-lg text-neutral-800 dark:text-white">
|
||||
Random
|
||||
Random <span class="font-light text-xs text-neutral-800/60 dark:text-white/40">(Cached for 5 minutes)</span>
|
||||
</p>
|
||||
|
||||
@php $random = \App\Models\Episode::inRandomOrder()->limit(8)->get(); @endphp
|
||||
@php
|
||||
$random = \cache()->remember('random_home', 300, function () {
|
||||
return \App\Models\Episode::inRandomOrder()->limit(8)->get(); ;
|
||||
});
|
||||
@endphp
|
||||
|
||||
<div class="mb-6">
|
||||
@include('home.partials.tab.template', ['episodes' => $random, 'showThumbnails' => false])
|
||||
|
@@ -67,8 +67,7 @@
|
||||
@livewire('nav-live-search')
|
||||
<div class="hidden lg:block pl-4">
|
||||
<div class="flex flex-col items-center bg-gray-50/20 dark:bg-neutral-900/40 rounded-md">
|
||||
@php $random = App\Models\Episode::inRandomOrder()->limit(1)->pluck('slug')->first(); @endphp
|
||||
<a href="{{ route('hentai.index', ['title' => $random]) }}"
|
||||
<a href="{{ route('hentai.random') }}"
|
||||
class="cursor-pointer px-4 py-2 text-sm font-medium dark:hover:text-white text-gray-500 dark:text-white/90 focus:outline-none flex flex-col items-center md:flex-row">
|
||||
<i class="fa-solid fa-shuffle"></i>
|
||||
<p class="md:pl-1 pl-0">Random</p>
|
||||
|
@@ -22,6 +22,7 @@ use Illuminate\Support\Facades\Route;
|
||||
Route::get('/', [HomeController::class, 'index'])->name('home.index');
|
||||
Route::get('/stats', [HomeController::class, 'stats'])->name('home.stats');
|
||||
Route::get('/banned', [HomeController::class, 'banned'])->name('home.banned');
|
||||
Route::get('/random', [HomeController::class, 'random'])->name('hentai.random');
|
||||
|
||||
// API Endpoint
|
||||
Route::get('/v1/hentai-list', [HentaiApiController::class, 'index'])->name('api.hentai.index');
|
||||
|
@@ -20,7 +20,8 @@ export default defineConfig({
|
||||
'resources/js/user-blacklist.js',
|
||||
'resources/js/admin-edit.js',
|
||||
'resources/js/admin-subtitles.js',
|
||||
'resources/js/preview.js'
|
||||
'resources/js/preview.js',
|
||||
'resources/js/stats.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
|
Reference in New Issue
Block a user