完成网络音乐、工具页面与安装器体验升级

This commit is contained in:
2026-08-18 13:54:33 +08:00
parent 337390f53e
commit 149c28082d
1082 changed files with 26442 additions and 162838 deletions
+75 -1
View File
@@ -388,6 +388,30 @@ function Find-WindowsSdkTool([string] $Name) {
($candidates | Sort-Object FullName -Descending | Select-Object -First 1).FullName
}
function Assert-PerMonitorV2Manifest([string] $Executable) {
if (-not (Test-Path -LiteralPath $Executable)) {
throw "DPI manifest validation target does not exist: $Executable"
}
$mt = Find-WindowsSdkTool 'mt.exe'
if (-not $mt) {
throw 'Windows SDK mt.exe was not found, so the PerMonitorV2 application manifest cannot be validated.'
}
$manifestPath = Join-Path ([IO.Path]::GetTempPath()) ("ymhut-dpi-{0}.manifest" -f [Guid]::NewGuid().ToString('N'))
try {
Invoke-ToolQuiet $mt @("-inputresource:$Executable;#1", "-out:$manifestPath") 'DPI manifest extraction failed'
$manifest = Get-Content -LiteralPath $manifestPath -Raw -Encoding UTF8
if ($manifest -notmatch '<dpiAwareness[^>]*>\s*PerMonitorV2\s*</dpiAwareness>' -or
$manifest -notmatch '<dpiAware[^>]*>\s*true/pm\s*</dpiAware>') {
throw "Executable is missing the required PerMonitorV2 DPI declarations: $Executable"
}
Write-Host " DPI manifest: PerMonitorV2 ($Executable)"
} finally {
Remove-Item -LiteralPath $manifestPath -Force -ErrorAction SilentlyContinue
}
}
function Find-InnoSetupCompiler {
$envCandidates = @()
if ($env:YMHUT_INNO_SETUP) {
@@ -1221,11 +1245,54 @@ function Remove-RootHelperDuplicates([string] $Directory) {
}
}
function Assert-MusicApiPayload([string] $Directory) {
$required = @(
'music-api\node.exe',
'music-api\NODE_LICENSE',
'music-api\MOEKOE_LICENSE',
'music-api\UPSTREAM_COMMIT',
'music-api\API_SUBMODULE_COMMIT',
'music-api\YMhut_PATCHES.md',
'music-api\api\ymhut-sidecar.js',
'music-api\api\server.js',
'music-api\api\package.json',
'music-api\api\pnpm-lock.yaml',
'music-api\api\LICENSE',
'music-api\api\README.md',
'music-api\api\node_modules\express\package.json'
)
$missing = $required | Where-Object { -not (Test-Path -LiteralPath (Join-Path $Directory $_) -PathType Leaf) }
if ($missing.Count -gt 0) {
throw "Release music-api payload is incomplete in '$Directory': $($missing -join ', ')"
}
}
function Assert-ToolUiPayload([string] $Directory) {
$folder = Join-Path $Directory 'Assets\data\tool-ui'
if (-not (Test-Path -LiteralPath $folder -PathType Container)) {
throw "Release tool UI payload is missing: $folder"
}
$files = @(Get-ChildItem -LiteralPath $folder -Filter '*.dat' -File -ErrorAction SilentlyContinue)
if ($files.Count -lt 202) {
throw "Release tool UI payload is incomplete in '$Directory': expected at least 202 .dat definitions, found $($files.Count)"
}
foreach ($file in $files) {
$bytes = [IO.File]::ReadAllBytes($file.FullName)
if ($bytes.Length -lt 60 -or [Text.Encoding]::ASCII.GetString($bytes, 0, 8) -ne 'YMHUTUI1' -or $bytes[8] -ne 2) {
throw "Tool UI definition has an invalid header: $($file.FullName)"
}
}
}
function Copy-PublishToLatest {
Stop-ProcessesFromDirectory $LatestRoot
Reset-DirectoryInsideRepo $LatestRoot
Copy-Item -Path (Join-Path $PublishRoot '*') -Destination $LatestRoot -Recurse -Force
Normalize-PublishLayout $LatestRoot
Assert-MusicApiPayload $LatestRoot
Assert-ToolUiPayload $LatestRoot
Write-LayoutManifests $LatestRoot
}
@@ -1245,6 +1312,9 @@ function Publish-UnpackagedApp([object] $VersionInfo) {
'-o', $PublishRoot
)
Normalize-PublishLayout $PublishRoot
Assert-MusicApiPayload $PublishRoot
Assert-ToolUiPayload $PublishRoot
Assert-PerMonitorV2Manifest (Join-Path $PublishRoot 'YMhutBox.exe')
Write-LayoutManifests $PublishRoot
Copy-PublishToLatest
}
@@ -1311,6 +1381,7 @@ function Build-InstallerBootstrap([object] $VersionInfo, [string] $SignTool) {
if ($SignTool) {
Sign-Artifact $SignTool $setupPath
}
Assert-PerMonitorV2Manifest $setupPath
Invoke-ToolQuiet $setupPath @('/SELFTEST') 'WinUI installer bootstrap self-test failed' " Installer self-test: $setupPath"
Invoke-ToolQuiet $setupPath @('/WINDOWSELFTEST') 'WinUI installer window navigation self-test failed' " Installer window self-test: $setupPath"
@@ -1430,6 +1501,9 @@ function Build-MsixPackage([object] $VersionInfo, [string] $MakeAppx, [string] $
Reset-DirectoryInsideRepo $MsixStageRoot
Copy-Item -Path (Join-Path $PublishRoot '*') -Destination $MsixStageRoot -Recurse -Force
Assert-MusicApiPayload $MsixStageRoot
Assert-ToolUiPayload $MsixStageRoot
Assert-PerMonitorV2Manifest (Join-Path $MsixStageRoot 'YMhutBox.exe')
Expand-SatelliteResourcePackages $MsixStageRoot -RemovePackages
Restore-LangResourceLayoutForMsix $MsixStageRoot
Write-AppxManifest $MsixStageRoot $VersionInfo.PackageVersion
@@ -1442,7 +1516,7 @@ function Build-MsixPackage([object] $VersionInfo, [string] $MakeAppx, [string] $
$stageAssets = Join-Path $MsixStageRoot 'Assets'
New-Directory $stageAssets
Copy-Item -LiteralPath (Join-Path $ProjectAssets '*') -Destination $stageAssets -Recurse -Force
Copy-Item -Path (Join-Path $ProjectAssets '*') -Destination $stageAssets -Recurse -Force
Repair-MsixStageThirdPartyPayloads
Invoke-ToolQuiet $MakeAppx @('pack', '/d', $MsixStageRoot, '/p', $msixPath, '/o') 'MakeAppx packaging failed' " MSIX package: $msixPath"