Update mido.sh

This commit is contained in:
Kroese 2024-05-24 11:51:26 +02:00 committed by GitHub
parent 4a43d212f2
commit 61a53836dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,12 +40,12 @@ handle_curl_error() {
return 1 return 1
} }
browser() { get_agent() {
local user_agent local user_agent
# Determine approximate latest Firefox release # Determine approximate latest Firefox release
user_agent="$((124 + ($(date +%s) - 1710892800) / 2419200))" browser_version="$((124 + ($(date +%s) - 1710892800) / 2419200))"
echo "Mozilla/5.0 (X11; Linux x86_64; rv:${browser_version}.0) Gecko/20100101 Firefox/${browser_version}.0" echo "Mozilla/5.0 (X11; Linux x86_64; rv:${browser_version}.0) Gecko/20100101 Firefox/${browser_version}.0"
return 0 return 0
@ -73,6 +73,7 @@ download_windows() {
* ) error "Invalid VERSION specified, value \"$id\" is not recognized!" && return 1 ;; * ) error "Invalid VERSION specified, value \"$id\" is not recognized!" && return 1 ;;
esac esac
user_agent=$(get_agent)
language=$(getLanguage "$lang" "name") language=$(getLanguage "$lang" "name")
local url="https://www.microsoft.com/en-us/software-download/windows$windows_version" local url="https://www.microsoft.com/en-us/software-download/windows$windows_version"
@ -80,8 +81,6 @@ download_windows() {
8 | 10) url="${url}ISO";; 8 | 10) url="${url}ISO";;
esac esac
user_agent=$(browser)
# uuidgen: For MacOS (installed by default) and other systems (e.g. with no /proc) that don't have a kernel interface for generating random UUIDs # uuidgen: For MacOS (installed by default) and other systems (e.g. with no /proc) that don't have a kernel interface for generating random UUIDs
session_id="$(cat /proc/sys/kernel/random/uuid 2> /dev/null || uuidgen --random)" session_id="$(cat /proc/sys/kernel/random/uuid 2> /dev/null || uuidgen --random)"
@ -209,7 +208,7 @@ download_windows_eval() {
error "Invalid VERSION specified, value \"$id\" is not recognized!" && return 1 ;; error "Invalid VERSION specified, value \"$id\" is not recognized!" && return 1 ;;
esac esac
user_agent=$(browser) user_agent=$(get_agent)
culture=$(getLanguage "$lang" "culture") culture=$(getLanguage "$lang" "culture")
local country="${culture#*-}" local country="${culture#*-}"
@ -275,10 +274,10 @@ getWindows() {
"win81${PLATFORM,,}" | "win10${PLATFORM,,}" | "win11${PLATFORM,,}" ) "win81${PLATFORM,,}" | "win10${PLATFORM,,}" | "win11${PLATFORM,,}" )
download_windows "$version" "$lang" && return 0 download_windows "$version" "$lang" && return 0
;; ;;
"win11${PLATFORM,,}-enterprise-eval" ) "win11${PLATFORM,,}-enterprise"* )
download_windows_eval "$version" "$lang" && return 0 download_windows_eval "$version" "$lang" && return 0
;; ;;
"win10${PLATFORM,,}-enterprise-eval" | "win10${PLATFORM,,}-enterprise-ltsc-eval" ) "win10${PLATFORM,,}-enterprise"* )
download_windows_eval "$version" "$lang" && return 0 download_windows_eval "$version" "$lang" && return 0
;; ;;
"win2022-eval" | "win2019-eval" | "win2016-eval" | "win2012r2-eval" ) "win2022-eval" | "win2019-eval" | "win2016-eval" | "win2012r2-eval" )