Files
nyaterm/.github/scripts/assert-webview2-win7-runtime.ps1
Kang bf9a8e2101 ci(scripts): add Windows 7 compatibility scripts for WebView2
- Introduced multiple PowerShell scripts to ensure compatibility of WebView2 with Windows 7, including runtime verification, installer content checks, and PE import audits.
- Added a workflow configuration for building and bundling the application specifically for Windows 7, ensuring proper handling of dependencies and runtime requirements.
- Implemented logic to prepare and validate the WebView2 fixed runtime and loader, enhancing the overall compatibility and user experience on Windows 7.
2026-08-19 18:41:27 +08:00

35 lines
1.3 KiB
PowerShell

[CmdletBinding()]
param(
[string]$RuntimeDirectory = (Join-Path $PSScriptRoot "..\..\src-tauri\webview2-fixed-runtime"),
[string]$ExpectedVersion = "109.0.1518.78"
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
if (!(Test-Path -LiteralPath $RuntimeDirectory -PathType Container)) {
throw "Expected WebView2 fixed runtime directory does not exist: $RuntimeDirectory"
}
$runtimeExe = Join-Path $RuntimeDirectory "msedgewebview2.exe"
if (!(Test-Path -LiteralPath $runtimeExe -PathType Leaf)) {
throw "Expected WebView2 runtime executable is missing: $runtimeExe"
}
$actualVersion = (Get-Item -LiteralPath $runtimeExe).VersionInfo.ProductVersion
if ($actualVersion -notlike "$ExpectedVersion*") {
throw "Unexpected WebView2 runtime version. Expected $ExpectedVersion, actual $actualVersion."
}
$signature = Get-AuthenticodeSignature -LiteralPath $runtimeExe
if ($signature.Status -ne [System.Management.Automation.SignatureStatus]::Valid -or
$null -eq $signature.SignerCertificate -or
$signature.SignerCertificate.Subject -notmatch "Microsoft Corporation") {
throw "WebView2 runtime executable is not signed by Microsoft Corporation: $runtimeExe"
}
Write-Host "WebView2 fixed runtime verified:"
Write-Host " Directory: $RuntimeDirectory"
Write-Host " Version: $actualVersion"
Write-Host " Signer: $($signature.SignerCertificate.Subject)"