Better handling of users file
This commit is contained in:
parent
c1debe2a20
commit
9f8b5e0030
|
@ -61,15 +61,17 @@ case $sel in
|
|||
--msgbox $"The user '$TOX_USERNAME' was not found on the mesh" 8 60
|
||||
exit 2
|
||||
fi
|
||||
TOX_ID=$(cat "$USERS_FILE" | grep "$TOX_USERNAME" | head -n 1 | awk -F ' ' '{print $2}')
|
||||
if ! grep -q "$TOX_ID" $IPFS_USERS_FILE; then
|
||||
dialog --title $"Visit IPFS site" \
|
||||
--backtitle $"Freedombone mesh" \
|
||||
--msgbox $"An IPFS site was not found for the user '$TOX_USERNAME'" 8 60
|
||||
exit 3
|
||||
TOX_ID=$(cat "$USERS_FILE" | grep "$TOX_USERNAME" | head -n 1 | sed "s|$TOX_USERNAME ||g" | sed -e 's/^[[:space:]]*//')
|
||||
if [ ${#TOX_ID} -gt 5 ]; then
|
||||
if ! grep -q "$TOX_ID" $IPFS_USERS_FILE; then
|
||||
dialog --title $"Visit IPFS site" \
|
||||
--backtitle $"Freedombone mesh" \
|
||||
--msgbox $"An IPFS site was not found for the user '$TOX_USERNAME'" 8 60
|
||||
exit 3
|
||||
fi
|
||||
IPFS_FULL_URL=${IPFS_URL}/$(cat "$IPFS_USERS_FILE" | grep $TOX_ID | head -n 1 | awk -F ':' '{print $2}')
|
||||
$BROWSER $IPFS_FULL_URL
|
||||
fi
|
||||
IPFS_FULL_URL=${IPFS_URL}/$(cat "$IPFS_USERS_FILE" | grep $TOX_ID | head -n 1 | awk -F ':' '{print $2}')
|
||||
$BROWSER $IPFS_FULL_URL
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue