diff --git a/icscheck/icscheck.conf.dist b/icscheck/icscheck.conf.dist index 36206f8..33a2db0 100644 --- a/icscheck/icscheck.conf.dist +++ b/icscheck/icscheck.conf.dist @@ -5,6 +5,7 @@ local icsconf_url="https://somethi.ng" local icsconf_output="${HOME}/my.ics" +local icsconf_useragent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0" # icsError # Called if the download from ${icsconf_url} failed diff --git a/icscheck/icscheck.sh b/icscheck/icscheck.sh index 3f44395..271770d 100755 --- a/icscheck/icscheck.sh +++ b/icscheck/icscheck.sh @@ -77,13 +77,18 @@ icscheck() { mkdir -p "${ics_temp_dir}" "${ics_store_dir}" - wget -O "$ics_down_file" "$ics_url" >/dev/null 2>&1 + curl -L "${ics_url}" -H "User-Agent: ${icsconf_useragent:?}" -o "${ics_down_file}" >/dev/null 2>&1 # -s : exists and size greater zero if [ ! -s "$ics_down_file" ] || [ ! -r "$ics_down_file" ]; then icsError exit 1 fi + # check if ics file has VEVENTs + if ! grep -qE "(BEGIN:|END:)VEVENT" "${ics_down_file}"; then + icsError + exit 1 + fi # Delete storage if manual renew is requested (( renew )) && rm -f "${ics_store_file}"