317 lines
9.5 KiB
HTML
317 lines
9.5 KiB
HTML
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
<link rel="icon" type="image/x-icon" href="/ipfs/QmQRq211EMmQJ7QE44FrVZt8EMF7JJWnayDXHyKzes4pX1">
|
|
<title>Astroport - TW - LOGIN / LOGOUT </title>
|
|
|
|
<script src="/ipfs/Qmae5v9zydax9u6C9ceDijURu5PYdd5avmv4NkenCw7RFv/astro.js"></script>
|
|
|
|
<script src="/ipfs/QmQLQ5WdCEc7mpKw5rhUujUU1URKweei4Bb4esyVNd9Atx/G1PalPay_fichiers/jquery-3.6.3.min.js"></script>
|
|
<script src="/ipfs/QmQLQ5WdCEc7mpKw5rhUujUU1URKweei4Bb4esyVNd9Atx/G1PalPay_fichiers/instascan.min.js"></script>
|
|
<link rel="stylesheet" href="/ipfs/QmaCh8mywWfxkXF3JziFzqZS6yZFo3eNS5fSfnzJqdSQvX/decoration.css" type="text/css" />
|
|
<link rel="stylesheet" href="/ipfs/QmaCh8mywWfxkXF3JziFzqZS6yZFo3eNS5fSfnzJqdSQvX/layout.css" type="text/css" />
|
|
<style>
|
|
body {
|
|
background-color: black;
|
|
display: flex;
|
|
background-image: url("/ipfs/QmQspubjs9XymRC1f6ka7kJUb66WyXhuymW3vCqm2nN4GB");
|
|
background-repeat: no-repeat;
|
|
background-size: 100% 100%;
|
|
padding: 0;
|
|
margin: 0;
|
|
font-family: sans-serif;
|
|
}
|
|
|
|
/* Apply styles to an inner container for the image */
|
|
.demo {
|
|
background-image: url("/ipfs/QmQP9qz4R5Y9ycSQ36CXKE44SptpzRxZ2o9AKympj6Cikc");
|
|
background-repeat: no-repeat;
|
|
background-size: contain; /* Keep the image aspect ratio and fit it within the container */
|
|
width: 80%; /* Adjust the width of the container as needed */
|
|
height: 80%; /* Adjust the height of the container as needed */
|
|
}
|
|
|
|
html {
|
|
height: 100%
|
|
}
|
|
header {
|
|
opacity: 0.8;
|
|
}
|
|
input[type=submit] {
|
|
width: 12em; height: 4em;
|
|
}
|
|
input[type=checkbox] {
|
|
width: 2em; height: 2em;
|
|
}
|
|
input {
|
|
width: 26em; height: 2em;
|
|
}
|
|
#aframe {
|
|
background: white;
|
|
color: black;
|
|
}
|
|
|
|
h1 {
|
|
margin-top: 10px;
|
|
font-size: 40px;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.subtitle {
|
|
font-size: 20px;
|
|
margin-bottom: 20px;
|
|
color: #777;
|
|
}
|
|
|
|
a {
|
|
color: white;
|
|
}
|
|
|
|
#demo {
|
|
overflow: hidden;
|
|
}
|
|
|
|
#showoff {
|
|
width: 80%;
|
|
|
|
-webkit-touch-callout: none;
|
|
-webkit-user-select: none;
|
|
-khtml-user-select: none;
|
|
-moz-user-select: none;
|
|
-ms-user-select: none;
|
|
user-select: none;
|
|
}
|
|
|
|
/* Add these styles to your existing CSS */
|
|
/* Adjust the top and right positions to align with the camera */
|
|
#qrcode-container {
|
|
position: absolute;
|
|
top: 20px; /* Adjust the top position as needed */
|
|
left: 20px; /* Adjust the left position as needed */
|
|
}
|
|
|
|
#form-container {
|
|
position: absolute;
|
|
top: 20px; /* Adjust the top position as needed */
|
|
left: 280px; /* Adjust the right position to align with the camera */
|
|
|
|
padding: 20px; /* Add padding to create a background effect */
|
|
text-align: right;
|
|
width: 22%; /* Adjust the width of the form container as needed */
|
|
}
|
|
|
|
#console {
|
|
background: rgba(0, 0, 0, 0.7); /* Adjust the background color and opacity as needed */
|
|
color: white;
|
|
width: 100%;
|
|
position: absolute;
|
|
bottom: 0;
|
|
left: 0;
|
|
padding: 10px;
|
|
visibility: hidden;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
#ainfo {
|
|
position: absolute;
|
|
top: 10px; /* Adjust the top position as needed */
|
|
right: 10px; /* Adjust the right position as needed */
|
|
}
|
|
|
|
#container {
|
|
top: 40px;
|
|
right: 0px;
|
|
position: absolute;
|
|
display: inline-block;
|
|
width: 300px;
|
|
height: 400px;
|
|
}
|
|
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
<div id="demo">
|
|
<div id="showoff">
|
|
<div id="qrcode-container">
|
|
<video id="preview" style="transform: scaleX(-1);width: 240px;height: 240px;" autoplay="autoplay" class="active"></video>
|
|
</div>
|
|
<div id="form-container">
|
|
<!-- Your form content here -->
|
|
<!--
|
|
<h1><button id="ainfo" onclick="javascript:var x = document.getElementById('console'); if (x.style.visibility === 'hidden') {x.style.visibility = 'visible';} else {x.style.visibility = 'hidden';}">0/1</button></h1>
|
|
-->
|
|
<div id="container">
|
|
<input type="hidden" id="PASS" value="PASS"/>
|
|
<p><input type="hidden" id="g1pub" value="2L8vaYixCf97DMT8SistvQFeBj7vb6RQL7tvwyiv1XVH"/></p>
|
|
<div id="appname">
|
|
<label>
|
|
<input type="radio" id="r0" name="appname" value="login">
|
|
<b>LOGIN</b>
|
|
</label>
|
|
<label>
|
|
<input type="radio" id="r5" name="appname" value="logout" checked="checked">
|
|
<b>LOGOUT</b>
|
|
</label>
|
|
</div>
|
|
<strong><div id="resu"></div></strong>
|
|
<p> <h2>Scan G1Card</h2> </p>
|
|
<h1><div id="countdown">___</div></h1>
|
|
|
|
<p><a href="https://opencollective.com/monnaie-libre/" target="funding">- (^‿‿^) -</a></p>
|
|
|
|
</div>
|
|
</div>
|
|
<div id="console"><a href="_STATION_" target="aframe">CONSOLE</a>
|
|
<iframe name="aframe" id="aframe" src="_STATION_" width="100%" height="40px"></iframe>
|
|
<h1>TW connect</h1>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
|
|
<script type="text/javascript">
|
|
// Extract the hostname (e.g., "ipfs.copylaradio.com")
|
|
var hostname = window.location.hostname;
|
|
var currentURL = window.location.href;
|
|
var protocol = currentURL.split("://")[0];
|
|
var astroURL = hostname.replace("ipfs", "astroport");
|
|
var modifiedURL = astroURL.replace(":8080", ":1234");
|
|
// Create the "station" variable with the specified format
|
|
var station = protocol + "://" + modifiedURL;
|
|
|
|
async function fetchAstroport(myURL) {
|
|
try {
|
|
|
|
let one = await fetch(myURL); // Gets a promise
|
|
var doc = await one.text();
|
|
var regex = /url='([^']+)/i; // Get response PORT
|
|
var redirectURL = doc.match(regex)[1]
|
|
|
|
console.log(redirectURL)
|
|
|
|
// start countdown
|
|
var timeLeft = 20;
|
|
var elem = document.getElementById("countdown");
|
|
var timerId = setInterval(countdown, 1000);
|
|
|
|
function countdown() {
|
|
if (timeLeft == -1) {
|
|
clearTimeout(timerId);
|
|
elem.innerHTML = "<a target='aframe' href='"+redirectURL+"'>OK</a>";
|
|
window.open( redirectURL, "AstroTab");
|
|
} else {
|
|
elem.innerHTML = timeLeft + " s";
|
|
timeLeft--;
|
|
}
|
|
}
|
|
|
|
} catch (err) {
|
|
console.log('Fetch error:' + err); // Error handling
|
|
}
|
|
}
|
|
|
|
console.log('STATION:' + station);
|
|
|
|
let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
|
|
|
|
scanner.addListener('scan', function (content) {
|
|
alert(content);
|
|
if (content.startsWith('~~~~~')) {
|
|
// GET APPNAME
|
|
var appname = document.querySelector('input[name="appname"]:checked').value;
|
|
|
|
if ( appname == 'login' || appname == 'logout' ) {
|
|
var amount = prompt("Saisir EMAIL:");
|
|
}
|
|
|
|
// GET PASS TO DECODE PGP
|
|
var oldpass = document.getElementById("PASS").value;
|
|
if ( oldpass == 'PASS') {
|
|
var pass = prompt("Saisir PASS:");
|
|
} else {
|
|
var pass = oldpass;
|
|
}
|
|
|
|
// PREVIOUS G1PUB SCAN
|
|
var g1pub = document.getElementById("g1pub").value;
|
|
|
|
// APPNAME : DATA COLLECT & ARRANGE
|
|
if ( appname == 'pay') {
|
|
var amount = prompt("MONTANT (Ğ1) ?");
|
|
alert('PAY TO ' + g1pub + ' = ' + amount);
|
|
}
|
|
|
|
if ( appname == 'friend') {
|
|
var amount = prompt("Entre 1 et 5 (★) ?");
|
|
alert( amount + '★ > ' + g1pub );
|
|
}
|
|
|
|
if ( amount == 'undefined' || amount == '' ) {
|
|
var amount = document.getElementById("g1pub").value;
|
|
}
|
|
|
|
var myU = station + '/?qrcode=' + content +'&pass=' + pass + '&' + appname + '=' + amount + '&g1pub=' + g1pub ;
|
|
console.log(myU);
|
|
|
|
if ( appname == 'login' || appname == 'logout' ) {
|
|
homeAstroportStation(myU, 'tab', 5000)
|
|
} else {
|
|
homeAstroportStation(myU, 'aframe', 12000)
|
|
}
|
|
|
|
} else {
|
|
|
|
// COPY QRCODE IN g1pub input
|
|
document.getElementById("g1pub").value = content;
|
|
// document.getElementById("resu").innerHTML = content;
|
|
var myU = station + '/?qrcode=' + content;
|
|
console.log(myU);
|
|
homeAstroportStation(myU, 'aframe', 12000)
|
|
}
|
|
|
|
// fetchAstroport(myU)
|
|
|
|
});
|
|
|
|
Instascan.Camera.getCameras().then(function (cameras) {
|
|
|
|
if (cameras.length > 0) {
|
|
|
|
scanner.start(cameras[0]);
|
|
|
|
} else {
|
|
|
|
console.error('No cameras found.');
|
|
|
|
}
|
|
|
|
}).catch(function (e) {
|
|
|
|
console.error(e);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
let cookies = document.cookie;
|
|
console.log('COOKIE:' + cookies);
|
|
|
|
const el = document.getElementById('console');
|
|
|
|
setTimeout(() => {
|
|
el.style.visibility = 'visible';
|
|
}, 3000); // 👈️ delay in milliseconds
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|