diff --git a/.install/loveland.sh b/.install/loveland.sh index 3023b21..be9d568 100755 --- a/.install/loveland.sh +++ b/.install/loveland.sh @@ -175,7 +175,8 @@ sudo sed -i "s/_APPLI_/jukebox/g" /tmp/jukebox.conf sudo cp -f /tmp/jukebox.conf /etc/nginx/conf.d/jukebox.conf ### G1SMS loveland entrance localhost:10099 ("ipfs p2p" forwarded) -[[ $(which gammu) ]] && sudo sed "s/_PHPVERSION_/$PHPVERSION/g" /home/$YOU/.zen/astroport/www/g1sms.conf > /tmp/g1sms.conf && sudo cp -f /tmp/g1sms.conf /etc/nginx/conf.d/ +[[ $(which gammu) ]] && sudo sed "s/_PHPVERSION_/$PHPVERSION/g" /home/$YOU/.zen/astroport/www/g1sms.conf > /tmp/g1sms.conf \ +&& sudo cp -f /tmp/g1sms.conf /etc/nginx/conf.d/ # && ipfs p2p listen /x/g1sms /ip4/127.0.0.1/tcp/10099 # SEE 'zen/ipfs_OPEN_ports.sh' sudo systemctl restart nginx || err=1 diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index c5738e2..3cbcbf8 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -90,7 +90,7 @@ fi # /_//_/ /____/|__/|__/\__,_/_/ /_/ /_/ /_/\____/ # ################################################################## -# REFRESH IPFS SWARM DATA EVERY 12 minutes +# REFRESH IPFS SWARM DATA EVERY 12 & 15 minutes [[ $(($minute % 12)) == 0 ]] && sleep $((1 + RANDOM % 10)) && $MY_PATH/zen/ssb_IPFS_swarm.sh [[ $(($minute % 15)) == 0 ]] && sleep $((1 + RANDOM % 10)) && $MY_PATH/zen/ipfs_SWARM_refresh.sh ################################################################## @@ -159,8 +159,19 @@ if [[ "$timebar" == "00:01" ]]; then rm ~/.zen/zenytv.last.ts rm ~/.zen/zenyta.last.ts - # SYNC SSB Friends with IPFS SWARM - $MY_PATH/zen/ssb_IPFS_swarm.sh + # ipfs_OPEN_ports.sh (distribute g1sms port with ipfs p2p +echo ' + _________ + / ____< / _________ ___ _____ + / / __ / / / ___/ __ `__ \/ ___/ +/ /_/ // / (__ ) / / / / (__ ) +\____//_/ /____/_/ /_/ /_/____/ + +http://127.0.0.1:10099 +' + ipfs p2p close --all + $MY_PATH/zen/ipfs_OPEN_ports.sh + ipfs p2p ls fi ################################################################## diff --git a/www/LOVELand/ajaxform.js b/www/LOVELand/ajaxform.js index e81f5cf..a4a5a61 100644 --- a/www/LOVELand/ajaxform.js +++ b/www/LOVELand/ajaxform.js @@ -13,7 +13,7 @@ jQuery(document).ready(function () { var naissance = jQuery("#naissance"); var data = ''; // ajax call to ajax.php - jQuery.getJSON("g1sms/sms_loveland.php", { + jQuery.getJSON("http://127.0.0.1:10099/sms_loveland.php", { phone: phone.val(), parrain: parrain.val(), naissance: naissance.val() }, function (data) { $("#phoneresultat").html("

Votre inscription en prise en compte...

"); diff --git a/www/LOVELand/g1sms/sms_loveland.php b/www/LOVELand/g1sms/sms_loveland.php index 0276549..4723c7e 100644 --- a/www/LOVELand/g1sms/sms_loveland.php +++ b/www/LOVELand/g1sms/sms_loveland.php @@ -18,17 +18,8 @@ if (strlen($_REQUEST['phone']) == 10 ) { // LOCAL $fp = fopen('/tmp/loveland_entrance/'.$HPHONE, 'w'); - fwrite($fp, $PHONE.'|'.$PARRAIN.'|'.$naissance); - // MODE SWARM : write - $YOU = exec("ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1", $output, $return); - $POINTSMS = exec("ls /home/$YOU/.zen/ipfs_swarm/.Qm*/G1SSB/_g1sms | shuf -n 1 | cut -d '/' -f 6", $output, $return); - if ($return == 0) { - // FOUND $POINTSMS ACCESS RIGHT PROBLEM !!! - $fp = fopen('/home/'.$YOU.'/.zen/ipfs/'.$POINTSMS.'/TASK/loveland_entrance/'.$HPHONE, 'w'); - fwrite($fp, $PHONE); - } return true; } else { return false; diff --git a/zen/ipfs_OPEN_ports.sh b/zen/ipfs_OPEN_ports.sh index 0bfebaa..3f41599 100755 --- a/zen/ipfs_OPEN_ports.sh +++ b/zen/ipfs_OPEN_ports.sh @@ -7,20 +7,31 @@ # Activate SUPPORT MODE: open ssh over IPFS MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized - +######################################################################## +YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) || er+=" ipfs daemon not running" +IPFSNODEID=$(ipfs id -f='\n') || er+=" ipfs id problem" +WHOAMI=$(sbotc whoami | jq -r .id) || er+=" sbotc whoami problem" +[[ "$YOU" == "" || "$IPFSNODEID" == "" || "$WHOAMI" == "" ]] && echo "ERROR : $er " +######################################################################## # TODO ESTABLISH A PORT FORWARD STRATEGY (depending on Node Flavour) -exit # Arrange local port forwarded to swarm -# GET _uidna -YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1) +# GET _uidna (means g1sms/init.sh been run) +[[ -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]] && UIDNA=$(cat /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna) -IPFSNODEID=$(ipfs id -f='\n') -UIDNA=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna) +if [[ $(which gammu) ]]; then + # I am a g1sms NODE, pushing my web interface + ipfs p2p listen /x/g1sms /ip4/127.0.0.1/tcp/10099 +else + # Looking for g1sms NODE in my swarm + SMSNODE=$(ls /home/$YOU/.zen/ipfs_swarm/.Qm*/G1SSB/_g1sms | shuf -n 1 | cut -d '/' -f 6 | cut -d '.' -f 2) + sleep 10 # Wait for DHT to propagate.... Then forward /x/g1sms + [[ $SMSNODE ]] && ipfs p2p forward /x/g1sms /ip4/127.0.0.1/tcp/10099 /p2p/$SMSNODE +fi -p2p close --all -ipfs p2p listen /x/ssh-$UIDNA /ip4/127.0.0.1/tcp/22 -ipfs p2p listen /x/http-$UIDNA /ip4/127.0.0.1/tcp/80 -ipfs p2p listen /x/https-$UIDNA /ip4/127.0.0.1/tcp/443 +# p2p close --all +# ipfs p2p listen /x/ssh-$UIDNA /ip4/127.0.0.1/tcp/22 +# ipfs p2p listen /x/http-$UIDNA /ip4/127.0.0.1/tcp/80 +# ipfs p2p listen /x/https-$UIDNA /ip4/127.0.0.1/tcp/443 ipfs p2p ls