2020-03-24 15:24:16 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-03-26 12:00:09 +00:00
|
|
|
cachedUrls=$(cat ~/.cache/audit-urls 2>/dev/null)
|
2020-03-24 15:24:16 +00:00
|
|
|
localServices=$(netstat -ltpn 2>/dev/null | grep "node" | awk '{ print "http://"$4 }')
|
|
|
|
|
2020-03-26 12:00:09 +00:00
|
|
|
test -n "$localServices" && dmenUrls+="$localServices"
|
|
|
|
test -n "$cachedUrls" && dmenuUrls+="$cachedUrls"
|
|
|
|
|
2022-10-09 15:30:41 +00:00
|
|
|
url="$(echo -e "$dmenuUrls" | uniq | sort | dmenu -i "$@")"
|
2020-03-26 12:00:09 +00:00
|
|
|
|
|
|
|
if [[ -n "$url" && "$url" != "http://" && "$url" != "https://" ]]; then
|
|
|
|
rm -f "$HOME"/Downloads/lighthouse.html
|
|
|
|
env CHROME_PATH=/usr/local/bin/brave lighthouse --output-path="$HOME"/Downloads/lighthouse.html "$url"
|
|
|
|
|
|
|
|
if [ -f "$HOME"/Downloads/lighthouse.html ]; then
|
|
|
|
setsid /usr/local/bin/brave ~/Downloads/lighthouse.html
|
|
|
|
else
|
|
|
|
read -r -n 1 -p "Something went wrong. Press any key to exit."
|
|
|
|
fi
|
2020-03-24 15:24:16 +00:00
|
|
|
|
2020-03-26 12:00:09 +00:00
|
|
|
# Cache list of audit urls used with dmenu
|
|
|
|
if [[ ! $(grep "$url" ~/.cache/audit-urls) ]]; then
|
|
|
|
echo "$url" >>~/.cache/audit-urls
|
|
|
|
fi
|
2020-03-24 15:24:16 +00:00
|
|
|
|
|
|
|
fi
|