297 lines
11 KiB
HTML
297 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<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>Xplane WebRTC</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" />
|
|
<!-- CDN script to import micromodal -->
|
|
<script src="https://cdn.jsdelivr.net/npm/micromodal/dist/micromodal.min.js"></script>
|
|
</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">
|
|
<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>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<section>
|
|
<div class="video-container">
|
|
<!-- TODO: 'iframe[allow]' is not supported by Firefox for Android -->
|
|
<iframe
|
|
src="https://www.youtube.com/embed/WVDSVhMW7o4"
|
|
title="YouTube video player"
|
|
frameborder="0"
|
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
allowfullscreen
|
|
>
|
|
</iframe>
|
|
</div>
|
|
</section>
|
|
|
|
<div class="barrier-section">
|
|
<form onsubmit="(event) => event.preventDefault()">
|
|
<div class="field">
|
|
<label class="label">Barrier IP Address</label>
|
|
<div class="control">
|
|
<input
|
|
class="input"
|
|
type="text"
|
|
placeholder="Barrier IP address"
|
|
name="BarrierIP"
|
|
id="BarrierIP"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<label class="label">Machine Name</label>
|
|
<div class="control">
|
|
<input class="input" type="text" name="MachineName" id="MachineName" placeholder="Machine name" />
|
|
</div>
|
|
</div>
|
|
<div class="field is-grouped">
|
|
<div class="control">
|
|
<button type="button" class="custom-button button-dark" onclick="AddBarrierNode();return false;">
|
|
Add Barrier Information
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<div class="divider"></div>
|
|
<div class="barrier-session-info-wrapper block">
|
|
<div class="barrier-session-info">
|
|
<div class="light-text">Barrier Session information</div>
|
|
{{ range .BarrierIPS }}
|
|
<div>
|
|
<div class="small-text">{{ .BarrierIP }} and {{ .MachineName }}</div>
|
|
<button type="button" class="custom-button button-light" onclick="RemoveBarrierSessions({{ .BarrierIP }});return false;">
|
|
Remove
|
|
</button>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="cards-container">
|
|
{{ range .GameSessions }}
|
|
<div class="custom-card">
|
|
<article class="tile is-child box">
|
|
<p class="title">{{ .Server.Hostname }}</p>
|
|
<p class="server-info">RAM: {{ .Server.RAM }} MB</p>
|
|
<p class="server-info">Rate: {{ .Rate }}$/hr</p>
|
|
<p class="server-info">CPU: {{ .Server.CPU }}</p>
|
|
<p class="server-info">Disk: {{ .Server.Disk }} MB</p>
|
|
<p class="server-info">Platform: {{ .Server.Platform }}</p>
|
|
<p class="server-info">GPU: {{ .Server.GPU }}</p>
|
|
<br />
|
|
<button
|
|
type="button"
|
|
class="button is-block is-success is-fullwidth is-medium"
|
|
onclick="setCurrentLink({currentLink: `{{ .Link }}`})"
|
|
>
|
|
Play
|
|
</button>
|
|
</article>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
|
|
<div class="modal micromodal-slide" id="modal-1" aria-hidden="true">
|
|
<div class="modal__overlay" tabindex="-1" data-micromodal-close>
|
|
<div
|
|
class="modal__container"
|
|
role="dialog"
|
|
aria-modal="true"
|
|
aria-labelledby="modal-1-title"
|
|
>
|
|
<header class="modal__header">
|
|
<h2 class="modal__title" id="modal-1-title">Choose barrier session</h2>
|
|
<button
|
|
type="button"
|
|
class="modal__close"
|
|
aria-label="Close modal"
|
|
data-micromodal-close
|
|
></button>
|
|
</header>
|
|
<main class="modal__content" id="modal-1-content">
|
|
{{ range .BarrierIPS }}
|
|
<div class="form-check">
|
|
<button
|
|
type="button"
|
|
class="modal__btn modal__btn-primary"
|
|
onclick="goToLink({{ .BarrierIP }})"
|
|
data-micromodal-close
|
|
>
|
|
{{ .BarrierIP }} and {{ .MachineName }}
|
|
</button>
|
|
<!-- <input class="form-check-input" type="radio" name="flexRadioDefault" id="flexRadioDefault{{ .MachineName }}">-->
|
|
<!-- <label class="form-check-label" for="flexRadioDefault{{ .MachineName }}">-->
|
|
<!-- {{ .BarrierIP }} and {{ .MachineName }}-->
|
|
<!-- </label>-->
|
|
</div>
|
|
<br>
|
|
{{ end }}
|
|
</main>
|
|
<footer class="modal__footer">
|
|
<!-- <button-->
|
|
<!-- type="button"-->
|
|
<!-- class="modal__btn modal__btn-primary"-->
|
|
<!-- onclick="goToLink()"-->
|
|
<!-- data-micromodal-close-->
|
|
<!-- >-->
|
|
<!-- Continue-->
|
|
<!-- </button>-->
|
|
<button
|
|
type="button"
|
|
class="modal__btn"
|
|
data-micromodal-close
|
|
aria-label="Close this dialog window"
|
|
>
|
|
Close
|
|
</button>
|
|
</footer>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
// Docs for micromodal: https://micromodal.vercel.app
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
try {
|
|
MicroModal.init({
|
|
awaitOpenAnimation: true, // set to false, to remove open animation
|
|
awaitCloseAnimation: true, // set to false, to remove close animation
|
|
});
|
|
} catch (e) {
|
|
console.log("micromodal error: ", e);
|
|
}
|
|
});
|
|
|
|
let link = "";
|
|
|
|
// set the link to the current link
|
|
function setCurrentLink({ currentLink }) {
|
|
link = currentLink.slice(1, -1); //? get rid of the quotes
|
|
// If radio button is selected
|
|
// redirect based on the link provided
|
|
}
|
|
|
|
// open the link in a new tab
|
|
function goToLink(barrierip) {
|
|
window.open(link + "&barrierip=" + barrierip, "_blank");
|
|
}
|
|
|
|
// The function is called on OnClick action
|
|
function AddBarrierNode() {
|
|
// Getting element information of all the fields
|
|
// required for registration
|
|
var BarrierIP = document.getElementById("BarrierIP").value
|
|
var MachineName = document.getElementById("MachineName").value
|
|
|
|
|
|
// // When EmailID is not entered
|
|
// if (BarrierIP == "") {
|
|
// document.getElementById("EmailIDError").innerHTML = "Enter EmailID"
|
|
// return
|
|
// }
|
|
//
|
|
// // When EmailID is entered
|
|
// if (BarrierIP != "") {
|
|
// document.getElementById("EmailIDError").innerHTML = ""
|
|
// }
|
|
//
|
|
// // When password and confirm password don't match
|
|
// if (MachineName != "") {
|
|
// document.getElementById("PasswordError").innerHTML = ""
|
|
// }
|
|
// // When the password matches then clear the field
|
|
// if (MachineName == "") {
|
|
// document.getElementById("PasswordError").innerHTML = "Enter password"
|
|
// return
|
|
// }
|
|
|
|
// binding data to uri encoded string
|
|
uriencoded = "BarrierIP=" + BarrierIP + "&MachineName=" + MachineName
|
|
|
|
// Submitting the registration information
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open("POST", "/AddBarrierIP", 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("/");
|
|
}
|
|
}
|
|
}
|
|
|
|
function RemoveBarrierSessions(ipaddress) {
|
|
// binding data to uri encoded string
|
|
uriencoded = "BarrierIP=" + ipaddress
|
|
|
|
// Submitting the registration information
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open("POST", "/RemoveBarrierIP", 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 === "BarrierIP removed successfully") {
|
|
window.location.replace("/");
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<script async type="text/javascript" src="assets/js/bulma.js"></script>
|
|
</body>
|
|
</html>
|