From 07fe1d51c5de69ad600e1644e22f38c615e60698 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 2 Nov 2022 14:06:26 +0100 Subject: [PATCH] "'*'" --- 12345.sh | 2 +- _12345.sh | 41 +++++++++++++++++++++++++++++++++++----- templates/index.302 | 2 +- templates/index.http | 2 +- templates/index.redirect | 2 +- 5 files changed, 40 insertions(+), 9 deletions(-) diff --git a/12345.sh b/12345.sh index 712c1d06..56f0bf52 100755 --- a/12345.sh +++ b/12345.sh @@ -31,7 +31,7 @@ ncrunning=$(ps auxf --sort=+utime | grep -w 'nc -l -p 1234' | grep -v -E 'color= # Some client needs to respect that HTTPCORS="HTTP/1.1 200 OK -Access-Control-Allow-Origin: * +Access-Control-Allow-Origin: '*' Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: GET Server: Astroport.ONE diff --git a/_12345.sh b/_12345.sh index 888a2e86..49024365 100755 --- a/_12345.sh +++ b/_12345.sh @@ -6,15 +6,46 @@ ################################################################################ # This script scan Swarm API layer from official bootstraps # Then publish map of json DApp data - +MOATS=$(date -u +"%Y%m%d%H%M%S%4N") IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) +myIP=$(hostname -I | awk '{print $1}' | head -n 1) +[[ ! $myIP ]] && myIP="127.0.1.1" + +PORT=12345 + + YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); ## $USER running ipfs + LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2) ## SWARM#0 ENTRANCE URL + for bootnode in $(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#") # remove comments do ipfsnodeid=${bootnode##*/} - mkdir -p ~/.zen/tmp/$IPFSNODEID/$ipfsnodeid + mkdir -p ~/.zen/tmp/swarm/$ipfsnodeid echo "IPFS get /ipns/$ipfsnodeid" - ipfs get -o ~/.zen/tmp/$IPFSNODEID/$ipfsnodeid /ipns/$ipfsnodeid - echo "Updated : ~/.zen/tmp/$IPFSNODEID/$ipfsnodeid" - ls ~/.zen/tmp/$IPFSNODEID/$ipfsnodeid + [[ $YOU ]] && echo "http://$myIP:8080/ipns/${ipfsnodeid} ($YOU)" && ipfs --time-out 12s get -o ~/.zen/tmp/swarm/$ipfsnodeid /ipns/$ipfsnodeid +## [[ ! -s ~/.zen/tmp/swarm/$ipfsnodeid/index.json ]] && echo "$LIBRA/ipns/${ipfsnodeid}" && curl -m 6 -so ~/.zen/tmp/swarm/$ipfsnodeid/index.json "$LIBRA/ipns/${ipfsnodeid}" + + echo "Updated : ~/.zen/tmp/swarm/$ipfsnodeid" + ls ~/.zen/tmp/swarm/$ipfsnodeid done + + + +ls ~/.zen/tmp/${IPFSNODEID}/ +ROUTING=$(ipfs add -rwq ~/.zen/tmp/${IPFSNODEID} | tail -n 1 ) +echo "SELF PUBLISHING SWARM STATUS" +ipfs name publish --allow-offline /ipfs/$ROUTING + +HTTPCORS="HTTP/1.1 200 OK +Access-Control-Allow-Origin: '*' +Access-Control-Allow-Credentials: true +Access-Control-Allow-Methods: GET +Server: Astroport.ONE +Content-Type: application/json; charset=UTF-8 + +{ + \"ipns\"=\"${IPFSNODEID}\" + \"url\"=\"http://${myIP}:8080/ipns/${IPFSNODEID}\" +} +" + diff --git a/templates/index.302 b/templates/index.302 index c0a08653..b67f1f32 100644 --- a/templates/index.302 +++ b/templates/index.302 @@ -1,5 +1,5 @@ HTTP/1.1 302 Found -Access-Control-Allow-Origin: * +Access-Control-Allow-Origin: '*' Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: GET Content-Type: text/html; charset=UTF-8 diff --git a/templates/index.http b/templates/index.http index bc53ad7f..cfd2521e 100644 --- a/templates/index.http +++ b/templates/index.http @@ -1,5 +1,5 @@ HTTP/1.1 200 OK -Access-Control-Allow-Origin: * +Access-Control-Allow-Origin: '*' Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: GET Server: Astroport diff --git a/templates/index.redirect b/templates/index.redirect index d8421f69..8c8b0069 100644 --- a/templates/index.redirect +++ b/templates/index.redirect @@ -1,5 +1,5 @@ HTTP/1.1 200 OK -Access-Control-Allow-Origin: * +Access-Control-Allow-Origin: '*' Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: GET Server: Astroport