diff --git a/web/app/Helpers/GridHelper.php b/web/app/Helpers/GridHelper.php index d83ff93..c0c06c9 100644 --- a/web/app/Helpers/GridHelper.php +++ b/web/app/Helpers/GridHelper.php @@ -14,22 +14,22 @@ use App\Models\WebsiteConfiguration; class GridHelper { - public static function isIpWhitelisted(Request $request) { - $ip = $request->ip(); + public static function isIpWhitelisted() { + $ip = request()->ip(); $whitelistedIps = explode(';', WebsiteConfiguration::where('name', 'WhitelistedIPs')->first()->value); return in_array($ip, $whitelistedIps); } - public static function isAccessKeyValid(Request $request) { + public static function isAccessKeyValid() { $accessKey = WebsiteConfiguration::where('name', 'ComputeServiceAccessKey')->first()->value; - return ($request->header('AccessKey') == $accessKey); + return (request()->header('AccessKey') == $accessKey); } - public static function hasAllAccess(Request $request) { + public static function hasAllAccess() { if(COMHelper::isCOM()) return true; - if(GridHelper::isIpWhitelisted($request) && GridHelper::isAccessKeyValid($request)) return true; + if(GridHelper::isIpWhitelisted() && GridHelper::isAccessKeyValid()) return true; return false; } diff --git a/web/app/Helpers/MaintenanceHelper.php b/web/app/Helpers/MaintenanceHelper.php index 4e0c1be..e363916 100644 --- a/web/app/Helpers/MaintenanceHelper.php +++ b/web/app/Helpers/MaintenanceHelper.php @@ -14,6 +14,12 @@ class MaintenanceHelper { public static function isDown(Request $request) { + if(GridHelper::hasAllAccess()) + return true; + + if(!file_exists(storage_path('framework/down'))) + return false; + $data = json_decode(file_get_contents(storage_path('framework/down')), true); return (app()->isDownForMaintenance() && !MaintenanceHelper::hasValidBypassCookie($request, $data)); diff --git a/web/app/Http/Controllers/Apis/AppSettings.php b/web/app/Http/Controllers/Apis/AppSettings.php index 0336d56..53a8438 100644 --- a/web/app/Http/Controllers/Apis/AppSettings.php +++ b/web/app/Http/Controllers/Apis/AppSettings.php @@ -58,7 +58,7 @@ class AppSettings extends Controller $bucketIds = [ $primaryBucket->id ]; $bucketIds = array_merge($bucketIds, json_decode($primaryBucket->inheritedGroupIds)); - if($primaryBucket->protected == 1 && !GridHelper::hasAllAccess($request)) { + if($primaryBucket->protected == 1 && !GridHelper::hasAllAccess()) { return ErrorHelper::error([ 'code' => 2, 'message' => 'You do not have access to this bucket.' diff --git a/web/app/Http/Controllers/Apis/VersionCompatibility.php b/web/app/Http/Controllers/Apis/VersionCompatibility.php index 8c89628..6ba5461 100644 --- a/web/app/Http/Controllers/Apis/VersionCompatibility.php +++ b/web/app/Http/Controllers/Apis/VersionCompatibility.php @@ -14,7 +14,7 @@ class VersionCompatibility extends Controller { function getVersions(Request $request) { - if(!GridHelper::hasAllAccess($request)) { + if(!GridHelper::hasAllAccess()) { return ErrorHelper::error([ 'code' => 1, 'message' => 'You do not have access to this resource.' @@ -30,7 +30,7 @@ class VersionCompatibility extends Controller function getMD5Hashes(Request $request) { - if(!GridHelper::hasAllAccess($request)) { + if(!GridHelper::hasAllAccess()) { return ErrorHelper::error([ 'code' => 1, 'message' => 'You do not have access to this resource.' @@ -46,7 +46,7 @@ class VersionCompatibility extends Controller function getMemHashes(Request $request) { - if(!GridHelper::hasAllAccess($request)) { + if(!GridHelper::hasAllAccess()) { return ErrorHelper::error([ 'code' => 1, 'message' => 'You do not have access to this resource.' diff --git a/web/app/Http/Controllers/Auth/AuthController.php b/web/app/Http/Controllers/Auth/AuthController.php new file mode 100644 index 0000000..6e5b47c --- /dev/null +++ b/web/app/Http/Controllers/Auth/AuthController.php @@ -0,0 +1,33 @@ +isMethod('post')) { + $request->validate( + [ + 'username' => ['required', 'string', 'exists:App\Models\User,id'], + 'password' => ['required', 'string'] + ] + ); + + + } + + return view('auth.login'); + } + + public function register(Request $request) + { + $errors = []; + + return view('auth.register'); + } +} diff --git a/web/app/Http/Middleware/Exception/WebException.php b/web/app/Http/Middleware/Exception/WebException.php index 33e68d7..efa5290 100644 --- a/web/app/Http/Middleware/Exception/WebException.php +++ b/web/app/Http/Middleware/Exception/WebException.php @@ -11,7 +11,7 @@ class WebException $response = $next($request); if ($response->exception) { - return response()->view('errors.500', ['stack' => $response->exception->getTraceAsString()], 500); + return response()->view('errors.500', ['stack' => $response->exception], 500); } return $response; diff --git a/web/app/Providers/AppServiceProvider.php b/web/app/Providers/AppServiceProvider.php index ee8ca5b..30a750a 100644 --- a/web/app/Providers/AppServiceProvider.php +++ b/web/app/Providers/AppServiceProvider.php @@ -3,6 +3,7 @@ namespace App\Providers; use Illuminate\Support\ServiceProvider; +use Illuminate\Support\Facades\Blade; class AppServiceProvider extends ServiceProvider { @@ -23,6 +24,12 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { - // + Blade::directive('nonav', function() { + return ''; + }); + + Blade::directive('nofooter', function() { + return ''; + }); } } diff --git a/web/app/Providers/MaintenanceServiceProvider.php b/web/app/Providers/MaintenanceServiceProvider.php index 6fd1a8d..2944193 100644 --- a/web/app/Providers/MaintenanceServiceProvider.php +++ b/web/app/Providers/MaintenanceServiceProvider.php @@ -2,18 +2,11 @@ namespace App\Providers; -use Illuminate\Contracts\Foundation\Application; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; class MaintenanceServiceProvider extends ServiceProvider { - protected $app; - public function __construct(Application $app) - { - $this->app = $app; - } - /** * Register any application services. * diff --git a/web/app/View/Components/Card.php b/web/app/View/Components/Card.php index c7ffb7c..f5eecdf 100644 --- a/web/app/View/Components/Card.php +++ b/web/app/View/Components/Card.php @@ -6,16 +6,14 @@ use Illuminate\View\Component; class Card extends Component { - public $title; - /** * Create a new component instance. * * @return void */ - public function __construct($title) + public function __construct() { - $this->title = $title; + // } /** diff --git a/web/public/mix-manifest.json b/web/public/mix-manifest.json index 2443630..34b1601 100644 --- a/web/public/mix-manifest.json +++ b/web/public/mix-manifest.json @@ -1,5 +1,5 @@ { "/js/app.js": "/js/app.js?id=cd2fb1cee326ab151ccc", "/js/pages/maintenance.js": "/js/pages/maintenance.js?id=bdec3edf7c97c2fbbd28", - "/css/graphictoria.css": "/css/graphictoria.css?id=569f8477631683f9ea96" + "/css/graphictoria.css": "/css/graphictoria.css?id=2edc33f806075c671b93" } diff --git a/web/resources/sass/Graphictoria.scss b/web/resources/sass/Graphictoria.scss index 2eb1620..900ec9d 100644 --- a/web/resources/sass/Graphictoria.scss +++ b/web/resources/sass/Graphictoria.scss @@ -904,10 +904,6 @@ a.list-group-item { // Dialog -.error-dialog.show { - display: block; -} - .nav-item { color: transparent !important; } @@ -1109,12 +1105,9 @@ p { align-items: center !important; } -.error-dialog { - padding: 5px; +.graphictoria-error-popup { margin-bottom: 10px; border-radius: 10px; - text-align: center; - background-color: var(--bs-red); animation-duration: 0.2s; animation-fill-mode: both; diff --git a/web/resources/views/auth/login.blade.php b/web/resources/views/auth/login.blade.php new file mode 100644 index 0000000..f668b74 --- /dev/null +++ b/web/resources/views/auth/login.blade.php @@ -0,0 +1,46 @@ +@php + $fields = [ + 'username' => 'Username', + 'password' => 'Password' + ]; +@endphp + +@extends('layouts.app') + +@section('title', 'Login') + +@section('content') +
Creating an account takes less than a minute, and you can join a community of 8k+ users for completely free.
Sign Up
{{ $body }}
{{ $footer }} diff --git a/web/resources/views/layouts/app.blade.php b/web/resources/views/layouts/app.blade.php index ad44bc2..820d1e2 100644 --- a/web/resources/views/layouts/app.blade.php +++ b/web/resources/views/layouts/app.blade.php @@ -1,5 +1,5 @@ @php - $slogan = 'Graphictoria is an online social platform for those looking to relive the classic Roblox experience. So what are you waiting for? Join 8k+ other users in reliving the good ol\' days! Graphictoria is not affiliated with or sponsored by Roblox Corporation, all Roblox related indica and slogans belong to Roblox Corporation.'; + $slogan = (View::hasSection('description') ? View::getSection('description') . ' ' : '') . 'Graphictoria is an online social platform for those looking to relive the classic Roblox experience. So what are you waiting for? Join 8k+ other users in reliving the good ol\' days! Graphictoria is not affiliated with or sponsored by Roblox Corporation, all Roblox related indica and slogans belong to Roblox Corporation.'; $authenticated = \App\Helpers\AuthHelper::IsAuthenticated(request()); @endphp @@ -15,7 +15,7 @@ - + diff --git a/web/resources/views/maintenance.blade.php b/web/resources/views/maintenance.blade.php index 8282134..bce824a 100644 --- a/web/resources/views/maintenance.blade.php +++ b/web/resources/views/maintenance.blade.php @@ -1,12 +1,12 @@ @php -$noFooter = true; - -$buttons = str_split('Graphictoria') + $buttons = str_split('Graphictoria') @endphp @extends('layouts.app') +@nofooter @section('title', 'Maintenance') +@section('description', 'Graphictoria is currently under maintenance, check back later!') @section('theme', 'dark') diff --git a/web/routes/web.php b/web/routes/web.php index 0753957..4f9c22e 100644 --- a/web/routes/web.php +++ b/web/routes/web.php @@ -16,9 +16,13 @@ use Illuminate\Support\Facades\Route; // web Route::view('/', 'home'); -// misc +Route::any('/login', 'Auth\\AuthController@login'); +Route::any('/register', 'Auth\\AuthController@register'); Route::any('/maintenance', 'MaintenanceController@showPage'); + +// misc Route::view('/javascript', 'javascript'); +Route::view('/testing/blank', 'blank'); // client Route::get('/asset', 'ContentController@fetchAsset');