add ipfessay

This commit is contained in:
fred 2022-03-11 21:34:13 +01:00
parent 422d4dce5b
commit 08636b1010
22 changed files with 1249 additions and 17 deletions

View File

@ -35,14 +35,9 @@ MMMM0..0MMMMMX 'NMMMMMMMMMMX 'NMMMMMMMMMMM',WMMMMMMMMMMMMx OMMMMMMMMMMN dMM
o00000000000000x, O000: l000x c000x .lk0000Od; O000; ck0000Ox: o000x l000d .0000.
ASTROPORT is a peer to peer friends of friends real life game based on IPFS.
Join the OASIS so we fix the world together.
Join the Astronaiuts Team. Learn and share how to live together on 'One Planet'
Oasis is a collective shared place where
Players are dreamers wanting to enhance their relation to the world
@@@@@@@@@@@@@@
INSTALL DEPENDENCIES
@@@@@@@@@@@@@@
NOW INSTALLING REQUIRED TOOLS & CRYPTO STUFF
"
[ $(id -u) -eq 0 ] && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1
@ -71,12 +66,12 @@ sudo pip3 install brother_ql
sudo cupsctl --remote-admin
sudo usermod -aG lpadmin pi
## CREATE GAME DIRECTORIES
## CREATING GAME DIRECTORIES
mkdir -p ~/.zen/tmp
mkdir -p ~/.zen/game/players
########################################################################
echo "CREATING OASIS ASTROPORT STATION IPFSNODEID"
echo "CREATING OASIS ASTROPORT STATION SPECIAL IPFSNODEID"
########################################################################
salt="$(${MY_PATH}/tools/diceware.sh 3 | xargs)"
salto="$salt"
@ -84,9 +79,9 @@ salto="$salt"
pepper="$(${MY_PATH}/tools/diceware.sh 3 | xargs)"
XZUID=$(${MY_PATH}/tools/diceware.sh 1 | xargs)${RANDOM:0:2}$(${MY_PATH}/tools/diceware.sh 1 | xargs)
[[ "$USER" != "xbian" ]] && echo "Gardez ou modifiez cet identifiant (passphrase 1)? $salt" && read salty && [[ $salty ]] && salt="$salty"
[[ "$USER" != "xbian" ]] && echo "Gardez ou modifiez cet mot de passe (passphrase 2)? $pepper" && read peppery && [[ $peppery ]] && pepper="$peppery"
[[ "$USER" != "xbian" && "$salt" != "$salto" ]] && echo "Gardez ou modifiez ce Pseudo? $XZUID" && read XZUIDy && [[ $XZUIDy ]] && XZUID="$XZUIDy"
echo "Gardez ou modifiez cet identifiant (passphrase 1)? $salt" && read salty && [[ $salty ]] && salt="$salty"
echo "Gardez ou modifiez cet mot de passe (passphrase 2)? $pepper" && read peppery && [[ $peppery ]] && pepper="$peppery"
[[ "$salt" != "$salto" ]] && echo "Gardez ou modifiez ce Pseudo? $XZUID" && read XZUIDy && [[ $XZUIDy ]] && XZUID="$XZUIDy"
g1_salt="$salt"
g1_pepper="$pepper"
@ -97,7 +92,7 @@ echo "$g1_pepper" >> /tmp/secret.june
########################################################################
########################################################################
echo "CREATING /tmp/secret.dunikey (https://cesium.app WALLET)"
echo "CREATING STATION secret.dunikey (https://cesium.app WALLET)"
########################################################################
python3 ${MY_PATH}/tools/key_create_dunikey.py "$g1_salt" "$g1_pepper"
g1pub=$(cat /tmp/secret.dunikey | grep "pub" | cut -d ' ' -f 2)
@ -105,7 +100,7 @@ g1sec=$(cat /tmp/secret.dunikey | grep "sec" | cut -d ' ' -f 2)
########################################################################
########################################################################
echo "CREATING /tmp/config.ipfs"
echo "CREATING config.ipfs"
########################################################################
ipfs_ID=$(python3 ${MY_PATH}/tools/create_ipfsnodeid_from_tmp_secret.dunikey.py)
echo $ipfs_ID > /tmp/secret.ipfs && source /tmp/secret.ipfs

View File

