GLOBAL BIG CHANGE
|
@ -15,3 +15,5 @@ history.*
|
||||||
.install/log
|
.install/log
|
||||||
.install/.OS
|
.install/.OS
|
||||||
.profile
|
.profile
|
||||||
|
deps/g1bot/
|
||||||
|
mesms/
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
|
[[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile || echo -e "${c_red}Le .profile n'existe pas$c_" && exit 1
|
||||||
|
|
||||||
OS=$(head -n1 $MY_PATH/.OS)
|
|
||||||
isARM=$(cat $MY_PATH/.OS | grep YES)
|
|
||||||
unset err
|
unset err
|
||||||
|
|
||||||
# Basics
|
# Basics
|
||||||
|
@ -26,7 +25,7 @@ silkaj() {
|
||||||
ipfs() {
|
ipfs() {
|
||||||
echo -e "${c_yellow}Installation d'IPFS...$c_"
|
echo -e "${c_yellow}Installation d'IPFS...$c_"
|
||||||
[[ -f /usr/local/bin/ipfs ]] && sudo service ipfs stop
|
[[ -f /usr/local/bin/ipfs ]] && sudo service ipfs stop
|
||||||
if [[ $isARM ]]; then
|
if [[ $ARM == "yes" ]]; then
|
||||||
wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update"
|
wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update"
|
||||||
else
|
else
|
||||||
wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update"
|
wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update"
|
||||||
|
|
|
@ -2,10 +2,9 @@
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
source $MY_PATH/../.install/.GPATH
|
|
||||||
|
|
||||||
## Récupère les données du profile
|
## Récupère les données du profile
|
||||||
[[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile
|
[[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile || echo -e "${c_red}Le .profile n'existe pas$c_" && exit 1
|
||||||
|
|
||||||
## Désactive les processus écoutant le tty1
|
## Désactive les processus écoutant le tty1
|
||||||
[[ $(sudo systemctl status getty@tty1.service | grep "loaded" 2>/dev/null) ]] && sudo systemctl stop getty@tty1.service && sudo systemctl disable getty@tty1.service
|
[[ $(sudo systemctl status getty@tty1.service | grep "loaded" 2>/dev/null) ]] && sudo systemctl stop getty@tty1.service && sudo systemctl disable getty@tty1.service
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
templates="$MY_PATH/templates/3"
|
source $MY_PATH/../.profile
|
||||||
|
|
||||||
isARM=$(cat $MY_PATH/.OS | grep YES)
|
templates="$MY_PATH/templates/3"
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
## INSTALL TOOLS
|
## INSTALL TOOLS
|
||||||
|
@ -27,7 +27,7 @@ sudo apt-get install ca-certificates git-core binutils rsync alsa-utils bc libid
|
||||||
|
|
||||||
wget http://launchpadlibrarian.net/339874908/libav-tools_3.3.4-2_all.deb -O $MY_PATH/libav-tools.deb
|
wget http://launchpadlibrarian.net/339874908/libav-tools_3.3.4-2_all.deb -O $MY_PATH/libav-tools.deb
|
||||||
wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-data_1.0+git20130326-3_all.deb -O $MY_PATH/libttspico-data.deb
|
wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-data_1.0+git20130326-3_all.deb -O $MY_PATH/libttspico-data.deb
|
||||||
if [[ $isARM ]]; then
|
if [[ $ARM == "yes" ]]; then
|
||||||
wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-3_armhf.deb -O $MY_PATH/libttspico0.deb
|
wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-3_armhf.deb -O $MY_PATH/libttspico0.deb
|
||||||
wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-3_armhf.deb -O $MY_PATH/libttspico-utils.deb
|
wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-3_armhf.deb -O $MY_PATH/libttspico-utils.deb
|
||||||
else
|
else
|
||||||
|
|
|
@ -3,13 +3,12 @@
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
|
|
||||||
[[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile
|
[[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile || echo -e "${c_red}Le .profile n'existe pas$c_" && exit 1
|
||||||
unset err
|
unset err
|
||||||
|
|
||||||
args=$@
|
args=$@
|
||||||
[[ $args =~ noask ]] && noask=o && askSSL=o
|
[[ $args =~ noask ]] && noask=o && askSSL=o
|
||||||
|
|
||||||
OS=$(head -n1 $MY_PATH/.OS)
|
|
||||||
IP=$(ifconfig | grep "inet " | grep -v "127.0.0.1" | awk '{ print $2 }')
|
IP=$(ifconfig | grep "inet " | grep -v "127.0.0.1" | awk '{ print $2 }')
|
||||||
if [[ -z $KSMS_DOMAIN ]]; then
|
if [[ -z $KSMS_DOMAIN ]]; then
|
||||||
echo -e "${c_yellow}Choisissez un nom de domaine pour KALKUN (Sinon $IP sera choisi): $c_" && read KSMS_DOMAIN
|
echo -e "${c_yellow}Choisissez un nom de domaine pour KALKUN (Sinon $IP sera choisi): $c_" && read KSMS_DOMAIN
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
source $MY_PATH/../.install/.GPATH
|
[[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile || echo -e "${c_red}Le .profile n'existe pas$c_" && exit 1
|
||||||
|
|
||||||
GPATHS=$(echo $GPATH | sed 's./.\\/.g')
|
GPATHS=$(echo $GPATH | sed 's./.\\/.g')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
|
|
||||||
|
[[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile || echo -e "${c_red}Le .profile n'existe pas$c_" && exit 1
|
||||||
|
|
||||||
|
## Install node 13 via NVM
|
||||||
|
if [[ -z $(which node) ]]; then
|
||||||
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
|
||||||
|
nvm install 13
|
||||||
|
nvm use 13
|
||||||
|
fi
|
||||||
|
|
||||||
|
## install pm2 for deamoning
|
||||||
|
[[ -z $(which pm2) ]] && npm install pm2 -g
|
||||||
|
|
||||||
|
## Install g1bot
|
||||||
|
[[ ! -d $GPATH/deps ]] && mkdir $GPATH/deps
|
||||||
|
cd $GPATH/deps/
|
||||||
|
[[ -d g1bot ]] && echo "g1bot est déjà installé" && exit 1
|
||||||
|
git clone https://git.p2p.legal/axiom-team/g1bot.git g1bot && cd g1bot || exit 1
|
||||||
|
npm install
|
||||||
|
cp .env.example .env
|
||||||
|
echo "Now edit url and password in .env in 3 seconds ..." && sleep 3
|
||||||
|
nano .env
|
||||||
|
|
||||||
|
pm2 kill && sleep 1
|
||||||
|
pm2 start bbot.js && echo "${c_green}BBOT a été correctement installé et a pu démarrer$c_" || echo "$c{c_gree,}BBOT n'a pas pu démarrer$c_"
|
||||||
|
|
||||||
|
exit 0
|
|
@ -1,6 +1,15 @@
|
||||||
|
### PROFILE ###
|
||||||
|
|
||||||
ADMINPSEUDO=_ADMINPSEUDO
|
ADMINPSEUDO=_ADMINPSEUDO
|
||||||
ADMINPHONE=_ADMINPHONE
|
ADMINPHONE=_ADMINPHONE
|
||||||
MASTERPHONE=_MASTERPHONE
|
MASTERPHONE=_MASTERPHONE
|
||||||
ADRESSE="_ADRESSE"
|
ADRESSE="_ADRESSE"
|
||||||
PIN=_PIN
|
PIN=_PIN
|
||||||
KSMS_DOMAIN=
|
KSMS_DOMAIN=
|
||||||
|
|
||||||
|
### SYSTEME ###
|
||||||
|
|
||||||
|
GPATH=_GPATH
|
||||||
|
OS=_OS
|
||||||
|
ARM=_ARM
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=_USER
|
User=_USER
|
||||||
ExecStart=/usr/local/bin/ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub --routing=dhtclient --enable-gc
|
ExecStart=/usr/local/bin/ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub --enable-gc
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -2,7 +2,7 @@ server {
|
||||||
listen 80;
|
listen 80;
|
||||||
listen 443;
|
listen 443;
|
||||||
listen [::]:443 ssl;
|
listen [::]:443 ssl;
|
||||||
server_name _DOMAIN;
|
server_name _DOMAIN 127.0.0.1 localhost;
|
||||||
|
|
||||||
#add_header Content-Security-Policy upgrade-insecure-requests;
|
#add_header Content-Security-Policy upgrade-insecure-requests;
|
||||||
#if ($http_x_forwarded_proto = "http") { return 301 https://$server_name$request_uri; }
|
#if ($http_x_forwarded_proto = "http") { return 301 https://$server_name$request_uri; }
|
||||||
|
|
|
@ -7,8 +7,14 @@
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
|
if [[ -f $MY_PATH/.profile ]]; then
|
||||||
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
source $MY_PATH/.profile
|
||||||
|
elif [[ -f $MY_PATH/../.profile ]]; then
|
||||||
|
source $MY_PATH/../.profile
|
||||||
|
else
|
||||||
|
echo -e "${c_red}Le .profile n'existe pas$c_"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
|
# Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
|
||||||
function log () {
|
function log () {
|
||||||
|
|
|
@ -2,7 +2,14 @@
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
source $MY_PATH/../.install/.GPATH
|
if [[ -f $MY_PATH/.profile ]]; then
|
||||||
|
source $MY_PATH/.profile
|
||||||
|
elif [[ -f $MY_PATH/../.profile ]]; then
|
||||||
|
source $MY_PATH/../.profile
|
||||||
|
else
|
||||||
|
echo -e "${c_red}Le .profile n'existe pas$c_"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Clean /tmp/ytdl.list
|
# Clean /tmp/ytdl.list
|
||||||
#echo > /tmp/ytdl.list
|
#echo > /tmp/ytdl.list
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const fs = require('fs');
|
||||||
|
const util = require('util')
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['biz aide','biz help']
|
||||||
|
}, (b) => {
|
||||||
|
membres = exec("src/shell/aide.sh text", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'biz-aide'
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
|
||||||
|
//ADMINS
|
||||||
|
var adminRooms = ["pokabizbot", "_recrutement", "compta-axiom", "_admin-at", "test-bot-chat", "poka"];
|
||||||
|
//var adminRooms = exec("cat admins-chan.txt");
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['axiom adhérent','axiom adhérents','axiom adherent','axiom adherents']
|
||||||
|
}, (b) => {
|
||||||
|
// cmd = b.message.text
|
||||||
|
// roomName = b.message.user.room.name
|
||||||
|
|
||||||
|
if (b.message.user.room.type == "p") {
|
||||||
|
roomName = b.message.user.room.name
|
||||||
|
} else {
|
||||||
|
roomName = b.message.user.name
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adminRooms.indexOf(roomName) == -1) {
|
||||||
|
cmd = "adherentsSoft"
|
||||||
|
} else {
|
||||||
|
cmd = "adherents"
|
||||||
|
}
|
||||||
|
process.env.hb_cmd = cmd
|
||||||
|
|
||||||
|
pubkey = exec("src/shell/helloasso.sh $hb_cmd", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'axiom-adherents'
|
||||||
|
});
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['axiom cagnotte']
|
||||||
|
}, (b) => {
|
||||||
|
membres = exec("src/shell/helloasso.sh cagnotte", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'axiom-cagnotte'
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const util = require('util');
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['debug user']
|
||||||
|
}, (b) => {
|
||||||
|
username = b.message
|
||||||
|
// const userId = res.message.user.id
|
||||||
|
// username = robot.adapter.api.get('users.info', { userId })
|
||||||
|
// process.env.hb_username = username
|
||||||
|
b.reply("```" + util.inspect(username, {showHidden: false, depth: null}) + "```")
|
||||||
|
|
||||||
|
|
||||||
|
}, {
|
||||||
|
id: 'debug'
|
||||||
|
});
|
|
@ -0,0 +1,201 @@
|
||||||
|
const bot = require('bbot')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All branch examples start from the "global" conversation scope.
|
||||||
|
* We are working on features to provide branching within a conversational
|
||||||
|
* context, but as those methods are changing in the beta, they aren't included
|
||||||
|
* as examples to follow just yet.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Branch types are declared from their scope, see all available types here:
|
||||||
|
* http://bbot.chat/docs/path#builtforbranching
|
||||||
|
*
|
||||||
|
* `text` branches take the following arguments:
|
||||||
|
* - matcher: expression, semantic conditions object, or array of conditions
|
||||||
|
* - callback: to fire on successful match, given the state object (b)
|
||||||
|
* - [options]: object with `id` (string) and/or `force` (boolean) attributes
|
||||||
|
*
|
||||||
|
* Test with "Hello bots!"
|
||||||
|
*/
|
||||||
|
bot.global.text(/(hi|hello).*bots?/, (b) => b.respond('Hello :wave:'), {
|
||||||
|
id: 'hello-bots'
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `direct` branch type requires the bot to be explicitly addressed.
|
||||||
|
*
|
||||||
|
* `reply` instead of `respond` prepends messages with user's name.
|
||||||
|
*
|
||||||
|
* In Rocket.Chat all messages to a bot in a direct room have the name prepended
|
||||||
|
* by the Rocket.Chat SDK before it's processed by the bot framework.
|
||||||
|
*
|
||||||
|
* Test with "@brocket Hello" or just "Hello" in a DM.
|
||||||
|
*/
|
||||||
|
bot.global.direct(/hi|hello/i, (b) => b.reply('Hey there.'), {
|
||||||
|
id: 'hello-direct'
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `respondVia` allows using custom platform methods to dispatch response.
|
||||||
|
*
|
||||||
|
* Matcher conditions allow semantic attributes with a string or array of
|
||||||
|
* optional values to match against, possibly capturing content.
|
||||||
|
* Accepted atts: is, starts, ends, contains, excludes, after, before, range
|
||||||
|
*
|
||||||
|
* Test with "Hello anyone?"
|
||||||
|
*/
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['hi', 'hello']
|
||||||
|
}, (b) => b.respondVia('react', ':wave:'), {
|
||||||
|
id: 'hello-react'
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Branch callbacks allow asynchronous responding, if they return a promise.
|
||||||
|
* State (b) includes branch matching attributes, see bbot.chat/docs/thought.
|
||||||
|
*
|
||||||
|
* Test with "@brocket ping back in 5 seconds"
|
||||||
|
*/
|
||||||
|
bot.global.direct(/ping back in (\d*)/i, async (b) => {
|
||||||
|
const ms = parseInt(b.match[1]) * 1000
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, ms))
|
||||||
|
return b.respond('Ping :ping_pong:')
|
||||||
|
}, {
|
||||||
|
id: 'ping-delay'
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `respond` method can accept attachment objects as well as strings.
|
||||||
|
* Rendering support depends on the message platform and adapter. In shell,
|
||||||
|
* it will display the fallback text.
|
||||||
|
*
|
||||||
|
* Test with "bot attach image"
|
||||||
|
*/
|
||||||
|
bot.global.text(/attach image/i, (b) => {
|
||||||
|
return b.respond({
|
||||||
|
fallback: `See: https://www.wikiwand.com/en/Three_Laws_of_Robotics`,
|
||||||
|
image: `https://upload.wikimedia.org/wikipedia/en/8/8e/I_Robot_-_Runaround.jpg`,
|
||||||
|
title: {
|
||||||
|
text: `Asimov's Three Laws of Robotics`,
|
||||||
|
link: `https://www.wikiwand.com/en/Three_Laws_of_Robotics`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, { id: 'attach-image' })
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `envelope` provides helpers for adding rich-message payloads before
|
||||||
|
* responding. Preparing envelopes before dispatch also allows changing the
|
||||||
|
* user/room the envelope is addressed to or dispatching multiple envelopes.
|
||||||
|
*
|
||||||
|
* Test with "I want a prize"
|
||||||
|
*/
|
||||||
|
bot.global.text({
|
||||||
|
contains: 'prize'
|
||||||
|
}, (b) => {
|
||||||
|
b.envelope.write('Choose your fate! 🚪... 🎁 ')
|
||||||
|
b.envelope.attach({ color: '#f4426e' })
|
||||||
|
b.envelope.payload
|
||||||
|
.quickReply({ text: 'Door number 1' })
|
||||||
|
.quickReply({ text: 'Door number 2' })
|
||||||
|
.quickReply({ text: 'Door number 3' })
|
||||||
|
return b.respond().catch((err) => console.error(err))
|
||||||
|
}, { id: 'door-prize-intro' })
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `conditions` attribute contains results of semantic condition matching
|
||||||
|
* and capture groups. Each condition can be given a key for easy reference.
|
||||||
|
*
|
||||||
|
* Test with "what's behind door number 2"
|
||||||
|
*/
|
||||||
|
bot.global.text({
|
||||||
|
door: { after: 'door', range: '1-3' }
|
||||||
|
}, (b) => {
|
||||||
|
switch (b.conditions.captured.door) {
|
||||||
|
case '1': return b.respond(`You win nothing 💔`)
|
||||||
|
case '2': return b.respond(`You win a monkey 🐒`)
|
||||||
|
case '3': return b.respond(`It's a new car!! 🚗`)
|
||||||
|
}
|
||||||
|
}, { id: 'door-prize-award' })
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Branch callbacks can be async functions, to awaiting one or more processes
|
||||||
|
* before responding. This example uses API requests to fill a dynamic array
|
||||||
|
* of actions, using the url property to provide link action buttons.
|
||||||
|
*
|
||||||
|
* Test with "@brocket plan meeting" in a public or private room.
|
||||||
|
*/
|
||||||
|
bot.global.direct({
|
||||||
|
is: 'plan meeting'
|
||||||
|
}, async (b) => {
|
||||||
|
if (bot.adapters.message.name !== 'rocketchat-message-adapter') return
|
||||||
|
b.envelope.write('Please review time zones in the room...')
|
||||||
|
const { id, type } = b.message.user.room
|
||||||
|
let room
|
||||||
|
const q = { roomId: id }
|
||||||
|
if (type === 'c') {
|
||||||
|
room = await bot.adapters.message.api.get('channels.members', q, true)
|
||||||
|
} else if (type === 'p') {
|
||||||
|
room = await bot.adapters.message.api.get('groups.members', q, true)
|
||||||
|
} else {
|
||||||
|
return b.respond('Sorry, that only works in channels and private groups.')
|
||||||
|
}
|
||||||
|
const offsets = room.members
|
||||||
|
.map((member) => member.utcOffset || undefined)
|
||||||
|
.filter((offset) => !!offset)
|
||||||
|
for (let utc of offsets) {
|
||||||
|
b.envelope.payload.quickReply({
|
||||||
|
text: `🌐 UTC ${utc}`,
|
||||||
|
url: `https://www.timeanddate.com/worldclock/timezone/utc${utc}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
b.respond()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo This example requires PR #11811 to be merged. Room names are undefined.
|
||||||
|
*/
|
||||||
|
bot.global.text(/where am i/i, (b) => {
|
||||||
|
const { name, type } = b.message.user.room
|
||||||
|
switch (type) {
|
||||||
|
case 'c': return b.respond(`You're in the #${name} public channel.`)
|
||||||
|
case 'p': return b.respond(`You're in a private group called **${name}**.`)
|
||||||
|
case 'l': return b.respond(`You're in a livechat channel.`)
|
||||||
|
case 'd': return b.respond(`You're in a DM with me :hugging:`)
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
id: 'location-check'
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom options can be added to the bot, with the full config utility of bBot,
|
||||||
|
* allowing them to be defined as environment variables, command line args or
|
||||||
|
* package.json attributes. Extend settings with a yargs option format.
|
||||||
|
*
|
||||||
|
* Try any of the following:
|
||||||
|
* - `node index.js --avatar <YOUR_AVATAR_URL>`
|
||||||
|
* - BOT_AVATAR=<YOUR_AVATAR_URL> in .env
|
||||||
|
* - `{ "bot": { "avatar": "<YOUR_AVATAR_URL>" } }` in package.json
|
||||||
|
*/
|
||||||
|
bot.settings.extend({
|
||||||
|
avatar: {
|
||||||
|
'type': 'string',
|
||||||
|
'description': 'Set a custom avatar for your bot account profile'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bot can access lower level methods of the Rocket.Chat SDK through the
|
||||||
|
* message adapter, once it's connected. This example sets an avatar on login.
|
||||||
|
*
|
||||||
|
* Try replacing the avatar configured in package.json with your own.
|
||||||
|
*/
|
||||||
|
bot.events.on('started', () => {
|
||||||
|
if (bot.adapters.message.name !== 'rocketchat-message-adapter') return
|
||||||
|
if (bot.settings.get('avatar')) {
|
||||||
|
bot.logger.info('Setting bot avatar')
|
||||||
|
bot.adapters.message.api.post('users.setAvatar', {
|
||||||
|
avatarUrl: bot.settings.get('avatar')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,33 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const fs = require('fs');
|
||||||
|
const util = require('util')
|
||||||
|
|
||||||
|
bot.global.text({ contains: [''] }, (b) => b.respond(""), {
|
||||||
|
id: 'id-tpl'
|
||||||
|
})
|
||||||
|
|
||||||
|
// --------
|
||||||
|
|
||||||
|
bot.global.text({ contains: [''] }, (b) => {
|
||||||
|
b.respond("")
|
||||||
|
}, {
|
||||||
|
id: 'id-tpl-2'
|
||||||
|
});
|
||||||
|
|
||||||
|
// --------
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['']
|
||||||
|
}, (b) => {
|
||||||
|
membres = exec("src/shell/.sh", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'id-tpl-3'
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
const bot = require('bbot');
|
||||||
|
const request = require('request');
|
||||||
|
const decodeEntities = require('decode-entities');
|
||||||
|
//var decode = require('unescape');
|
||||||
|
|
||||||
|
var request_options = {
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'crabot retrieving url metadata (https://wiki.crapaud-fou.org/crabot)'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bot.global.text(/(https?:\/\/[^ ,\)"\n]*)/ig, async (b) => {
|
||||||
|
// console.log(JSON.stringify(b.match, null, 2));
|
||||||
|
for (url of b.match) {
|
||||||
|
// console.log(JSON.stringify(url, null, 2));
|
||||||
|
if (!/(coa|pad)\.crapaud-fou\.org/.test(url)) {
|
||||||
|
request_options.url = url;
|
||||||
|
request(request_options, (err, res, body) => {
|
||||||
|
// console.log(JSON.stringify(res, null, 2));
|
||||||
|
if (!err && res.statusCode === 200) {
|
||||||
|
var re = /<title[^>]*>([^<]*)<\/title>/gi;
|
||||||
|
var match = re.exec(body);
|
||||||
|
if (match && match[1]) {
|
||||||
|
var extra = "";
|
||||||
|
var link = res.request.uri.href;
|
||||||
|
link = link.replace(/[\?&]fbclid=.+/gi, "");
|
||||||
|
link = link.replace(/[\?&]ncid=.+/gi, "");
|
||||||
|
//kopa match[1] = match[1].replace("'", "'");
|
||||||
|
if (/youtube.com/.test(link)) {
|
||||||
|
if (t = /[?&]v=([^&]+)/.exec(link)) {
|
||||||
|
link = "https://www.youtube.com/watch?v=" + t[1];
|
||||||
|
extra += " - [no-cookie](https://www.youtube-nocookie.com/embed/" + t[1] + ")";
|
||||||
|
extra += " - [invidious](https://invidio.us/watch?v=" + t[1] + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b.respond(decodeEntities("[>>>](" + link + ") _" + match[1].replace(/\n/g, " ").trim() + "_" + extra));
|
||||||
|
// b.respond("\>\>\>\> _" + match[1].replace(/\n/g, " ").trim() + "_" + extra);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('-----------------------------------');
|
||||||
|
console.log('URL: ' + url);
|
||||||
|
console.log('ERR - - - - - - - - - - - - - - - -');
|
||||||
|
console.log(JSON.stringify(err, null, 2));
|
||||||
|
console.log('RES - - - - - - - - - - - - - - - -');
|
||||||
|
console.log(JSON.stringify(res, null, 2));
|
||||||
|
console.log('-----------------------------------');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
id: 'get-url-metadata'
|
||||||
|
});
|
|
@ -0,0 +1,35 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
starts: ['pubkey','publique','rib','public','cle', 'brocket rib']
|
||||||
|
}, (b) => {
|
||||||
|
username = b.message.user.name
|
||||||
|
cmd = b.message.text
|
||||||
|
process.env.hb_username = username
|
||||||
|
process.env.hb_cmd = cmd
|
||||||
|
pubkey = exec("src/shell/g1-infos.sh pubkey $hb_username \"$hb_cmd\"", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'g1-pubkey'
|
||||||
|
});
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['membre','membres']
|
||||||
|
}, (b) => {
|
||||||
|
membres = exec("src/shell/g1-infos.sh membres", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'g1-membres'
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
module.exports = (robot) =>
|
||||||
|
{
|
||||||
|
robot.respond( /aide/i, (res) =>
|
||||||
|
res.reply( `QWant est ton ami...
|
||||||
|
... Nan j'déconne, voici ce que je connais:
|
||||||
|
- *biz aide*: Affiche cette aide
|
||||||
|
- *biz liens*: Donne des liens utiles
|
||||||
|
- *index pads*: Donne le lien vers l'index de nos pads
|
||||||
|
- *membres*: Affiche le nombre de membres actuelles de la Ğ1
|
||||||
|
- *pubkey*: Affiche sa propre clé publique Ğ1
|
||||||
|
- *axiom adhérents*: Affiche les adhérents de l'association
|
||||||
|
- *axiom cagnotte*: Affiche le status de la cagnotte de l'association
|
||||||
|
- Massages Viet pour 150Ğ1
|
||||||
|
- Et bien d'autres choses, je vais pas tout te dire non plus !! :rofl:` )
|
||||||
|
)
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
module.exports = (robot) =>
|
||||||
|
{
|
||||||
|
robot.hear( /index pad/i, res=> res.send(":arrow_right: https://pad.p2p.legal/axiom_index-pads") )
|
||||||
|
robot.hear( /index des pad/i, res=> res.send(":arrow_right: https://pad.p2p.legal/axiom_index-pads") )
|
||||||
|
robot.respond( /lien/i, res=> res.send(`*Index de tous nos documents* :arrow_right: https://pad.p2p.legal/axiom_index-pads
|
||||||
|
*Site officiel de l'association Axiom-Team* :arrow_right: https://axiom-team.fr/
|
||||||
|
*Forum de l'asso axiom-team* :arrow_right: https://forum.axiom-team.fr/
|
||||||
|
*Cloud publique axiom - Ressources Agora* :arrow_right: https://cloud.p2p.legal/s/DDbKi2pqdEmixS9
|
||||||
|
*Cloud interne axiom - Nécessite un accès* :arrow_right: https://cloud.p2p.legal/f/204193`
|
||||||
|
) )
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
*Voici ce que je sais faire ...*
|
||||||
|
|
||||||
|
```
|
||||||
|
- biz aide: Affiche cette aide
|
||||||
|
- biz liens: Donne des liens utiles
|
||||||
|
- index pads: Donne le lien vers l'index de nos pads
|
||||||
|
- membres: Affiche le nombre de membres actuelles de la Ğ1
|
||||||
|
- pubkey [pseudo]: Affiche sa propre clé publique Ğ1 si [pseudo] n'est pas renseigné, ou bien celle du pseudo indiqué
|
||||||
|
- axiom adhérents: Affiche les adhérents de l'association
|
||||||
|
- axiom cagnotte: Affiche le status de la cagnotte de l'association
|
||||||
|
- Massages Viet pour 150Ğ1
|
||||||
|
- Et bien d'autres choses, je vais pas tout te dire non plus !! 🤣
|
||||||
|
```
|
|
@ -0,0 +1,6 @@
|
||||||
|
index pad !! https://pad.p2p.legal/axiom_index-pads
|
||||||
|
Site officiel de l'association Axiom-Team !! https://axiom-team.fr/
|
||||||
|
Forum de l'asso axiom-team !! https://forum.axiom-team.fr/
|
||||||
|
Cloud publique axiom - Ressources Agora !! https://cloud.p2p.legal/s/DDbKi2pqdEmixS9
|
||||||
|
Cloud interne axiom _(Nécessite un accès)_ !! https://cloud.p2p.legal/f/204193`
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
5 personnes membres vous connaissent-elles bien ? Peuvent-elles vous contacter ? Contacter votre entourage ? Avez-vous sauvegardé votre document de révocation ? Avez-vous installé un client local sur votre ordinateur/smartphone comme Cesium ?
|
||||||
|
|
||||||
|
Si oui -> vous connaissez certainement ces personnes vous aussi, et pouvez leur demander.
|
||||||
|
Si non -> il va vous falloir créer des liens avec des membres, conformément à la **[licence](https://duniter.org/fr/wiki/licence-g1/)** que vous devez lire, comprendre et accepter.
|
||||||
|
|
||||||
|
Je vous invite également à lire le **[guide du débutant](https://forum.monnaie-libre.fr/t/00-intro-guide-du-debutant-en-monnaie-libre-g1-june/2777)**, et surtout à vous renseigner sur les rencontres de présentation de la monnaie libre autour de chez vous, pour créer des relations humaines réelles.
|
||||||
|
|
||||||
|
Bienvenue, et bonnes découvertes !
|
|
@ -0,0 +1,6 @@
|
||||||
|
OBSCURANTISTE!
|
||||||
|
MENTEUR!
|
||||||
|
Toute mlc ne sert qu'à nuire à l’eveil de conscience sur la création monétaire.
|
||||||
|
Avez vous déjà vérifié les arguments (fallacieux) servis par les rabatteurs de mlc?
|
||||||
|
Les mlc coutent un bras au profit des banques et de quelques « chiens de garde» de leur salaire en unl qui en découle (rabatteurs).
|
||||||
|
La plus grosse mlc de l’histoire j’ai analysé: La mlc argentine en 2001. Elle a permis l’emergence de Monsanto compagny en 2002. N’hésitez pas à vérifier.
|
|
@ -0,0 +1,23 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
bot.global.text({ contains: ['vtfn','si tes pas content','si t\'es pas content'] }, (b) => b.respond(":arrow_right: https://vatefairecuireunnem.com/"), {
|
||||||
|
id: 'joke-vtfn'
|
||||||
|
})
|
||||||
|
|
||||||
|
bot.global.text({ contains: ['biz présente toi'] }, (b) => b.respond(":arrow_right: https://matiou.biz"), {
|
||||||
|
id: 'joke-presente'
|
||||||
|
})
|
||||||
|
|
||||||
|
// L'infernal matiou sur les MLC ...
|
||||||
|
let bizbi = fs.readFileSync('./src/inc/repliques-mlc.txt', 'utf8');
|
||||||
|
bizbi = bizbi.split('\n')
|
||||||
|
function randomize(toRand) {
|
||||||
|
resultRand = toRand[Math.floor(Math.random()*toRand.length)]
|
||||||
|
return resultRand;
|
||||||
|
}
|
||||||
|
bot.global.text({ contains: ['mlc'] }, (b) => b.respond(randomize(bizbi)), {
|
||||||
|
id: 'joke-presente'
|
||||||
|
})
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const fs = require('fs');
|
||||||
|
const util = require('util')
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['biz lien','biz liens']
|
||||||
|
}, (b) => {
|
||||||
|
cmd = b.message.text
|
||||||
|
process.env.hb_cmd = cmd
|
||||||
|
membres = exec("src/shell/liens.sh $hb_cmd", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'biz-liens'
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
const bot = require('bbot');
|
||||||
|
const globe_delay = 60000; // 1 minute
|
||||||
|
var globe_said = {};
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['facebook', 'google', 'amazon', 'apple', 'microsoft']
|
||||||
|
}, (b) => {
|
||||||
|
b.respondVia('react', ':hear_no_evil:');
|
||||||
|
}, {
|
||||||
|
id: 'gafam-react'
|
||||||
|
});
|
||||||
|
|
||||||
|
bot.global.text(
|
||||||
|
/pe?tit? globe/i
|
||||||
|
, (b) => {
|
||||||
|
if (!globe_said[b.message.user.room] || new Date().getTime() > globe_said[b.message.user.room] + globe_delay) {
|
||||||
|
b.respond('![pti globe](https://crapaud-fou.org/images/chat-ptiglobe.png)');
|
||||||
|
globe_said[b.message.user.room] = new Date().getTime();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
id: 'ptiglobe-direct'
|
||||||
|
})
|
|
@ -0,0 +1,22 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
is: ['biz reload']
|
||||||
|
}, (b) => {
|
||||||
|
function reload() {
|
||||||
|
pubkey = exec("pm2 reload index --force", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu: " + " - " + stderr)
|
||||||
|
} else {
|
||||||
|
b.respond("Biz a été rechargé")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
b.respond("Biz redémarre ... OK dans 5 secondes")
|
||||||
|
setTimeout(reload, 10);
|
||||||
|
|
||||||
|
}, {
|
||||||
|
id: 'reload-scripts'
|
||||||
|
});
|
|
@ -0,0 +1,12 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const fs = require('fs');
|
||||||
|
const util = require('util')
|
||||||
|
|
||||||
|
bot.global.text({ contains: ['me certifier','me faire certifier','je cherche une certification','je cherche des certifications'] }, (b) => {
|
||||||
|
// Lisez la licence Ḡ1 ...
|
||||||
|
let newml = fs.readFileSync('./src/inc/need-certif.txt', 'utf8');
|
||||||
|
b.respond("Bonjour, et bienvenue @" + b.message.user.name + " ! =)" + newml)
|
||||||
|
}, {
|
||||||
|
id: 'rep-certif'
|
||||||
|
});
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
auto() {
|
||||||
|
echo "*Je suis l'aide auto*"
|
||||||
|
cd src
|
||||||
|
|
||||||
|
#cmds=$(grep "^bot\." *.js -A3 | grep -E "\['|aide = ")
|
||||||
|
cmds=$(grep "\['" *.js | awk -F "[" '{ print $2 }' | awk -F "]" '{ print $1 }')
|
||||||
|
IFS=$'\n'
|
||||||
|
for i in $cmds; do
|
||||||
|
echo "$i" | awk -F "'" '{ print $2 }'
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
text() {
|
||||||
|
cat src/inc/aide.txt
|
||||||
|
}
|
||||||
|
|
||||||
|
$@
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
node="https://duniter-g1.p2p.legal"
|
||||||
|
|
||||||
|
pubkey() {
|
||||||
|
url="$node/wot/members"
|
||||||
|
if [[ "$@" =~ "brocket" ]]; then
|
||||||
|
[[ $4 ]] && username=$4 || username=$1
|
||||||
|
else
|
||||||
|
[[ $3 ]] && username=$3 || username=$1
|
||||||
|
fi
|
||||||
|
username=$(echo $username | tr -d '@')
|
||||||
|
local pubkey=$(curl -m 5 -s $url | grep -w -i -B 1 $username | grep "pubkey" | awk -F '"' '{ print $4 }')
|
||||||
|
# TODO: local pubkey=$(curl -m 5 -s $url | jq -r --arg username "$username" '.results[] | select(.uid=="$username") | .pubkey')
|
||||||
|
[[ $pubkey ]] && echo "@$username Ta clé publique Ğ1 est: $pubkey" || echo "@$username n'est pas pseudo membre de la Ḡ1"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
membres() {
|
||||||
|
url="$node/blockchain/current"
|
||||||
|
local nbr_membres=$(curl -m 5 -s $url | jq '.membersCount')
|
||||||
|
[[ $nbr_membres ]] && echo "Il y a actuellement $nbr_membres membres de la Ğ1 !" || echo "Service en maintenance, réessayez dans un instant :coffee:"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$@
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ids="axiom-team:tYrjD6rrfStJXBqHhzNET"
|
||||||
|
ha="https://api.helloasso.com/v3"
|
||||||
|
|
||||||
|
adherents() {
|
||||||
|
url="$ha/campaigns/000001053192/actions.json?type"
|
||||||
|
curl -m 5 --user $ids -s $url | jq -r '.resources[] | .date + " , " + .first_name + " " + .last_name + " - " + .email' | sed 's/T.*,//'
|
||||||
|
}
|
||||||
|
|
||||||
|
adherentsSoft() {
|
||||||
|
url="$ha/campaigns/000001053192/actions.json?type"
|
||||||
|
curl -m 5 --user $ids -s $url | jq -r '.resources[] | .date + " , " + .first_name + " " + .last_name' | sed 's/T.*,//'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cagnotte() {
|
||||||
|
url="$ha/campaigns/000001053192.json"
|
||||||
|
curl -m 5 --user $ids -s $url | jq -r '.name, {"Donnateurs": .supporters},{"Fonds":.funding},.url' | grep -v '{|}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$@
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ -z $3 ]]; then
|
||||||
|
res=$(sed 's/!!/:arrow_right:/g' src/inc/liens.txt)
|
||||||
|
else
|
||||||
|
shift 2
|
||||||
|
res=$(sed 's/!!/:arrow_right:/g' src/inc/liens.txt | grep -i "$@")
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ $res ]] && echo "$res" || echo "Aucun lien trouvé avec **$@**"
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,19 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const fs = require('fs');
|
||||||
|
const util = require('util')
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['biz aide','biz help']
|
||||||
|
}, (b) => {
|
||||||
|
membres = exec("src/shell/aide.sh text", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'biz-aide'
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
|
||||||
|
//ADMINS
|
||||||
|
var adminRooms = ["pokabizbot", "_recrutement", "compta-axiom", "_admin-at", "test-bot-chat", "poka"];
|
||||||
|
//var adminRooms = exec("cat admins-chan.txt");
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['axiom adhérent','axiom adhérents','axiom adherent','axiom adherents']
|
||||||
|
}, (b) => {
|
||||||
|
// cmd = b.message.text
|
||||||
|
// roomName = b.message.user.room.name
|
||||||
|
|
||||||
|
if (b.message.user.room.type == "p") {
|
||||||
|
roomName = b.message.user.room.name
|
||||||
|
} else {
|
||||||
|
roomName = b.message.user.name
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adminRooms.indexOf(roomName) == -1) {
|
||||||
|
cmd = "adherentsSoft"
|
||||||
|
} else {
|
||||||
|
cmd = "adherents"
|
||||||
|
}
|
||||||
|
process.env.hb_cmd = cmd
|
||||||
|
|
||||||
|
pubkey = exec("src/shell/helloasso.sh $hb_cmd", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'axiom-adherents'
|
||||||
|
});
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['axiom cagnotte']
|
||||||
|
}, (b) => {
|
||||||
|
membres = exec("src/shell/helloasso.sh cagnotte", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'axiom-cagnotte'
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const util = require('util');
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['debug user']
|
||||||
|
}, (b) => {
|
||||||
|
username = b.message
|
||||||
|
// const userId = res.message.user.id
|
||||||
|
// username = robot.adapter.api.get('users.info', { userId })
|
||||||
|
// process.env.hb_username = username
|
||||||
|
b.reply("```" + util.inspect(username, {showHidden: false, depth: null}) + "```")
|
||||||
|
|
||||||
|
|
||||||
|
}, {
|
||||||
|
id: 'debug'
|
||||||
|
});
|
|
@ -0,0 +1,201 @@
|
||||||
|
const bot = require('bbot')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All branch examples start from the "global" conversation scope.
|
||||||
|
* We are working on features to provide branching within a conversational
|
||||||
|
* context, but as those methods are changing in the beta, they aren't included
|
||||||
|
* as examples to follow just yet.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Branch types are declared from their scope, see all available types here:
|
||||||
|
* http://bbot.chat/docs/path#builtforbranching
|
||||||
|
*
|
||||||
|
* `text` branches take the following arguments:
|
||||||
|
* - matcher: expression, semantic conditions object, or array of conditions
|
||||||
|
* - callback: to fire on successful match, given the state object (b)
|
||||||
|
* - [options]: object with `id` (string) and/or `force` (boolean) attributes
|
||||||
|
*
|
||||||
|
* Test with "Hello bots!"
|
||||||
|
*/
|
||||||
|
bot.global.text(/(hi|hello).*bots?/, (b) => b.respond('Hello :wave:'), {
|
||||||
|
id: 'hello-bots'
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `direct` branch type requires the bot to be explicitly addressed.
|
||||||
|
*
|
||||||
|
* `reply` instead of `respond` prepends messages with user's name.
|
||||||
|
*
|
||||||
|
* In Rocket.Chat all messages to a bot in a direct room have the name prepended
|
||||||
|
* by the Rocket.Chat SDK before it's processed by the bot framework.
|
||||||
|
*
|
||||||
|
* Test with "@brocket Hello" or just "Hello" in a DM.
|
||||||
|
*/
|
||||||
|
bot.global.direct(/hi|hello/i, (b) => b.reply('Hey there.'), {
|
||||||
|
id: 'hello-direct'
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `respondVia` allows using custom platform methods to dispatch response.
|
||||||
|
*
|
||||||
|
* Matcher conditions allow semantic attributes with a string or array of
|
||||||
|
* optional values to match against, possibly capturing content.
|
||||||
|
* Accepted atts: is, starts, ends, contains, excludes, after, before, range
|
||||||
|
*
|
||||||
|
* Test with "Hello anyone?"
|
||||||
|
*/
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['hi', 'hello']
|
||||||
|
}, (b) => b.respondVia('react', ':wave:'), {
|
||||||
|
id: 'hello-react'
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Branch callbacks allow asynchronous responding, if they return a promise.
|
||||||
|
* State (b) includes branch matching attributes, see bbot.chat/docs/thought.
|
||||||
|
*
|
||||||
|
* Test with "@brocket ping back in 5 seconds"
|
||||||
|
*/
|
||||||
|
bot.global.direct(/ping back in (\d*)/i, async (b) => {
|
||||||
|
const ms = parseInt(b.match[1]) * 1000
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, ms))
|
||||||
|
return b.respond('Ping :ping_pong:')
|
||||||
|
}, {
|
||||||
|
id: 'ping-delay'
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `respond` method can accept attachment objects as well as strings.
|
||||||
|
* Rendering support depends on the message platform and adapter. In shell,
|
||||||
|
* it will display the fallback text.
|
||||||
|
*
|
||||||
|
* Test with "bot attach image"
|
||||||
|
*/
|
||||||
|
bot.global.text(/attach image/i, (b) => {
|
||||||
|
return b.respond({
|
||||||
|
fallback: `See: https://www.wikiwand.com/en/Three_Laws_of_Robotics`,
|
||||||
|
image: `https://upload.wikimedia.org/wikipedia/en/8/8e/I_Robot_-_Runaround.jpg`,
|
||||||
|
title: {
|
||||||
|
text: `Asimov's Three Laws of Robotics`,
|
||||||
|
link: `https://www.wikiwand.com/en/Three_Laws_of_Robotics`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, { id: 'attach-image' })
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `envelope` provides helpers for adding rich-message payloads before
|
||||||
|
* responding. Preparing envelopes before dispatch also allows changing the
|
||||||
|
* user/room the envelope is addressed to or dispatching multiple envelopes.
|
||||||
|
*
|
||||||
|
* Test with "I want a prize"
|
||||||
|
*/
|
||||||
|
bot.global.text({
|
||||||
|
contains: 'prize'
|
||||||
|
}, (b) => {
|
||||||
|
b.envelope.write('Choose your fate! 🚪... 🎁 ')
|
||||||
|
b.envelope.attach({ color: '#f4426e' })
|
||||||
|
b.envelope.payload
|
||||||
|
.quickReply({ text: 'Door number 1' })
|
||||||
|
.quickReply({ text: 'Door number 2' })
|
||||||
|
.quickReply({ text: 'Door number 3' })
|
||||||
|
return b.respond().catch((err) => console.error(err))
|
||||||
|
}, { id: 'door-prize-intro' })
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `conditions` attribute contains results of semantic condition matching
|
||||||
|
* and capture groups. Each condition can be given a key for easy reference.
|
||||||
|
*
|
||||||
|
* Test with "what's behind door number 2"
|
||||||
|
*/
|
||||||
|
bot.global.text({
|
||||||
|
door: { after: 'door', range: '1-3' }
|
||||||
|
}, (b) => {
|
||||||
|
switch (b.conditions.captured.door) {
|
||||||
|
case '1': return b.respond(`You win nothing 💔`)
|
||||||
|
case '2': return b.respond(`You win a monkey 🐒`)
|
||||||
|
case '3': return b.respond(`It's a new car!! 🚗`)
|
||||||
|
}
|
||||||
|
}, { id: 'door-prize-award' })
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Branch callbacks can be async functions, to awaiting one or more processes
|
||||||
|
* before responding. This example uses API requests to fill a dynamic array
|
||||||
|
* of actions, using the url property to provide link action buttons.
|
||||||
|
*
|
||||||
|
* Test with "@brocket plan meeting" in a public or private room.
|
||||||
|
*/
|
||||||
|
bot.global.direct({
|
||||||
|
is: 'plan meeting'
|
||||||
|
}, async (b) => {
|
||||||
|
if (bot.adapters.message.name !== 'rocketchat-message-adapter') return
|
||||||
|
b.envelope.write('Please review time zones in the room...')
|
||||||
|
const { id, type } = b.message.user.room
|
||||||
|
let room
|
||||||
|
const q = { roomId: id }
|
||||||
|
if (type === 'c') {
|
||||||
|
room = await bot.adapters.message.api.get('channels.members', q, true)
|
||||||
|
} else if (type === 'p') {
|
||||||
|
room = await bot.adapters.message.api.get('groups.members', q, true)
|
||||||
|
} else {
|
||||||
|
return b.respond('Sorry, that only works in channels and private groups.')
|
||||||
|
}
|
||||||
|
const offsets = room.members
|
||||||
|
.map((member) => member.utcOffset || undefined)
|
||||||
|
.filter((offset) => !!offset)
|
||||||
|
for (let utc of offsets) {
|
||||||
|
b.envelope.payload.quickReply({
|
||||||
|
text: `🌐 UTC ${utc}`,
|
||||||
|
url: `https://www.timeanddate.com/worldclock/timezone/utc${utc}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
b.respond()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo This example requires PR #11811 to be merged. Room names are undefined.
|
||||||
|
*/
|
||||||
|
bot.global.text(/where am i/i, (b) => {
|
||||||
|
const { name, type } = b.message.user.room
|
||||||
|
switch (type) {
|
||||||
|
case 'c': return b.respond(`You're in the #${name} public channel.`)
|
||||||
|
case 'p': return b.respond(`You're in a private group called **${name}**.`)
|
||||||
|
case 'l': return b.respond(`You're in a livechat channel.`)
|
||||||
|
case 'd': return b.respond(`You're in a DM with me :hugging:`)
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
id: 'location-check'
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom options can be added to the bot, with the full config utility of bBot,
|
||||||
|
* allowing them to be defined as environment variables, command line args or
|
||||||
|
* package.json attributes. Extend settings with a yargs option format.
|
||||||
|
*
|
||||||
|
* Try any of the following:
|
||||||
|
* - `node index.js --avatar <YOUR_AVATAR_URL>`
|
||||||
|
* - BOT_AVATAR=<YOUR_AVATAR_URL> in .env
|
||||||
|
* - `{ "bot": { "avatar": "<YOUR_AVATAR_URL>" } }` in package.json
|
||||||
|
*/
|
||||||
|
bot.settings.extend({
|
||||||
|
avatar: {
|
||||||
|
'type': 'string',
|
||||||
|
'description': 'Set a custom avatar for your bot account profile'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bot can access lower level methods of the Rocket.Chat SDK through the
|
||||||
|
* message adapter, once it's connected. This example sets an avatar on login.
|
||||||
|
*
|
||||||
|
* Try replacing the avatar configured in package.json with your own.
|
||||||
|
*/
|
||||||
|
bot.events.on('started', () => {
|
||||||
|
if (bot.adapters.message.name !== 'rocketchat-message-adapter') return
|
||||||
|
if (bot.settings.get('avatar')) {
|
||||||
|
bot.logger.info('Setting bot avatar')
|
||||||
|
bot.adapters.message.api.post('users.setAvatar', {
|
||||||
|
avatarUrl: bot.settings.get('avatar')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,33 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const fs = require('fs');
|
||||||
|
const util = require('util')
|
||||||
|
|
||||||
|
bot.global.text({ contains: [''] }, (b) => b.respond(""), {
|
||||||
|
id: 'id-tpl'
|
||||||
|
})
|
||||||
|
|
||||||
|
// --------
|
||||||
|
|
||||||
|
bot.global.text({ contains: [''] }, (b) => {
|
||||||
|
b.respond("")
|
||||||
|
}, {
|
||||||
|
id: 'id-tpl-2'
|
||||||
|
});
|
||||||
|
|
||||||
|
// --------
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['']
|
||||||
|
}, (b) => {
|
||||||
|
membres = exec("src/shell/.sh", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'id-tpl-3'
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
const bot = require('bbot');
|
||||||
|
const request = require('request');
|
||||||
|
const decodeEntities = require('decode-entities');
|
||||||
|
//var decode = require('unescape');
|
||||||
|
|
||||||
|
var request_options = {
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'crabot retrieving url metadata (https://wiki.crapaud-fou.org/crabot)'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bot.global.text(/(https?:\/\/[^ ,\)"\n]*)/ig, async (b) => {
|
||||||
|
// console.log(JSON.stringify(b.match, null, 2));
|
||||||
|
for (url of b.match) {
|
||||||
|
// console.log(JSON.stringify(url, null, 2));
|
||||||
|
if (!/(coa|pad)\.crapaud-fou\.org/.test(url)) {
|
||||||
|
request_options.url = url;
|
||||||
|
request(request_options, (err, res, body) => {
|
||||||
|
// console.log(JSON.stringify(res, null, 2));
|
||||||
|
if (!err && res.statusCode === 200) {
|
||||||
|
var re = /<title[^>]*>([^<]*)<\/title>/gi;
|
||||||
|
var match = re.exec(body);
|
||||||
|
if (match && match[1]) {
|
||||||
|
var extra = "";
|
||||||
|
var link = res.request.uri.href;
|
||||||
|
link = link.replace(/[\?&]fbclid=.+/gi, "");
|
||||||
|
link = link.replace(/[\?&]ncid=.+/gi, "");
|
||||||
|
//kopa match[1] = match[1].replace("'", "'");
|
||||||
|
if (/youtube.com/.test(link)) {
|
||||||
|
if (t = /[?&]v=([^&]+)/.exec(link)) {
|
||||||
|
link = "https://www.youtube.com/watch?v=" + t[1];
|
||||||
|
extra += " - [no-cookie](https://www.youtube-nocookie.com/embed/" + t[1] + ")";
|
||||||
|
extra += " - [invidious](https://invidio.us/watch?v=" + t[1] + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b.respond(decodeEntities("[>>>](" + link + ") _" + match[1].replace(/\n/g, " ").trim() + "_" + extra));
|
||||||
|
// b.respond("\>\>\>\> _" + match[1].replace(/\n/g, " ").trim() + "_" + extra);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('-----------------------------------');
|
||||||
|
console.log('URL: ' + url);
|
||||||
|
console.log('ERR - - - - - - - - - - - - - - - -');
|
||||||
|
console.log(JSON.stringify(err, null, 2));
|
||||||
|
console.log('RES - - - - - - - - - - - - - - - -');
|
||||||
|
console.log(JSON.stringify(res, null, 2));
|
||||||
|
console.log('-----------------------------------');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
id: 'get-url-metadata'
|
||||||
|
});
|
|
@ -0,0 +1,35 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
starts: ['pubkey','publique','rib','public','cle', 'brocket rib']
|
||||||
|
}, (b) => {
|
||||||
|
username = b.message.user.name
|
||||||
|
cmd = b.message.text
|
||||||
|
process.env.hb_username = username
|
||||||
|
process.env.hb_cmd = cmd
|
||||||
|
pubkey = exec("src/shell/g1-infos.sh pubkey $hb_username \"$hb_cmd\"", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'g1-pubkey'
|
||||||
|
});
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['membre','membres']
|
||||||
|
}, (b) => {
|
||||||
|
membres = exec("src/shell/g1-infos.sh membres", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'g1-membres'
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
module.exports = (robot) =>
|
||||||
|
{
|
||||||
|
robot.respond( /aide/i, (res) =>
|
||||||
|
res.reply( `QWant est ton ami...
|
||||||
|
... Nan j'déconne, voici ce que je connais:
|
||||||
|
- *biz aide*: Affiche cette aide
|
||||||
|
- *biz liens*: Donne des liens utiles
|
||||||
|
- *index pads*: Donne le lien vers l'index de nos pads
|
||||||
|
- *membres*: Affiche le nombre de membres actuelles de la Ğ1
|
||||||
|
- *pubkey*: Affiche sa propre clé publique Ğ1
|
||||||
|
- *axiom adhérents*: Affiche les adhérents de l'association
|
||||||
|
- *axiom cagnotte*: Affiche le status de la cagnotte de l'association
|
||||||
|
- Massages Viet pour 150Ğ1
|
||||||
|
- Et bien d'autres choses, je vais pas tout te dire non plus !! :rofl:` )
|
||||||
|
)
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
module.exports = (robot) =>
|
||||||
|
{
|
||||||
|
robot.hear( /index pad/i, res=> res.send(":arrow_right: https://pad.p2p.legal/axiom_index-pads") )
|
||||||
|
robot.hear( /index des pad/i, res=> res.send(":arrow_right: https://pad.p2p.legal/axiom_index-pads") )
|
||||||
|
robot.respond( /lien/i, res=> res.send(`*Index de tous nos documents* :arrow_right: https://pad.p2p.legal/axiom_index-pads
|
||||||
|
*Site officiel de l'association Axiom-Team* :arrow_right: https://axiom-team.fr/
|
||||||
|
*Forum de l'asso axiom-team* :arrow_right: https://forum.axiom-team.fr/
|
||||||
|
*Cloud publique axiom - Ressources Agora* :arrow_right: https://cloud.p2p.legal/s/DDbKi2pqdEmixS9
|
||||||
|
*Cloud interne axiom - Nécessite un accès* :arrow_right: https://cloud.p2p.legal/f/204193`
|
||||||
|
) )
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
*Voici ce que je sais faire ...*
|
||||||
|
|
||||||
|
```
|
||||||
|
- biz aide: Affiche cette aide
|
||||||
|
- biz liens: Donne des liens utiles
|
||||||
|
- index pads: Donne le lien vers l'index de nos pads
|
||||||
|
- membres: Affiche le nombre de membres actuelles de la Ğ1
|
||||||
|
- pubkey [pseudo]: Affiche sa propre clé publique Ğ1 si [pseudo] n'est pas renseigné, ou bien celle du pseudo indiqué
|
||||||
|
- axiom adhérents: Affiche les adhérents de l'association
|
||||||
|
- axiom cagnotte: Affiche le status de la cagnotte de l'association
|
||||||
|
- Massages Viet pour 150Ğ1
|
||||||
|
- Et bien d'autres choses, je vais pas tout te dire non plus !! 🤣
|
||||||
|
```
|
|
@ -0,0 +1,6 @@
|
||||||
|
index pad !! https://pad.p2p.legal/axiom_index-pads
|
||||||
|
Site officiel de l'association Axiom-Team !! https://axiom-team.fr/
|
||||||
|
Forum de l'asso axiom-team !! https://forum.axiom-team.fr/
|
||||||
|
Cloud publique axiom - Ressources Agora !! https://cloud.p2p.legal/s/DDbKi2pqdEmixS9
|
||||||
|
Cloud interne axiom _(Nécessite un accès)_ !! https://cloud.p2p.legal/f/204193`
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
5 personnes membres vous connaissent-elles bien ? Peuvent-elles vous contacter ? Contacter votre entourage ? Avez-vous sauvegardé votre document de révocation ? Avez-vous installé un client local sur votre ordinateur/smartphone comme Cesium ?
|
||||||
|
|
||||||
|
Si oui -> vous connaissez certainement ces personnes vous aussi, et pouvez leur demander.
|
||||||
|
Si non -> il va vous falloir créer des liens avec des membres, conformément à la **[licence](https://duniter.org/fr/wiki/licence-g1/)** que vous devez lire, comprendre et accepter.
|
||||||
|
|
||||||
|
Je vous invite également à lire le **[guide du débutant](https://forum.monnaie-libre.fr/t/00-intro-guide-du-debutant-en-monnaie-libre-g1-june/2777)**, et surtout à vous renseigner sur les rencontres de présentation de la monnaie libre autour de chez vous, pour créer des relations humaines réelles.
|
||||||
|
|
||||||
|
Bienvenue, et bonnes découvertes !
|
|
@ -0,0 +1,6 @@
|
||||||
|
OBSCURANTISTE!
|
||||||
|
MENTEUR!
|
||||||
|
Toute mlc ne sert qu'à nuire à l’eveil de conscience sur la création monétaire.
|
||||||
|
Avez vous déjà vérifié les arguments (fallacieux) servis par les rabatteurs de mlc?
|
||||||
|
Les mlc coutent un bras au profit des banques et de quelques « chiens de garde» de leur salaire en unl qui en découle (rabatteurs).
|
||||||
|
La plus grosse mlc de l’histoire j’ai analysé: La mlc argentine en 2001. Elle a permis l’emergence de Monsanto compagny en 2002. N’hésitez pas à vérifier.
|
|
@ -0,0 +1,23 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
bot.global.text({ contains: ['vtfn','si tes pas content','si t\'es pas content'] }, (b) => b.respond(":arrow_right: https://vatefairecuireunnem.com/"), {
|
||||||
|
id: 'joke-vtfn'
|
||||||
|
})
|
||||||
|
|
||||||
|
bot.global.text({ contains: ['biz présente toi'] }, (b) => b.respond(":arrow_right: https://matiou.biz"), {
|
||||||
|
id: 'joke-presente'
|
||||||
|
})
|
||||||
|
|
||||||
|
// L'infernal matiou sur les MLC ...
|
||||||
|
let bizbi = fs.readFileSync('./src/inc/repliques-mlc.txt', 'utf8');
|
||||||
|
bizbi = bizbi.split('\n')
|
||||||
|
function randomize(toRand) {
|
||||||
|
resultRand = toRand[Math.floor(Math.random()*toRand.length)]
|
||||||
|
return resultRand;
|
||||||
|
}
|
||||||
|
bot.global.text({ contains: ['mlc'] }, (b) => b.respond(randomize(bizbi)), {
|
||||||
|
id: 'joke-presente'
|
||||||
|
})
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const fs = require('fs');
|
||||||
|
const util = require('util')
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['biz lien','biz liens']
|
||||||
|
}, (b) => {
|
||||||
|
cmd = b.message.text
|
||||||
|
process.env.hb_cmd = cmd
|
||||||
|
membres = exec("src/shell/liens.sh $hb_cmd", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
id: 'biz-liens'
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
const bot = require('bbot');
|
||||||
|
const globe_delay = 60000; // 1 minute
|
||||||
|
var globe_said = {};
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
contains: ['facebook', 'google', 'amazon', 'apple', 'microsoft']
|
||||||
|
}, (b) => {
|
||||||
|
b.respondVia('react', ':hear_no_evil:');
|
||||||
|
}, {
|
||||||
|
id: 'gafam-react'
|
||||||
|
});
|
||||||
|
|
||||||
|
bot.global.text(
|
||||||
|
/pe?tit? globe/i
|
||||||
|
, (b) => {
|
||||||
|
if (!globe_said[b.message.user.room] || new Date().getTime() > globe_said[b.message.user.room] + globe_delay) {
|
||||||
|
b.respond('![pti globe](https://crapaud-fou.org/images/chat-ptiglobe.png)');
|
||||||
|
globe_said[b.message.user.room] = new Date().getTime();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
id: 'ptiglobe-direct'
|
||||||
|
})
|
|
@ -0,0 +1,22 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
is: ['biz reload']
|
||||||
|
}, (b) => {
|
||||||
|
function reload() {
|
||||||
|
pubkey = exec("pm2 reload index --force", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu: " + " - " + stderr)
|
||||||
|
} else {
|
||||||
|
b.respond("Biz a été rechargé")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
b.respond("Biz redémarre ... OK dans 5 secondes")
|
||||||
|
setTimeout(reload, 10);
|
||||||
|
|
||||||
|
}, {
|
||||||
|
id: 'reload-scripts'
|
||||||
|
});
|
|
@ -0,0 +1,12 @@
|
||||||
|
const bot = require('bbot');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const fs = require('fs');
|
||||||
|
const util = require('util')
|
||||||
|
|
||||||
|
bot.global.text({ contains: ['me certifier','me faire certifier','je cherche une certification','je cherche des certifications'] }, (b) => {
|
||||||
|
// Lisez la licence Ḡ1 ...
|
||||||
|
let newml = fs.readFileSync('./src/inc/need-certif.txt', 'utf8');
|
||||||
|
b.respond("Bonjour, et bienvenue @" + b.message.user.name + " ! =)" + newml)
|
||||||
|
}, {
|
||||||
|
id: 'rep-certif'
|
||||||
|
});
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
auto() {
|
||||||
|
echo "*Je suis l'aide auto*"
|
||||||
|
cd src
|
||||||
|
|
||||||
|
#cmds=$(grep "^bot\." *.js -A3 | grep -E "\['|aide = ")
|
||||||
|
cmds=$(grep "\['" *.js | awk -F "[" '{ print $2 }' | awk -F "]" '{ print $1 }')
|
||||||
|
IFS=$'\n'
|
||||||
|
for i in $cmds; do
|
||||||
|
echo "$i" | awk -F "'" '{ print $2 }'
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
text() {
|
||||||
|
cat src/inc/aide.txt
|
||||||
|
}
|
||||||
|
|
||||||
|
$@
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
node="https://duniter-g1.p2p.legal"
|
||||||
|
|
||||||
|
pubkey() {
|
||||||
|
url="$node/wot/members"
|
||||||
|
if [[ "$@" =~ "brocket" ]]; then
|
||||||
|
[[ $4 ]] && username=$4 || username=$1
|
||||||
|
else
|
||||||
|
[[ $3 ]] && username=$3 || username=$1
|
||||||
|
fi
|
||||||
|
username=$(echo $username | tr -d '@')
|
||||||
|
local pubkey=$(curl -m 5 -s $url | grep -w -i -B 1 $username | grep "pubkey" | awk -F '"' '{ print $4 }')
|
||||||
|
# TODO: local pubkey=$(curl -m 5 -s $url | jq -r --arg username "$username" '.results[] | select(.uid=="$username") | .pubkey')
|
||||||
|
[[ $pubkey ]] && echo "@$username Ta clé publique Ğ1 est: $pubkey" || echo "@$username n'est pas pseudo membre de la Ḡ1"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
membres() {
|
||||||
|
url="$node/blockchain/current"
|
||||||
|
local nbr_membres=$(curl -m 5 -s $url | jq '.membersCount')
|
||||||
|
[[ $nbr_membres ]] && echo "Il y a actuellement $nbr_membres membres de la Ğ1 !" || echo "Service en maintenance, réessayez dans un instant :coffee:"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$@
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ids="axiom-team:tYrjD6rrfStJXBqHhzNET"
|
||||||
|
ha="https://api.helloasso.com/v3"
|
||||||
|
|
||||||
|
adherents() {
|
||||||
|
url="$ha/campaigns/000001053192/actions.json?type"
|
||||||
|
curl -m 5 --user $ids -s $url | jq -r '.resources[] | .date + " , " + .first_name + " " + .last_name + " - " + .email' | sed 's/T.*,//'
|
||||||
|
}
|
||||||
|
|
||||||
|
adherentsSoft() {
|
||||||
|
url="$ha/campaigns/000001053192/actions.json?type"
|
||||||
|
curl -m 5 --user $ids -s $url | jq -r '.resources[] | .date + " , " + .first_name + " " + .last_name' | sed 's/T.*,//'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cagnotte() {
|
||||||
|
url="$ha/campaigns/000001053192.json"
|
||||||
|
curl -m 5 --user $ids -s $url | jq -r '.name, {"Donnateurs": .supporters},{"Fonds":.funding},.url' | grep -v '{|}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$@
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ -z $3 ]]; then
|
||||||
|
res=$(sed 's/!!/:arrow_right:/g' src/inc/liens.txt)
|
||||||
|
else
|
||||||
|
shift 2
|
||||||
|
res=$(sed 's/!!/:arrow_right:/g' src/inc/liens.txt | grep -i "$@")
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ $res ]] && echo "$res" || echo "Aucun lien trouvé avec **$@**"
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1 @@
|
||||||
|
../ssrc/
|
|
@ -9,6 +9,8 @@ if [ ! -e /sys/class/gpio/gpio4 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "out" > /sys/class/gpio/gpio4/direction
|
echo "out" > /sys/class/gpio/gpio4/direction
|
||||||
|
echo "0" > /sys/class/gpio/gpio4/value
|
||||||
|
sleep 3
|
||||||
echo "1" > /sys/class/gpio/gpio4/value
|
echo "1" > /sys/class/gpio/gpio4/value
|
||||||
|
|
||||||
sleep 3 && $MY_PATH/gammu-restart.sh
|
sleep 3 && $MY_PATH/gammu-restart.sh
|
||||||
|
|
31
install.sh
|
@ -7,8 +7,6 @@
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
|
|
||||||
echo "GPATH=$MY_PATH" > $MY_PATH/.install/.GPATH
|
|
||||||
source $MY_PATH/.install/.GPATH
|
|
||||||
|
|
||||||
init_loc="$MY_PATH/shell/init.sh"
|
init_loc="$MY_PATH/shell/init.sh"
|
||||||
now=$(date +%Y-%m-%d)
|
now=$(date +%Y-%m-%d)
|
||||||
|
@ -25,11 +23,13 @@ args="$@"
|
||||||
[[ $args =~ noask ]] && noask=o
|
[[ $args =~ noask ]] && noask=o
|
||||||
|
|
||||||
## Vérifie le type de système
|
## Vérifie le type de système
|
||||||
[[ $(uname -a | grep arm) ]] && isARM=YES || unset isARM
|
[[ $(uname -a | grep arm) ]] && ARM=yes || unset isARM
|
||||||
if [[ $(grep -E 'stretch|18.|19.' /etc/os-release) ]]; then OS=stretch;
|
if [[ $(grep -E 'stretch|18.|19.' /etc/os-release) ]]; then OS=stretch;
|
||||||
elif [[ $(grep buster /etc/os-release) ]]; then OS=buster;
|
elif [[ $(grep buster /etc/os-release) ]]; then OS=buster;
|
||||||
else echo "${c_red}Votre OS n'est pas supporté$c_"; exit 1; fi
|
else echo "${c_red}Votre OS n'est pas supporté$c_"; exit 1; fi
|
||||||
echo -e "$OS\n$isARM" > .install/.OS
|
sed -i 's/_OS/$OS/g' $MY_PATH/.profile
|
||||||
|
sed -i 's/_ARM/$ARM/g' $MY_PATH/.profile
|
||||||
|
sed -i 's/_GPATH/$MY_PATH/g' $MY_PATH/.profile
|
||||||
|
|
||||||
unset err
|
unset err
|
||||||
|
|
||||||
|
@ -79,18 +79,21 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
|
||||||
[[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old
|
[[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old
|
||||||
cp $MY_PATH/.install/templates/init.sh shell/init.sh || err+=1
|
cp $MY_PATH/.install/templates/init.sh shell/init.sh || err+=1
|
||||||
|
|
||||||
sed -i s/_MASTERPHONE/$MASTERPHONE/g $init_loc
|
sed -i "s/_MASTERPHONE/$MASTERPHONE/g" $init_loc
|
||||||
sed -i s/_ADRESSE/$ADRESSE/g $init_loc
|
sed -i "s/_ADRESSE/$ADRESSE/g" $init_loc
|
||||||
sed -i s/_ADMINPHONE/$ADMINPHONE/g $init_loc
|
sed -i "s/_ADMINPHONE/$ADMINPHONE/g" $init_loc
|
||||||
sed -i s/_ADMINPSEUDO/$ADMINPSEUDO/g $init_loc
|
sed -i "s/_ADMINPSEUDO/$ADMINPSEUDO/g" $init_loc
|
||||||
|
|
||||||
if [[ ! -f $MY_PATH/.profile ]]; then
|
if [[ ! -f $MY_PATH/.profile ]]; then
|
||||||
cp $MY_PATH/.install/templates/.profile $MY_PATH/
|
cp $MY_PATH/.install/templates/.profile $MY_PATH/
|
||||||
sed -i s/_MASTERPHONE/$MASTERPHONE/g $MY_PATH/.profile
|
sed -i "s/_MASTERPHONE/$MASTERPHONE/g" $MY_PATH/.profile
|
||||||
sed -i s/_ADRESSE/$ADRESSE/g $MY_PATH/.profile
|
sed -i "s/_ADRESSE/$ADRESSE/g" $MY_PATH/.profile
|
||||||
sed -i s/_ADMINPHONE/$ADMINPHONE/g $MY_PATH/.profile
|
sed -i "s/_ADMINPHONE/$ADMINPHONE/g" $MY_PATH/.profile
|
||||||
sed -i s/_ADMINPSEUDO/$ADMINPSEUDO/g $MY_PATH/.profile
|
sed -i "s/_ADMINPSEUDO/$ADMINPSEUDO/g" $MY_PATH/.profile
|
||||||
sed -i s/_PIN/$PIN/g $MY_PATH/.profile
|
sed -i "s/_PIN/$PIN/g" $MY_PATH/.profile
|
||||||
|
sed -i "s/_OS/$OS/g" $MY_PATH/.profile
|
||||||
|
sed -i "s/_ARM/$ARM/g" $MY_PATH/.profile
|
||||||
|
sed -i "s/_GPATH/$MY_PATH/g" $MY_PATH/.profile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -111,6 +114,8 @@ if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then $MY_PATH/.install/3-insta
|
||||||
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then isKalkun=1; $MY_PATH/.install/4a-install_kalkun.sh || err+=1; fi; repOption=$repOld
|
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then isKalkun=1; $MY_PATH/.install/4a-install_kalkun.sh || err+=1; fi; repOption=$repOld
|
||||||
[[ -z $repOption && -z $isKalkun ]] && echo -e "${c_yellow}Voulez-vous installer l'interface web playSMS ? (o/n)$c_" && read repOption
|
[[ -z $repOption && -z $isKalkun ]] && echo -e "${c_yellow}Voulez-vous installer l'interface web playSMS ? (o/n)$c_" && read repOption
|
||||||
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then $MY_PATH/.install/4b-install_playsms.sh || err+=1; fi; repOption=$repOld
|
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then $MY_PATH/.install/4b-install_playsms.sh || err+=1; fi; repOption=$repOld
|
||||||
|
[[ -z $repOption ]] && echo -e "${c_yellow}Voulez-vous installer BBOT ? (o/n)$c_" && read repOption
|
||||||
|
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then $MY_PATH/.install/6-install-bbot.sh || err+=1; fi; repOption=$repOld
|
||||||
|
|
||||||
if [[ $err ]]; then
|
if [[ $err ]]; then
|
||||||
echo -e "---\n${c_red}L'installation générale n'est mal déroulé =($c_"
|
echo -e "---\n${c_red}L'installation générale n'est mal déroulé =($c_"
|
||||||
|
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 253 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
@ -3,7 +3,7 @@
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 0.1
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
# BACKUP G1sms+ current Devlt code and push it with NODE_G1PRIVKEYFILE encryption to IPFS
|
# BACKUP G1sms+ current Devlt code and push it with NODE_G1AUTHFILE encryption to IPFS
|
||||||
################################################################################
|
################################################################################
|
||||||
source ./shell/init.sh
|
source ./shell/init.sh
|
||||||
source ./shell/functions.sh
|
source ./shell/functions.sh
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 0.1
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
# BACKUP G1sms+ current Devlt code and push it with NODE_G1PRIVKEYFILE encryption to IPFS
|
# BACKUP G1sms+ current Devlt code and push it with NODE_G1AUTHFILE encryption to IPFS
|
||||||
################################################################################
|
################################################################################
|
||||||
## GET LATEST DEV $ROOT
|
## GET LATEST DEV $ROOT
|
||||||
source ./shell/init.sh
|
source ./shell/init.sh
|
||||||
|
|
|
@ -63,7 +63,7 @@ for tag in ./wallets/.$IPFSNODEID/TAG/*; do
|
||||||
echo "__SUB:cron_G1TAG_REFRESH.sh: GET PUBLISHKEY for that G1TAG";
|
echo "__SUB:cron_G1TAG_REFRESH.sh: GET PUBLISHKEY for that G1TAG";
|
||||||
su $YOU -c "ipfs get -o /home/$YOU/.ipfs/keystore/${RR}.crypt /ipns/$tagj/TAG_publishkey.MASTER.crypt"
|
su $YOU -c "ipfs get -o /home/$YOU/.ipfs/keystore/${RR}.crypt /ipns/$tagj/TAG_publishkey.MASTER.crypt"
|
||||||
if [[ ! -f /home/$YOU/.ipfs/keystore/${RR}.crypt ]]; then log "__SUB:cron_MINUTE.sh: error getting publishkey"; continue; fi
|
if [[ ! -f /home/$YOU/.ipfs/keystore/${RR}.crypt ]]; then log "__SUB:cron_MINUTE.sh: error getting publishkey"; continue; fi
|
||||||
./shell/natools.py decrypt -k "$NODE_G1PRIVKEYFILE" -i /home/$YOU/.ipfs/keystore/${RR}.crypt -o /home/$YOU/.ipfs/keystore/$RR
|
./shell/natools.py decrypt -k "$NODE_G1AUTHFILE" -i /home/$YOU/.ipfs/keystore/${RR}.crypt -o /home/$YOU/.ipfs/keystore/$RR
|
||||||
rm /home/$YOU/.ipfs/keystore/${RR}.crypt
|
rm /home/$YOU/.ipfs/keystore/${RR}.crypt
|
||||||
fi
|
fi
|
||||||
echo "__SUB:cron_G1TAG_REFRESH.sh: G1Tag PUBLISHKEY OK : /home/$YOU/.ipfs/keystore/${RR}"
|
echo "__SUB:cron_G1TAG_REFRESH.sh: G1Tag PUBLISHKEY OK : /home/$YOU/.ipfs/keystore/${RR}"
|
||||||
|
|
|
@ -7,8 +7,14 @@
|
||||||
# Activate SUPPORT MODE: open ssh over IPFS
|
# Activate SUPPORT MODE: open ssh over IPFS
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
|
if [[ -f $MY_PATH/.profile ]]; then
|
||||||
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
source $MY_PATH/.profile
|
||||||
|
elif [[ -f $MY_PATH/../.profile ]]; then
|
||||||
|
source $MY_PATH/../.profile
|
||||||
|
else
|
||||||
|
echo -e "${c_red}Le .profile n'existe pas$c_"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
cd $GPATH
|
cd $GPATH
|
||||||
|
|
||||||
if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi
|
if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi
|
||||||
|
|
|
@ -10,8 +10,14 @@
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
|
if [[ -f $MY_PATH/.profile ]]; then
|
||||||
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
source $MY_PATH/.profile
|
||||||
|
elif [[ -f $MY_PATH/../.profile ]]; then
|
||||||
|
source $MY_PATH/../.profile
|
||||||
|
else
|
||||||
|
echo -e "${c_red}Le .profile n'existe pas$c_"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
||||||
if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi
|
if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi
|
||||||
|
@ -51,7 +57,7 @@ if [[ "$1" == "PRINT" ]]; then
|
||||||
rr=$(echo $qrrtag | cut -d '/' -f 5 | cut -d '.' -f 1)
|
rr=$(echo $qrrtag | cut -d '/' -f 5 | cut -d '.' -f 1)
|
||||||
if [[ ! -f "./wallets/.$IPFSNODEID/PRINT/done.$rr" ]]; then
|
if [[ ! -f "./wallets/.$IPFSNODEID/PRINT/done.$rr" ]]; then
|
||||||
log "__SUB:cron_MINUTE.sh: PRINT G1Tag $rr - START: $(date)"
|
log "__SUB:cron_MINUTE.sh: PRINT G1Tag $rr - START: $(date)"
|
||||||
./shell/natools.py decrypt -k "$NODE_G1PRIVKEYFILE" -i "${qrrtag}" -o "/tmp/G1Tag.png"
|
./shell/natools.py decrypt -k "$NODE_G1AUTHFILE" -i "${qrrtag}" -o "/tmp/G1Tag.png"
|
||||||
log "__SUB:cron_MINUTE.sh: natools.py decrypt - $(date)"
|
log "__SUB:cron_MINUTE.sh: natools.py decrypt - $(date)"
|
||||||
brother_ql_create --model QL-700 "/tmp/G1Tag.png" --label-size 62 > "/tmp/G1Tag.bin"
|
brother_ql_create --model QL-700 "/tmp/G1Tag.png" --label-size 62 > "/tmp/G1Tag.bin"
|
||||||
log "__SUB:cron_MINUTE.sh: brother_ql_create - $(date)"
|
log "__SUB:cron_MINUTE.sh: brother_ql_create - $(date)"
|
||||||
|
|
|
@ -17,23 +17,33 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
function sms_SEND () {
|
function sms_SEND () {
|
||||||
# sms_SEND ($1=phone, $2=message)
|
# sms_SEND ($1=phone, $2=message)
|
||||||
local dest="$1"
|
local dest="$1"
|
||||||
|
local dhash=$(echo -n $dest | sha256sum | cut -d ' ' -f 1)
|
||||||
local mess="$2"
|
local mess="$2"
|
||||||
|
|
||||||
|
# IF $dest looks like a phone number
|
||||||
if [[ ${#dest} -eq 10 || ${#dest} -eq 12 ]]; then
|
if [[ ${#dest} -eq 10 || ${#dest} -eq 12 ]]; then
|
||||||
if [[ -d ./wallets/$dest ]]; then
|
# Search it in wallets_swarm
|
||||||
# TEST IF $dest IS ON CURRENT NODE
|
if [[ -d ./wallets_swarm/PHONE/$dhash ]]; then
|
||||||
gammu-smsd-inject TEXT "$dest" -text "$mess" 1>&2
|
DESTNODEID=$(cat ./wallets_swarm/PHONE/$dhash/MASTERPHONE.ipfsid)
|
||||||
else
|
# Other Node is managing wallet, write SMS task to it
|
||||||
# Send SMS through $dest NODE (TODO: send it like PRINT, TASK, ...)
|
if [[ "$DESTNODEID" != "" && "$DESTNODEID" != "$IPFSNODEID" ]]; then
|
||||||
DESTNODEID=$(cat ./wallets_swarm/$dest/MASTERPHONE.ipfsid)
|
|
||||||
log "$dest is managed by NODE: $DESTNODEID)"
|
log "$dest is managed by NODE: $DESTNODEID)"
|
||||||
mkdir "./wallets/.$DESTNODEID/SMS"
|
mkdir -p "./wallets/.$DESTNODEID/SMS"
|
||||||
echo $mess > "./wallets/.$DESTNODEID/SMS/$dest.sms2send"
|
echo $mess > "./wallets/.$DESTNODEID/SMS/$dest.sms2send"
|
||||||
|
# Push changes to IPFS
|
||||||
I=$(ipfs_node_wallets_add)
|
I=$(ipfs_node_wallets_add)
|
||||||
|
else
|
||||||
|
# Send SMS from here
|
||||||
|
gammu-smsd-inject TEXT "$dest" -text "$mess" 1>&2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Send SMS from here
|
||||||
|
gammu-smsd-inject TEXT "$dest" -text "$mess" 1>&2
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log ">>>>>>>>>>SMS ERROR BAD DESTINATION $dest"
|
log ">>>>>>>>>>SMS ERROR BAD DESTINATION $dest"
|
||||||
fi
|
fi
|
||||||
log ">>>>>>>>>> SENDING SMS $mess TO $dest ($DESTNODEID)"
|
log ">>>>>>>>>> SENDING SMS $mess TO $dest via $DESTNODEID"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,6 +146,7 @@ log "__SUB:ipfs_swarm_wallets_refresh: ./wallets_swarm/ RENEW from $count peers
|
||||||
|
|
||||||
|
|
||||||
############################################################################"
|
############################################################################"
|
||||||
|
# TODO: MOVE AS GENERIC IPFS NODE DIALOG FUNCTION
|
||||||
# TREAT move_g1cents Tasks in ./wallets/.$IPFSNODEID
|
# TREAT move_g1cents Tasks in ./wallets/.$IPFSNODEID
|
||||||
# IF NODE find in ./wallets_swarm/.$IPFSNODEID/TASK directory && Have it's G1 Wallet already (for natools crypto)
|
# IF NODE find in ./wallets_swarm/.$IPFSNODEID/TASK directory && Have it's G1 Wallet already (for natools crypto)
|
||||||
if [[ "$1" != "SIMPLE" && -d ./wallets_swarm/.$IPFSNODEID/TASK && -f "./wallets/.$IPFSNODEID/$IPFSNODEID.authfile.GPGPASS.gpg" ]]; then
|
if [[ "$1" != "SIMPLE" && -d ./wallets_swarm/.$IPFSNODEID/TASK && -f "./wallets/.$IPFSNODEID/$IPFSNODEID.authfile.GPGPASS.gpg" ]]; then
|
||||||
|
@ -146,6 +157,8 @@ do
|
||||||
TNANO=$( echo $FTASK | cut -d '.' -f 1) # $NANODATE
|
TNANO=$( echo $FTASK | cut -d '.' -f 1) # $NANODATE
|
||||||
TTYPE=$( echo $FTASK | cut -d '.' -f 2) # move_g1cents
|
TTYPE=$( echo $FTASK | cut -d '.' -f 2) # move_g1cents
|
||||||
TDEST=$( echo $FTASK | cut -d '.' -f 3) # $DESTPHONE
|
TDEST=$( echo $FTASK | cut -d '.' -f 3) # $DESTPHONE
|
||||||
|
HDEST=$(echo -n $TDEST | sha256sum | cut -d ' ' -f 1)
|
||||||
|
|
||||||
log "__SUB:ipfs_swarm_wallets_refresh: .$IPFSNODEID($FTASK) FOUND TASK $TNANO:$TTYPE:$TDEST "
|
log "__SUB:ipfs_swarm_wallets_refresh: .$IPFSNODEID($FTASK) FOUND TASK $TNANO:$TTYPE:$TDEST "
|
||||||
# MAKE LOCAL .$IPFSNODEID directory
|
# MAKE LOCAL .$IPFSNODEID directory
|
||||||
mkdir -p ./wallets/.$IPFSNODEID/TASK/
|
mkdir -p ./wallets/.$IPFSNODEID/TASK/
|
||||||
|
@ -161,18 +174,18 @@ do
|
||||||
log "__SUB:ipfs_swarm_wallets_refresh: tdiff=$tdiff .$IPFSNODEID G1 = ./NODEG1Wallet.authfile :decrypt: Found $ZENVAL Zen to ADD"
|
log "__SUB:ipfs_swarm_wallets_refresh: tdiff=$tdiff .$IPFSNODEID G1 = ./NODEG1Wallet.authfile :decrypt: Found $ZENVAL Zen to ADD"
|
||||||
rm -f "./NODEG1Wallet.authfile"
|
rm -f "./NODEG1Wallet.authfile"
|
||||||
if [[ $ZENVAL -gt 0 ]]; then
|
if [[ $ZENVAL -gt 0 ]]; then
|
||||||
curvalue=$(cat ./wallets/$TDEST/$TDEST.g1cents)
|
curvalue=$(cat ./wallets/PHONE/$HDEST/_g1cents)
|
||||||
newvalue=$(bc -l <<< "$curvalue + $ZENVAL")
|
newvalue=$(bc -l <<< "$curvalue + $ZENVAL")
|
||||||
echo $newvalue > ./wallets/$TDEST/$TDEST.g1cents
|
echo $newvalue > ./wallets/PHONE/$HDEST/_g1cents
|
||||||
echo "OK.$tdiff" > ./wallets/.$IPFSNODEID/TASK/done.$TNANO
|
echo "OK.$tdiff" > ./wallets/.$IPFSNODEID/TASK/done.$TNANO
|
||||||
log "__SUB:ipfs_swarm_wallets_refresh: .$IPFSNODEID($FTASK) DONE! OPERATION: ($curvalue + $ZENVAL) = $newvalue Zen <=> ./wallets/$TDEST/$TDEST.g1cents:: OK"
|
log "__SUB:ipfs_swarm_wallets_refresh: .$IPFSNODEID($FTASK) DONE! OPERATION: ($curvalue + $ZENVAL) = $newvalue Zen <=> ./wallets/PHONE/$HDEST/_g1cents:: OK"
|
||||||
# REFRESH ./wallets and PUBLISH
|
# REFRESH ./wallets and PUBLISH
|
||||||
I=$(ipfs_node_wallets_add)
|
I=$(ipfs_node_wallets_add)
|
||||||
else
|
else
|
||||||
echo "KO.$tdiff" > ./wallets/.$IPFSNODEID/TASK/done.$TNANO
|
echo "KO.$tdiff" > ./wallets/.$IPFSNODEID/TASK/done.$TNANO
|
||||||
log "__SUB:ipfs_swarm_wallets_refresh: .$IPFSNODEID($FTASK) ERROR! BAD: ($curvalue + $ZENVAL) = $newvalue Zen <=> ./wallets/$TDEST/$TDEST.g1cents :: KO"
|
log "__SUB:ipfs_swarm_wallets_refresh: .$IPFSNODEID($FTASK) ERROR! BAD: ($curvalue + $ZENVAL) = $newvalue Zen <=> ./wallets/PHONE/$HDEST/_g1cents :: KO"
|
||||||
I=$(ipfs_node_wallets_add)
|
I=$(ipfs_node_wallets_add)
|
||||||
sms_SEND "$ADMINPHONE" "ADMIN! TASK ERROR: .$IPFSNODEID($FTASK) ERROR! BAD: ($curvalue + $ZENVAL) = $newvalue Zen <=> ./wallets/$TDEST/$TDEST.g1cents :: KO"
|
sms_SEND "$ADMINPHONE" "ADMIN! TASK ERROR: .$IPFSNODEID($FTASK) ERROR! BAD: ($curvalue + $ZENVAL) = $newvalue Zen <=> ./wallets/PHONE/$HDEST/_g1cents :: KO"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# TODO: Bad NODE in the Future task !!! Make better BAD Node detection = Swarm Banish?
|
# TODO: Bad NODE in the Future task !!! Make better BAD Node detection = Swarm Banish?
|
||||||
|
@ -210,94 +223,102 @@ function ipfs_node_wallets_add (){
|
||||||
|
|
||||||
# CHAIN STATE FOR $IPFSNODEID
|
# CHAIN STATE FOR $IPFSNODEID
|
||||||
echo $IWALLETS > ./wallets/.$IPFSNODEID.wallets.chain
|
echo $IWALLETS > ./wallets/.$IPFSNODEID.wallets.chain
|
||||||
log "__SUB:ipfs_node_wallets_add: NEW './wallets' HASH ipfs ls $IWALLETS"
|
log "__SUB:ipfs_node_wallets_add: NEW './wallets' HASH ipfs ls /ipfs/$IWALLETS"
|
||||||
|
|
||||||
# PUBLISH IPNS NODE WALLETS
|
# PUBLISH IPNS NODE WALLETS
|
||||||
NODEWALLETS=$(su $YOU -c "ipfs name publish --quieter /ipfs/$IWALLETS")
|
NODEWALLETS=$(su $YOU -c "ipfs name publish --quieter /ipfs/$IWALLETS")
|
||||||
log "__SUB:ipfs_node_wallets_add: G1smsWallet = ipfs cat /ipns/$NODEWALLETS/$PHONE/$PHONE.g1cents Zen"
|
log "__SUB:ipfs_node_wallets_add: G1smsWallet = ipfs cat /ipns/$NODEWALLETS/PHONE/$HASHLINK/_g1cents Zen"
|
||||||
|
|
||||||
echo $IWALLETS
|
echo $IWALLETS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#################################################################################################################################
|
#################################################################################################################################
|
||||||
function sms_uid2key (){
|
function sms_uid2pubkey (){
|
||||||
RIBFILE="./wallets/$PHONE/$PHONE.uidrib"
|
## USE $PHONE link instead of real local $HASHLINK directory
|
||||||
NAMEFILE="./wallets/$PHONE/$PHONE.uidname"
|
RIBFILE="./wallets/PHONE/$PHONE/_uidrib"
|
||||||
UIDNAFILE="./wallets/$PHONE/$PHONE.uidna"
|
NAMEFILE="./wallets/PHONE/$PHONE/_uidname"
|
||||||
# New related wallet asked
|
UIDNAFILE="./wallets/PHONE/$PHONE/_uidna"
|
||||||
|
|
||||||
|
# ASKWALLET is
|
||||||
ASKWALLET="$1"
|
ASKWALLET="$1"
|
||||||
#For micro payement
|
|
||||||
|
#For Micro Payement to DESTRIB (for easy G1sms wallet find in Cesium wallet History)
|
||||||
PHONE="$2"
|
PHONE="$2"
|
||||||
PIN="$3"
|
PIN="$3"
|
||||||
if -f "$UIDNAFILE"; then UIDNA=$(cat "$UIDNAFILE"); else UIDNA=""; fi
|
|
||||||
log "__SUB:sms_uid2key: $UIDNA Try to associate $ASKWALLET with $PHONE... SEARCHING..."
|
|
||||||
|
|
||||||
|
# Get PHONE wallet UIDNA name
|
||||||
|
if [[ -f "$UIDNAFILE" ]]; then UIDNA=$(cat "$UIDNAFILE"); else UIDNA=""; fi
|
||||||
|
log "__SUB:sms_uid2pubkey: $UIDNA Wallet ($PHONE) is trying to associate to $ASKWALLET... SEARCHING..."
|
||||||
|
|
||||||
|
# Link to itSelf
|
||||||
if [[ $UIDNA && "$ASKWALLET" == "$UIDNA" ]]; then
|
if [[ $UIDNA && "$ASKWALLET" == "$UIDNA" ]]; then
|
||||||
log "__SUB:sms_uid2key: "$ASKWALLET" == "$UIDNA" !!"
|
log "__SUB:sms_uid2pubkey: "$ASKWALLET" == "$UIDNA" !!"
|
||||||
sms_SEND "$PHONE" "[G1sms+] $UIDNA est le nom de votre porte monnaie libre pour $PHONE. Il ne peut également être compte maître!"
|
sms_SEND "$PHONE" "[G1sms+] $UIDNA est le nom de portefeuille G1sms. Il ne peut pas être associé à lui même!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Test if member files exists
|
# Test if _uidname file exists
|
||||||
if [ -f "$NAMEFILE" ]; then
|
if [ -f "$NAMEFILE" ]; then
|
||||||
|
# Actuel related wallet
|
||||||
UIDNAME=$(cat "$NAMEFILE")
|
UIDNAME=$(cat "$NAMEFILE")
|
||||||
log "__SUB:sms_uid2key: ALREADY $UIDNAME related Wallet for $PHONE Wallet change to $ASKWALLET !!"
|
log "__SUB:sms_uid2pubkey: Actual $UIDNA Wallet Related to $UIDNAME. Ask change to $ASKWALLET"
|
||||||
if [["$UIDNAME" != "$ASKWALLET" ]]; then
|
if [["$UIDNAME" != "$ASKWALLET" ]]; then
|
||||||
sms_SEND "$ADMINPHONE" "ADMIN! INFO: $PHONE Wallet associé à $UIDNAME change en $ASKWALLET !!"
|
sms_SEND "$ADMINPHONE" "ADMIN! INFO: $PHONE Wallet associé à $UIDNAME change en $ASKWALLET !!"
|
||||||
sms_SEND "$PHONE" "[G1sms+] Votre portefeuille maitre va passer de $UIDNAME à $ASKWALLET!"
|
sms_SEND "$PHONE" "[G1sms+] Votre portefeuille associé va passer de $UIDNAME à $ASKWALLET!"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Search fo duplicate
|
# Search fo duplicate (TODO: choose $PHONE result
|
||||||
DUP=$(grep -Rwl "$ASKWALLET" ./wallets/*/*.uidname | cut -f 3 -d '/')
|
DUP=$(grep -Rwl "$ASKWALLET" ./wallets/PHONE/*/_uidname | tail -n 1 | cut -f 4 -d '/')
|
||||||
if [[ "$DUP" != "" ]]; then
|
if [[ "$DUP" != "" ]]; then
|
||||||
sms_SEND "$ADMINPHONE" "ADMIN! INFO: $PHONE prend le même $ASKWALLET, que $DUP"
|
sms_SEND "$ADMINPHONE" "ADMIN! INFO: $PHONE prend le même $ASKWALLET, que $DUP"
|
||||||
sms_SEND "$DUP" "Vous devez savoir que $ASKWALLET est associé à un autre téléphone que le votre également!"
|
sms_SEND "$DUP" "Votre portefeuille associé $ASKWALLET vient d'être associé à $PHONE également!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
# FIND ASKWALLET into wallets, wallest_swarm OR duniter (silkaj)
|
# FIND ASKWALLET into wallets, wallest_swarm OR duniter (silkaj)
|
||||||
DESTMEM="$VIRDEST"
|
DESTMEM="$VIRDEST"
|
||||||
# SEARCH IN WALLETS
|
# SEARCH IN WALLETS
|
||||||
LOCAL=$(grep -Rwl "$ASKWALLET" ./wallets/*/*.uidna | cut -f 3 -d '/')
|
LOCAL=$(grep -Rwl "$ASKWALLET" ./wallets/PHONE/*/_uidna | tail -n 1 | cut -f 4 -d '/')
|
||||||
if [[ "$LOCAL" != "" ]]; then
|
if [[ "$LOCAL" != "" ]]; then
|
||||||
# LOCAL G1sms account
|
# LOCAL G1sms account
|
||||||
DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub)
|
DESTRIB=$(cat ./wallets/PHONE/$LOCAL/_pub)
|
||||||
DESTPHONE=$LOCAL
|
DESTPHONE=$LOCAL
|
||||||
log "__SUB:sms_uid2key: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
|
log "__SUB:sms_uid2pubkey: FOUND LOCAL ($MASTERPHONE) G1sms Wallet: $DESTRIB ($DESTPHONE)"
|
||||||
else
|
else
|
||||||
# SEARCH IN WALLETS SWARM
|
# SEARCH IN WALLETS SWARM
|
||||||
INSWARM=$(grep -Rwl "$ASKWALLET" ./wallets_swarm/*/*.uidna | cut -f 3 -d '/')
|
INSWARM=$(grep -Rwl "$ASKWALLET" ./wallets_swarm/PHONE/*/_uidna | tail -n 1 | cut -f 4 -d '/')
|
||||||
if [[ "$INSWARM" != "" ]]; then
|
if [[ "$INSWARM" != "" ]]; then
|
||||||
REMOTENODE=$(cat ./wallets_swarm/$INSWARM/MASTERPHONE.sms)
|
REMOTENODE=$(cat ./wallets_swarm/PHONE/$INSWARM/MASTERPHONE.sms)
|
||||||
DESTRIB=$(cat ./wallets_swarm/$INSWARM/$INSWARM.pub)
|
REMOTENODEIPFSID=$(cat ./wallets_swarm/PHONE/$INSWARM/MASTERPHONE.ipfsid)
|
||||||
|
DESTRIB=$(cat ./wallets_swarm/PHONE/$INSWARM/_pub)
|
||||||
DESTPHONE=$INSWARM
|
DESTPHONE=$INSWARM
|
||||||
log "__SUB:sms_uid2key: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)"
|
log "__SUB:sms_uid2pubkey: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($DESTPHONE)"
|
||||||
else
|
else
|
||||||
# SEARCH WITH SILKAJ
|
# SEARCH FOR DUNITER MEMBER WITH SILKAJ
|
||||||
log "__SUB:sms_uid2key: GETTING FROM SILKAJ MEMBER ID"
|
log "__SUB:sms_uid2pubkey: GETTING FROM SILKAJ MEMBER ID"
|
||||||
DESTRIB=$(./silkaj/silkaj id "$ASKWALLET" | grep -w "$ASKWALLET" | awk '{print $2}')
|
DESTRIB=$(./silkaj/silkaj id "$ASKWALLET" | grep -w "$ASKWALLET" | awk '{print $2}')
|
||||||
log "__SUB:sms_uid2key: OUT OFF SWARM MEMBER wallet: $DESTRIB"
|
log "__SUB:sms_uid2pubkey: OUT OFF SWARM MEMBER wallet: $DESTRIB"
|
||||||
# GET CESIUM+ geoPoint DATA (TODO: cron for GCHANGE SMS Alert)
|
# GET CESIUM+ geoPoint DATA (TODO: cron for GCHANGE SMS Alert)
|
||||||
curl -s ${CESIUM}/user/profile/${DESTRIB} | jq '._source.geoPoint' > "./wallets/$PHONE/$PHONE.uidgeo.json"
|
curl -s ${CESIUM}/user/profile/${DESTRIB} | jq '._source.geoPoint' > "./wallets/PHONE/$PHONE/_uidgeo.json"
|
||||||
log "__SUB:sms_uid2key: GET CESIUM+ geoPoint and AVATAR : $(cat ./wallets/$PHONE/$PHONE.uidgeo.json)"
|
log "__SUB:sms_uid2pubkey: GET CESIUM+ geoPoint and AVATAR : $(cat ./wallets/PHONE/$PHONE/_uidgeo.json)"
|
||||||
curl -s ${CESIUM}/user/profile/${DESTRIB} | jq '._source.avatar._content' | sed 's/\"//g' | base64 -d > "./wallets/$PHONE/$PHONE.avatar.png"
|
curl -s ${CESIUM}/user/profile/${DESTRIB} | jq '._source.avatar._content' | sed 's/\"//g' | base64 -d > "./wallets/PHONE/$PHONE/_avatar.png"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DESTRIB" != "" ]; then
|
if [ "$DESTRIB" != "" ]; then
|
||||||
echo "$DESTRIB" > "$RIBFILE"
|
echo "$DESTRIB" > "$RIBFILE"
|
||||||
echo "$ASKWALLET" > "$NAMEFILE"
|
echo "$ASKWALLET" > "$NAMEFILE"
|
||||||
log "__SUB:sms_uid2key: NEW EXTERNAL RELATED $DESTRIB / FOR MEMBER OR WALLET = $ASKWALLET - INIT 0.1 TX"
|
log "__SUB:sms_uid2pubkey: NEW RELATED $DESTRIB FOR G1sms WALLET = $ASKWALLET - INIT 0.1 TX"
|
||||||
INIT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="0.1" --output=$DESTRIB --comment="[G1sms+] Porte Monnaie $(cat $UIDNAFILE) -> $(cat $NAMEFILE)" -y)
|
INIT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$UIDNA" -password="$PIN" --amount="0.1" --output=$DESTRIB --comment="[G1sms+] Porte Monnaie $(cat $UIDNAFILE) -> $(cat $NAMEFILE)" -y)
|
||||||
log "__SUB:sms_uid2key: INIT = $INIT | Create Connection with related Wallet."
|
log "__SUB:sms_uid2pubkey: INIT = $INIT | Create Connection with related Wallet."
|
||||||
log_history "$PHONE" "MEMBER, $ASKWALLET"
|
log_history "$PHONE" "MEMBER, $ASKWALLET"
|
||||||
sms_SEND "$ADMINPHONE" "ADMIN! LOG: $PHONE Nouveau compte lié $UIDNA -- $ASKWALLET ($INIT)"
|
sms_SEND "$ADMINPHONE" "ADMIN! LOG: $PHONE ($UIDNA) Compte relié >> $ASKWALLET ($INIT)"
|
||||||
else
|
else
|
||||||
sms_SEND "$ADMINPHONE" "ADMIN! LOG: $PHONE / $ASKWALLET ABSENT"
|
sms_SEND "$ADMINPHONE" "ADMIN! LOG: $PHONE ($UIDNA) RELIER A $ASKWALLET INCONNU"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "__SUB:sms_uid2key: $MEMBER($DESTRIB)"
|
log "__SUB:sms_uid2pubkey: $MEMBER($DESTRIB)"
|
||||||
echo "$DESTRIB"
|
echo "$DESTRIB"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,52 +328,52 @@ function sms_INIT_ACCOUNT () {
|
||||||
log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
PHONE="$1"
|
PHONE="$1"
|
||||||
UNKNOWN=0
|
UNKNOWN=0
|
||||||
# TODO Optimize GLOBAL/local variables use, use more function array output ?!
|
|
||||||
# Initiate PHONE settings files and values
|
# Initiate PHONE settings files and values
|
||||||
|
|
||||||
# ALL CHANNEL INTO ./wallets/sha256sum(ID)
|
# WALLETS INTO ./wallets/CHANNEL/sha256sum(PHONE)
|
||||||
HASHLINK=$(echo $PHONE | sha256sum | cut -d ' ' -f 1)
|
HASHLINK=$(echo -n $PHONE | sha256sum | cut -d ' ' -f 1)
|
||||||
# ALL CHANNEL INTO ./wallets/sha256sum(ID)
|
# WALLETS INTO ./wallets/CHANNEL/sha256sum(PHONE)
|
||||||
|
|
||||||
IPFSNODEIDFILE="./wallets/$PHONE/MASTERPHONE.ipfsid" # Contains G1sms+ NODE IPFS id
|
IPFSNODEIDFILE="./wallets/PHONE/$PHONE/MASTERPHONE.ipfsid" # Contains G1sms+ NODE IPFS id
|
||||||
SMSNODE="./wallets/$PHONE/MASTERPHONE.sms" # Contains G1sms+ SMS phone number
|
SMSNODE="./wallets/PHONE/$PHONE/MASTERPHONE.sms" # Contains G1sms+ SMS phone number
|
||||||
PINFILE="./wallets/$PHONE/$PHONE.pin" # Contains phone wallet diceware password
|
PINFILE="./wallets/PHONE/$PHONE/_pin" # Contains phone wallet diceware password
|
||||||
GPGPINFILE="./wallets/$PHONE/$PHONE.pin.gpg" # Contains g1smsnode cypher phone wallet diceware password
|
GPGPINFILE="./wallets/PHONE/$PHONE/_pin.gpg" # Contains g1smsnode cypher phone wallet diceware password
|
||||||
AUTHCRYPTFILE="./wallets/$PHONE/$PHONE.authfile.crypt" # TEST!!! crypt with $PHONE wallet keypair
|
AUTHCRYPTFILE="./wallets/PHONE/$PHONE/_authfile.crypt" # TEST!!! crypt with $PHONE wallet keypair
|
||||||
PUBKEYFILE="./wallets/$PHONE/$PHONE.pub" # Contains phone wallet public key (RIB)
|
PUBKEYFILE="./wallets/PHONE/$PHONE/_pub" # Contains phone wallet public key (RIB)
|
||||||
UNITFILE="./wallets/$PHONE/$PHONE.unit" # Contains phone wallet prefered unit (LOVE,G1,DU)
|
UNITFILE="./wallets/PHONE/$PHONE/_unit" # Contains phone wallet prefered unit (LOVE,G1,DU)
|
||||||
|
|
||||||
RIBFILE="./wallets/$PHONE/$PHONE.uidrib" # Contains phone wallet related UID Pubkey
|
RIBFILE="./wallets/PHONE/$PHONE/_uidrib" # Contains phone wallet related UID Pubkey
|
||||||
NAMEFILE="./wallets/$PHONE/$PHONE.uidname" # Contains the member UID related to wallet
|
NAMEFILE="./wallets/PHONE/$PHONE/_uidname" # Contains the member UID related to wallet
|
||||||
MAILFILE="./wallets/$PHONE/$PHONE.email" # Contains the member EMAIL (Send BILLET)
|
MAILFILE="./wallets/PHONE/$PHONE/_email" # Contains the member EMAIL (Send BILLET)
|
||||||
GPGMAILFILE="./wallets/$PHONE/$PHONE.email.gpg" # Contains the member EMAIL (Send BILLET)
|
GPGMAILFILE="./wallets/PHONE/$PHONE/_email.gpg" # Contains the member EMAIL (Send BILLET)
|
||||||
UIDNAFILE="./wallets/$PHONE/$PHONE.uidna" # Contains the G1sms+ UID Name for recursive VIR
|
UIDNAFILE="./wallets/PHONE/$PHONE/_uidna" # Contains the G1sms+ UID Name for recursive VIR
|
||||||
GEOFILE="./wallets/$PHONE/$PHONE.uidgeo.json" # Contains the member GeoPoint from member Cesium+ related to wallet
|
GEOFILE="./wallets/PHONE/$PHONE/_uidgeo.json" # Contains the member GeoPoint from member Cesium+ related to wallet
|
||||||
|
|
||||||
RECFILE="./wallets/$PHONE/VIREMENTS" # File showing recurrent payements are left to be done with this G1sms Wallet
|
RECFILE="./wallets/PHONE/$PHONE/VIREMENTS" # File showing recurrent payements are left to be done with this G1sms Wallet
|
||||||
GPGRECFILE="./wallets/$PHONE/VIREMENTS.gpg" # Cypher file with GPGPASS (Node .Identity.PrivKey)
|
GPGRECFILE="./wallets/PHONE/$PHONE/VIREMENTS.gpg" # Cypher file with GPGPASS (Node .Identity.PrivKey)
|
||||||
G1COUNTFILE="./wallets/$PHONE/$PHONE.g1cents" # Last sms_COUNT.sh call value
|
G1COUNTFILE="./wallets/PHONE/$PHONE/_g1cents" # Last sms_COUNT.sh call value
|
||||||
CHAINFILE="./wallets/$PHONE/$PHONE.chain" # Contains wallet last IPFS hash before ZEN value change
|
CHAINFILE="./wallets/PHONE/$PHONE/_chain" # Contains wallet last IPFS hash before ZEN value change
|
||||||
|
|
||||||
DABUIDF="./wallets/$PHONE/uidna.G1TAGNODE" # Contains G1Dab Name
|
DABUIDF="./wallets/PHONE/$PHONE/uidna.G1TAGNODE" # Contains G1Dab Name
|
||||||
# GET CURRENT NODE UIDNA (default DABUID)
|
# GET CURRENT NODE UIDNA (default DABUID)
|
||||||
NODEUIDNA=$(cat "./wallets/.$IPFSNODEID/$IPFSNODEID.uidna")
|
NODEUIDNA=$(cat "./wallets/.$IPFSNODEID/_uidna")
|
||||||
######################################################################
|
######################################################################
|
||||||
# (NO PIN) = FIRST ACCOUNT: Create wallet
|
# (NO PIN) = FIRST ACCOUNT: Create wallet
|
||||||
if [ ! -f "$PINFILE" ]; then
|
if [ ! -f "$PINFILE" ]; then
|
||||||
# NOSMS mode?
|
# NOSMS mode? = DO NOT CREATE
|
||||||
if [[ $2 == "NOSMS" ]]; then UNKNOWN="unknown"; return; fi
|
if [[ $2 == "NOSMS" ]]; then UNKNOWN="unknown"; return; fi
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Create Account Files
|
# Create Account Files
|
||||||
#######################
|
#######################
|
||||||
[[ ! $GPATH ]] && GPATH="."
|
if [[ ! -d ./wallets/PHONE/$HASHLINK ]]; then
|
||||||
[[ -d $GPATH/wallets/$PHONE ]] && mv $GPATH/wallets/$PHONE $GPATH/wallets/$HASHLINK && ln -s $GPATH/wallets/$HASHLINK $GPATH/wallets/$PHONE
|
mkdir -p ./wallets/PHONE/$HASHLINK
|
||||||
[[ ! -d $GPATH/wallets/$HASHLINK ]] && mkdir -p $GPATH/wallets/$HASHLINK && ln -s $GPATH/wallets/$HASHLINK $GPATH/wallets/$PHONE
|
ln -s ./wallets/PHONE/$HASHLINK ./wallets/PHONE/$PHONE
|
||||||
|
fi
|
||||||
# LINKS ARE NOT REPLICATED INTO IPFS ;)
|
# LINKS ARE NOT REPLICATED INTO IPFS ;)
|
||||||
|
|
||||||
PIN=$(./shell/diceware.sh | xargs)
|
PIN=$(./shell/diceware.sh | xargs)
|
||||||
PUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$PHONE" -password="$PIN")
|
PUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$UIDNA" -password="$PIN")
|
||||||
|
|
||||||
# BACKUP authfile available to authfile or PIN owner (DOUBLON AVEC PIN) TEST
|
# BACKUP authfile available to authfile or PIN owner (DOUBLON AVEC PIN) TEST
|
||||||
log "__SUB:sms_INIT_ACCOUNT: ./shell/natools.py encrypt -p $PUBKEY -i ""./authfile"" -o ""$AUTHCRYPTFILE"""
|
log "__SUB:sms_INIT_ACCOUNT: ./shell/natools.py encrypt -p $PUBKEY -i ""./authfile"" -o ""$AUTHCRYPTFILE"""
|
||||||
|
@ -374,8 +395,8 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
#######################
|
#######################
|
||||||
# ACTIVATE G1SMS WALLET
|
# ACTIVATE G1SMS WALLET
|
||||||
#######################
|
#######################
|
||||||
# log "$NODE_G1PRIVKEYFILE $PUBKEY THIRD_PARTY_MANAGER:$NODE_G1PUBKEY"
|
# log "$NODE_G1AUTHFILE $PUBKEY THIRD_PARTY_MANAGER:$NODE_G1PUBKEY"
|
||||||
TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1PRIVKEYFILE" --amount=3.24 --output=$PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$NODE_G1PUBKEY " -y)
|
TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1AUTHFILE" --amount=3.24 --output=$PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$NODE_G1PUBKEY " -y)
|
||||||
log "__SUB:sms_INIT_ACCOUNT: G1 Wallet TX IN: $TX_IN"
|
log "__SUB:sms_INIT_ACCOUNT: G1 Wallet TX IN: $TX_IN"
|
||||||
sleep 2
|
sleep 2
|
||||||
TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount=0.1 --output=$NODE_G1PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$NODE_G1PUBKEY:ACK" -y)
|
TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount=0.1 --output=$NODE_G1PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$NODE_G1PUBKEY:ACK" -y)
|
||||||
|
@ -407,7 +428,7 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
######################################################################
|
######################################################################
|
||||||
if [[ ! -f "$GPGPINFILE" ]]
|
if [[ ! -f "$GPGPINFILE" ]]
|
||||||
then
|
then
|
||||||
HASH=$(echo $PHONE | sha256sum | cut -d ' ' -f 1)
|
HASH=$(echo -n $PHONE | sha256sum | cut -d ' ' -f 1)
|
||||||
|
|
||||||
# ------------8<------------------
|
# ------------8<------------------
|
||||||
# WALLET MIGRATION -> CRYPT PIN (For Old G1sms clear PIN WALLETs...)
|
# WALLET MIGRATION -> CRYPT PIN (For Old G1sms clear PIN WALLETs...)
|
||||||
|
@ -577,7 +598,7 @@ esac
|
||||||
log "__SUB:make_accounting: LOCAL $VIR amount for $PHONE : $PUBKEY"
|
log "__SUB:make_accounting: LOCAL $VIR amount for $PHONE : $PUBKEY"
|
||||||
# Try to ask silkaj. If timeout, use SWARM last known $PHONE.g1cents value
|
# Try to ask silkaj. If timeout, use SWARM last known $PHONE.g1cents value
|
||||||
AMOUNTG1=$(./shell/timeout.sh -t 20 ./silkaj/silkaj amount "$PUBKEY")
|
AMOUNTG1=$(./shell/timeout.sh -t 20 ./silkaj/silkaj amount "$PUBKEY")
|
||||||
if [[ ! $AMOUNTG1 ]]; then AMOUNTG1=$(bc -l <<< "scale=2; $(cat ./wallets_swarm/$PHONE/$PHONE.g1cents) / 100"); fi
|
if [[ ! $AMOUNTG1 ]]; then AMOUNTG1=$(bc -l <<< "scale=2; $(cat ./wallets_swarm/$PHONE/_g1cents) / 100"); fi
|
||||||
if [[ "$AMOUNTG1" == "" ]]; then AMOUNTG1=0; fi
|
if [[ "$AMOUNTG1" == "" ]]; then AMOUNTG1=0; fi
|
||||||
# TAX AND MINIMUM WALLET ACCOUNT CALCULATION
|
# TAX AND MINIMUM WALLET ACCOUNT CALCULATION
|
||||||
PERCENT=0$(bc -l <<< "scale=2; $VIR / $SWARMCOMM")
|
PERCENT=0$(bc -l <<< "scale=2; $VIR / $SWARMCOMM")
|
||||||
|
@ -628,7 +649,7 @@ function move_g1cents (){
|
||||||
# USE natools with NODEPUB crypt
|
# USE natools with NODEPUB crypt
|
||||||
echo "$zenvalue" > "/tmp/move_g1cents.$winnerphone"
|
echo "$zenvalue" > "/tmp/move_g1cents.$winnerphone"
|
||||||
# GET NODE G1sms Wallet PUBKEY
|
# GET NODE G1sms Wallet PUBKEY
|
||||||
NODEPUB=$(cat ./wallets_swarm/.$NODEID/$NODEID.pub)
|
NODEPUB=$(cat ./wallets_swarm/.$NODEID/_pub)
|
||||||
./shell/natools.py encrypt -p $NODEPUB -i "/tmp/move_g1cents.$winnerphone" -o "./wallets/.$NODEID/TASK/$NANODATE.move_g1cents.$winnerphone.NODEPUB.crypt"
|
./shell/natools.py encrypt -p $NODEPUB -i "/tmp/move_g1cents.$winnerphone" -o "./wallets/.$NODEID/TASK/$NANODATE.move_g1cents.$winnerphone.NODEPUB.crypt"
|
||||||
log "__SUB:move_g1cents: CREDIT: WRITE TASK TO ./wallets/.$NODEID/$NANODATE.move_g1cents.$winnerphone.NODEPUB.crypt "
|
log "__SUB:move_g1cents: CREDIT: WRITE TASK TO ./wallets/.$NODEID/$NANODATE.move_g1cents.$winnerphone.NODEPUB.crypt "
|
||||||
rm -f /tmp/move_g1cents.$winnerphone
|
rm -f /tmp/move_g1cents.$winnerphone
|
||||||
|
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
@ -7,7 +7,14 @@
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
source $MY_PATH/.install/.GPATH
|
if [[ -f $MY_PATH/.profile ]]; then
|
||||||
|
source $MY_PATH/.profile
|
||||||
|
elif [[ -f $MY_PATH/../.profile ]]; then
|
||||||
|
source $MY_PATH/../.profile
|
||||||
|
else
|
||||||
|
echo -e "${c_red}Le .profile n'existe pas$c_"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
|
# Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
|
||||||
function log () {
|
function log () {
|
||||||
|
|
|
@ -9,11 +9,32 @@
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
|
if [[ -f $MY_PATH/.profile ]]; then
|
||||||
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
source $MY_PATH/.profile
|
||||||
|
elif [[ -f $MY_PATH/../.profile ]]; then
|
||||||
|
source $MY_PATH/../.profile
|
||||||
|
else
|
||||||
|
echo -e "${c_red}Le .profile n'existe pas$c_"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
||||||
# TODO Make it directory independant. (for now it is tested for pi running ipfs and code in $HOME/G1sms+
|
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
||||||
|
NANODATE=$(date -u +%s%N) #1569692075385428020
|
||||||
|
|
||||||
|
##########################################################
|
||||||
|
# CHECK LAST TIME NODE HAD ACTION : Calibrate NANODATE
|
||||||
|
if [[ -f ./wallets/.$IPFSNODEID/_nanodate ]]; then
|
||||||
|
last=$(cat ./wallets/.$IPFSNODEID/_nanodate)
|
||||||
|
timediff=$( echo "${NANODATE} - ${last}" | bc -l )
|
||||||
|
# Get median nanodate before
|
||||||
|
# NODE TIME SYNC 600 milliards de nanosecondes = 600 s = 10 mn
|
||||||
|
if [[ $timediff -gt 600000000000 ]]; then
|
||||||
|
# RUN & LOG ntpdate
|
||||||
|
log "__SUB:ntpdate pool.ntp.org: $timediff $(ntpdate pool.ntp.org)"
|
||||||
|
export NANODATE=$(date -u +%s%N)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# G1sms+ Node KEYS (G1wallet, gpg, IPNS)
|
# G1sms+ Node KEYS (G1wallet, gpg, IPNS)
|
||||||
|
@ -29,131 +50,106 @@ if [ ! $SWARMKEY ]; then echo "FATAL ERROR:: .ipfs/swarm.key EMPTY"; exit; fi
|
||||||
# G1sms+ Swarm KEYS
|
# G1sms+ Swarm KEYS
|
||||||
##################################################################
|
##################################################################
|
||||||
# G1sms Service - G1Wallet
|
# G1sms Service - G1Wallet
|
||||||
if [[ -f "${GPATH}/g1sms.pub.key" && -f "${GPATH}/g1sms.priv.key" ]]; then
|
#
|
||||||
chown root:root ${GPATH}/g1sms.priv.key
|
# CLEF G1 DU SWARM
|
||||||
chmod 600 ${GPATH}/g1sms.priv.key
|
SWARM_G1PUBKEY=$(cat "${GPATH}/g1sms.pub.key")
|
||||||
export NODE_G1PUBKEY=$(cat "${GPATH}/g1sms.pub.key")
|
|
||||||
export NODE_G1PRIVKEYFILE="${GPATH}/g1sms.priv.key"
|
# CLEF G1 NODE = CLEF G1 SWARM
|
||||||
|
if [[ ! -e "./g1sms.preoni.pub.key" && -f "./g1sms.priv.key" ]]; then
|
||||||
|
log "__SUB:initkeys.sh: Linking preoni Keys to SWARM G1 Keys"
|
||||||
|
ln -s ./g1sms.priv.key ./g1sms.preoni.priv.key
|
||||||
|
ln -s ./g1sms.pub.key ./g1sms.preoni.pub.key
|
||||||
else
|
else
|
||||||
echo "ATTENTION!! Vous devez installer une clef de G1 Wallet!!"
|
# CREATE NODE G1 KEYS AND FILES
|
||||||
./shell/parle.sh "Il manque les Clefs du portefeuille G1 de votre noeud. Au revoir."
|
|
||||||
echo "Fichiers manquants:"
|
|
||||||
echo "${GPATH}/g1sms.pub.key"
|
|
||||||
echo "${GPATH}/g1sms.priv.key"
|
|
||||||
echo "Contactez nous sur https://g1sms.fr"
|
|
||||||
log "${GPATH}/g1sms.pub.key"
|
|
||||||
log "${GPATH}/g1sms.priv.key"
|
|
||||||
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "Clef de G1Wallet du SWARM g1sms.priv.key manquante! contactez-nous pour la recevoir https://g1sms.fr" 1>&2
|
|
||||||
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "Debug: ${GPATH}/g1sms.pub.key et ${GPATH}/g1sms.priv.key" 1>&2
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
##################################################################
|
|
||||||
# NODE KEYS (SCRIPT CALLED BY ROOT !!! gammu is root)
|
|
||||||
##################################################################
|
|
||||||
export IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
|
||||||
export NANODATE=$(date -u +%s%N) #1569692075385428020
|
|
||||||
|
|
||||||
# CHECK LAST TIME NODE HAD ACTION
|
|
||||||
if [[ -f ./wallets/.$IPFSNODEID/$IPFSNODEID.nanodate ]]; then
|
|
||||||
last=$(cat ./wallets/.$IPFSNODEID/$IPFSNODEID.nanodate)
|
|
||||||
timediff=$( echo "${NANODATE} - ${last}" | bc -l )
|
|
||||||
# Get median nanodate before
|
|
||||||
# NODE TIME SYNC 120 milliards de nanosecondes = 120s
|
|
||||||
if [[ $timediff -gt 120000000000 ]]; then
|
|
||||||
log "__SUB:ntpdate pool.ntp.org: $timediff $(ntpdate pool.ntp.org)"
|
|
||||||
export NANODATE=$(date -u +%s%N)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#################################################################
|
|
||||||
# CREATE NODE .$IPFSNODEID SPACE (G1Wallet + TASK + NODE DETAILS)
|
|
||||||
#################################################################
|
|
||||||
# Create G1sms Wallet with that NODE G1 wallet as member reference
|
|
||||||
if [[ ! -f "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" ]]; then
|
|
||||||
mkdir -p ./wallets/.$IPFSNODEID/TASK
|
mkdir -p ./wallets/.$IPFSNODEID/TASK
|
||||||
# TODO @poka ?? Place in install sequence: Create Node G1 Wallet (login=ipfsID pass=ipfsPrivKey)
|
################################################
|
||||||
NODEG1WALLET=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$IPFSNODEID" -password="$GPGPASS")
|
# GIVE NAME TO NODE G1 WALLET: "0000diceware"
|
||||||
if [[ ! $NODEG1WALLET ]]; then echo "PROBLEME CREATION DU WALLET G1 DE $IPFSNODEID"; exit; fi
|
# CREATE "preoni" KeyS & ./wallets/.Qm***/_files
|
||||||
|
################################################
|
||||||
# Backup authfile GPG with IPFS NODE PRIVATE KEY
|
# 4 derniers chiffres du MASTERPHONE + diceware
|
||||||
echo "${GPGPASS}" | gpg -q --output "./wallets/.$IPFSNODEID/$IPFSNODEID.authfile.GPGPASS.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./authfile"
|
PRE=${MASTERPHONE:8:4}
|
||||||
# Backup authfile CYPHER with NODE G1 WALLET PUB KEY
|
UID=$(./shell/diceware.sh 1 | xargs)
|
||||||
./shell/natools.py encrypt -p $NODEG1WALLET -i "./authfile" -o "./wallets/.$IPFSNODEID/$IPFSNODEID.authfile.crypt"
|
|
||||||
|
|
||||||
# TODO ADD ACCESS TO OTHER SWARM NODES CYPHERING WITH ALL ACTUAL NODES G1WALLET PUB KEYS
|
|
||||||
# USEFUL TO OPERATE G1TAG WITHOUT SHARING NODE_G1PRIVKEYFILE...
|
|
||||||
# for nodepubfile in ./wallets_swarm/.Qm*/*.pub; do
|
|
||||||
# nodeG1pub=$(cat $nodepubfile)
|
|
||||||
# nodeID=$(echo $all | cut -d '/' -f 3)
|
|
||||||
# ./shell/natools.py encrypt -p $nodeG1pub -i "./authfile" -o "./wallets/.$IPFSNODEID/$nodeID.authfile.crypt"
|
|
||||||
# done
|
|
||||||
|
|
||||||
# Keep Node G1 wallet authfile in G1sms+ root
|
|
||||||
mv -f ./authfile ../
|
|
||||||
|
|
||||||
echo $NODEG1WALLET > "./wallets/.$IPFSNODEID/$IPFSNODEID.pub"
|
|
||||||
echo $IPFSNODEID > "./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsid"
|
|
||||||
log "__SUB:initkeys.sh: [ADMIN] G1sms+ CREATE G1WALLET FOR: $IPFSNODEID: pub = $NODEG1WALLET "
|
|
||||||
|
|
||||||
# BACKUP $IPFSNODEID config
|
|
||||||
./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "/home/$YOU/.ipfs/config" -o "./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsconfig.crypt"
|
|
||||||
log "__SUB:initkeys.sh: [ADMIN] BACKUP $IPFSNODEID NODE CONFIG to ./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsconfig.crypt "
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# GIVE NAME TO WALLET
|
|
||||||
#######################
|
|
||||||
# 4 derniers chiffres du numéro de téléphone
|
|
||||||
TAIL=${MASTERPHONE:8:4}
|
|
||||||
# No UIDNA yet. Create new
|
|
||||||
UIDNA=$(./shell/diceware.sh 1 | xargs)
|
|
||||||
# Check if already existing among all swarm wallets
|
# Check if already existing among all swarm wallets
|
||||||
while [[ $(grep -Rwl "$UIDNA$TAIL" ./wallets_swarm/*/*.uidna) ]]; do UIDNA=$(./shell/diceware.sh 1 | xargs); done
|
while [[ $(grep -Rwl "$PRE$UID" ./wallets_swarm/.*/_uidna) ]]; do UID=$(./shell/diceware.sh 1 | xargs); done
|
||||||
# WRITE NODE uidna NAME TO /etc/hosts & .Qm*/Qm*.uidna file
|
NODE_UIDNA="$PRE$UID"
|
||||||
echo "127.0.0.101 $UIDNA$TAIL" >> "/etc/hosts"
|
NODE_PIN=$(./shell/diceware.sh | xargs)
|
||||||
echo "$UIDNA$TAIL" > "./wallets/.$IPFSNODEID/$IPFSNODEID.uidna"
|
NODE_G1PUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$NODE_UIDNA" -password="$NODE_PIN")
|
||||||
|
if [[ ! $NODE_G1PUBKEY ]]; then log "PROBLEME CREATION DU WALLET G1 POUR $NODE_UIDNA = $IPFSNODEID"; exit; fi
|
||||||
|
log "__SUB:initkeys.sh: NODE G1WALLET CESIUM: $NODE_UIDNA / $NODE_PIN CREATED..."
|
||||||
|
|
||||||
# TODO: MAYBE REMOVE THAT CREATE NODE WALLET LIKE A PHONE (Stored in wallets/.$IPFSNODEID) BUT CREATE & ATTACH G1TAG INSTEAD
|
# WRITE NODE_UIDNA
|
||||||
echo "${GPGPASS}" > "./wallets/.$IPFSNODEID/$IPFSNODEID.pin"
|
echo "$NODE_UIDNA" > "./wallets/.$IPFSNODEID/_uidna" ################# _uidna
|
||||||
echo "${GPGPASS}" | gpg -q --output "./wallets/.$IPFSNODEID/$IPFSNODEID.pin.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./wallets/.$IPFSNODEID/$IPFSNODEID.pin"
|
|
||||||
echo "" > "./wallets/.$IPFSNODEID/$IPFSNODEID.pin"
|
############ SYSTEM MODIFY hosts & hostname ################
|
||||||
echo "$UIDNA$TAIL" > "./wallets/.$IPFSNODEID/$IPFSNODEID.uidna"
|
# WRITE NODE uidna NAME TO /etc/hosts & .Qm*/_uidna file
|
||||||
echo "314" > "./wallets/.$IPFSNODEID/$IPFSNODEID.g1cents"
|
echo "127.0.0.101 $NODE_UIDNA" >> "/etc/hosts"
|
||||||
echo $NODEG1WALLET > "./wallets/.$IPFSNODEID/$IPFSNODEID.pub"
|
echo $NODE_UIDNA > "/etc/hostname"
|
||||||
|
############################################################
|
||||||
|
|
||||||
|
# BACKUP AUTHFILE FOR FOR SWARM USE (TODO: Refine Swarm, Node access)
|
||||||
|
./shell/natools.py encrypt -p $SWARM_G1PUBKEY -i "./authfile" -o "./wallets/.$IPFSNODEID/_authfile.swarm.crypt"
|
||||||
|
|
||||||
|
echo $NODE_G1PUBKEY > "./wallets/.$IPFSNODEID/_pub" ################# _pub
|
||||||
|
echo $IPFSNODEID > "./wallets/.$IPFSNODEID/_ipfsid" ################# _ipfsid
|
||||||
|
log "__SUB:initkeys.sh: [ADMIN] G1sms+ CREATE G1WALLET FOR: $IPFSNODEID: _pub = $NODE_G1PUBKEY "
|
||||||
|
|
||||||
|
# BACKUP $IPFSNODEID config ################# _ipfsconfig.swarm.crypt
|
||||||
|
./shell/natools.py encrypt -p $SWARM_G1PUBKEY -i "/home/$YOU/.ipfs/config" -o "./wallets/.$IPFSNODEID/_ipfsconfig.swarm.crypt"
|
||||||
|
log "__SUB:initkeys.sh: [ADMIN] BACKUP IPFS NODE CONFIG to ./wallets/.$IPFSNODEID/_ipfsconfig.swarm.crypt"
|
||||||
|
|
||||||
|
# Cyper & Empty PIN
|
||||||
|
echo "${NODE_PIN}" > "./wallets/.$IPFSNODEID/_pin" ################# _pin / _pin.node.crypt / _pin.gpg
|
||||||
|
./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "./wallets/.$IPFSNODEID/_pin" -o "./wallets/.$IPFSNODEID/_pin.node.crypt"
|
||||||
|
echo "${GPGPASS}" | gpg -q --output "./wallets/.$IPFSNODEID/_pin.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./wallets/.$IPFSNODEID/_pin"
|
||||||
|
echo "" > "./wallets/.$IPFSNODEID/_pin"
|
||||||
|
|
||||||
|
echo "314" > "./wallets/.$IPFSNODEID/_g1cents" ################# _g1cents
|
||||||
|
echo $NANODATE > "./wallets/.$IPFSNODEID/_nanodate" ################# _nanodate
|
||||||
|
|
||||||
# SILKAJ INIT G1 NODE WALLET
|
# SILKAJ INIT G1 NODE WALLET
|
||||||
TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1PRIVKEYFILE" --amount=3.24 --output=$NODEG1WALLET --comment="[G1sms+] G1NODE ($ADMINPSEUDO) $UIDNA$TAIL $IPFSNODEID" -y)
|
TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1AUTHFILE" --amount=3.24 --output=$NODEG1WALLET --comment="[G1sms+] G1NODE ($ADMINPSEUDO) $UIDNA $IPFSNODEID" -y)
|
||||||
TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$IPFSNODEID" -password="$GPGPASS" --amount=0.1 --output=$NODE_G1PUBKEY --comment="[G1sms+] G1NODE $IPFSNODEID:ACK" -y)
|
TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$IPFSNODEID" -password="$GPGPASS" --amount=0.1 --output=$NODE_G1PUBKEY --comment="[G1sms+] G1NODE $IPFSNODEID:ACK" -y)
|
||||||
log "__SUB:initkeys.sh: [ADMIN] G1sms+ $ADMINPSEUDO-$UIDNA$TAIL OUVERT POUR NODE: ls ./wallet/.$IPFSNODEID"
|
|
||||||
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "[ADMIN] G1sms+ $ADMINPSEUDO-$UIDNA$TAIL OUVERT POUR NODE: ls ./wallets/.$IPFSNODEID" 1>&2
|
log "__SUB:initkeys.sh: [ADMIN] NODE G1sms+ $UIDNA : ls ./wallet/.$IPFSNODEID"
|
||||||
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "$NODEG1WALLET" 1>&2
|
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "[ADMIN] G1sms+ NODE $UIDNA ($IPFSNODEID)" 1>&2
|
||||||
|
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "$NODE_G1PUBKEY" 1>&2
|
||||||
|
|
||||||
|
# CREATE preoni FILES
|
||||||
|
mv ./authfile ./g1sms.preoni.priv.key
|
||||||
|
echo NODE_G1PUBKEY > ./g1sms.preoni.pub.key
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $NANODATE > ./wallets/.$IPFSNODEID/$IPFSNODEID.nanodate
|
NODE_G1PUBKEY=$(cat "${GPATH}/g1sms.preoni.pub.key")
|
||||||
|
NODE_G1AUTHFILE="${GPATH}/g1sms.preoni.priv.key"
|
||||||
|
|
||||||
|
|
||||||
|
# MEMORIZE NODE NANODATE EXECUTION TIME (for ntpdate regular sync)
|
||||||
|
echo $NANODATE > ./wallets/.$IPFSNODEID/_nanodate
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
#INFORM ABOUT NODE CAPACITIES
|
#INFORM ABOUT NODE CAPACITIES
|
||||||
export NODEPUB=$(cat "./wallets/.$IPFSNODEID/$IPFSNODEID.pub")
|
export NODEPUB=$(cat "./wallets/.$IPFSNODEID/_pub")
|
||||||
|
|
||||||
## IS IT A SMS NODE (gammu-smsd is installed)??
|
## IS IT A SMS NODE (gammu-smsd is installed)??
|
||||||
if [[ $G1SMS ]]; then
|
if [[ $G1SMS ]]; then
|
||||||
echo $MASTERPHONE > "./wallets/.$IPFSNODEID/$IPFSNODEID.sms"
|
echo $MASTERPHONE > "./wallets/.$IPFSNODEID/_sms"
|
||||||
else
|
else
|
||||||
if [ -f "./wallets/.$IPFSNODEID/$IPFSNODEID.sms" ]; then rm -f "./wallets/.$IPFSNODEID/$IPFSNODEID.sms"; fi
|
if [ -f "./wallets/.$IPFSNODEID/_sms" ]; then rm -f "./wallets/.$IPFSNODEID/_sms"; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## IS THERE USB PRINTER CONNECTED?
|
## IS THERE USB PRINTER CONNECTED?
|
||||||
if [[ -e "/dev/usb/lp0" ]]; then
|
if [[ -e "/dev/usb/lp0" ]]; then
|
||||||
log "G1CORE: IMPRESSION G1Tag ACTIF .............."
|
log "G1CORE: IMPRESSION G1Tag ACTIF .............."
|
||||||
echo $ADRESSE > "./wallets/.$IPFSNODEID/$IPFSNODEID.where"
|
echo $ADRESSE > "./wallets/.$IPFSNODEID/_where"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## IS THERE SERIAL QR CODE READER CONNECTED?
|
## IS THERE SERIAL QR CODE READER CONNECTED?
|
||||||
if [[ -e "/dev/ttyACM0" ]]; then
|
if [[ -e "/dev/ttyACM0" ]]; then
|
||||||
log "G1CORE: SCAN G1Tag ACTIF .............."
|
log "G1CORE: SCAN G1Tag ACTIF .............."
|
||||||
export G1TX="YES"
|
export G1TX="YES"
|
||||||
echo "/dev/ttyACM0" > "./wallets/.$IPFSNODEID/$IPFSNODEID.scan"
|
echo "/dev/ttyACM0" > "./wallets/.$IPFSNODEID/_scan"
|
||||||
else
|
else
|
||||||
if [ -f "./wallets/.$IPFSNODEID/$IPFSNODEID.scan" ]; then rm -f "./wallets/.$IPFSNODEID/$IPFSNODEID.scan"; fi
|
if [ -f "./wallets/.$IPFSNODEID/_scan" ]; then rm -f "./wallets/.$IPFSNODEID/_scan"; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 0.2
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
|
# CREATE NEW G1 ./wallets/PHONE/sha256_ID ACCOUNT
|
||||||
source ./shell/init.sh
|
source ./shell/init.sh
|
||||||
source ./shell/functions.sh
|
source ./shell/functions.sh
|
||||||
log "${c_yellow}X sms_NEW.sh ($1=phone, $2=uid)$c_"
|
log "${c_yellow}X sms_NEW.sh ($1=phone, $2=uid)$c_"
|
||||||
|
@ -16,11 +17,14 @@ sms_INIT_ACCOUNT "$PHONE"
|
||||||
if [[ "$MEMBERUID" != "" && "$MEMBERUID" != "N" && "$MEMBERUID" != "D" && "$MEMBERUID" != "NOUV" ]]; then
|
if [[ "$MEMBERUID" != "" && "$MEMBERUID" != "N" && "$MEMBERUID" != "D" && "$MEMBERUID" != "NOUV" ]]; then
|
||||||
# UID RECEIVED in SMS
|
# UID RECEIVED in SMS
|
||||||
VIRDEST=$MEMBERUID
|
VIRDEST=$MEMBERUID
|
||||||
MEMRIB=$(sms_uid2key "$MEMBERUID" "$PHONE" "$PIN")
|
# GET ASSOCIATED MEMBER OR UIDNA G1 PUB KEY
|
||||||
|
MEMRIB=$(sms_uid2pubkey "$MEMBERUID" "$PHONE" "$PIN")
|
||||||
|
# No related wallet found
|
||||||
if [[ $MEMRIB == "" ]]; then exit; fi
|
if [[ $MEMRIB == "" ]]; then exit; fi
|
||||||
MEMBER="$MEMBERUID"
|
MEMBER="$MEMBERUID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO Replace "NOSMS" mode with .profile READ, or similar...
|
||||||
sms_INIT_ACCOUNT "$PHONE" "NOSMS"
|
sms_INIT_ACCOUNT "$PHONE" "NOSMS"
|
||||||
# Check account amount
|
# Check account amount
|
||||||
countvalues=($(check_account))
|
countvalues=($(check_account))
|
||||||
|
@ -29,26 +33,19 @@ AMOUNTG1=${countvalues[0]}
|
||||||
AMOUNT=${countvalues[1]}
|
AMOUNT=${countvalues[1]}
|
||||||
UNIT=${countvalues[2]}
|
UNIT=${countvalues[2]}
|
||||||
|
|
||||||
mess="[G1sms+]
|
mess="[G1sms+] Portefeuille G1
|
||||||
Id: $UIDNA
|
$UIDNA
|
||||||
Solde: $AMOUNT $UNIT
|
$PIN
|
||||||
DAB: $DABID
|
|
||||||
---
|
---
|
||||||
https://cesium.app
|
Solde: $AMOUNT $UNIT
|
||||||
* Identifiant ="
|
https://cesium.app"
|
||||||
sms_SEND "$PHONE" "$mess"
|
sms_SEND "$PHONE" "$mess"
|
||||||
sleep 2
|
sleep 2
|
||||||
sms_SEND "$PHONE" "$PHONE"
|
sms_SEND "$PHONE" "* Clef Publique G1 (RIB) ="
|
||||||
sleep 2
|
|
||||||
sms_SEND "$PHONE" "* Mot de passe ="
|
|
||||||
sleep 2
|
|
||||||
sms_SEND "$PHONE" "$PIN"
|
|
||||||
sleep 2
|
|
||||||
sms_SEND "$PHONE" "* Clef Publique (RIB) ="
|
|
||||||
sleep 2
|
sleep 2
|
||||||
sms_SEND "$PHONE" "$PUBKEY"
|
sms_SEND "$PHONE" "$PUBKEY"
|
||||||
sleep 2
|
sleep 2
|
||||||
sms_SEND "$PHONE" "Compte relié? $MEMBER $MAIL
|
[[ $MEMBER || $MAIL ]] && sms_SEND "$PHONE" "Compte relié: $MEMBER $MAIL
|
||||||
$MEMRIB"
|
$MEMRIB"
|
||||||
|
|
||||||
# Add contact to database
|
# Add contact to database
|
||||||
|
|
|
@ -155,8 +155,8 @@ cat /dev/ttyACM0 | while read line; do
|
||||||
|
|
||||||
# Make Silkaj TX
|
# Make Silkaj TX
|
||||||
G1VAL=$(bc -l <<< "scale=2; $BVALUE / 100" | cut -d '.' -f 1)
|
G1VAL=$(bc -l <<< "scale=2; $BVALUE / 100" | cut -d '.' -f 1)
|
||||||
log "__SUB:tag_READ.sh: Silkaj TX $NODE_G1PRIVKEYFILE ($G1VAL) -> $CASHBACK"
|
log "__SUB:tag_READ.sh: Silkaj TX $NODE_G1AUTHFILE ($G1VAL) -> $CASHBACK"
|
||||||
PAY=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1PRIVKEYFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] CAPTURE G1Tag $RR" -y)
|
PAY=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1AUTHFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] CAPTURE G1Tag $RR" -y)
|
||||||
|
|
||||||
log "__SUB:tag_READ.sh: Silkaj output = $PAY"
|
log "__SUB:tag_READ.sh: Silkaj output = $PAY"
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" == "KO" ]]; then
|
if [[ "$(echo $PAY | cut -d '|' -f 1)" == "KO" ]]; then
|
||||||
|
@ -221,7 +221,7 @@ cat /dev/ttyACM0 | while read line; do
|
||||||
else
|
else
|
||||||
log "__SUB:tag_READ.sh: Transfert de G1 Tag à G1 Tag. $BVALUE $CUR"
|
log "__SUB:tag_READ.sh: Transfert de G1 Tag à G1 Tag. $BVALUE $CUR"
|
||||||
./shell/parle.sh "Transfert de ${val[1]} $CUR vers le G1 Tag ${FID}"
|
./shell/parle.sh "Transfert de ${val[1]} $CUR vers le G1 Tag ${FID}"
|
||||||
log "__SUB:tag_READ.sh: $(./shell/tag_OP.sh ${obj[1]} ${obj[0]} ${val[1]} $NODE_G1PRIVKEYFILE)"
|
log "__SUB:tag_READ.sh: $(./shell/tag_OP.sh ${obj[1]} ${obj[0]} ${val[1]} $NODE_G1AUTHFILE)"
|
||||||
fi
|
fi
|
||||||
CASHBACK=""
|
CASHBACK=""
|
||||||
fi
|
fi
|
||||||
|
@ -234,7 +234,7 @@ cat /dev/ttyACM0 | while read line; do
|
||||||
else
|
else
|
||||||
log "__SUB:tag_READ.sh: Transformation du G1 Tag en Rec Tag. ${val[0]} = ${val[1]}"
|
log "__SUB:tag_READ.sh: Transformation du G1 Tag en Rec Tag. ${val[0]} = ${val[1]}"
|
||||||
./shell/parle.sh "Transformation du G1 Tag ${val[0]} $CUR en Rec Tag chargé de ${FID}..."
|
./shell/parle.sh "Transformation du G1 Tag ${val[0]} $CUR en Rec Tag chargé de ${FID}..."
|
||||||
log "__SUB:tag_READ.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $NODE_G1PRIVKEYFILE)"
|
log "__SUB:tag_READ.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $NODE_G1AUTHFILE)"
|
||||||
fi
|
fi
|
||||||
CASHBACK=""
|
CASHBACK=""
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -20,9 +20,9 @@ function log () {
|
||||||
$1" >> /tmp/tag_READ_X.log
|
$1" >> /tmp/tag_READ_X.log
|
||||||
}
|
}
|
||||||
|
|
||||||
NODE_G1PRIVKEYFILE="${MY_PATH}/../g1sms.priv.key"
|
NODE_G1AUTHFILE="${MY_PATH}/../g1sms.priv.key"
|
||||||
if [ ! -f $NODE_G1PRIVKEYFILE ]; then echo "ERREUR CLEF DECHIFFRAGE!"; exit; fi
|
if [ ! -f $NODE_G1AUTHFILE ]; then echo "ERREUR CLEF DECHIFFRAGE!"; exit; fi
|
||||||
# TODO G1TAG: USE CREATOR NODE KEY FILE INSTEAD OF NODE_G1PRIVKEYFILE SWARM KEY
|
# TODO G1TAG: USE CREATOR NODE KEY FILE INSTEAD OF NODE_G1AUTHFILE SWARM KEY
|
||||||
|
|
||||||
# DOUCHETTE ES TU LA?
|
# DOUCHETTE ES TU LA?
|
||||||
if [ ! $G1TX ]; then echo "Branchez votre lecteur de QR code!"; exit; fi
|
if [ ! $G1TX ]; then echo "Branchez votre lecteur de QR code!"; exit; fi
|
||||||
|
@ -177,8 +177,8 @@ cat /dev/ttyACM0 | while read line; do
|
||||||
|
|
||||||
# Make Silkaj TX
|
# Make Silkaj TX
|
||||||
G1VAL=$(bc -l <<< "scale=2; $BVALUE / 100" | cut -d '.' -f 1)
|
G1VAL=$(bc -l <<< "scale=2; $BVALUE / 100" | cut -d '.' -f 1)
|
||||||
log "__SUB:tag_READ_X.sh: Silkaj TX $NODE_G1PRIVKEYFILE ($G1VAL) -> $CASHBACK"
|
log "__SUB:tag_READ_X.sh: Silkaj TX $NODE_G1AUTHFILE ($G1VAL) -> $CASHBACK"
|
||||||
PAY=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1PRIVKEYFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] G1Tag $RR ZEN -> G1" -y)
|
PAY=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1AUTHFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] G1Tag $RR ZEN -> G1" -y)
|
||||||
|
|
||||||
log "__SUB:tag_READ_X.sh: Silkaj output = $PAY"
|
log "__SUB:tag_READ_X.sh: Silkaj output = $PAY"
|
||||||
# Stop 1LETTER.spinner.py
|
# Stop 1LETTER.spinner.py
|
||||||
|
@ -251,8 +251,8 @@ cat /dev/ttyACM0 | while read line; do
|
||||||
COMBIENZEN=$(bc -l <<< "$COMBIEN * 100")
|
COMBIENZEN=$(bc -l <<< "$COMBIEN * 100")
|
||||||
log "__SUB:tag_READ_X.sh: Transfert de G1 Tag à G1 Tag. $COMBIEN"
|
log "__SUB:tag_READ_X.sh: Transfert de G1 Tag à G1 Tag. $COMBIEN"
|
||||||
./shell/tools/4LETTER.scroll.py "G1TAG ${FID} -> TX $COMBIENZEN ZEN *** $COMBIEN G1"
|
./shell/tools/4LETTER.scroll.py "G1TAG ${FID} -> TX $COMBIENZEN ZEN *** $COMBIEN G1"
|
||||||
log "__SUB:tag_READ_X.sh: ./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN $NODE_G1PRIVKEYFILE"
|
log "__SUB:tag_READ_X.sh: ./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN $NODE_G1AUTHFILE"
|
||||||
./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN "$NODE_G1PRIVKEYFILE"
|
./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN "$NODE_G1AUTHFILE"
|
||||||
else
|
else
|
||||||
./shell/tools/4LETTER.scroll.py "ERREUR $COMBIEN > VALEUR DE ${FID} *** ${val[1]} ZEN"
|
./shell/tools/4LETTER.scroll.py "ERREUR $COMBIEN > VALEUR DE ${FID} *** ${val[1]} ZEN"
|
||||||
fi
|
fi
|
||||||
|
@ -268,7 +268,7 @@ cat /dev/ttyACM0 | while read line; do
|
||||||
else
|
else
|
||||||
log "__SUB:tag_READ_X.sh: Transformation du G1 Tag en Rec Tag. ${val[0]} = ${val[1]}"
|
log "__SUB:tag_READ_X.sh: Transformation du G1 Tag en Rec Tag. ${val[0]} = ${val[1]}"
|
||||||
./shell/tools/4LETTER.scroll.py "TRASNFORMATION G1TAG ${val[0]} ZEN EN PASSENGER ${FID}";
|
./shell/tools/4LETTER.scroll.py "TRASNFORMATION G1TAG ${val[0]} ZEN EN PASSENGER ${FID}";
|
||||||
log "__SUB:tag_READ_X.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $NODE_G1PRIVKEYFILE)"
|
log "__SUB:tag_READ_X.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $NODE_G1AUTHFILE)"
|
||||||
fi
|
fi
|
||||||
CASHBACK=""
|
CASHBACK=""
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -2,4 +2,4 @@ SILKAJ_VERSION = "silkaj 0.5.0"
|
||||||
NO_MATCHING_ID = "No matching identity"
|
NO_MATCHING_ID = "No matching identity"
|
||||||
G1_SYMBOL = "Ğ1"
|
G1_SYMBOL = "Ğ1"
|
||||||
GTEST_SYMBOL = "ĞTest"
|
GTEST_SYMBOL = "ĞTest"
|
||||||
G1_DEFAULT_ENDPOINT = "duniter-g1.p2p.legal", "443"
|
G1_DEFAULT_ENDPOINT = "duniter.moul.re", "443"
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
toto
|