2023-12-28 01:25:49 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
2021-05-09 18:55:34 +02:00
|
|
|
|
2023-12-28 01:25:49 +01:00
|
|
|
<head>
|
|
|
|
<%- header %>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body id="app">
|
|
|
|
<Navbar></Navbar>
|
|
|
|
<div id="content" class="container">
|
|
|
|
<h1 class="my-4">PIN Pairing</h1>
|
|
|
|
<form action="" class="form d-flex flex-column align-items-center" id="form">
|
|
|
|
<div class="card flex-column d-flex p-4 mb-4">
|
|
|
|
<input type="text" pattern="\d*" placeholder="PIN" id="pin-input" class="form-control my-4" />
|
|
|
|
<button class="btn btn-primary">Send</button>
|
|
|
|
</div>
|
|
|
|
<div class="alert alert-warning">
|
|
|
|
<b>Warning!</b> Make sure you have access to the client you are pairing
|
2024-01-07 13:32:32 -05:00
|
|
|
with.<br>
|
2023-12-28 01:25:49 +01:00
|
|
|
This software can give total control to your computer, so be careful!
|
|
|
|
</div>
|
|
|
|
<div id="status"></div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
<script type="module">
|
|
|
|
import Navbar from './Navbar.vue'
|
|
|
|
import {createApp} from 'vue'
|
|
|
|
let app = createApp({
|
|
|
|
components: {
|
|
|
|
Navbar
|
|
|
|
}
|
|
|
|
});
|
|
|
|
app.mount("#app");
|
|
|
|
|
2021-08-17 19:12:15 +02:00
|
|
|
document.querySelector("#form").addEventListener("submit", (e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
let pin = document.querySelector("#pin-input").value;
|
|
|
|
document.querySelector("#status").innerHTML = "";
|
|
|
|
let b = JSON.stringify({ pin: pin });
|
|
|
|
fetch("/api/pin", { method: "POST", body: b })
|
|
|
|
.then((response) => response.json())
|
|
|
|
.then((response) => {
|
2022-01-23 17:31:32 +01:00
|
|
|
if (response.status.toString().toLowerCase() === "true") {
|
2021-08-17 19:12:15 +02:00
|
|
|
document.querySelector(
|
|
|
|
"#status"
|
|
|
|
).innerHTML = `<div class="alert alert-success" role="alert">Success! Please check Moonlight to continue</div>`;
|
2023-05-04 22:33:50 -05:00
|
|
|
document.querySelector("#pin-input").value = "";
|
2021-08-17 19:12:15 +02:00
|
|
|
} else {
|
|
|
|
document.querySelector(
|
|
|
|
"#status"
|
2022-01-19 21:27:17 +01:00
|
|
|
).innerHTML = `<div class="alert alert-danger" role="alert">Pairing Failed: Check if the PIN is typed correctly</div>`;
|
2021-08-17 19:12:15 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|