connected remotegameprivate and backend

This commit is contained in:
2023-02-24 15:41:40 +00:00
parent 574317d286
commit 0fadadee2d
24 changed files with 2101 additions and 151 deletions

View File

@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Admin - Free Bulma template</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">
<!-- Bulma Version 0.9.0-->
<link rel="stylesheet" href="https://unpkg.com/bulma@0.9.0/css/bulma.min.css" />
<link rel="stylesheet" type="text/css" href="assets/css/admin.css">
</head>
<body>
<!-- START NAV -->
<nav class="navbar is-white">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item brand-text" href="index.html">
XPlane11-WebRTC
</a>
<div class="navbar-burger burger" data-target="navMenu">
<span></span>
<span></span>
<span></span>
</div>
</div>
<div id="navMenu" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item" href="admin.html">
Home
</a>
</div>
</div>
</div>
</nav>
<!-- END NAV -->
<div class="container">
<div class="">
<div class="">
<section class="hero is-info welcome is-small">
<div class="hero-body">
<div class="container">
<h1 class="title">
Hello, User.
</h1>
<h2 class="subtitle">
I hope you are having a great day!
</h2>
</article>
</div>
</div>
</section>
<section class="info-tiles">
<div class="tile is-ancestor has-text-centered row columns is-multiline">
{{ range .GameSessions }}
<div class="column is-4 tile is-parent">
<article class="tile is-child box">
<p class="title">{{ .Server.GPU }}</p>
<p style="color: #8F99A3; margin-top:-1.25rem; font-weight: 300; font-size: 1.25rem">RAM: {{ .Server.RAM }}</p>
<p style="color: #8F99A3; font-weight: 300; font-size: 1.25rem">Rate: 1$/hr </p>
<p style="color: #8F99A3; font-weight: 300; font-size: 1.25rem">CPU: {{ .Server.CPU }} </p>
<p style="color: #8F99A3; font-weight: 300; font-size: 1.25rem">Disk: {{ .Server.Disk }} </p>
<br>
<a href="{{ .Link }}" class="button is-block is-success is-fullwidth is-medium">Play</a>
</article>
</div>
{{ end }}
</div>
</section>
</div>
</div>
</div>
<script async type="text/javascript" src="assets/js/bulma.js"></script>
</body>
</html>

View File

