Compare commits
13 Commits
13c5cafa9f
...
87bdbeee05
| Author | SHA1 | Date | |
|---|---|---|---|
| 87bdbeee05 | |||
| 84529c373d | |||
| b03ad75e9e | |||
|
|
7bf42dcc47 | ||
| 9c1c781595 | |||
| 796ab611bb | |||
| b061c4d87d | |||
| 39037af3f9 | |||
| f90efdfa0e | |||
| e3f0f10d5d | |||
|
|
7a8b0fdf10 | ||
|
|
8519764f8f | ||
|
|
8021b9e3e2 |
@ -54,6 +54,7 @@ class Kernel extends HttpKernel
|
||||
*/
|
||||
protected $middlewareAliases = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.admin' => \App\Http\Middleware\AuthenticateAdmin::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
|
||||
24
app/Http/Middleware/AuthenticateAdmin.php
Normal file
24
app/Http/Middleware/AuthenticateAdmin.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class AuthenticateAdmin
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (!auth()->user()->is_admin) {
|
||||
return response('Unauthorized', 401);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@ -15,6 +15,10 @@ class HeaderAuth
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (! $request->hasHeader('X-BOTAUTH')) {
|
||||
return response()
|
||||
->json(["status" => false, "message" => "Unauthorized."], 401);
|
||||
}
|
||||
if (!hash_equals(config('bot.header_auth'), $request->header('X-BOTAUTH'))) {
|
||||
return response('Unauthorized', 401);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 15 KiB |
4
resources/views/components/icons/chat-bubble.blade.php
Normal file
4
resources/views/components/icons/chat-bubble.blade.php
Normal file
@ -0,0 +1,4 @@
|
||||
{{-- https://heroicons.com/ --}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 01.865-.501 48.172 48.172 0 003.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0012 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018z" />
|
||||
</svg>
|
||||
4
resources/views/components/icons/home.blade.php
Normal file
4
resources/views/components/icons/home.blade.php
Normal file
@ -0,0 +1,4 @@
|
||||
{{-- https://heroicons.com/ --}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" />
|
||||
</svg>
|
||||
4
resources/views/components/icons/square-stack.blade.php
Normal file
4
resources/views/components/icons/square-stack.blade.php
Normal file
@ -0,0 +1,4 @@
|
||||
{{-- https://heroicons.com/ --}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6.429 9.75L2.25 12l4.179 2.25m0-4.5l5.571 3 5.571-3m-11.142 0L2.25 7.5 12 2.25l9.75 5.25-4.179 2.25m0 0L21.75 12l-4.179 2.25m0 0l4.179 2.25L12 21.75 2.25 16.5l4.179-2.25m11.142 0l-5.571 3-5.571-3" />
|
||||
</svg>
|
||||
@ -2,7 +2,12 @@
|
||||
|
||||
<a {{ $attributes }} class="
|
||||
{{ Route::is($route)
|
||||
? 'text-nexi-red bg-gray-50 dark:text-nexi-purple dark:bg-zinc-800 transition-colors duration-300'
|
||||
: 'text-nexi-black dark:text-nexi-grey hover:text-nexi-red dark:hover:text-nexi-red hover:bg-gray-100 dark:hover:bg-zinc-500 transition-colors duration-300' }}
|
||||
group flex items-center px-2 py-2 text-base font-medium rounded-md"
|
||||
>{{ $slot }}</a>
|
||||
? 'text-nexi-red bg-gray-50 dark:bg-zinc-800 transition-colors duration-300'
|
||||
: 'text-nexi-black dark:text-nexi-grey hover:text-nexi-red dark:hover:text-nexi-red hover:bg-gray-400 dark:hover:bg-zinc-700 transition-colors duration-300' }}
|
||||
group flex gap-x-3 leading-6 items-center p-2 text-base font-medium rounded-md"
|
||||
wire:navigate>
|
||||
{{ $svg ?? '' }}
|
||||
<span>
|
||||
{{ $slot }}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@ -1,45 +1,44 @@
|
||||
<div>
|
||||
<div class="flex h-16 shrink-0 items-center border-b border-gray-200">
|
||||
<a href="{{ route('home') }}" wire:navigate>
|
||||
<img class="h-12 w-auto" src="https://benjamyn.love/PriceyBot.png" alt="">
|
||||
<img class="h-12 w-auto rounded" src="{{ asset('images/PriceyBot.webp') }}" alt="all hail pricey bot">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<nav class="flex flex-1 flex-col">
|
||||
<ul role="list" class="flex flex-1 flex-col gap-y-7">
|
||||
<li class="border-b border-gray-200">
|
||||
<li class="border-b border-gray-200 pb-1">
|
||||
<div class="text-xs font-semibold leading-6 text-gray-400">User Menu</div>
|
||||
<ul role="list" class="-mx-2 mt-2 space-y-1">
|
||||
<ul role="list" class="-mx-2 space-y-1">
|
||||
<li>
|
||||
{{-- TODO: fill with SVG icons to make it pretty --}}
|
||||
{{-- <svg class="h-6 w-6 shrink-0 text-indigo-600" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">--}}
|
||||
{{-- <path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" />--}}
|
||||
{{-- </svg>--}}
|
||||
<x-sidebar-nav :href="route('dashboard')" route="dashboard">First Page</x-sidebar-nav>
|
||||
</li>
|
||||
<li>
|
||||
{{-- TODO: fill with SVG icons to make it pretty --}}
|
||||
{{-- <x-sidebar-nav :href="route('u-2')" route="u-2">Second Page</x-sidebar-nav>--}}
|
||||
</li>
|
||||
<li>
|
||||
{{-- TODO: fill with SVG icons to make it pretty --}}
|
||||
{{-- <x-sidebar-nav :href="route('u-3')" route="u-3">Third Page</x-sidebar-nav>--}}
|
||||
<li >
|
||||
<x-sidebar-nav :href="route('dashboard')" route="dashboard">
|
||||
<x-slot:svg><x-icons.home/></x-slot:svg>
|
||||
First Page
|
||||
</x-sidebar-nav>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</li>
|
||||
@if(auth()->user()->is_admin)
|
||||
<li>
|
||||
<li class="border-b border-gray-200 pb-1">
|
||||
<div class="text-xs font-semibold leading-6 text-gray-400">Admin Menu</div>
|
||||
<ul role="list" class="-mx-2 mt-2 space-y-1">
|
||||
<li>
|
||||
{{-- TODO: fill with SVG icons to make it pretty --}}
|
||||
<x-sidebar-nav :href="route('admin.send')" route="send">Send Quote</x-sidebar-nav>
|
||||
</li>
|
||||
<li>
|
||||
<x-sidebar-nav :href="route('admin.logs')" route="admin.logs">Logs</x-sidebar-nav>
|
||||
</li>
|
||||
<ul role="list" class="-mx-2 space-y-1">
|
||||
<li>
|
||||
<x-sidebar-nav :href="route('admin.send')" route="admin.send">
|
||||
<x-slot:svg><x-icons.chat-bubble/></x-slot:svg>
|
||||
Send Quote
|
||||
</x-sidebar-nav>
|
||||
</li>
|
||||
<li>
|
||||
<x-sidebar-nav :href="route('admin.logs')" route="admin.logs">
|
||||
<x-slot:svg><x-icons.square-stack/></x-slot:svg>
|
||||
Logs
|
||||
</x-sidebar-nav>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<x-guest-layout>
|
||||
<div class="flex flex-col mt-8">
|
||||
<div class="flex flex-col mt-8 mb-8">
|
||||
<livewire:pages.quote.request/>
|
||||
|
||||
<livewire:pages.quote.requested/>
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
<body class="antialiased bg-nexi-primary dark:bg-nexi-primary-dark font-sans text-nexi-black transition-colors duration-300 h-full">
|
||||
<div x-data="{ sidebarOpen: false }">
|
||||
<div class="relative z-50 lg:hidden" role="dialog" aria-modal="true">
|
||||
{{-- TODO: Look into why the fuck does this not work? mobile views seem to not work with livewire clicks??? --}}
|
||||
<div x-show="sidebarOpen"
|
||||
x-transition:enter="transition-opacity ease-linear duration-300"
|
||||
x-transition:enter-start="opacity-0"
|
||||
|
||||
@ -19,10 +19,9 @@
|
||||
</head>
|
||||
<body class="antialiased bg-nexi-primary dark:bg-nexi-primary-dark font-sans text-nexi-black transition-colors duration-300">
|
||||
<div class="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 ">
|
||||
{{-- TODO: REPLACE WITH OUR LOGO --}}
|
||||
<div class="mt-24">
|
||||
<img class="h-24 w-auto rounded" src="https://benjamyn.love/PriceyBot.png" alt="">
|
||||
</div>
|
||||
<a href="{{ route('home') }}" class="mt-24" wire:navigate>
|
||||
<img class="h-24 w-auto rounded" src="{{ asset('images/PriceyBot.webp') }}" alt="all hail pricey bot">
|
||||
</a>
|
||||
|
||||
@if (Route::has('login'))
|
||||
<livewire:guest.navigation />
|
||||
|
||||
@ -43,7 +43,6 @@ new class extends Component
|
||||
id="user-menu-button"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true">
|
||||
{{-- TODO: Add User Image URL here --}}
|
||||
<img class="h-8 w-8 rounded-full bg-gray-50" src="{{ auth()->user()->profile }}" alt="">
|
||||
<span class="hidden lg:flex lg:items-center">
|
||||
<span class="ml-4 text-base font-semibold leading-6 text-nexi-black dark:text-nexi-grey" aria-hidden="true"
|
||||
@ -73,7 +72,7 @@ new class extends Component
|
||||
x-transition:leave-end="transform opacity-0 scale-95"
|
||||
>
|
||||
<div class="mt-3 space-y-1 text-sm">
|
||||
<x-responsive-nav-link u :href="route('profile')" wire:navigate>
|
||||
<x-responsive-nav-link :href="route('profile')" wire:navigate>
|
||||
{{ __('Profile') }}
|
||||
</x-responsive-nav-link>
|
||||
|
||||
|
||||
@ -19,9 +19,12 @@ Route::middleware(['header.auth', 'throttle:api'])->group(function () {
|
||||
Route::get('/test', [WebHookController::class, 'test']);
|
||||
Route::post('/sendQuote', [WebHookController::class, 'sendQuote']);
|
||||
Route::post('/randomQuote', [WebHookController::class, 'sendRandomQuote']);
|
||||
Route::post('/user/register', [UserController::class, 'registerUser']);
|
||||
Route::get('/user/{user:uuid}', [UserController::class, 'getUser'])
|
||||
->missing(function (Request $request) {
|
||||
return response()->json(["status" => false, "message" => "User not found"]);
|
||||
});
|
||||
|
||||
Route::prefix('user')->group(function () {
|
||||
Route::post('register', [UserController::class, 'registerUser']);
|
||||
Route::get('{user:uuid}', [UserController::class, 'getUser'])
|
||||
->missing(function () {
|
||||
return response()->json(['status' => false, 'message' => 'User not found']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -17,17 +17,18 @@ use Livewire\Volt\Volt;
|
||||
Route::view('/', 'home')
|
||||
->name('home');
|
||||
|
||||
Route::view('dashboard', 'dashboard')
|
||||
->middleware(['auth'])
|
||||
->name('dashboard');
|
||||
Route::middleware(['auth'])->group(function() {
|
||||
Route::view('dashboard', 'dashboard')
|
||||
->name('dashboard');
|
||||
|
||||
Route::view('profile', 'profile')
|
||||
->middleware(['auth'])
|
||||
->name('profile');
|
||||
Route::view('profile', 'profile')
|
||||
->name('profile');
|
||||
|
||||
Route::view('send', 'admin.send')
|
||||
->middleware(['auth'])
|
||||
->name('admin.send');
|
||||
Route::middleware('auth.admin')->prefix('admin')->group(function () {
|
||||
Route::view('send', 'admin.send')
|
||||
->name('admin.send');
|
||||
});
|
||||
});
|
||||
|
||||
Route::view('/admin/logs', 'admin.logs')
|
||||
->middleware(['auth'])
|
||||
|
||||
Reference in New Issue
Block a user