Introducing a new way to review your PRs.

Read the announcement

mustardchef / wsabuilds

Run Windows Subsystem For Android on your Windows 10 and Windows 11 PC using prebuilt binaries with Google Play Store (MindTheGapps) and/or Magisk or KernelSU (root solutions) built in.

View on GitHub

12 documents · Updated Nov 16, 2026

docs / magiskonwsa-download-discovery

MagiskOnWSA Download and Version Discovery

Overview

This flow resolves the external packages that a MagiskOnWSA build needs before the build can assemble WSA with root and optional Google apps. The covered scripts all append aria2-style download entries to a caller-provided temporary download list: each selected URL is written followed by dir=<download_dir> and out=<file_name>, so downstream build steps can fetch the files into the shared download directory without rediscovering them. The scripts are normally invoked from the MagiskOnWSA/scripts working directory; when the download directory argument is empty they write to MagiskOnWSA/download via Path.cwd().parent / "download".

Path map for this discovery area:

MagiskOnWSA/…/generateWSALinks.py accepts arch, release_type, download_dir, tempScript, and optional skip_wsa_download arguments. It maps release types (retail, RP, WIS, WIF) to display names for logging, reads an optional Microsoft account user_code from <download_dir>/.ms_account, and uses the hard-coded Microsoft Store category id 858014f3-3934-4abe-8078-4aa193e74ca8. It posts MagiskOnWSA/…/GetCookie.xml to https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx, extracts the returned EncryptedData, then posts MagiskOnWSA/…/WUIDRequest.xml with {user, cookie, category id, release_type} to the same endpoint. The response is parsed for ExtendedUpdateInfo/Updates/Update file metadata and NewUpdates/UpdateInfo update identities. For every matching file identity, the script can request a secured file URL by posting MagiskOnWSA/…/FE3FileUrl.xml to https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured with {user, UpdateID, RevisionNumber, release_type}.

The WSA script selects only the latest MicrosoftCorporationII.WindowsSubsystemForAndroid_*.msixbundle build by parsing dotted build versions from filenames and comparing them with packaging.version. It writes that bundle as wsa-<release_type>.zip unless skip_wsa_download is set. It also includes matching Microsoft.UI.Xaml..._<arch>_*.appx, Microsoft.VCLibs...UWPDesktop..._<arch>_*.appx, and Microsoft.VCLibs..._<arch>_*.appx dependencies, naming those outputs from the package identity plus architecture. URL resolution for these selected identities is threaded; each successful FileLocation/Url whose text length is not 99 is appended to the shared temp script.

MagiskOnWSA/…/generateMagiskLink.py accepts magisk_ver, download_dir, and tempScript. Empty magisk_ver defaults to stable; stable, beta, canary, and debug are resolved by downloading https://github.com/topjohnwu/magisk-files/raw/master/<channel>.json and reading magisk.link, falling back to https://fastly.jsdelivr.net/gh/topjohnwu/magisk-files@master/<channel>.json on exception. Output names are magisk-<channel>.zip. The same script also calls https://api.github.com/repos/LSPosed/WSA-Addon/releases/latest and appends the first asset whose name matches cust.img. If a token file exists in the current working directory, it is used as a GitHub bearer token for that WSA-Addon request.

MagiskOnWSA/…/generateKernelSULink.py accepts arch, download_dir, tempScript, kernelVersion, and final file_name. It maps x64 to x86_64 and arm64 to arm64, then queries https://api.github.com/repos/tiann/KernelSU/releases/tags/v2.1.2. Among zip assets matching kernel-WSA-<abi>-<kernelVersion>*.zip, it extracts the version embedded in the asset name, keeps the highest one with packaging.version, then appends that asset URL using the caller-provided output filename. It also reads and rewrites the properties file at os.environ['WSA_WORK_ENV'], setting KERNELSU_VER to the GitHub release name.

MagiskOnWSA/…/generateGappsLink.py accepts arch, download_dir, tempScript, android_api, and file_name, although the final argument is not used for the output name. It maps WSA architectures to release asset ABI names and maps Android API 30, 32, and 33 to GApps release strings 11.0, 12.1, and 13.0. It queries the latest LSPosed/WSA-Addon GitHub release, optionally authenticated by a local token file, and appends all assets matching either gapps.*<release>.*.rc or gapps.*<release>.*<abi>.*.img. The download output names remain the asset names from the release.

MagiskOnWSA/…/WSAUpdateChecker.py checks whether a GitHub Actions update branch should be refreshed. It reads GITHUB_ENV for writing workflow outputs and API_KEY for GitHub API authorization. For WSA, WSAChecker() uses the same Microsoft FE3 category id and the same MagiskOnWSA/…/GetCookie.xml and MagiskOnWSA/…/WUIDRequest.xml SOAP templates as generateWSALinks.py, but only parses the highest WSA msixbundle version; it does not request file URLs through FE3FileUrl.xml. It compares that live version against https://raw.githubusercontent.com/YT-Advanced/WSA-Script/update/<release_type>.appversion, writes the current value to ../<release_type>.appversion, and when a newer live version exists it checks out or creates the update branch, replaces the appversion file, and appends SHOULD_BUILD=yes, RELEASE_TYPE=<release_type>, and a human-readable MSG to GITHUB_ENV.

The same update checker handles Magisk and GApps via MagiskandGappsChecker(). For Magisk it compares the tracked magisk.appversion against magisk.version in https://github.com/topjohnwu/magisk-files/raw/master/stable.json. For GApps it compares gapps.appversion against the latest release name from https://api.github.com/repos/YT-Advanced/MindTheGappsBuilder/releases/latest. The checker first tries WSA stable without a user token, then Magisk, then MindTheGapps; if it can fetch a Microsoft account token from https://api.github.com/repos/bubbles-wow/MS-Account-Token/contents/token.cfg, it also checks WSA Insider Fast (WIF) with that user_code.

Coupling

Risks

  • MagiskOnWSA/…/generateWSALinks.py and MagiskOnWSA/…/WSAUpdateChecker.py disable TLS verification on their Microsoft FE3 requests.Session instances. If FE3 responses are intercepted or malformed, the scripts can write incorrect WSA download URLs or trigger a false update without certificate validation stopping the run.
  • MagiskOnWSA/…/generateWSALinks.py filters FileLocation/Url values by checking len(url) != 99. If Microsoft changes the shape or length of placeholder/error URLs, the script may accept an unusable URL or discard a valid WSA dependency URL.
  • MagiskOnWSA/…/generateKernelSULink.py assumes the GitHub API response for tiann/KernelSU includes x-ratelimit-remaining and that matching asset names contain a parseable dotted version in asset_name.split("-")[3]. A GitHub error shape or asset naming change can raise before the explicit “No KernelSU release found” path and leave the download list incomplete.
  • MagiskOnWSA/…/WSAUpdateChecker.py mutates ../<type>.appversion before it knows whether a newer version exists and shells out to git checkout -f update || git switch --discard-changes --orphan update after detecting a change. If the working directory layout or branch policy changes, this update check can overwrite the wrong relative file or discard pending changes in the workflow checkout.