feat: Additional download mirrors

This commit is contained in:
Kroese 2024-11-24 21:37:51 +01:00 committed by GitHub
parent 216107fac1
commit 6df6fe037f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -441,17 +441,19 @@ getMG() {
local user_agent=""
user_agent=$(get_agent)
language=$(getLanguage "$lang" "name")
language=$(getLanguage "$lang" "desc")
culture=$(getLanguage "$lang" "culture")
local msg="Requesting download link from massgrave.dev..."
info "$msg" && html "$msg"
local pattern=""
local platform="x64"
local locale="${culture,,}"
local platform="${PLATFORM,,}"
local url="https://massgrave.dev/"
if [[ "${PLATFORM,,}" != "arm64" ]]; then
case "${version,,}" in
"win11${PLATFORM,,}" )
url+="windows_11_links"
@ -582,6 +584,33 @@ getMG() {
;;
esac
else
case "${version,,}" in
"win11${PLATFORM,,}" | "win11${PLATFORM,,}-enterprise" | "win11${PLATFORM,,}-enterprise-eval" )
url+="windows_arm_links"
pattern="11_business"
;;
"win11${PLATFORM,,}-ltsc" | "win11${PLATFORM,,}-enterprise-ltsc-eval" )
url+="windows_arm_links"
pattern="11_iot_enterprise_ltsc"
;;
"win10${PLATFORM,,}" | "win10${PLATFORM,,}-enterprise" | "win10${PLATFORM,,}-enterprise-eval" )
url+="windows_arm_links"
pattern="Pro_10"
locale="$language"
[[ "$locale" == "Chinese" ]] && locale="ChnSimp"
[[ "$locale" == "Chinese HK" ]] && locale="ChnTrad"
[[ "$locale" == "Chinese TW" ]] && locale="ChnTrad"
;;
"win10${PLATFORM,,}-ltsc" | "win10${PLATFORM,,}-enterprise-ltsc-eval" )
url+="windows_arm_links"
pattern="10_iot_enterprise_ltsc"
;;
esac
fi
local body=""
[[ "$DEBUG" == [Yy1]* ]] && echo "Parsing download page: ${url}"
@ -591,10 +620,10 @@ getMG() {
}
local list=""
list=$(echo "$body" | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep '\.iso$')
list=$(echo "$body" | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i '\.iso$')
local result=""
result=$(echo "$list" | grep "${platform}" | grep "${pattern}" | grep -m 1 "${locale,,}_")
result=$(echo "$list" | grep -i "${platform}" | grep "${pattern}" | grep -i -m 1 "${locale,,}_")
if [ -z "$result" ]; then
if [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-"* ]]; then