IPFS gateway astronaut login

This commit is contained in:
fred 2022-10-05 01:18:11 +02:00
parent c955dfd4ed
commit a85775d2ae
3 changed files with 14 additions and 7 deletions

10
12345.sh Normal file → Executable file
View File

@ -47,22 +47,22 @@ while true; do
# CHECK IPNS KEY EXISTENCE
ipfs key rm gchange 2>/dev/null
rm -f ~/.zen/tmp/gchange.key
${MY_PATH}/keygen -t ipfs -o ~/.zen/tmp/gchange.key "$SALT" "$PEPPER"
${MY_PATH}/tools/keygen -t ipfs -o ~/.zen/tmp/gchange.key "$SALT" "$PEPPER"
GNS=$(ipfs key import gchange -f pem-pkcs8-cleartext ~/.zen/tmp/gchange.key )
echo "/ipns/$GNS"
echo "Getting latest online TW..."
mkdir -p ~/.zen/tmp/TW
rm -f ~/.zen/tmp/TW/index.html
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
YOU=$(ps auxf --sort=+utime | grep -w "ipfs " | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
echo "$LIBRA/ipns/$GNS"
[[ $YOU ]] && ipfs --timeout 12s cat /ipns/$GNS > ~/.zen/tmp/TW/index.html \
|| curl -so ~/.zen/tmp/TW/index.html "$LIBRA/ipns/$GNS"
|| curl -m 12 -so ~/.zen/tmp/TW/index.html "$LIBRA/ipns/$GNS"
if [ ! -s ~/.zen/tmp/TW/index.html ]; then
rm -f ~/.zen/tmp/TW/index.html
echo "Aucun TW détecté! Creation TW Astronaute"
###################################################################################################
PLAYER="$EMAIL"
@ -82,7 +82,7 @@ while true; do
# Create Player "IPNS Key" (key import)
${MY_PATH}/keygen -t ipfs -o ~/.zen/game/players/$PLAYER/secret.player "$SALT" "$PEPPER"
${MY_PATH}/tools/keygen -t ipfs -o ~/.zen/game/players/$PLAYER/secret.player "$SALT" "$PEPPER"
ipfs key import $PLAYER -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/secret.player
ASTRONAUTENS=$(ipfs key import $G1PUB -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/secret.player)

View File

@ -4,7 +4,14 @@ Content-Type: text/html; charset=UTF-8
<!doctype html>
<html>
<head>
<meta http-equiv="refresh" content="30; url='http://127.0.0.1:12345'" />
</head>
<body>
<h1>CANAL TW ASTROPORT</h1>
<h1>ASTROPORT</h1>
<h2>Astronaute</h2>
<form action = "http://127.0.0.1:12345" method = "GET">
<input type='submit' value='OUVRIR VOTRE TW'>
</form>
</body>
</html>

View File

@ -5,7 +5,7 @@ Content-Type: text/html; charset=UTF-8
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="7; url='_TWLINK_'" />
<meta http-equiv="refresh" content="0; url='_TWLINK_'" />
</head>
<body>
<p>Please follow <a href="_TWLINK_">this link</a>.</p>