Some stuff, cant really remember what all I did.
This commit is contained in:
parent
a65e618d04
commit
6d34216f2d
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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.'
|
||||
|
|
|
|||
|
|
@ -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.'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
public function login(Request $request)
|
||||
{
|
||||
if($request->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');
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 '<?php $noNav=true; ?>';
|
||||
});
|
||||
|
||||
Blade::directive('nofooter', function() {
|
||||
return '<?php $noFooter=true; ?>';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
@php
|
||||
$fields = [
|
||||
'username' => 'Username',
|
||||
'password' => 'Password'
|
||||
];
|
||||
@endphp
|
||||
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Login')
|
||||
|
||||
@section('content')
|
||||
<div class="container graphictoria-center-vh">
|
||||
<x-card>
|
||||
<x-slot name="title">
|
||||
<i class="fas fa-user-circle"></i> SIGN IN
|
||||
</x-slot>
|
||||
<x-slot name="body">
|
||||
<div class="p-2 row">
|
||||
<div class="col-md-8 mb-2">
|
||||
@if($errors->any())
|
||||
<div class="px-5 mb-10">
|
||||
<div class="alert alert-danger graphictoria-alert graphictoria-error-popup">{{ $errors->first() }}</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ url('/login') }}">
|
||||
@csrf
|
||||
@foreach($fields as $field => $label)
|
||||
<input type="{{ $field }}" @class(['form-control', 'mb-4', 'is-invalid'=>($errors->first($field) != null)]) placeholder="{{ $label }}" name="{{ $field }}" value="{{ old($field) }}" />
|
||||
@endforeach
|
||||
<button class="btn btn-primary px-5" type="submit">SIGN IN</button>
|
||||
</form>
|
||||
|
||||
<a href="/passwordreset" class="text-decoration-none fw-normal center" target="_blank">Forgot your password?</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h5>New to Graphictoria?</h5>
|
||||
<p>Creating an account takes less than a minute, and you can join a community of 8k+ users for <b>completely free</b>.<br/><a href="/register" class="btn btn-sm btn-success mt-2" target="_blank">Sign Up</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</x-slot>
|
||||
<x-slot name="footer"></x-slot>
|
||||
</x-card>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Register')
|
||||
|
||||
@section('content')
|
||||
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
This page left intentionally blank
|
||||
@endsection
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<div class="card graphictoria-small-card shadow-sm">
|
||||
<div class="card-body text-center">
|
||||
<h5 class="card-title fw-bold">{{ $title }}</h5>
|
||||
<h5 class="card-title fw-bold">{{ isset($title) ? $title : $attributes['title'] }}</h5>
|
||||
<hr class="mx-5"/>
|
||||
<p class="card-text">{{ $body }}</p>
|
||||
{{ $footer }}
|
||||
|
|
|
|||
|
|
@ -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 @@
|
|||
<meta name="keywords" content="graphictoria, xdiscuss, nostalgia, roblox, gtoria, private server, classic, old roblox, classic roblox, forum, game engine, mmo, classic mmo, old internet"/>
|
||||
<meta property="og:title" content="Graphictoria{{ View::hasSection('title') ? ' | ' . View::getSection('title') : '' }}"/>
|
||||
<meta property="og:site_name" content="Graphictoria"/>
|
||||
<meta property="og:description" content="{{ View::hasSection('description') ? View::getSection('description') . ' ' : '' }}{{ $slogan }}"/>
|
||||
<meta property="og:description" content="{{ $slogan }}"/>
|
||||
<meta property="og:type" content="website"/>
|
||||
<meta property="og:image" content="{{ asset('images/banner.png') }}">
|
||||
<meta name="twitter:image" content="{{ asset('images/banner.png') }}">
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in New Issue