feat: Refactor download code
This commit is contained in:
parent
2b202ef9e0
commit
19f954e891
1 changed files with 5 additions and 34 deletions
|
|
@ -140,37 +140,6 @@ switchEdition() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
getCatalog() {
|
|
||||||
|
|
||||||
local id="$1"
|
|
||||||
local ret="$2"
|
|
||||||
local url=""
|
|
||||||
local name=""
|
|
||||||
local edition=""
|
|
||||||
|
|
||||||
case "${id,,}" in
|
|
||||||
"win11${PLATFORM,,}" )
|
|
||||||
edition="Professional"
|
|
||||||
name="Windows 11 Pro"
|
|
||||||
url="https://go.microsoft.com/fwlink?linkid=2156292"
|
|
||||||
;;
|
|
||||||
"win10${PLATFORM,,}" )
|
|
||||||
edition="Professional"
|
|
||||||
name="Windows 10 Pro"
|
|
||||||
url="https://go.microsoft.com/fwlink/?LinkId=841361"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "${ret,,}" in
|
|
||||||
"url" ) echo "$url" ;;
|
|
||||||
"name" ) echo "$name" ;;
|
|
||||||
"edition" ) echo "$edition" ;;
|
|
||||||
*) echo "";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
getLink1() {
|
getLink1() {
|
||||||
|
|
||||||
# Fallbacks for users who cannot connect to the Microsoft servers
|
# Fallbacks for users who cannot connect to the Microsoft servers
|
||||||
|
|
@ -286,10 +255,12 @@ isMido() {
|
||||||
isESD() {
|
isESD() {
|
||||||
|
|
||||||
local id="$1"
|
local id="$1"
|
||||||
local url
|
|
||||||
|
|
||||||
url=$(getCatalog "$id" "url")
|
case "${id,,}" in
|
||||||
[ -n "$url" ] && return 0
|
"win11${PLATFORM,,}" | "win10${PLATFORM,,}" )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue