Live preview

This commit is contained in:
Kuba Orlik 2022-04-24 20:04:45 +02:00
parent 2da3ba3e63
commit ae54c490d5
5 changed files with 17 additions and 14 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash -x #!/bin/bash
INPUT="$1" INPUT="$1"
ID=$2 ID=$2
@ -10,17 +10,15 @@ unquote(){
URL=$(unquote $(echo $INPUT | jq .url)) URL=$(unquote $(echo $INPUT | jq .url))
DOMAINS=`node array-to-lines.js "$(echo $INPUT | jq .third_party_domains)"` DOMAINS=`node array-to-lines.js "$(echo $INPUT | jq .third_party_domains)"`
echo "$DOMAINS"
source ./ephemeral-x.sh source ./ephemeral-x.sh
source ./annotate_header.sh source ./annotate_header.sh
source ./utils.sh source ./utils.sh
# (while true; do (while true; do
# grab_screen_to_public $ID grab_screen_to_public $ID
# sleep 1 sleep 1
# done) & done) &
# refresher_pid=$!; refresher_pid=$!;
start_firefox start_firefox
grab start_firefox grab start_firefox
@ -36,8 +34,6 @@ grab open_network_inspector
declare -a pids; declare -a pids;
pids=() pids=()
echo DOMAINS: "$DOMAINS"
index=0 index=0
mkdir -p "/opt/static/$ID" mkdir -p "/opt/static/$ID"
@ -71,7 +67,7 @@ while IFS= read -r DOMAIN; do
done done
done <<< "$DOMAINS" done <<< "$DOMAINS"
# kill $refresher_pid; kill $refresher_pid;
echo "starting wait..." echo "starting wait..."

View File

@ -102,10 +102,9 @@ load_website(){
printf "." printf "."
scrot scrot
times=$((times + 1)) times=$((times + 1))
if [ $times -eq 60 ] if [ $times -eq 30 ]
then then
echo "Could not load website in time" echo "Could not load website in time, trying anyway"
exit 1;
break; break;
fi fi
done done

View File

@ -24,6 +24,10 @@ function attach(docker_id, output_stream) {
output_stream.push(d); output_stream.push(d);
console.log("DATA!", d.toString()); console.log("DATA!", d.toString());
}); });
task.stderr.on("data", (d) => {
/* output_stream.push(d); */
console.log("STDERR!", d.toString());
});
task.stdout.on("error", (d) => { task.stdout.on("error", (d) => {
output_stream.push(d); output_stream.push(d);
}); });

4
run.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
docker run -i -v $PWD/static:/opt/static headless-fox ./script3.sh '{"url": "pearson.pl", "third_party_domains": ["hotjar.com", "cookielaw.org"]}' 12345