mirror of
https://github.com/alrayyes/dotfiles/
synced 2023-11-14 15:56:30 +00:00
Audit script now caches urls for user convenience
This commit is contained in:
parent
f18cfbcafe
commit
dff2f6cd17
@ -2,18 +2,27 @@
|
|||||||
|
|
||||||
. $HOME/.cache/wal/colors.sh
|
. $HOME/.cache/wal/colors.sh
|
||||||
|
|
||||||
|
cachedUrls=$(cat ~/.cache/audit-urls 2>/dev/null)
|
||||||
localServices=$(netstat -ltpn 2>/dev/null | grep "node" | awk '{ print "http://"$4 }')
|
localServices=$(netstat -ltpn 2>/dev/null | grep "node" | awk '{ print "http://"$4 }')
|
||||||
url="$(echo -e "$localServices\nOther" | dmenu -i -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15" "$@")"
|
|
||||||
|
|
||||||
if [ "$url" == "Other" ]; then
|
test -n "$localServices" && dmenUrls+="$localServices"
|
||||||
read -r -p "Url: " url
|
test -n "$cachedUrls" && dmenuUrls+="$cachedUrls"
|
||||||
fi
|
|
||||||
|
url="$(echo -e "$dmenuUrls" | uniq | sort | dmenu -i -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15" "$@")"
|
||||||
rm -f "$HOME"/Downloads/lighthouse.html
|
|
||||||
env CHROME_PATH=/usr/local/bin/brave lighthouse --output-path="$HOME"/Downloads/lighthouse.html "$url"
|
if [[ -n "$url" && "$url" != "http://" && "$url" != "https://" ]]; then
|
||||||
|
rm -f "$HOME"/Downloads/lighthouse.html
|
||||||
if [ -f "$HOME"/Downloads/lighthouse.html ]; then
|
env CHROME_PATH=/usr/local/bin/brave lighthouse --output-path="$HOME"/Downloads/lighthouse.html "$url"
|
||||||
setsid /usr/local/bin/brave ~/Downloads/lighthouse.html
|
|
||||||
else
|
if [ -f "$HOME"/Downloads/lighthouse.html ]; then
|
||||||
read -r -n 1 -p "Something went wrong. Press any key to exit."
|
setsid /usr/local/bin/brave ~/Downloads/lighthouse.html
|
||||||
|
else
|
||||||
|
read -r -n 1 -p "Something went wrong. Press any key to exit."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Cache list of audit urls used with dmenu
|
||||||
|
if [[ ! $(grep "$url" ~/.cache/audit-urls) ]]; then
|
||||||
|
echo "$url" >>~/.cache/audit-urls
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user