@@ -0,0 +1,82 @@
html, body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
font-size: 16px;
line-height: 1.5;
height: 100%;
background: #ECF0F3;
}
nav.navbar {
border-top: 4px solid #276cda;
margin-bottom: 1rem;
}
.navbar-item.brand-text {
font-weight: 300;
}
.navbar-item, .navbar-link {
font-size: 14px;
font-weight: 700;
}
.columns {
width: 100%;
height: 100%;
margin-left: 0;
}
.menu-label {
color: #8F99A3;
letter-spacing: 1.3;
font-weight: 700;
}
.menu-list a {
color: #0F1D38;
font-size: 14px;
font-weight: 700;
}
.menu-list a:hover {
background-color: transparent;
color: #276cda;
}
.menu-list a.is-active {
background-color: transparent;
color: #276cda;
font-weight: 700;
}
.card {
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.18);
margin-bottom: 2rem;
}
.card-header-title {
color: #8F99A3;
font-weight: 400;
}
.info-tiles {
margin: 1rem 0;
}
.info-tiles .subtitle {
font-weight: 300;
color: #8F99A3;
}
.hero.welcome.is-info {
background: #36D1DC;
background: -webkit-linear-gradient(to right, #5B86E5, #36D1DC);
background: linear-gradient(to right, #5B86E5, #36D1DC);
}
.hero.welcome .title, .hero.welcome .subtitle {
color: hsl(192, 17%, 99%);
}
.card .content {
font-size: 14px;
}
.card-footer-item {
font-size: 14px;
font-weight: 700;
color: #8F99A3;
}
.card-footer-item:hover {
}
.card-table .table {
margin-bottom: 0;
}
.events-card .card-table {
max-height: 250px;
overflow-y: scroll;
}

View File

@@ -0,0 +1,4 @@
.va {
display: flex;
align-items: center;
}

View File

@@ -0,0 +1,10 @@
// The following code is based off a toggle menu by @Bradcomp
// source: https://gist.github.com/Bradcomp/a9ef2ef322a8e8017443b626208999c1
(function() {
var burger = document.querySelector('.burger');
var menu = document.querySelector('#'+burger.dataset.target);
burger.addEventListener('click', function() {
burger.classList.toggle('is-active');
menu.classList.toggle('is-active');
});
})();

View File

@@ -0,0 +1,153 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Register - Free Bulma template</title>
<link href="https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;500;700&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/15181efa86.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://unpkg.com/bulma@0.9.0/css/bulma.min.css"/>
<link rel="stylesheet" type="text/css" href="assets/css/register.css">
</head>
<body>
<section class="container">
<div class="columns is-multiline">
<div class="column is-8 is-offset-2 register">
<div class="columns">
<div class="column left">
<h1 class="title is-1">Xplane 11 WebRTC</h1>
<br>
<h2 class="subtitle is-4">Enjoy the XPlane 11 gameplay performance without any setup</h2>
<p></p>
</div>
<div class="column right has-text-centered">
<h1 class="title is-4">Forgot password</h1>
<p class="description">We will send a reset password link to your email</p>
<form>
<div class="field">
<div class="control">
<input class="input is-medium" type="email" placeholder="Email">
</div>
</div>
<button class="button is-block is-success is-fullwidth is-medium">Send reset password link</button>
<br>
<a href="/register" >Create a new account</a>
<br>
<a href="/login" >Already have an account ?</a>
<br/>
<small><em></em></small>
</form>
</div>
</div>
</div>
<div class="column is-8 is-offset-2">
<br>
<nav class="level">
<div class="level-left">
<div class="level-item">
<span class="icon">
<i class="fab fa-github"></i>
</span> &emsp;
</div>
</div>
<div class="level-right">
<small class="level-item" style="color: var(--textLight)">
&copy; Super Cool Website. All Rights Reserved.
</small>
</div>
</nav>
</div>
</div>
</section>
</body>
<style>
:root {
--brandColor: hsl(166, 67%, 51%);
--background: rgb(247, 247, 247);
--textDark: hsla(0, 0%, 0%, 0.66);
--textLight: hsla(0, 0%, 0%, 0.33);
}
body {
background: url('https://forums.x-plane.org/screenshots/monthly_2017_07/b738_21.png.5ba5bcaca689d85705396affb04473ce.png');
background-size: cover; /* <------ */
background-repeat: no-repeat;
background-position: center center;
height: 100vh;
color: var(--textDark);
}
.field:not(:last-child) {
margin-bottom: 1rem;
}
.register {
margin-top: 10rem;
background: white;
border-radius: 10px;
}
.left,
.right {
padding: 4.5rem;
}
.left {
border-right: 5px solid var(--background);
}
.left .title {
font-weight: 800;
letter-spacing: -2px;
}
.left .colored {
color: var(--brandColor);
font-weight: 500;
margin-top: 1rem !important;
letter-spacing: -1px;
}
.left p {
color: var(--textLight);
font-size: 1.15rem;
}
.right .title {
font-weight: 800;
letter-spacing: -1px;
}
.right .description {
margin-top: 1rem;
margin-bottom: 1rem !important;
color: var(--textLight);
font-size: 1.15rem;
}
.right small {
color: var(--textLight);
}
input {
font-size: 1rem;
}
input:focus {
border-color: var(--brandColor) !important;
box-shadow: 0 0 0 1px var(--brandColor) !important;
}
.fab,
.fas {
color: var(--textLight);
margin-right: 1rem;
}
</style>
</html>

85
templates/index.html Normal file
View File

@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Admin - Free Bulma template</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">
<!-- Bulma Version 0.9.0-->
<link rel="stylesheet" href="https://unpkg.com/bulma@0.9.0/css/bulma.min.css" />
<link rel="stylesheet" type="text/css" href="assets/css/admin.css">
</head>
<body>
<!-- START NAV -->
<nav class="navbar is-white">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item brand-text" href="/">
XPlane11-WebRTC
</a>
<div class="navbar-burger burger" data-target="navMenu">
<span></span>
<span></span>
<span></span>
</div>
</div>
<div id="navMenu" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item" href="/">
Home
</a>
<a class="navbar-item" href="/logout">
Logout
</a>
</div>
</div>
</div>
</nav>
<!-- END NAV -->
<div class="container">
<div class="">
<div class="">
<section class="hero is-info welcome is-small">
<div class="hero-body">
<div class="container">
<h1 class="title">
Hello, {{ .User.Name }}
</h1>
<h2 class="subtitle">
I hope you are having a great day!
</h2>
</article>
</div>
</div>
</section>
<section class="info-tiles">
<div class="tile is-ancestor has-text-centered row columns is-multiline">
{{ range .GameSessions }}
<div class="column is-4 tile is-parent">
<article class="tile is-child box">
<p class="title">{{ .Server.GPU }}</p>
<p style="color: #8F99A3; margin-top:-1.25rem; font-weight: 300; font-size: 1.25rem">RAM: {{ .Server.RAM }} MB</p>
<p style="color: #8F99A3; font-weight: 300; font-size: 1.25rem">Rate: {{ .Rate }}$/hr </p>
<p style="color: #8F99A3; font-weight: 300; font-size: 1.25rem">CPU: {{ .Server.CPU }} </p>
<p style="color: #8F99A3; font-weight: 300; font-size: 1.25rem">Disk: {{ .Server.Disk }} MB</p>
<p style="color: #8F99A3; font-weight: 300; font-size: 1.25rem">Platform: {{ .Server.Platform }}</p>
<br>
<a href="{{ .Link }}" class="button is-block is-success is-fullwidth is-medium">Play</a>
</article>
</div>
{{ end }}
</div>
</section>
</div>
</div>
</div>
<script async type="text/javascript" src="assets/js/bulma.js"></script>
</body>
</html>

218
templates/login.html Normal file
View File

@@ -0,0 +1,218 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Register - Free Bulma template</title>
<link href="https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;500;700&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/15181efa86.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://unpkg.com/bulma@0.9.0/css/bulma.min.css"/>
<link rel="stylesheet" type="text/css" href="assets/css/register.css">
</head>
<body>
<section class="container">
<div class="columns is-multiline">
<div class="column is-8 is-offset-2 register">
<div class="columns">
<div class="column left">
<h1 class="title is-1">Xplane 11 WebRTC</h1>
<br>
<h2 class="subtitle is-4">Enjoy the XPlane 11 gameplay performance without any setup</h2>
<p></p>
</div>
<div class="column right has-text-centered">
<h1 class="title is-4">Login</h1>
<p class="description">We cool so long as your computer supports a browser</p>
<form>
<div class="field">
<div class="control">
<input class="input is-medium" type="email" placeholder="Email" id="EmailID">
</div>
</div>
<div class="field">
<div class="control">
<input class="input is-medium" type="password" placeholder="Password" id="Password">
</div>
</div>
<div class="field">
<div class="control">
<p id="EmailIDError"></p>
<p id="PasswordError"></p>
<p id="ResponseText"></p>
</div>
</div>
<button class="button is-block is-success is-fullwidth is-medium" onclick="LoginSubmit();return false;">Login</button>
<br>
<a href="/register" >Create a new account</a>
<br>
<a href="/forgotpassword">Forgot password ?</a>
<br/>
<small><em></em></small>
</form>
</div>
</div>
</div>
<div class="column is-8 is-offset-2">
<br>
<nav class="level">
<div class="level-left">
<div class="level-item">
<span class="icon">
<i class="fab fa-github"></i>
</span> &emsp;
</div>
</div>
<div class="level-right">
<small class="level-item" style="color: var(--textLight)">
&copy; Super Cool Website. All Rights Reserved.
</small>
</div>
</nav>
</div>
</div>
</section>
</body>
<script>
// The function is called on OnClick action
function LoginSubmit() {
// Getting element information of all the fields
// required for registration
var EmailID = document.getElementById("EmailID").value
var Password = document.getElementById("Password").value
// When EmailID is not entered
if (EmailID == "") {
document.getElementById("EmailIDError").innerHTML = "Enter EmailID"
return
}
// When EmailID is entered
if (EmailID != "") {
document.getElementById("EmailIDError").innerHTML = ""
}
// When password and confirm password don't match
if (Password != "") {
document.getElementById("PasswordError").innerHTML = ""
}
// When the password matches then clear the field
if (Password == "") {
document.getElementById("PasswordError").innerHTML = "Enter password"
return
}
// binding data to uri encoded string
uriencoded = "EmailID=" + EmailID + "&Password=" + Password
// Submitting the registration information
var xhr = new XMLHttpRequest();
xhr.open("POST", "/login", true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send(uriencoded);
xhr.onload = function () {
console.log(xhr.responseText)
// Outputting response text
document.getElementById("ResponseText").innerHTML = xhr.responseText
// Create Sessions browser
// if response is success then redirect
if (xhr.responseText == "Success!") {
window.location.replace("/");
}
}
}
</script>
<style>
:root {
--brandColor: hsl(166, 67%, 51%);
--background: rgb(247, 247, 247);
--textDark: hsla(0, 0%, 0%, 0.66);
--textLight: hsla(0, 0%, 0%, 0.33);
}
body {
background: url('https://forums.x-plane.org/screenshots/monthly_2017_07/b738_21.png.5ba5bcaca689d85705396affb04473ce.png');
background-size: cover; /* <------ */
background-repeat: no-repeat;
background-position: center center;
height: 100vh;
color: var(--textDark);
}
.field:not(:last-child) {
margin-bottom: 1rem;
}
.register {
margin-top: 10rem;
background: white;
border-radius: 10px;
}
.left,
.right {
padding: 4.5rem;
}
.left {
border-right: 5px solid var(--background);
}
.left .title {
font-weight: 800;
letter-spacing: -2px;
}
.left .colored {
color: var(--brandColor);
font-weight: 500;
margin-top: 1rem !important;
letter-spacing: -1px;
}
.left p {
color: var(--textLight);
font-size: 1.15rem;
}
.right .title {
font-weight: 800;
letter-spacing: -1px;
}
.right .description {
margin-top: 1rem;
margin-bottom: 1rem !important;
color: var(--textLight);
font-size: 1.15rem;
}
.right small {
color: var(--textLight);
}
input {
font-size: 1rem;
}
input:focus {
border-color: var(--brandColor) !important;
box-shadow: 0 0 0 1px var(--brandColor) !important;
}
.fab,
.fas {
color: var(--textLight);
margin-right: 1rem;
}
</style>
</html>

249
templates/registration.html Normal file
View File

@@ -0,0 +1,249 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Register - Free Bulma template</title>
<link href="https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;500;700&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/15181efa86.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://unpkg.com/bulma@0.9.0/css/bulma.min.css"/>
<link rel="stylesheet" type="text/css" href="assets/css/register.css">
</head>
<body>
<section class="container">
<div class="columns is-multiline">
<div class="column is-8 is-offset-2 register">
<div class="columns">
<div class="column left">
<h1 class="title is-1">Xplane 11 WebRTC</h1>
<br>
<h2 class="subtitle is-4">Enjoy the XPlane 11 gameplay performance without any setup</h2>
<p></p>
</div>
<div class="column right has-text-centered">
<h1 class="title is-4">Sign up today</h1>
<p class="description">We cool so long as your computer supports a browser</p>
<form>
<div class="field">
<div class="control">
<input class="input is-medium" type="text" id="Name" placeholder="Name" required>
</div>
</div>
<div class="field">
<div class="control">
<input class="input is-medium" type="email" id="EmailID" placeholder="Email" required>
</div>
</div>
<div class="field">
<div class="control">
<input class="input is-medium" type="password" id="Password" placeholder="Password" required>
</div>
</div>
<div class="field">
<div class="control">
<input class="input is-medium" type="password" id="ConfirmPassword" placeholder="Confirm password" required>
</div>
</div>
<div class="field">
<div class="control">
<p id="NameError"></p>
<p id="EmailIDError"></p>
<p id="ConfirmPasswordError"></p>
<p id="ResponseText"></p>
</div>
</div>
<button class="button is-block is-success is-fullwidth is-medium" onclick="RegisterSubmit();return false;">Submit</button>
<br>
<a href="/login" >Already have an account ?</a>
<br>
<a href="/forgotpassword">Forgot password ?</a>
<br/>
<br/>
<small><em></em></small>
</form>
</div>
</div>
</div>
<div class="column is-8 is-offset-2">
<br>
<nav class="level">
<div class="level-left">
<div class="level-item">
<span class="icon">
<i class="fab fa-github"></i>
</span> &emsp;
</div>
</div>
<div class="level-right">
<small class="level-item" style="color: var(--textLight)">
&copy; Super Cool Website. All Rights Reserved.
</small>
</div>
</nav>
</div>
</div>
</section>
</body>
<!-- The following script handles communicating with the server for registration -->
<script>
// The function is called on OnClick action
function RegisterSubmit() {
// Getting element information of all the fields
// required for registration
var EmailID = document.getElementById("EmailID").value
var Name = document.getElementById("Name").value
var Password = document.getElementById("Password").value
var ConfirmPassword = document.getElementById("ConfirmPassword").value
// When Name is not entered
if (Name == "") {
document.getElementById("Name").innerHTML = "Enter Name"
return
}
// When Name is entered
if (Name != "") {
document.getElementById("Name").innerHTML = ""
}
// When EmailID is not entered
if (EmailID == "") {
document.getElementById("EmailIDError").innerHTML = "Enter EmailID"
return
}
// When EmailID is entered
if (EmailID != "") {
document.getElementById("EmailIDError").innerHTML = ""
}
// When password and confirm password don't match
if (Password != ConfirmPassword) {
document.getElementById("ConfirmPasswordError").innerHTML = "Password and confirm password don't match"
return
}
// When the password matches then clear the field
if (Password == ConfirmPassword){
document.getElementById("ConfirmPasswordError").innerHTML = ""
}
// binding data to uri encoded string
uriencoded = "Name=" + Name + "&EmailID=" + EmailID + "&Password=" + Password
// Submitting the registration information
var xhr = new XMLHttpRequest();
xhr.open("POST", "/register", true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send(uriencoded);
xhr.onload = function() {
// Outputting response text
document.getElementById("ResponseText").innerHTML = xhr.responseText
}
}
// comparing strings
function strcmp(a, b)
{
return (a<b?-1:(a>b?1:0));
}
</script>
<style>
:root {
--brandColor: hsl(166, 67%, 51%);
--background: rgb(247, 247, 247);
--textDark: hsla(0, 0%, 0%, 0.66);
--textLight: hsla(0, 0%, 0%, 0.33);
}
body {
background: url('https://forums.x-plane.org/screenshots/monthly_2017_07/b738_21.png.5ba5bcaca689d85705396affb04473ce.png');
background-size: cover; /* <------ */
background-repeat: no-repeat;
background-position: center center;
height: 100vh;
color: var(--textDark);
}
.field:not(:last-child) {
margin-bottom: 1rem;
}
.register {
margin-top: 10rem;
background: white;
border-radius: 10px;
}
.left,
.right {
padding: 4.5rem;
}
.left {
border-right: 5px solid var(--background);
}
.left .title {
font-weight: 800;
letter-spacing: -2px;
}
.left .colored {
color: var(--brandColor);
font-weight: 500;
margin-top: 1rem !important;
letter-spacing: -1px;
}
.left p {
color: var(--textLight);
font-size: 1.15rem;
}
.right .title {
font-weight: 800;
letter-spacing: -1px;
}
.right .description {
margin-top: 1rem;
margin-bottom: 1rem !important;
color: var(--textLight);
font-size: 1.15rem;
}
.right small {
color: var(--textLight);
}
input {
font-size: 1rem;
}
input:focus {
border-color: var(--brandColor) !important;
box-shadow: 0 0 0 1px var(--brandColor) !important;
}
.fab,
.fas {
color: var(--textLight);
margin-right: 1rem;
}
</style>
</html>