23 lines
545 B
Bash
23 lines
545 B
Bash
#!/bin/bash
|
|
|
|
# shellcheck source=homepage_server-env
|
|
. "${HOME}"/"${USER}"-env
|
|
|
|
base_url=https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons
|
|
|
|
svg_url=${base_url}/svg/${1}.svg
|
|
png_url=${base_url}/png/${1}.png
|
|
|
|
if ! curl -I "${svg_url}" | grep -E "HTTP/.* 404" >/dev/null; then
|
|
curl -Ss -O --output-dir "${VOLUME_PATH}"/icons "${svg_url}"
|
|
echo "svg"
|
|
exit 0
|
|
elif ! curl -I "${png_url}" | grep -E "HTTP/.* 404" >/dev/null; then
|
|
curl -Ss -O --output-dir "${VOLUME_PATH}"/icons "${png_url}"
|
|
echo "png"
|
|
exit 0
|
|
else
|
|
echo "Not Found"
|
|
exit 1
|
|
fi
|