forked from mirror/fake-firehose
use /data as workdir, so /config can be immutable
This commit is contained in:
parent
2901b87d87
commit
5be901062b
1 changed files with 14 additions and 14 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo > /config/urls.txt
|
echo > /data/urls.txt
|
||||||
echo > /config/hosts
|
echo > /data/hosts
|
||||||
|
|
||||||
# Get federated hosts and begin to stream them
|
# Get federated hosts and begin to stream them
|
||||||
cat /config/domains-federated | grep -v "##" | while read -r line
|
cat /config/domains-federated | grep -v "##" | while read -r line
|
||||||
|
@ -23,15 +23,15 @@ do
|
||||||
if [[ $tag != "" ]]; then
|
if [[ $tag != "" ]]; then
|
||||||
echo "[INFO] Found tag $tag"
|
echo "[INFO] Found tag $tag"
|
||||||
# Create a url to fetch for each tag
|
# Create a url to fetch for each tag
|
||||||
echo "https://$host/api/v1/streaming/hashtag?tag=$tag $host" >> /config/urls.txt
|
echo "https://$host/api/v1/streaming/hashtag?tag=$tag $host" >> /data/urls.txt
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
elif [[ "$line" != *" #"* ]]; then
|
elif [[ "$line" != *" #"* ]]; then
|
||||||
echo "[INFO] $line didn't have hashtags"
|
echo "[INFO] $line didn't have hashtags"
|
||||||
host=$line
|
host=$line
|
||||||
echo "https://$line/api/v1/streaming/public $line" >> /config/urls.txt
|
echo "https://$line/api/v1/streaming/public $line" >> /data/urls.txt
|
||||||
fi
|
fi
|
||||||
echo $host >> /config/hosts
|
echo $host >> /data/hosts
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -56,30 +56,30 @@ do
|
||||||
if [[ $tag != "" ]]; then
|
if [[ $tag != "" ]]; then
|
||||||
echo "[INFO] Found tag $tag"
|
echo "[INFO] Found tag $tag"
|
||||||
# Create a url to fetch for each tag
|
# Create a url to fetch for each tag
|
||||||
echo "https://$host/api/v1/streaming/hashtag/local?tag=$tag $host" >> /config/urls.txt
|
echo "https://$host/api/v1/streaming/hashtag/local?tag=$tag $host" >> /data/urls.txt
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
elif [[ "$line" != *" #"* ]]; then
|
elif [[ "$line" != *" #"* ]]; then
|
||||||
echo "[INFO] $line didn't have hashtags"
|
echo "[INFO] $line didn't have hashtags"
|
||||||
host=$line
|
host=$line
|
||||||
echo "https://$line/api/v1/streaming/public/local $line" >> /config/urls.txt
|
echo "https://$line/api/v1/streaming/public/local $line" >> /data/urls.txt
|
||||||
fi
|
fi
|
||||||
echo $host >> /config/hosts
|
echo $host >> /data/hosts
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
cat /config/hashtags | grep -v "##" | while read -r hashtag; do
|
cat /config/hashtags | grep -v "##" | while read -r hashtag; do
|
||||||
hashtag=`echo $hashtag | cut -d "#" -f 2`
|
hashtag=`echo $hashtag | cut -d "#" -f 2`
|
||||||
sort /config/hosts | uniq -u |while read -r host; do
|
sort /data/hosts | uniq -u |while read -r host; do
|
||||||
if [[ $hashtag != "" && "$host" != "" ]]; then
|
if [[ $hashtag != "" && "$host" != "" ]]; then
|
||||||
echo "https://$host/api/v1/streaming/hashtag?tag=$hashtag $host" >> /config/hashtag-urls.txt
|
echo "https://$host/api/v1/streaming/hashtag?tag=$hashtag $host" >> /data/hashtag-urls.txt
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
cat /config/hashtag-urls.txt >> /config/urls.txt
|
cat /data/hashtag-urls.txt >> /data/urls.txt
|
||||||
|
|
||||||
cat /config/urls.txt | while read -r url
|
cat /data/urls.txt | while read -r url
|
||||||
do
|
do
|
||||||
echo "[INFO] Opening $url to stream"
|
echo "[INFO] Opening $url to stream"
|
||||||
sleep $streamDelay
|
sleep $streamDelay
|
||||||
|
|
Loading…
Reference in a new issue