mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 15:44:25 +08:00
fix.调整了OOBE流程,修复了启动器打包问题
This commit is contained in:
51
.github/workflows/installer-build.yml
vendored
51
.github/workflows/installer-build.yml
vendored
@@ -20,6 +20,8 @@ on:
|
||||
env:
|
||||
DOTNET_VERSION: '10.0.x'
|
||||
INSTALLER_PROJECT: LanDesktopPLONDS.installer/LanDesktopPLONDS.installer.csproj
|
||||
INSTALLER_RUNTIME: win-x64
|
||||
INSTALLER_ARTIFACT_DIR: artifacts/installer-online/win-x64
|
||||
DOTNET_gcServer: 1
|
||||
|
||||
jobs:
|
||||
@@ -49,3 +51,52 @@ jobs:
|
||||
|
||||
- name: Build installer
|
||||
run: dotnet build ${{ env.INSTALLER_PROJECT }} --no-restore -c ${{ matrix.configuration }} -v minimal
|
||||
|
||||
- name: Publish online installer artifact payload
|
||||
if: matrix.configuration == 'Release'
|
||||
shell: pwsh
|
||||
run: |
|
||||
$publishDir = Join-Path $env:GITHUB_WORKSPACE '${{ env.INSTALLER_ARTIFACT_DIR }}'
|
||||
if (Test-Path $publishDir) {
|
||||
Remove-Item -LiteralPath $publishDir -Recurse -Force
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path $publishDir -Force | Out-Null
|
||||
|
||||
dotnet restore '${{ env.INSTALLER_PROJECT }}' -r '${{ env.INSTALLER_RUNTIME }}'
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Online installer runtime restore failed with exit code $LASTEXITCODE."
|
||||
}
|
||||
|
||||
dotnet publish '${{ env.INSTALLER_PROJECT }}' `
|
||||
--no-restore `
|
||||
-c '${{ matrix.configuration }}' `
|
||||
-r '${{ env.INSTALLER_RUNTIME }}' `
|
||||
-p:PublishAot=true `
|
||||
-p:UseAppHost=true `
|
||||
-o $publishDir `
|
||||
-v minimal
|
||||
|
||||
$installerExe = Join-Path $publishDir 'LanDesktopPLONDS.installer.exe'
|
||||
if (-not (Test-Path $installerExe)) {
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Online installer publish failed with exit code $LASTEXITCODE and did not produce $installerExe."
|
||||
}
|
||||
|
||||
throw "Expected online installer executable was not produced: $installerExe"
|
||||
}
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Warning "dotnet publish exited with $LASTEXITCODE after producing the installer artifact."
|
||||
}
|
||||
|
||||
Get-ChildItem -Path $publishDir -File -Filter 'LanDesktopPLONDS.installer*' |
|
||||
Select-Object Name, Length
|
||||
|
||||
- name: Upload online installer artifact
|
||||
if: matrix.configuration == 'Release'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: LanDesktopPLONDS-online-installer-${{ env.INSTALLER_RUNTIME }}
|
||||
path: ${{ env.INSTALLER_ARTIFACT_DIR }}/**
|
||||
if-no-files-found: error
|
||||
|
||||
@@ -503,26 +503,6 @@ public partial class OobeWindow : Window
|
||||
await NavigateToStep(5);
|
||||
}
|
||||
|
||||
private void SaveOobeStartupPresentation()
|
||||
{
|
||||
try
|
||||
{
|
||||
var choices = CollectOobeStartupChoices();
|
||||
var path = HostAppSettingsOobeMerger.GetSettingsFilePath(_resolver.ResolveDataRoot());
|
||||
HostAppSettingsOobeMerger.MergeStartupPresentation(path, choices);
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
_ = new LauncherWindowsStartupService().SetEnabled(choices.AutoStartWithWindows);
|
||||
}
|
||||
|
||||
Logger.Info($"[OobeWindow] 启动与展示已写入 '{path}'.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Warn($"[OobeWindow] 启动与展示保存失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshOobeStartupPresentationFromDisk()
|
||||
{
|
||||
var path = HostAppSettingsOobeMerger.GetSettingsFilePath(ResolveSelectedDataRoot());
|
||||
@@ -1039,44 +1019,6 @@ public partial class OobeWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
private void SavePrivacySettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
var crashTelemetryEnabled = this.FindControl<ToggleSwitch>("CrashTelemetryToggle")?.IsChecked ?? true;
|
||||
var usageTelemetryEnabled = this.FindControl<ToggleSwitch>("UsageTelemetryToggle")?.IsChecked ?? true;
|
||||
var telemetryId = this.FindControl<TextBox>("TelemetryIdTextBox")?.Text ?? Guid.NewGuid().ToString("N");
|
||||
|
||||
// 保存到启动器配置
|
||||
var privacyConfig = new PrivacyConfig
|
||||
{
|
||||
CrashTelemetryEnabled = crashTelemetryEnabled,
|
||||
UsageTelemetryEnabled = usageTelemetryEnabled,
|
||||
TelemetryId = telemetryId
|
||||
};
|
||||
|
||||
var configPath = Path.Combine(_resolver.ResolveLauncherDataPath(), "privacy-config.json");
|
||||
var json = System.Text.Json.JsonSerializer.Serialize(privacyConfig, AppJsonContext.Default.PrivacyConfig);
|
||||
File.WriteAllText(configPath, json);
|
||||
|
||||
// 保存隐私协议同意状态(带防篡改保护)
|
||||
var agreementService = new PrivacyAgreementService(_resolver.ResolveLauncherDataPath());
|
||||
var isAgreed = this.FindControl<CheckBox>("PrivacyAgreementCheckBox")?.IsChecked ?? false;
|
||||
|
||||
// 生成用户ID和设备ID
|
||||
var userId = telemetryId;
|
||||
var deviceId = GetDeviceIdentifier();
|
||||
|
||||
agreementService.SaveAgreement(isAgreed, userId, deviceId);
|
||||
|
||||
Logger.Info($"[OobeWindow] 隐私设置已保存: Crash={crashTelemetryEnabled}, Usage={usageTelemetryEnabled}, Agreement={isAgreed}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Warn($"[OobeWindow] 保存隐私设置失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备标识符
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user