-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathunfollow
executable file
·37 lines (31 loc) · 945 Bytes
/
unfollow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash -x
# Request an unfollow from the target
IFS=""
hostname=$(cat config/hostname):$(cat config/port)
key=$(curl -s ${1}/unfollow?url=http://${hostname})
. scripts/functions
gpg=$(findGPG)
if grep ${1} data/following 2> /dev/null; then
email=$(echo $key \
| $gpg --with-colons 2> /dev/null \
| grep ^uid \
| cut -d '<' -f 2 \
| tr -d '>:')
keyid=$(echo $key \
| $gpg --with-colons --with-fingerprint 2> /dev/null \
| grep -E "^fpr"\
| tr -d 'fpr:::::::::');
if [[ ${email} != "" && ${keyid} != "" ]]; then
tmp=$(mktemp)
grep -v "${email} ${1} ${keyid}" data/following > ${tmp}
mv ${tmp} data/following
scripts/gen
exit 0
else
echo "Error removing following for ${1}"
exit 1
fi
else
echo "Not following ${1}"
exit 1
fi