@ -0,0 +1,531 @@
/** General **/
html {
font-family: Helvetica, Geneva, sans-serif;
}
body {
color: #666;
}
html,
body {
margin: 0;
background: hsla(182, 43%, 94%, 1);
}
/** Helpers **/
.noscroll {
overflow: hidden;
}
/** Structure **/
header {
text-align: left;
margin: 30px;
position: relative;
color: rgba(0, 0, 0, .25);
}
header img {
float: left;
margin-right: 2em;
}
header h1 {
color: #333;
margin: 0 0 0.2em;
font-size: 3em;
font-weight: 600;
}
header h2 {
margin: 0;
font-size: 1.5em;
font-weight: 500;
color: rgba(0, 0, 0, .35);
}
.attr {
display: block;
position: absolute;
right: 0;
top: 50%;
transform: translate3d(0,-50%,0);
font-size: 0.9em;
}
.attr a {
color: #7abbed;
text-decoration: none;
}
.attr a:hover {
text-decoration: underline;
}
article {
font-family: Verdana, Geneva, sans-serif;
}
footer {
position: fixed;
width: 100%;
position: sticky;
bottom: 0;
padding-bottom: 30px;
z-index: 1;
}
/** MCE overrides **/
.editor-toolbar,
.CodeMirror {
border-left: none !important;
border-right: none !important;
border-radius: 0 !important;
}
.editor-toolbar {
background-color: #f9f9f9 !important;
}
.editor-statusbar {
padding: 8px 30px !important;
}
/** Button **/
button {
overflow: visible;
text-transform: none;
font: inherit;
}
.pure-button {
border: transparent;
box-sizing: border-box;
cursor: pointer;
display: inline-block;
font-family: inherit;
line-height: normal;
padding: .5em 1em;
text-align: center;
text-decoration: none;
vertical-align: middle;
white-space: nowrap;
zoom: 1;
-webkit-user-drag: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
color: rgba(0, 0, 0, .5);
font-weight: bold;
border-radius: 4px;
background: rgb(122, 202, 206);
display: block;
transition: all .25s ease-in;
color: #fff;
border-color: rgb(82, 137, 132);
border-width: 1px 1px 3px;
border-style: solid;
font-family: Helvetica;
}
.pure-button:hover {
background-color: #93d4d7;
}
.pure-button:active {
border-width: 3px 1px 1px;
}
.button-publish {
margin: 0 auto;
font-size: 150%;
}
/** Overlay **/
#overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,.75);
z-index: 2;
transform: perspective(600px);
display: none;
overflow-y: scroll;
}
#overlay section {
background: #fff;
margin: 0 auto;
transform: translate3d(-50%, -50%,0);
left: 50%;
top: 50%;
position: fixed;
padding: 0;
text-align: left;
width: 48em;
display: none;
border-radius: 5px;
box-shadow: 0px 10px 12px -5px rgba(0,0,0,.25);
padding-bottom: 20px;
}
#overlay section div {
margin: 0 20px;
}
#overlay section div p,
#overlay section a.essayaddr,
#overlay section code {
margin: 0 0 1em;
}
#overlay section a.essayaddr {
font-size: 15px;
font-weight: bold;
text-align: center;
background: #f9f9f9;
padding: 5px;
border-radius: 3px;
display: block;
text-overflow: ellipsis;
overflow: hidden;
}
#overlay section code {
background: #000;
border-radius: 5px;
color: #999;
display: block;
overflow: hidden;
overflow-x: auto;
padding: 5px;
white-space: nowrap;
}
#overlay section div.note {
padding: 10px;
background-color: rgb(255, 255, 209);
border-radius: 5px;
}
#overlay section div.note p:last-child {
margin-bottom: 0;
}
#overlay section h3 {
margin: 0 0 20px;
padding: 10px;
background: hsla(182, 43%, 94%, 1);
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom: 1px solid rgba(0,0,0,.15);
}
#overlay section a {
color: #7abbed;
}
#overlay .pure-button {
margin: 20px auto 0;
display: block;
}
#overlay #essay-pin {
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
}
#overlay .loading {
position: absolute;
left: 50%;
top: 50%;
display: block;
width: 30px;
height: 30px;
transform: translate3d(-50%, -50%, 0) rotate3d(0,1,1, -90deg) scale3d(1,1,1);
transform-style: preserve-3d;
animation: pulse 0.5s infinite alternate;
}
#overlay .loading:before,
#overlay .loading:after,
#overlay .loading em {
content: '';
display: block;
background-color: #4a9ea1;
width: 30px;
height: 30px;
text-indent: -9999999px;
box-shadow: inset 0 0 0px 4px rgba(0, 0, 0, .25);
}
#overlay .loading:before {
transform: translate3d(50%,0%,0) rotateY(90deg);
background: rgb(110,183,187);
}
#overlay .loading em {
transform: translate3d(0,-100%,15px);
background: rgb(122,202,206);
}
#overlay .loading:after {
transform: translate3d(0%,-150%,0) rotateX( 90deg );
background: rgb(95,157,161);
}
@keyframes pulse {
from {
transform: translate3d(-50%, -50%, 0) rotate3d(0,1,1, -90deg) scale3d(1,1,1);
}
to {
transform: translate3d(-50%, -50%, 0) rotate3d(0,1,1, -90deg) scale3d(1.5,1.5,1.5);
}
}
/** Overlay **/
.overlay {
display: none;
}
.overlay.open {
display: block;
}
.overlay {
display: none;
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: rgba(0,0,0,.6);
z-index: 3;
}
.overlay .overlay-body {
width: 600px;
background: #fff;
position: absolute;
left: 50%;
transform: translate3d(-50%, -50%, 0);
top: 50%;
text-align: center;
padding: 0;
border-radius: 0px;
box-shadow: 0 12px 30px 0 rgba(0,0,0,.5), inset 0 1px 0 0 hsla(0,0%,100%,.65);
z-index: 4;
}
.overlay .closeoverlay {
cursor: pointer;
}
.overlay .overlay-body .tabs {
white-space: nowrap;
background: rgb(122, 202, 206);
overflow: hidden;
}
.overlay .overlay-body .tab {
padding: 10px 0;
width: 50%;
display: inline-block;
box-sizing: border-box;
text-decoration: none;
color: #fff;
}
.overlay .overlay-body .tabs .active {
color: #000;
background: #fff;
cursor: default;
}
.overlay .overlay-body [data-tabcontent] {
display: none;
padding: 20px;
}
.overlay .overlay-body [data-tabcontent].active {
display: block;
}
.overlay #upload,
.overlay form button {
margin: 0 0 20px;
display: inline-block;
}
.overlay #upload.uploading {
color: #33759F;
background-color: transparent;
cursor: default;
}
.overlay #upload.uploading:hover {
border-color: #33759F;
}
.overlay #background {
display: none;
}
.overlay .overlay-body h3 {
margin: 0 0 20px;
color: #33759F;
padding: 10px 10px 10px;
border-bottom: 2px solid #33759F;
text-align: left;
}
.overlay .visit {
display: block;
margin-bottom: 20px;
font-weight: bold;
font-size: 20px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.overlay .fields {
text-align: left;
width: inherit;
}
.overlay .field {
margin-bottom: 35px;
position: relative;
}
.overlay .field:after {
display: none;
position: absolute;
top: 0px;
left: 50%;
transform: translate3d(-50%, 0,0 );
padding: 2px 9px;
margin: 0;
}
.overlay .field.error:after {
content: attr(data-err);
display: block;
}
.overlay label {
display: block;
font-weight: bold;
margin-bottom: 10px;
}
.overlay input {
width: 100%;
margin: 0;
}
.overlay .pin-stats {
display: none;
position: absolute;
left: 50%;
transform: translate3d(-50%, 100%, 0);
font-size: 15px;
font-style: normal;
bottom: -10px;
}
.overlay .pin-stats.open {
display: block;
}
#form-messages p {
margin: 10px;
display: inline-block;
padding: 5px 15px;
}
.overlay .field:after,
#form-messages p {
background: red;
color: #fff;
font-size: 15px;
border-radius: 30px;
}
input {
outline: none;
margin: 0;
font-size: 20px;
display: inline;
border-radius: 30px;
padding: 8px 13px;
border: 2px solid #787C7F;
box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.25);
box-sizing: border-box;
}
input::placeholder {
color: #ccc;
}
/** Media queries **/
@media (max-width: 48em) {
header {
text-align: center;
}
header img {
float: none;
width: 70px;
margin: 0 0 1em 0;
}
header h1 {
font-size: 2em;
}
header h2 {
font-size: 1.2em;
}
.attr {
position: static;
transform: initial;
margin-top: 30px;
text-align: center;
}
.editor-statusbar {
display: none !important;
}
#overlay section {
border-radius: 0;
width: 100%;
top: 0;
left: 0;
transform: initial;
position: static;
}
#overlay section h3 {
border-radius: 0;
}
}
@media (max-width: 650px) {
.overlay .overlay-body {
width: 100%;
border: none;
border-radius: 0;
bottom: 0;
transform: none;
left: 0;
box-sizing: border-box;
top: initial;
padding: 0;
}
.overlay form button {
margin-top: 20px;
}
.overlay .fields {
padding: 20px 20px 0;
box-sizing: border-box;
}
.overlay .field {
margin-bottom: 20px;
white-space: nowrap;
}
.overlay .field:last-child {
margin: 0;
}
.overlay .button.newpin {
margin: 20px 0;
}
.overlay .button.closeoverlay {
display: block;
text-align: center;
border: none;
margin-top: 20px;
border-radius: 0;
padding: 10px;
font-weight: normal;
margin: 0;
color: #33759F;
border: none;
border-top: 1px solid #ddd;
}
}
@media (max-width: 520px) {
.authenticated h1 {
font-size: 30px;
}
.overlay .overlay-body h3 {
margin-bottom: 10px;
}
.overlay .pin-details p.name input {
width: 150px;
}
.overlay .pin-details p.name .button {
padding: 7px 10px;
}
}

