www = ASTROBOT DApp Templates

This commit is contained in:
fred 2023-10-09 12:15:41 +02:00
parent 6e62165480
commit a9717a78d0
14 changed files with 24 additions and 804 deletions

View File

@ -134,12 +134,12 @@ while true; do
echo "/ CONTACT : $HOSTP"
if [ -z "$isLAN" ]; then
echo $(mySalt) | \
mySalt | \
sed "s~http://127.0.0.1:12345~http://${myIP}:${PORT}~g" | \
sed "s~http://${myIP}:${PORT}~${myASTROPORT}/${PORT}~g" | \
nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
else
echo $(mySalt) | \
mySalt | \
sed "s~http://127.0.0.1:12345~http://${myIP}:${PORT}~g" | \
nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
fi

View File

@ -73,7 +73,7 @@ if [[ ${QRCODE} == "station" ]]; then
ISTATION=$(cat ~/.zen/tmp/ISTATION)
fi
## SHOW G1PALPAY FRONT (IFRAME)
sed "s~_STATION_~${myIPFS}${ISTATION}/~g" $MY_PATH/../www/G1PalPay/index.html > ~/.zen/tmp/${MOATS}/index.htm
sed "s~_STATION_~${myIPFS}${ISTATION}/~g" $MY_PATH/../templates/G1PalPay/index.html > ~/.zen/tmp/${MOATS}/index.htm
[[ ! $isLAN ]] && sed -i "s~MENU~DEMO~g" ~/.zen/tmp/${MOATS}/index.htm
sed -i "s~http://127.0.0.1:8080~${myIPFS}~g" ~/.zen/tmp/${MOATS}/index.htm
sed -i "s~http://127.0.0.1:33101~${myG1BILLET}~g" ~/.zen/tmp/${MOATS}/index.htm

View File

@ -6,8 +6,6 @@ As we use IPFS, we can record any data structure as a "blockchain" by just copyi
IPNS key publishes evolving "Solid State" (like archive.org). Any ECC key is an IPNS key.
So Duniter/Cesium, GChange, SSH, PGP, ... can benefit a side shared storage onto IPFS.
Astroport.ONE is collecting is map through the bootstrap nodes in ~/.zen/Astroport.ONE/A_boostrap_nodes.txt
A new list makes a new "Station Tribe". Some bootstrap scenario could initiate automatic key creation & cross signatures
(ex: Create 25 PLAYERs to start a 5x5 document emitting with random cross signature)
@ -15,7 +13,7 @@ A new list makes a new "Station Tribe". Some bootstrap scenario could initiate a
PLAYER key & wishes can be controled through : ```~/.zen/Astroport.ONE/command.sh``` or directly through TW (Tag="voeu")
Each wish, is a derivated key, it has an IPNS publishing and can be associated to its own ASTROBOT program to take care about Friends data collect & merge.
VISA.new.sh is creating TW from ```templates/twdefault.html```
VISA.new.sh is creating TW from ```templates/twdefault.html``` and ```templates/minimal.html```
This script is important as it initialize PLAYER... It could allow different templating.
## 20H12
@ -34,6 +32,25 @@ Sequence is run in that order:
This process is run almost every hour. Stations are getting and publishing
Each time MAP.refresh.sh is running it takes data from PLAYERs caches (~/.zen/game/players/.../) and publish it on Station IPNS key.
## UPlanet
UMap shared keys introduce common blockchains.
PROTOCOL
To avoid collisions and maintain data freshness.
20H12 process time should be adjusted on real sun time based on longitude.
Every 4 minute next 0.01 longitude is processed.
Every UMap is then processed by latitude...
So the planet sectors act like a "Virtual Hard Drive" giving 24s to each sector for being refreshed.
To spread blockchain next step calculations, key management will be given to the closest Astroport Station.
CONTROL AGENT
Disfunctions and protocol break can be detected by every Stations thus they can identify bad IPFS NODE publiher(s) and blacklist them
## REVERSE CODE
You can use ~/.zen/Astroport.ONE/search command to search the code for "EXPRESSIONS"

View File

@ -139,7 +139,7 @@ async function fetchAstroport(myURL) {
}
}
```
Utilisez "[astro.js](www/G1PalPay/G1PalPay_fichiers/astro.js)" comme dans l'Application DEMO www/G1PalPay (accessible sur "Open Station")
Utilisez "[astro.js](templates/G1PalPay/G1PalPay_fichiers/astro.js)" comme dans l'Application DEMO templates/G1PalPay (accessible sur "Open Station")
```
<script src="https://ipfs.asycn.io/ipfs/Qmae5v9zydax9u6C9ceDijURu5PYdd5avmv4NkenCw7RFv/astro.js"></script>
```

View File

@ -1,2 +0,0 @@
HELLO THERE. WELCOME TO THE "SMALL WORLD" EXPERIMENT.
A SECURE WORLD OF WISHES AND FRIENDS...

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -1,224 +0,0 @@
<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="http://127.0.0.1:8080/ipfs/QmeDx4rAhXaMfmFNzi12iCinG7vpvMnMf9GvB4iigbPjJ9">
<title>@PASS - ♥Box - </title>
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmQLQ5WdCEc7mpKw5rhUujUU1URKweei4Bb4esyVNd9Atx/G1PalPay_fichiers/demo.css">
<script src="http://127.0.0.1:8080/ipfs/QmYD4y1pXHVnGxxFcn2LWo84ytwmWdNbkyUeFnPCbrpUQy/openpgp.min.js"></script>
<script src="http://127.0.0.1:8080/ipfs/Qmae5v9zydax9u6C9ceDijURu5PYdd5avmv4NkenCw7RFv/astro.js"></script>
<script src="http://127.0.0.1:8080/ipfs/QmQLQ5WdCEc7mpKw5rhUujUU1URKweei4Bb4esyVNd9Atx/G1PalPay_fichiers/jquery-3.6.3.min.js"></script>
<script src="http://127.0.0.1:8080/ipfs/QmQLQ5WdCEc7mpKw5rhUujUU1URKweei4Bb4esyVNd9Atx/G1PalPay_fichiers/instascan.min.js"></script>
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmaCh8mywWfxkXF3JziFzqZS6yZFo3eNS5fSfnzJqdSQvX/decoration.css" type="text/css" />
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmaCh8mywWfxkXF3JziFzqZS6yZFo3eNS5fSfnzJqdSQvX/layout.css" type="text/css" />
<style>
body {
background-image:url("http://127.0.0.1:8080/ipfs/Qma8mnar3NYJCNYcasg1JN55WBkKiEofRvzvPBULF5kJYD");
background-repeat: no-repeat;
background-size: 100% 100%;
padding: 0;
margin: 0;
font-family: sans-serif;
}
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;
}
#yellow {
background: black;
color: white;
position: absolute;
bottom: 2%;
left: 2%;
width: 70%;
visibility: hidden;
}
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;
}
#description {
text-align: left;
float: left;
width: 49%;
max-width: 500px;
padding-top: 15px;
padding-left: 20px;
}
#ainfo {
position: absolute;
top: 2%;
left: 50%;
}
#showoff {
float: right;
width: 30%;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#container {
top: 10px;
right: 0px;
position: absolute;
display: inline-block;
width: 400px;
height: 400px;
}
</style>
</head>
<body>
<div id="demo">
<div id="description">
<header>
<h1><a href="http://astroport.localhost:1234"><span>petit</span> Monde </a></h1><br>
<p>@@@@@ @PASS @@@@@<br>Lisez le message et renvoyez le à vous-même ou un ami de confiance.</p>
</header>
</div>
</div>
<div id="showoff">
<div id="container">
<video id="preview" style="transform: scaleX(-1);width: 240px;height: 240px;" autoplay="autoplay" class="active"></video>
<strong><div id="countdown">____</div></strong>
<p><input type="hidden" id="g1pub" value="DsEx1pS33vzYZg4MroyBV9hCw98j1gtHEhwiZ5tK7ech"/></p>
<p>Email : <input type="text" id="email" value=""/></p>
<p>Dedicace : <input type="text" id="newline" value=""/></p>
<div id="appname">
<input type="radio" id="r0" name="appname" value="milgram" checked="checked"><p><b>G1Missive</b></p>
</div>
<strong><div id="resu"></div></strong>
</div>
</div>
<script type="text/javascript">
var currentDate = new Date();
var year = currentDate.getFullYear();
var month = (currentDate.getMonth() + 1).toString().padStart(2, 0);
var dateInYYYYMM = year + month;
let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
scanner.addListener('scan', function (content) {
alert(content);
if (content.startsWith('%40%40')) {
// GET APPNAME (milgram)
var appname = document.querySelector('input[name="appname"]:checked').value;
// SET PASS OF THE MONTH
var pass = dateInYYYYMM ;
// GET NEWLINE & EMAIL TO SEND NEXT
var newline = document.getElementById("newline").value;
var email = document.getElementById("email").value;
var myU = 'http://astroport.localhost:1234/?qrcode=' + content +'&pass=' + pass + '&' + appname + '=' + newline + '&email=' + email;
// alert(myU);
console.log(myU);
homeAstroportStation(myU, 'aframe', 10000)
} else {
// COPY QRCODE IN newline input
document.getElementById("newline").value = content;
}
});
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>
<h1><button id="ainfo" onclick="javascript:var x = document.getElementById('yellow'); if (x.style.visibility === 'hidden') {x.style.visibility = 'visible';} else {x.style.visibility = 'hidden';}">0/1</button></h1>
<div id="yellow" >
<!--
<textarea id="myTextArea" name="myTextArea" rows="10" cols="50">
Markdown content goes here
</textarea>
-->
<iframe name="aframe" id="aframe" src="http://127.0.0.1:8080/ipfs/QmXN4osB1uGDgbhwGxxaUeshEcQ57cViCnLRbaJQXDQ2Vm" width="100%" height="320px"></iframe>
</div>
<script>
let cookies = document.cookie;
console.log(cookies);
const el = document.getElementById('yellow');
setTimeout(() => {
el.style.visibility = 'visible';
}, 2000); // 👈️ delay in milliseconds
</script>
</body></html>

View File

@ -1,90 +0,0 @@
<!-- homeAstroportStation function API Twist -->
// Include <div id="ainfo"></div> in your HTML
async function ainfo(zURL){
try {
let two = await fetch(zURL); // Gets a promise
var miam = await two.text();
console.log(miam)
document.getElementById("ainfo").innerHTML = two.text(); // Replaces id='ainfo' with response
} catch (err) {
console.log('Fetch error:' + err); // Error handling
}
}
// Include <div id="countdown"></div> in your HTML
async function homeAstroportStation(myURL, option = '', duration = 3000) {
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(option + " ... Teleportation ... in " + duration + " ms ... " + redirectURL)
// start countdown
var timeLeft = Math.floor(duration / 1000);
var elem = document.getElementById("countdown");
var timerId = setInterval(countdown, 1000);
function countdown() {
if (timeLeft == -1) {
clearTimeout(timerId);
switch(option) {
case "tab":
window.open( redirectURL, "AstroTab");
break;
case "page":
window.location.replace(redirectURL);
break;
case "parent":
window.parent.location.href = redirectURL;
break;
case "aframe":
document.getElementById("aframe").src = redirectURL;
break;
case "ainfo":
ainfo(redirectURL);
break;
default:
window.location.href = redirectURL;
}
if (document.getElementById("countdown").innerHTML !== '') {
document.getElementById("countdown").innerHTML = "<a href='"+redirectURL+"' target='aframe'>OK</a>";
}
} else {
elem.innerHTML = timeLeft + " s";
timeLeft--;
}
}
} catch (err) {
console.log('Fetch error:' + err + myURL ); // Error handling
}
}
// <center><div id="countdown"></div></center>
function promptUser(inout) {
let salt = prompt("Secret 1");
let pepper = prompt("Secret 2");
let email = prompt("Email");
let resultUt = '/?salt=' + salt + '&pepper=' + pepper + '&' + inout + '=' + email;
console.log(resultUt)
homeAstroportStation( resultUt,'', 12000)
}

View File

@ -1,129 +0,0 @@
body {
background: black;
margin: 0;
padding: 0;
color: #DDD;
text-align: center;
padding-bottom: 20px;
}
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;
}
#description {
text-align: left;
float: left;
width: 49%;
max-width: 500px;
padding-top: 50px;
padding-left: 20px;
}
#showoff {
float: left;
width: 49%;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#container {
position: relative;
display: inline-block;
width: 400px;
height: 400px;
}
#sphere, #flights, #glow-shadows, #locations, #drag {
position: absolute;
top: 0px;
left: 0px;
width: 400px;
height: 400px;
}
#glow-shadows {
top: 1px;
left: 1px;
}
.location {
position: absolute;
width: 10px;
height: 10px;
left: 10px;
top: 10px;
border: 2px solid white;
margin-left: -5px;
margin-top: -5px;
border-radius: 50%;
cursor: pointer;
}
.location:hover {
width: 15px;
height: 15px;
margin-left: -7.5px;
margin-top: -7.5px;
}
.flight:hover {
width: 36px;
height: 37.5px;
margin-left: -18px;
margin-top: -18.75px;
}
.choose_example {
width: 35%;
margin-left: 32.5%;
}
#example_code {
width: 100%;
height: 200px;
background-color: black;
color: white;
border: 0px;
resize: none;
display: none;
}
.code {
margin-top: 10px;
}
.social {
display: inline-block;
}
.social.twitter {
vertical-align: -3px;
}
.social.google {
vertical-align: -7px;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
HELLO THERE

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@ -1,301 +0,0 @@
<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="http://127.0.0.1:8080/ipfs/QmQLQ5WdCEc7mpKw5rhUujUU1URKweei4Bb4esyVNd9Atx/favicon.ico">
<title>♥Box Ğ1Station - Astroport Ŋ1 - </title>
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmQLQ5WdCEc7mpKw5rhUujUU1URKweei4Bb4esyVNd9Atx/G1PalPay_fichiers/demo.css">
<script src="http://127.0.0.1:8080/ipfs/QmYD4y1pXHVnGxxFcn2LWo84ytwmWdNbkyUeFnPCbrpUQy/openpgp.min.js"></script>
<script src="http://127.0.0.1:8080/ipfs/Qmae5v9zydax9u6C9ceDijURu5PYdd5avmv4NkenCw7RFv/astro.js"></script>
<script src="http://127.0.0.1:8080/ipfs/QmQLQ5WdCEc7mpKw5rhUujUU1URKweei4Bb4esyVNd9Atx/G1PalPay_fichiers/jquery-3.6.3.min.js"></script>
<script src="http://127.0.0.1:8080/ipfs/QmQLQ5WdCEc7mpKw5rhUujUU1URKweei4Bb4esyVNd9Atx/G1PalPay_fichiers/instascan.min.js"></script>
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmaCh8mywWfxkXF3JziFzqZS6yZFo3eNS5fSfnzJqdSQvX/decoration.css" type="text/css" />
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmaCh8mywWfxkXF3JziFzqZS6yZFo3eNS5fSfnzJqdSQvX/layout.css" type="text/css" />
<style>
body {
background-image:url("http://127.0.0.1:8080/ipfs/QmSFgatcq3q898J56epa8SyGbH651vRBFnv93kQSwfoi83/background.014.jpg");
background-repeat: no-repeat;
background-size: 100% 100%;
padding: 0;
margin: 0;
font-family: sans-serif;
}
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;
}
#yellow {
background: black;
color: white;
position: absolute;
bottom: 2%;
left: 2%;
width: 60%;
visibility: hidden;
}
#ainfo {
position: absolute;
top: 2%;
left: 50%;
}
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;
}
#description {
text-align: left;
float: left;
width: 49%;
max-width: 500px;
padding-top: 15px;
padding-left: 20px;
}
#showoff {
float: right;
width: 30%;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#container {
top: 40px;
right: 0px;
position: absolute;
display: inline-block;
width: 400px;
height: 400px;
}
</style>
</head>
<body>
<div id="demo">
<div id="description">
<header>
<h1><a href="http://astroport.localhost:1234"><span>♥Box</span> Ğ1Station </a></h1><br>
</header>
<form method='get' action='http://127.0.0.1:33101' target='aframe'>
<input type='hidden' name='montant' value='0' >
<label for='type'>Type :</label><select name='type'>
<option value=''>G1BILLET+ ( x 6 )</option>
<option value='jeu' selected>G1Card</option>
<option value='xastro'>G1Card+TW</option>
</select><input type='hidden' name='dice' value='6' >&nbsp;&nbsp;&nbsp;&nbsp;
<button type='submit'>Lancer Fabrication</button>
</form>
<h3>Oubliez la crise !</h3>
<h2>Utilisez la Monnaie Libre.</h2>
<h3>Explorez le Monde en confiance...</h3>
</div>
</div>
<div id="showoff">
<div id="container">
<video id="preview" style="transform: scaleX(-1);width: 240px;height: 240px;" autoplay="autoplay" class="active"></video>
<h1><div id="countdown">___</div></h1>
<input type="hidden" id="PASS" value="PASS"/>
<p><input type="text" id="g1pub" value="2L8vaYixCf97DMT8SistvQFeBj7vb6RQL7tvwyiv1XVH"/></p>
<p><b>G1PUB</b> destinataire</p>
<div id="appname">
<input type="radio" id="r0" name="appname" value="login"> LOGIN
<input type="radio" id="r1" name="appname" value="friend"> (★★★★★)
<input type="radio" id="r2" name="appname" value="history"> Historique
<input type="radio" id="r3" name="appname" value="pay"> Virement
<input type="radio" id="r4" name="appname" value="balance" checked="checked"> Balance
<input type="radio" id="r5" name="appname" value="logout"> LOGOUT
</div>
<p><b></b>"G1Card" pperations</p>
<strong><div id="resu"></div></strong>
<p> <strong>Scan QRCODE</strong> </p>
</div>
</div>
<a href="https://opencollective.com/monnaie-libre/" target="funding">- (^‿‿^) -</a>
<script type="text/javascript">
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
}
}
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;
// 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;
// MEMORIZE
if ( appname == 'pay') {
document.getElementById("PASS").value = pass;
} else {
document.getElementById("PASS").value = "PASS";
}
// 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 ( appname == 'login' || appname == 'logout' ) {
var amount = prompt("Saisir EMAIL:");
}
if ( amount == 'undefined' || amount == '' ) {
var amount = document.getElementById("g1pub").value;
}
var myU = 'http://astroport.localhost:1234/?qrcode=' + content +'&pass=' + pass + '&' + appname + '=' + amount + '&g1pub=' + g1pub ;
console.log(myU);
if ( appname == 'login') {
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 = 'http://astroport.localhost:1234/?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>
<h1><button id="ainfo" onclick="javascript:var x = document.getElementById('yellow'); if (x.style.visibility === 'hidden') {x.style.visibility = 'visible';} else {x.style.visibility = 'hidden';}">0/1</button></h1>
<div id="yellow" ><a href="_STATION_" target="aframe">MENU</a>
<iframe name="aframe" id="aframe" src="_STATION_" width="100%" height="320px"></iframe>
</div>
<script>
let cookies = document.cookie;
console.log(cookies);
const el = document.getElementById('yellow');
setTimeout(() => {
el.style.visibility = 'visible';
}, 3000); // 👈️ delay in milliseconds
</script>
</body></html>