mix up
This commit is contained in:
parent
70fbbd0d1b
commit
eb85c057ac
|
@ -1,7 +1,13 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 2020.03.24
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
{
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
|
||||
[[ $USER == "root" ]] && echo "DO NOT RUN AS root!! Use regular USER with sudo AUTHORISATION" && exit 1
|
||||
|
||||
|
@ -17,45 +23,47 @@ if [[ ! $(which youtube-dl) ]]; then
|
|||
sudo chown $USER /usr/local/bin/youtube-dl
|
||||
fi
|
||||
|
||||
sudo apt install libid3-tools mpd mpc lame -y || err=1
|
||||
# AUDIO LAYER
|
||||
sudo apt-get update
|
||||
sudo apt-get install libid3-tools mpd mpc lame -y || err=1
|
||||
sudo apt-get install lame sox libsox-fmt-mp3 eyed3 python-chardet imagemagick curl -y #libav-tools || err=1
|
||||
sudo apt-get install ca-certificates git-core binutils rsync alsa-utils bc espeak mpg321 fuse atomicparsley -y || err=1
|
||||
|
||||
## CONFIG MPD
|
||||
sudo cp -f $MY_PATH/templates/copylaradio/mpd.conf /etc/mpd.conf
|
||||
sudo sed -i "s/_USER_/$USER/g" /etc/mpd.conf || err=1
|
||||
mkdir ~/.config/mpd && sudo cp -f /etc/mpd.conf ~/.config/mpd/mpd.conf && chown $USER ~/.config/mpd/mpd.conf
|
||||
|
||||
mkdir ~/.config/mpd
|
||||
sudo cp -f /etc/mpd.conf ~/.config/mpd/mpd.conf
|
||||
chown $USER ~/.config/mpd/mpd.conf
|
||||
|
||||
## MUSIC & PLAYLISTS
|
||||
mkdir -p ~/.zen/music
|
||||
mkdir -p ~/.zen/playlists
|
||||
|
||||
## CHOWN mpd FILES STRUCTURE
|
||||
sudo chown -R $USER /var/lib/mpd/ /var/run/mpd /run/mpd /var/log/mpd
|
||||
sudo service mpd restart || err=1
|
||||
## TODO add to system start (/etc/rc.local?)
|
||||
|
||||
### NGINX
|
||||
### INSTALL NGINX
|
||||
sudo apt-get install fail2ban nginx ssl-cert openssl-blacklist php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-fpm sqlite -y || err=1
|
||||
|
||||
# CONFIG NGINX - LOVE LAND
|
||||
# CONFIG NGINX - LOVE LAND FRONTAL WEB PAGE
|
||||
sudo cp -f $MY_PATH/../www/loveland.conf /etc/nginx/conf.d/
|
||||
PHPVERSION=$(ps auxf | grep php-fpm | grep -v -E 'color=auto|grep' | head -n 1 | grep -oP '(?<=\().*(?=\))' | awk -F '/' '{print $4}')
|
||||
sudo sed -i "s/_PHPVERSION_/$PHPVERSION/g" /etc/nginx/conf.d/loveland.conf
|
||||
nodename=$(cat /etc/hostname)
|
||||
extension=$(echo $nodename | cut -d '.' -f 2)
|
||||
if [[ $extension == $nodename ]]; then
|
||||
nodename=$nodename.local
|
||||
nodename=$nodename.local # TODO : Adpapt to Internet BOX local DNS stategy
|
||||
fi
|
||||
sudo sed -i "s/_SERVERNAME_/$nodename/g" /etc/nginx/conf.d/loveland.conf
|
||||
|
||||
sudo systemctl restart nginx || err=1
|
||||
|
||||
# INSTALL LOVELand WebSite LINKs
|
||||
sudo ln -s $MY_PATH/../www/LOVELand/ /var/www/loveland
|
||||
sudo chmod 777 /var/www/loveland/jukebox/albumart
|
||||
sudo chmod 777 /var/www/loveland/jukebox/prefs
|
||||
|
||||
sudo systemctl restart nginx || err=1
|
||||
|
||||
if [[ $err ]]; then
|
||||
echo -e "${c_red}Installation de LOVELand incomplète$c_"
|
||||
exit 1
|
||||
|
@ -64,4 +72,4 @@ else
|
|||
exit 0
|
||||
fi
|
||||
|
||||
}
|
||||
} # for script being completely downloaded before run
|
||||
|
|
|
@ -54,6 +54,7 @@ g1sms $G1SMS
|
|||
|
||||
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
||||
|
||||
# TODO (make and use ./zen/config )
|
||||
##################################################################
|
||||
# Activate logging to /tmp/g1sms.log (YES/NO)
|
||||
export DOLOG="YES"
|
||||
|
|
|
@ -10,17 +10,33 @@ MY_PATH="`dirname \"$0\"`" # relative
|
|||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
source $MY_PATH/init.sh
|
||||
source $MY_PATH/functions.sh
|
||||
|
||||
TODAY=$(date '+%Y%m%d')
|
||||
timestamp=$(date -u +%s%N | cut -b1-13)
|
||||
|
||||
log "__SUB:sms_ASTROPORT.sh"
|
||||
|
||||
# VERIFY /tmp/loveland_entrance EXISTS and is 777
|
||||
# VERIFY task relay directory EXISTS and is 777
|
||||
# LOCAL MODE
|
||||
[[ ! -d /tmp/loveland_entrance ]] && mkdir -p /tmp/loveland_entrance && chmod -R 777 /tmp/loveland_entrance
|
||||
# SWARM MODE
|
||||
[[ ! -d /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/TASK/loveland_entrance ]] \
|
||||
&& mkdir -p /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/TASK/loveland_entrance \
|
||||
&& chmod -R 777 /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/TASK/loveland_entrance
|
||||
|
||||
# SWARM MODE
|
||||
# for hashfile in $(ls /home/$YOU/.zen/ipfs_swarm/.Qm*/TASK/loveland_entrance); do
|
||||
# TODO SSB task relay MODE
|
||||
# Search new SSB Publish
|
||||
|
||||
for hashfile in $(ls /tmp/loveland_entrance/); do
|
||||
PHONE=$(cat $hashfile)
|
||||
PHONEHASH=$(basename -- "$hashfile")
|
||||
# CHECK PHONE
|
||||
|
||||
# TODO CHECK PHONE IN SWARM
|
||||
# if [[ ! -f /home/$YOU/.zen/ipfs_swarm/.Qm*/CHANNEL/$PHONEHASH@*/_pub ]]; then
|
||||
# fi
|
||||
|
||||
if [[ ! -f /home/$YOU/.zen/g1sms_wallets/$PHONE/_pub ]]; then
|
||||
# NOT THERE
|
||||
sms_INIT_ACCOUNT "$PHONE"
|
||||
|
@ -31,14 +47,20 @@ for hashfile in $(ls /tmp/loveland_entrance/); do
|
|||
AMOUNTG1=$(silkaj_balance $PUBKEY)
|
||||
AMOUNTDU=$(bc -l <<< "scale=2; $AMOUNTG1 / $DUFACTOR")
|
||||
AMOUNTLOVE=$(bc -l <<< "scale=0; $AMOUNTG1 * 100 / $DUFACTOR")
|
||||
|
||||
# DOUBLE AUTH SMS !!
|
||||
|
||||
mess="Bonjounr
|
||||
Ce numéro est déjà enregistré...
|
||||
mess="Bonjour
|
||||
Compte
|
||||
Astroport Station"
|
||||
|
||||
# Send response SMS
|
||||
sms_SEND "$PHONE" "$mess"
|
||||
|
||||
# SEND THE KEY !!
|
||||
|
||||
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
|
|
@ -7,7 +7,7 @@ if (isset($_REQUEST['email'])) $email = $_REQUEST['email']; else $email = "";
|
|||
|
||||
$message = "Message de {$phone} / {$email}";
|
||||
|
||||
$headers = "From: webmaster@zicmama.com"; // Who should it come from?
|
||||
$headers = "From: support@qo-op.com"; // Who should it come from?
|
||||
if( $phone != "" || $email != "" ) {
|
||||
error_log("SEND EMail ". $email. " ". $phone );
|
||||
mail($to, $subject, $message, $headers);
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<!-- Navigation -->
|
||||
<nav class="navbar navbar-light bg-light static-top">
|
||||
<div class="container">
|
||||
<a class="btn btn-lg btn-primary" href="./" onclick="javascript:event.target.port=3000" target="oasis">Oasis</a>
|
||||
<a class="btn btn-lg btn-primary" href="/profile" onclick="javascript:event.target.port=3000" target="oasis">Oasis</a>
|
||||
<a class="btn btn-lg btn-primary" href="./cesium/index.html" target="cesium">Cesium</a>
|
||||
<a class="btn btn-lg btn-primary" href="./gchange/index.html" target="gchange">Gchange</a>
|
||||
</div>
|
||||
|
|
|
@ -2,12 +2,22 @@
|
|||
header("Access-Control-Allow-Origin: *");
|
||||
if (strlen($_REQUEST['phone']) == 10 ) {
|
||||
// Replace leading 0 with +33
|
||||
$newNumber = preg_replace('/^0?/', '+33', $_REQUEST['phone']);
|
||||
$PHONE = preg_replace('/^0?/', '+33', $_REQUEST['phone']);
|
||||
// HASH NUMBER
|
||||
$HASH=hash('sha256', $newNumber);
|
||||
$HPHONE=hash('sha256', $PHONE);
|
||||
// CREATE FILE for POST TREATMENT with sms_ASTROPORT.sh
|
||||
$fp = fopen('/tmp/loveland_entrance/'.$HASH, 'a');
|
||||
fwrite($fp, $newNumber);
|
||||
// LOCAL
|
||||
$fp = fopen('/tmp/loveland_entrance/'.$HPHONE, 'a');
|
||||
fwrite($fp, $PHONE);
|
||||
// SWARM
|
||||
exec("ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)", $YOU, $return);
|
||||
if ($return == 0) {
|
||||
exec("ipfs id -f='<id>\n'", $ipfsnodeid, $return);
|
||||
// ACCESS RIGHT PROBLEM !!!
|
||||
$fp = fopen('/home/$YOU/.zen/ipfs/.'.$ipfsnodeid.'/TASK/loveland_entrance/'.$HASH, 'a');
|
||||
fwrite($fp, $PHONE);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -14,7 +14,7 @@ server {
|
|||
# php parsing
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
|
||||
fastcgi_pass unix:/var/run/php/php_PHPVERSION_-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,9 @@ echo '
|
|||
crontab -l > /tmp/mycron
|
||||
# Remove any previous line containing "cron_MINUTE"
|
||||
awk -i inplace -v rmv="cron_MINUTE" '!index($0,rmv)' /tmp/mycron && echo "Astroport cron was there"
|
||||
# DOUBLE CHECK (awk = nawk or gawk -i ?)
|
||||
crontest=$(cat /tmp/mycron | grep -F 'cron_MINUTE')
|
||||
# Create cron_MINUTE.sh cron
|
||||
# ADD cron_MINUTE.sh TO cron ?
|
||||
if [[ ! $crontest ]]; then
|
||||
echo "* * * * * $MY_PATH/../cron_MINUTE.sh >> /tmp/astroport.log 2>&1" >> /tmp/mycron && crontab /tmp/mycron \
|
||||
else
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
|
||||
# TODO ESTABLISH A PORT FORWARD STRATEGY (depending on Node Flavour)
|
||||
exit
|
||||
|
||||
# Arrange local port forwarded to swarm
|
||||
|
|
|
@ -58,3 +58,4 @@ do
|
|||
$MY_PATH/tools/timeout.sh -t 30 ipfs get --output=~/.zen/ipfs_swarm/ /ipns/$id
|
||||
done
|
||||
|
||||
# TODO: TASK treatment.
|
||||
|
|
Loading…
Reference in New Issue