screenshot-service/Docker/bloater.sh

36 lines
934 B
Bash
Raw Normal View History

2022-07-31 12:19:32 +02:00
#!/bin/bash
BLOATING_DOMAINS=$(cat bloating-domains.txt)
bloat_firefox(){
if [ "$#" = 0 ]; then
echo "Bloating Firefox by bloating defined domain list..."
DOMAINS=$(printf '%s\n' "${BLOATING_DOMAINS[@]}")
else
echo "Bloating Firefox by requested domain list..."
2022-09-12 09:50:13 +02:00
DOMAINS=`node filter-requested-domains.js "$1"`
2022-07-31 12:19:32 +02:00
echo "selected domains"
echo $DOMAINS
fi
if [ -n "$DOMAINS" ]; then
while IFS= read -r DOMAIN; do
# these domains return a 404 anyways, no need to waste time on them:
if is_http_error "$DOMAIN"; then echo "skipping $DOMAIN"; continue; fi
load_website "$DOMAIN?hl=pl" "$DOMAIN"
sleep 1 # sometimes the consent popup needs a little time
open_console
grab "$DOMAIN before"
(tr '\n' ' ' < click-accept-all.js) | xclip -sel clip
keycombo Control_L v
sleep 0.3
xdotool key Return
sleep 1.5
grab "$DOMAIN after"
done <<< "$DOMAINS"
else
2022-08-16 12:42:21 +02:00
echo "No need to bloat"
2022-07-31 12:19:32 +02:00
fi
}