isLAN or WAN => ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin
This commit is contained in:
parent
8f4c8e3c84
commit
3fb23f8c61
7
12345.sh
7
12345.sh
|
@ -16,7 +16,9 @@ ME="${0##*/}"
|
|||
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"
|
||||
isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
|
||||
[[ ! $myIP || $isLAN ]] && 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
|
||||
|
@ -355,7 +357,8 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
|
|||
[[ ! $OLDIP ]] && (echo "$HTTPCORS 501 ERROR - SORRY - YOUR TW IS OUT OF SWARM#0 - CONTINUE " | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "(☓‿‿☓) Execution time was "`expr $end - $start` seconds. && continue
|
||||
echo "TW is on $OLDIP"
|
||||
wasLAN=$(echo $OLDIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
|
||||
[[ ! $wasLAN ]] && TWIP=$OLDIP || TWIP=$myIP
|
||||
[[ ! $wasLAN ]] && TWIP=$OLDIP \
|
||||
|| TWIP=$myIP
|
||||
# LOCKED TW BECOMING ACTIVE GATEWAY
|
||||
if [[ $OLDIP == "_SECRET_" || "$TWIP" == "$myIP" ]]; then
|
||||
echo "_SECRET_ TW PUSHING TW" ## BECOMING OFFICIAL BECOME R/W TW
|
||||
|
|
|
@ -118,11 +118,6 @@ echo
|
|||
[[ -s ~/.zen/tmp/newindex.html ]] && cp ~/.zen/tmp/newindex.html ~/.zen/game/world/$WISHKEY/index.html
|
||||
[[ ! -s ~/.zen/tmp/newindex.html ]] && echo "ERROR ~/.zen/tmp/newindex.html MISSING" && exit 1
|
||||
|
||||
## EXTEND ipfs daemon accreditation
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$myIP':8080", "http://127.0.0.1:8080", "http://astroport:8080", "http://'$(hostname)'.home:8080" ]'
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin ## CORS
|
||||
echo "RESTART IPFS !?"
|
||||
|
||||
echo "# CREATION QR CODE"
|
||||
|
||||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
|
|
|
@ -214,7 +214,9 @@ ipfs config --json Addresses.Swarm | jq '. += ["/ip4/0.0.0.0/tcp/30215/ws"]' > /
|
|||
ipfs config --json Addresses.Swarm "$(cat /tmp/30215.ws)"
|
||||
|
||||
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$myIP':8080", "http://127.0.0.1:8080", "http://astroport", "https://astroport.com", "https://qo-op.com", "https://tube.copylaradio.com", "http://libra.copylaradio.com:8080" ]'
|
||||
isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
|
||||
[[ ! $isLAN ]] && ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$myIP':8080", "http://127.0.0.1:8080", "http://127.0.1.1:8080" ]' \
|
||||
|| ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://127.0.0.1:8080", "http://127.0.1.1:8080" ]'
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'
|
||||
|
||||
|
|
|
@ -90,7 +90,10 @@ ipfs config --json Experimental.Libp2pStreamMounting true
|
|||
ipfs config --json Experimental.P2pHttpProxy true
|
||||
ipfs config --json Swarm.ConnMgr.LowWater 0
|
||||
ipfs config --json Swarm.ConnMgr.HighWater 0
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://127.0.0.1:8080", "http://astroport", "https://astroport.com", "https://qo-op.com", "https://tube.copylaradio.com" ]'
|
||||
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
|
||||
isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
|
||||
[[ ! $isLAN ]] && ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$myIP':8080", "http://127.0.0.1:8080", "http://127.0.1.1:8080" ]' \
|
||||
|| ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://127.0.0.1:8080", "http://127.0.1.1:8080" ]'
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'
|
||||
|
||||
|
|
Loading…
Reference in New Issue