Groundwork for games.

This commit is contained in:
Graphictoria 2021-10-02 14:48:14 -04:00
parent 60ddda8aa9
commit e4e754da18
14 changed files with 199 additions and 4 deletions

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Games;
use App\Models\WebStatus;
class GamesController extends Controller
{
/**
* Returns if the games arbiter is operational or not.
*
* @return Response
*/
public function isAvailable()
{
$status = WebStatus::where('name', 'GamesArbiter')
->first();
return response()->json(['available' => $status->operational])
->header('Access-Control-Allow-Origin', env('APP_URL'))
->header('Vary', 'origin')
->header('Content-Type', 'application/json');
}
}

11
web/app/Models/Games.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Games extends Model
{
use HasFactory;
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class WebStatus extends Model
{
protected $casts = [
'operational' => 'boolean',
];
use HasFactory;
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateWebstatusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('web_statuses', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->boolean('operational')->default(false);
$table->float('responseTime')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('web_statuses');
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateGamesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('games', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description')->nullable();
$table->unsignedInteger('creator');
$table->enum('status', ['unmoderated', 'review', 'deleted'])->default('unmoderated');
$table->unsignedInteger('genre')->default(0); // bitwise flags
$table->unsignedInteger('allowed_gears')->default(0); // bitwise flags
$table->unsignedInteger('players_ingame')->default(0);
$table->unsignedInteger('visits')->default(0);
$table->unsignedInteger('max_players')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('games');
}
}

View File

@ -4,6 +4,8 @@ namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Database\Seeders\WebStatusSeeder;
class DatabaseSeeder extends Seeder
{
/**
@ -13,6 +15,8 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// \App\Models\User::factory(10)->create();
$this->call([
WebStatusSeeder::class
]);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\WebStatus;
class WebStatusSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
WebStatus::create([
'name' => 'ThumbArbiter'
]);
WebStatus::create([
'name' => 'GamesArbiter'
]);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -21,7 +21,7 @@ const Footer = () => {
<p className="text-muted fw-bold mb-0 mt-1"><FooterLink label="About Us" href="/legal/about-us"/> | <FooterLink label="Terms of Service" href="/legal/terms-of-service"/> | <FooterLink label="Privacy Policy" href="/legal/privacy-policy"/> | <FooterLink label="DMCA" href="/legal/dmca"/> | <FooterLink label="Support" href="/support"/> | <FooterLink label="Blog" href="/blog"/></p>
<hr className="mx-auto my-2 w-25"/>
<p className="text-muted fw-light m-0">Copyright © {CurrentDate.getFullYear()} Graphictoria. All rights reserved.</p>
<p className="text-muted fw-light m-0">Graphictoria is not associated with ROBLOX Corporation. The usage of this website signifies your acceptance of the <FooterLink label="Terms of Service" href="/legal/terms-of-service"/> and our <FooterLink label="Privacy Policy" href="/legal/privacy-policy"/>.</p>
<p className="text-muted fw-light m-0">Graphictoria is not affiliated with or sponsored by Roblox Corporation. The usage of this website signifies your acceptance of the <FooterLink label="Terms of Service" href="/legal/terms-of-service"/> and our <FooterLink label="Privacy Policy" href="/legal/privacy-policy"/>.</p>
<div className="my-1">
<a className="mx-1" href="https://twitter.com/gtoriadotnet" rel="noreferrer" target="_blank"><img src="/images/Twitter.svg" alt="Twitter" height="28" width="28"></img></a>
<a className="mx-1" href="https://discord.gg/q666a2sF6d" rel="noreferrer" target="_blank"><img src="/images/Discord.svg" alt="Discord" height="28" width="28"></img></a>

View File

@ -16,6 +16,8 @@ import { Auth } from '../Pages/Auth.js';
import { NotFound, InternalServerError } from '../Pages/Errors.js';
import { Maintenance } from '../Pages/Maintenance.js';
import { Games } from '../Pages/Games.js';
import { About } from '../Pages/Legal/About.js';
import { Copyright } from '../Pages/Legal/Copyright.js';
import { Privacy } from '../Pages/Legal/Privacy.js';
@ -114,6 +116,10 @@ class App extends React.Component {
<Auth location={location.pathname}/>
</Route>
<Route exact path="/games">
<Games/>
</Route>
<Route path="*">
<NotFound/>
</Route>

View File

@ -74,4 +74,4 @@ class InternalServerError extends React.Component {
}
}
export { NotFound, InternalServerError };
export { NotFound, InternalServerError, GenericErrorModal };

29
web/resources/js/pages/Games.js vendored Normal file
View File

@ -0,0 +1,29 @@
// © XlXi 2021
// Graphictoria 5
import React from "react";
import { Link, useHistory } from "react-router-dom";
import SetTitle from "../Helpers/Title.js";
import { GenericErrorModal } from './Errors.js';
class Games extends React.Component {
componentDidMount()
{
SetTitle("Games");
}
render()
{
return (
<GenericErrorModal title="Games Offline">
<img src="/images/symbols/warning.png" width="100" className="mb-3" />
<br />
Seems like XlXi tripped over the game server's power cord again. Games are temporarily unavailable and administrators have been notified of the issue. Sorry for the inconvenience!
</GenericErrorModal>
);
}
}
export { Games };

View File

@ -21,7 +21,7 @@ class Home extends React.Component {
<div className="mb-4 graphictoria-home-shadow">
<h1 className="graphictoria-homepage-header">Graphictoria</h1>
<h5 className="mb-0">Graphictoria aims to revive the classic Roblox experience. Join <b>5k+</b> other users and relive your childhood!</h5>
<p className="graphictoria-homepage-fine-print fst-italic">* Graphictoria is not affiliated with Roblox Corporation.</p>
<p className="graphictoria-homepage-fine-print fst-italic">* Graphictoria is not affiliated with or sponsored by Roblox Corporation.</p>
</div>
<Link to="/register" className="btn btn-success">Create your account<i className="ps-2 graphictoria-small-aligned-text fas fa-chevron-right"></i></Link>
</div>

View File

@ -3,6 +3,7 @@
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\BannerController;
use App\Http\Controllers\GamesController;
/*
|--------------------------------------------------------------------------
@ -21,6 +22,8 @@ Route::get('/', function () {
Route::get('/web/activebanners', [BannerController::class, 'getBanners']);
Route::get('/web/games/status', [GamesController::class, 'isAvailable']);
Route::fallback(function () {
return response('{"errors":[{"code":404,"message":"NotFound"}]}', 404)
->header('Cache-Control', 'private')