7
ipfessay/assets/css/simplemde.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/assets/icons/mstile-150x150.png"/>
<TileColor>#00aba9</TileColor>
</tile>
</msapplication>
</browserconfig>

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,17 @@
{
"name": "IPFessay",
"icons": [
{
"src": "/assets/icons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/assets/icons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#5fcbcf",
"background_color": "#5fcbcf"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1 @@
<svg version="1" xmlns="http://www.w3.org/2000/svg" width="933.333" height="933.333" viewBox="0 0 700.000000 700.000000"><path d="M343.5 3.7c-3.3 2-8 4.7-10.5 6.1-6.9 3.9-9 5.1-31.4 18.1-11.5 6.6-21.1 12.1-21.3 12.1-.2 0-1.6.8-3.1 1.9-1.5 1-16.6 9.9-33.7 19.7-44.4 25.4-74.6 42.9-85 48.9-13.7 8-72.4 41.9-77.5 44.8-2.5 1.4-11 6.3-19 10.9l-14.5 8.4V525.3l24 13.9c13.2 7.7 26.3 15.2 29 16.8 2.8 1.5 16.3 9.3 30 17.2 13.8 8 26.4 15.3 28 16.2 1.7.9 4.4 2.5 6 3.5 1.7 1 5 2.9 7.5 4.3s12.3 7.1 21.9 12.7c9.5 5.5 17.5 10.1 17.7 10.1.2 0 4.4 2.5 9.5 5.5 5 3 9.5 5.5 10 5.5s.9.4.9 1c0 .5.5 1 1.1 1 .9 0 14.1 7.4 29.9 16.9 1.9 1.1 4.9 2.8 6.5 3.7 1.7.9 19 10.9 38.5 22.2 19.5 11.2 37 21.3 38.8 22.3l3.3 1.9 6.7-3.9c3.7-2.1 13.9-8 22.7-13.1 34.7-20.1 46.9-27 47.7-27 .4 0 .8-.5.8-1 0-.6.6-1 1.3-1 .7 0 2.8-1.1 4.7-2.3 1.9-1.3 5.5-3.5 8-4.9 2.5-1.4 6.2-3.5 8.3-4.7 2-1.1 5.4-3.1 7.5-4.2 2-1.2 7.5-4.4 12.2-7.2 4.7-2.7 10.1-5.9 12-7 17.8-10 35.6-20.2 36-20.7.3-.3 1.9-1.2 3.5-2.1 6.6-3.6 122.3-70.4 126.8-73.1l4.7-3V349.4c0-97.4-.4-175.4-.9-175.4-.4 0-12.9-7-27.6-15.5-14.7-8.5-27.1-15.5-27.6-15.5s-.9-.5-.9-1c0-.6-.4-1-1-1-.5 0-5.5-2.7-11.1-6-5.5-3.3-10.2-6-10.4-6-.2 0-3.6-1.9-7.7-4.3-4-2.4-9.3-5.5-11.8-6.9-2.5-1.4-8.5-4.9-13.5-7.8-4.9-2.9-10.6-6.2-12.5-7.2-3.5-2.1-19.4-11.2-71-41.1-15.7-9-30.1-17.3-32-18.4-1.9-1.1-19.6-11.3-39.3-22.7C366.1 9.3 349.9 0 349.7 0c-.1.1-2.9 1.7-6.2 3.7z"/></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#FFCC4D" d="M36 18c0 9.941-8.059 18-18 18-9.94 0-18-8.059-18-18C0 8.06 8.06 0 18 0c9.941 0 18 8.06 18 18"/><ellipse fill="#664500" cx="11.5" cy="16.5" rx="2.5" ry="3.5"/><path fill="#664500" d="M28.457 17.797c-.06-.135-1.499-3.297-4.457-3.297-2.957 0-4.397 3.162-4.457 3.297-.092.207-.032.449.145.591.175.142.426.147.61.014.012-.009 1.262-.902 3.702-.902 2.426 0 3.674.881 3.702.901.088.066.194.099.298.099.11 0 .221-.037.312-.109.177-.142.238-.386.145-.594zM5.999 12.458c-.208 0-.419-.065-.599-.2-.442-.331-.531-.958-.2-1.4 3.262-4.35 7.616-4.4 7.8-4.4.552 0 1 .448 1 1 0 .551-.445.998-.996 1-.156.002-3.569.086-6.205 3.6-.195.262-.496.4-.8.4zm23.002 2.125c-.305 0-.604-.138-.801-.4-2.592-3.457-6.961-2.627-7.004-2.62-.547.108-1.068-.243-1.177-.784-.108-.542.243-1.068.784-1.177.231-.047 5.657-1.072 8.996 3.38.332.442.242 1.069-.2 1.4-.179.137-.389.201-.598.201zm-5.747 8.994c-.188-.11-.432-.087-.597.06-.01.008-1.013.863-4.657.863-3.641 0-4.646-.854-4.646-.854-.159-.16-.404-.19-.6-.082-.195.111-.293.339-.238.557.01.044 1.144 4.379 5.484 4.379s5.474-4.335 5.485-4.379c.053-.213-.044-.431-.231-.544z"/></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

15
ipfessay/assets/js/simplemde.min.js vendored Normal file

File diff suppressed because one or more lines are too long

648
ipfessay/index.html Normal file
View File

@ -0,0 +1,648 @@
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Astronaute - Astroport One - PROFIL MadeInZion - </title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" sizes="180x180" href="assets/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="assets/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/icons/favicon-16x16.png">
<link rel="manifest" href="assets/icons/manifest.json">
<link rel="mask-icon" href="assets/icons/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="assets/icons/favicon.ico">
<meta name="msapplication-config" content="assets/icons/browserconfig.xml">
<meta name="theme-color" content="#5fcbcf">
<link rel="stylesheet" href="assets/css/main.css">
<link rel="stylesheet" href="assets/css/simplemde.min.css">
<script src="assets/js/simplemde.min.js"></script>
<script>
(function() {
var Utilities = {
isMobileOrTablet : function() {
var check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
return check;
},
hasClass : (el, className) => {
if(!el)
return;
if (el.classList)
return el.classList.contains(className)
else
return !!el.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'))
},
addClass : (el, className) => {
if(!el)
return;
if (el.classList)
el.classList.add(className)
else if (!hasClass(el, className))
el.className += " " + className
},
removeClass : (el, className) => {
if(!el)
return;
if (el.classList)
el.classList.remove(className)
else if (hasClass(el, className)) {
var reg = new RegExp('(\\s|^)' + className + '(\\s|$)')
el.className=el.className.replace(reg, ' ')
}
}
};
var FilesOverlay = {
isImage : false,
initialize : function() {
if(!document.querySelector('#image-overlay'))
return;
var self = this;
// Fixes the sticky hover effects in iOS
document.querySelector('#upload').addEventListener('click', () => {
setTimeout(() => {
this.className = '';
}, 300);
});
document.querySelector('#background').addEventListener('change', (event) => {
if(!event.target)
return;
var files = event.target.files;
if(files.count == 0)
return;
var file = files[0];
if(!file)
return;
// Remove the extension from the file
var name = file.name.replace(/\.[^/.]+$/, "");
IPFessay.files[file.name.toLowerCase()] = file;
var md_text = (this.isImage ? '![](' + file.name + ')' : '[' + file.name + '](' + file.name + ')');
var pos = IPFessay.simplemde.codemirror.getCursor();
IPFessay.simplemde.codemirror.setSelection(pos, pos);
IPFessay.simplemde.codemirror.replaceSelection(md_text);
this.closeOverlay();
});
var tabs = document.querySelectorAll('#image-overlay .tab');
for(var i = 0; i < tabs.length; i++) {
tabs[i].addEventListener('click', function(event) {
var tab = this.dataset.tab;
if(Utilities.hasClass(this, 'active'))
return;
var tabs = document.querySelectorAll('#image-overlay .tab');
for(var k = 0; k < tabs.length; k++) {
var localTab = tabs[k];
if(localTab.dataset.tab.localeCompare(tab) == 0)
Utilities.addClass(localTab, 'active');
else
Utilities.removeClass(localTab, 'active');
}
var tabContents = document.querySelectorAll('#image-overlay [data-tabcontent]');
for(var j = 0; j < tabContents.length; j++) {
var tabContent = tabContents[j];
if(tabContent.dataset.tabcontent.localeCompare(tab) == 0)
Utilities.addClass(tabContent, 'active');
else
Utilities.removeClass(tabContent, 'active');
}
document.querySelector('#form-messages').innerHTML = '';
});
}
document.querySelector('#image-overlay form').addEventListener('submit', (event) => {
event.stopPropagation();
event.preventDefault();
var imageURL = document.getElementById('image_url').value;
var md_text = (this.isImage ? '![](' + imageURL + ')' : '[' + imageURL + '](' + imageURL + ')');
var pos = IPFessay.simplemde.codemirror.getCursor();
IPFessay.simplemde.codemirror.setSelection(pos, pos);
IPFessay.simplemde.codemirror.replaceSelection(md_text);
this.closeOverlay();
return false;
});
document.querySelector('#image-overlay').addEventListener('click', function(event) {
if(event.target != this)
return;
self.closeOverlay();
});
document.querySelector('#image-overlay .new-hash').addEventListener('submit', (event) => {
event.stopPropagation();
event.preventDefault();
return false;
});
document.addEventListener('keyup', (event) => {
if(this.isOverlayOpen && event.keyCode == 27)
this.closeOverlay();
});
var closeButtons = document.querySelectorAll('#image-overlay .closeoverlay');
for(i = 0; i < closeButtons.length; i++ )
closeButtons[i].addEventListener('click', () => { this.closeOverlay(); });
},
startUploading : function() {
document.querySelector('#background').disabled = 'disabled';
Utilities.addClass(document.querySelector('#upload'), 'uploading');
document.querySelector('#upload').innerHTML = 'Uploading...';
},
endUploading : function() {
document.querySelector('#background').disabled = '';
Utilities.removeClass(document.querySelector('#upload'), 'uploading');
document.querySelector('#upload').innerHTML = 'Upload';
},
openOverlay : function() {
document.getElementById('background').accept = (this.isImage ? 'image/*' : '');
Utilities.addClass(document.body, 'noscroll');
Utilities.addClass(document.querySelector('#image-overlay'), 'open');
setTimeout(() => {
if(!Utilities.isMobileOrTablet())
document.querySelector('#image_url').focus();
}, 100);
this.isOverlayOpen = true;
},
closeOverlay : function() {
Utilities.removeClass(document.body, 'noscroll');
Utilities.removeClass(document.querySelector('#image-overlay'), 'open');
Utilities.removeClass(document.querySelector('.overlay .pin-stats'), 'open');
Utilities.removeClass(document.querySelector('.field[data-name="hash"]'), 'error');
Utilities.removeClass(document.querySelector('.field[data-name="name"]'), 'error');
document.querySelector('#form-messages').innerHTML = '';
document.querySelector('#image_url').value = '';
this.isOverlayOpen = false;
}
};
var IPFessay = {
files : {},
initialize : function() {
var textArea = document.querySelector('#text-input');
this.simplemde = new SimpleMDE({
autofocus: true,
element: textArea,
toolbar: [
"bold", "italic", "heading", "|",
"quote", "unordered-list", "ordered-list", "|",
"link", "image", "table", "code", "|",
"preview", "side-by-side", "fullscreen", "|",
"guide"
],
});
this.simplemde.codemirror.on("beforeChange", (event, change) => {
if(!change.text || change.text.length == 0)
return;
var changeText = change.text[0];
var isImageButton = (changeText.length > 0 && "![](http://)".localeCompare(changeText) == 0);
var isLinkButton = (changeText.length > 0 && "[](http://)".localeCompare(changeText) == 0);
if(isImageButton || isLinkButton) {
FilesOverlay.isImage = isImageButton;
FilesOverlay.openOverlay();
change.cancel();
}
});
document.addEventListener('keydown', (event) => {
if ((event.ctrlKey || event.metaKey) &&
(event.keyCode == 13 || event.keyCode == 10))
this.publishEssay();
});
document.addEventListener('keyup', (event) => {
if(!this.overlayLoading && event.keyCode == 27)
this.closeOverlay();
});
document.querySelector('#overlay button').addEventListener('click', () => {
this.closeOverlay();
});
document.querySelector('.button-publish').addEventListener('click', () => {
this.publishEssay();
});
},
ipfsPUT : function(hash, data, filename, success) {
var req = new XMLHttpRequest();
req.onreadystatechange = () => {
if(req.readyState != XMLHttpRequest.DONE)
return;
if(req.status >= 200 && req.status < 300) {
var hash = req.getResponseHeader("Ipfs-Hash");
success && success(hash);
}
else
this.showError();
};
req.onerror = (error) => { this.showError(); };
req.open("PUT", "/ipfs/" + hash + "/" + filename, true);
req.setRequestHeader("Content-type", "text/html");
req.send(data);
},
uploadFiles : function(hash, files, callback) {
if(files.length == 0) {
callback && callback(hash);
return;
}
// Get the first file
var file = files[0];
var filename = undefined;
if(typeof file == 'string')
filename = 'index.html';
else
filename = file.name;
// Remove it from the files array
files.splice(files.indexOf(file),1);
this.ipfsPUT(hash, file, filename, (new_hash) => {
this.uploadFiles(new_hash, files, callback);
});
},
publishEssay : function() {
this.openOverlay();
this.simplemde.codemirror.save();
var md = document.querySelector('#text-input').value;
// Get the generated HTML
var mdHTML = this.simplemde.options.previewRender(md);
// Create a temp element
var div = document.createElement('div');
div.innerHTML = mdHTML;
var title = undefined;
if(div.children.length > 0 && div.children[0].tagName.match("^[hH][123]$"))
title = div.children[0].innerText;
var renderedPage = this.renderPage(mdHTML, title);
var addedFiles = [];
addedFiles.push(renderedPage);
// Look for images and links in the markdown file
var re = /(\[.*?\]\()(.+?)(\))/g;
while ((matches = re.exec(md)) !== null) {
if(matches.length < 3)
continue;
var filename = matches[2].toLowerCase();
// Cross match them with the ones in the files dictionary
if(filename in this.files)
addedFiles.push(this.files[filename]);
}
this.uploadFiles(
"QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn", // Empty folder hash
addedFiles,
(hash) => {
this.showLink(hash, title);
this.primeCaches(hash);
});
},
showError : function() {
this.closeOverlay();
setTimeout(() => {
alert('There was an error communicating with the IPFS gateway API.\n\n' +
'Please ensure the daemon is running, ipfs daemon --writable');
}, 500);
},
openOverlay : function() {
document.body.className = 'noscroll';
document.querySelector('#overlay').style.display = 'block';
document.querySelector('#overlay .loading').style.display = 'block';
document.querySelector('#overlay section').style.display = 'none';
this.overlayLoading = true;
},
closeOverlay : function() {
document.body.className = '';
document.querySelector('#overlay').style.display = 'none';
document.querySelector('#overlay section').style.display = 'none';
},
primeCaches : function(hash) {
// Make background GET requests to some public gateways just to
// add the file to their caches.
[
"gateway.ipfs.io",
// "hardbin.com",
"ipfs.eternum.io",
// "cloudflare-ipfs.com",
// "ipfs.infura.io",
"tube.copylaradio.com",
].forEach(function(gateway) {
var req = new XMLHttpRequest();
req.open("GET", "https://" + gateway + "/ipfs/" + hash);
req.send();
});
},
showLink : function(hash, title) {
var pinName = 'MadeInZion';
if(title)
pinName = title;
this.overlayLoading = false;
document.querySelector('#overlay .loading').style.display = 'none';
document.querySelector('#overlay section').style.display = 'block';
document.querySelector('#overlay a#essay-link').href = "http://localhost:8080/ipfs/" + hash;
document.querySelector('#overlay a#essay-link').innerText = "http://localhost:8080/ipfs/" + hash;
document.querySelector('#overlay a#eternum-link').href = "https://tube.copylaradio.com/ipfs/" + hash;
document.querySelector('#overlay a#eternum-link').innerText = "https://tube.copylaradio.com/ipfs/" + hash;
document.querySelector('#overlay #essay-pin').innerHTML = '<a href="https://www.eternum.io/pin/' + hash + '/?name=' + pinName + '" target="_blank">https://www.eternum.io/pin/' + hash + '/</a>';
document.querySelector('#overlay #pin-link').innerText = "$ ipfs pin add " + hash;
},
renderPage: function(mdHTML, title) {
var pageTitle = 'Profil Astronaute';
if(title)
pageTitle = title;
return '<html>' +
'<head>' +
'<meta name="viewport" content="width=device-width, initial-scale=1">' +
'<link rel="stylesheet" href="/ipfs/QmSMwjABWVBsnS3Gha3xmjb5zKYndvFrS74iCAwykQCqcY/typesettings-1.2-min.css">' +
'<title>' + pageTitle + '</title>' +
'<style>' +
'footer {padding: 3em 0; text-align: center; font-size: 1.4em; border-top: 1px solid #e1e1e1;}' +
'a:hover { color: #222; border-bottom-color: #555; }' +
'@media only screen and (min-width: 1441px) { .typesettings { font-size: 2.4em; } }' +
'.typesettings { max-width: 33em; margin: 0 auto; }' +
'a { color: #aeaeae; border-bottom: 1px dotted #aeaeae; text-decoration: none; }' +
'</style>' +
'</head>' +
'<body>' +
'<article class="typesettings golden">' +
mdHTML +
'</article>' +
// '<footer><a href="https://ipfessay.stavros.io/">Publish your own essay with IPFessay</a>' +
// ' | <a href="https://gitlab.com/stavros/IPFessay">Gitlab</a></footer>' +
'</body>' +
'</html>';
}
};
window.IPFessay = IPFessay;
window.FilesOverlay = FilesOverlay;
})();
window.addEventListener('DOMContentLoaded', () => {
IPFessay.initialize();
FilesOverlay.initialize();
});
</script>
</head>
<body>
<header>
<img src="assets/images/logo.svg" width="100"/>
<h1>Astroport ONE</h1>
<h2>Identité Numérique Libre</h2>
<span class="attr">
<a href="https://oasis.astroport.com">Blog</a> |
<a href="https://www.youtube.com/channel/UCgbd28yps5uF3NWDq-FLE9A">Youtube</a>
</span>
</header>
<article>
<textarea id="text-input" style="width: 100%;" oninput="this.editor.update()" rows="15" cols="60">
# _PLAYER_ / _PSEUDO_
Astronaute, décrivez-vous...
Qui. Quand. Quoi. Où. Pourquoi?
## Savoir-faire
exemple
* Bois (cousu, vis, emboitement
* Soudure
_VIDEOS_
## Matos
exemple
1. Van : RENAULT TRAFIC
2. Perçeuse Visseuse sans fil : HITACHI
_PHOTOS_
~~~
Astronaute de la communauté MadeInzion. Voyagez entre les stations Astroport.
Votre identité souveraine s'inscrit de façon inaliénable sur IPFS
~~~
</textarea>
</article>
<footer>
<button class="button-publish pure-button">Publier</button>
</footer>
<div id="overlay">
<span class="loading"><em>Chargement...</em></span>
<section>
<h3>Astroport One - Astronaute</h3>
<div>
<p>
Voici votre lien permanent, infalsifiable enregsitré sur IPFS:
</p>
<a id="essay-link" class="essayaddr" href="" target="_blank"></a>
<p>
Vous pouvez le faire publier sur le bootstrap astrXbian :
</p>
<a id="eternum-link" class="essayaddr" href="" target="_blank"></a>
</div>
<div class="note">
<p>
<strong>NOTE: Ceci est un document numérique officiel MadeInZion.</strong>
<br>Bienvenue extraterrestre, bricoleur de génie, ingénieur, inventeur, rêveur...
Autonomie et mode de vie en Forêt Jardin, œuvre collective de terraformation.
Aucune carte d'identité requise. Participez au jeu... Rejoignez la communauté des créateurs.
</p>
<p>Vous pouvez épingler votre profil avec la commande :</p>
<code id="pin-link"></code>
<p>
Connectez-votre station et profitez du service <a href="https://tube.copylaradio.com/"
target="_blank">CopyLaRadio</a>.
</p>
<p id="essay-pin"></p>
</div>
<button class="pure-button">Fermer</button>
</section>
</div>
<div class="overlay" id="image-overlay">
<div class="new-hash overlay-body">
<div class="tabs">
<a href="javascript:void(0);" data-tab="link" class="tab active">Lien</a>
<a href="javascript:void(0);" data-tab="upload" class="tab">Depuis votre ordinateur</a>
</div>
<div id="form-messages"></div>
<form data-tabcontent="link" class="active">
<div class="fields">
<div class="field" data-name="hash">
<label for="image_url">URL</label>
<input required type="text" id="image_url"/>
</div>
</div>
<div>
<button class="pure-button prominent" type="submit">Attacher</button>
</div>
<span class="closeoverlay">Fermer</span>
</form>
<div data-tabcontent="upload">
<div>
<label for="background" id="upload" class="prominent pure-button">Envoyer et Attacher</label>
<input type="file" accept="image/*" id="background"/>
</div>
<span class="closeoverlay">Fermer</span>
</div>
</div>
</div>
</body>
</html>

View File

@ -7,18 +7,23 @@
ts=$(date -u +%s%N | cut -b1-13)
################################################################################
# Capture la photographie satellite de la France
# https://fr.sat24.com/image?type=visual5HDComplete&region=fr
# https://media.meteonews.net/sat/EURwest_1273x892_c1/sat_20220308_1500.jpg
mkdir -p ~/..zen/game/meteofrance
rm -f ~/..zen/game/meteofrance/meteo.jpg
curl -m 20 --output ~/..zen/game/meteofrance/meteo.jpg https://fr.sat24.com/image?type=visual5HDComplete&region=fr
curl -m 20 --output ~/..zen/game/meteofrance/meteo.jpg https://media.meteonews.net/sat/EURwest_1273x892_c1/sat_20220308_1500.jpg
if [[ ! -f ~/..zen/game/meteofrance/meteo.jpg ]]; then
echo "Impossible de vous connecter à https://fr.sat24.com/"
exit 1
else
echo "MIse à jour blockchain meteo : $ts"
echo "MIse à jour de votre archive meteo : $ts"
echo $ts > ~/..zen/game/meteofrance/.ts
ipfs add
IPFS=$(ipfs add -Rw ~/..zen/game/meteofrance/)
echo $IPFS > ~/..zen/game/meteofrance/.chain
fi