webPackage.nsh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. !macro downloadApplicationFiles
  2. Var /GLOBAL packageUrl
  3. Var /GLOBAL packageArch
  4. StrCpy $packageUrl "${APP_PACKAGE_URL}"
  5. StrCpy $packageArch "${APP_PACKAGE_URL}"
  6. !ifdef APP_PACKAGE_URL_IS_INCOMPLETE
  7. !ifdef APP_64_NAME
  8. !ifdef APP_32_NAME
  9. !ifdef APP_ARM64_NAME
  10. ${if} ${IsNativeARM64}
  11. StrCpy $packageUrl "$packageUrl/${APP_ARM64_NAME}"
  12. ${elseif} ${IsNativeAMD64}
  13. StrCpy $packageUrl "$packageUrl/${APP_64_NAME}"
  14. ${else}
  15. StrCpy $packageUrl "$packageUrl/${APP_32_NAME}"
  16. ${endif}
  17. !else
  18. ${if} ${IsNativeAMD64}
  19. StrCpy $packageUrl "$packageUrl/${APP_64_NAME}"
  20. ${else}
  21. StrCpy $packageUrl "$packageUrl/${APP_32_NAME}"
  22. ${endif}
  23. !endif
  24. !else
  25. StrCpy $packageUrl "$packageUrl/${APP_64_NAME}"
  26. !endif
  27. !else
  28. StrCpy $packageUrl "$packageUrl/${APP_32_NAME}"
  29. !endif
  30. !endif
  31. ${if} ${IsNativeARM64}
  32. StrCpy $packageArch "ARM64"
  33. ${elseif} ${IsNativeAMD64}
  34. StrCpy $packageArch "64"
  35. ${else}
  36. StrCpy $packageArch "32"
  37. ${endif}
  38. download:
  39. inetc::get /USERAGENT "electron-builder (Mozilla)" /HEADER "X-Arch: $packageArch" /RESUME "" "$packageUrl" "$PLUGINSDIR\package.7z" /END
  40. Pop $0
  41. ${if} $0 == "Cancelled"
  42. Quit
  43. ${endif}
  44. ${if} $0 != "OK"
  45. # try without proxy
  46. inetc::get /NOPROXY /USERAGENT "electron-builder (Mozilla)" /HEADER "X-Arch: $packageArch" /RESUME "" "$packageUrl" "$PLUGINSDIR\package.7z" /END
  47. Pop $0
  48. ${endif}
  49. ${if} $0 == "Cancelled"
  50. quit
  51. ${elseif} $0 != "OK"
  52. Messagebox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Unable to download application package from $packageUrl (status: $0).$\r$\n$\r$\nPlease check your internet connection and retry." IDRETRY download
  53. Quit
  54. ${endif}
  55. StrCpy $packageFile "$PLUGINSDIR\package.7z"
  56. !macroend