Skip to content

feat: add startup update checker using HMBSbige.UpdateChecker#307

Merged
HMBSbige merged 4 commits intomasterfrom
copilot/add-update-check-on-startup
Mar 2, 2026
Merged

feat: add startup update checker using HMBSbige.UpdateChecker#307
HMBSbige merged 4 commits intomasterfrom
copilot/add-update-check-on-startup

Conversation

Copy link
Contributor

Copilot AI commented Mar 1, 2026

Adds automatic update checking on startup with configurable settings, using HMBSbige.UpdateChecker to query GitHub Releases.

Contract & Service Layer

  • IUpdateAppService in Application.Contracts with CheckForUpdateAsync(bool includePreRelease, CancellationToken)
  • UpdateAppService implementation using GitHubReleasesUpdateChecker and IHttpClientFactory (consistent with StunServerListAppService)
  • 15s HTTP timeout; tag-to-version strips v prefix

Configuration

  • AppConfig extended with AutoCheckUpdate (default: true), CheckUpdateInterval (default: 1h), IncludePreRelease (default: false), LastUpdateCheckTime (DateTimeOffset? for timezone correctness)
  • Settings persisted via existing IAppConfigManager reactive pipeline

ViewModel

  • SettingsViewModel: new reactive properties, CheckUpdateCommand, CheckForUpdateOnStartupAsync with interval gating
  • MainWindowViewModel.InitializeAsync: fires startup check via Task.Run to avoid blocking UI
  • Silent mode: startup check swallows exceptions and skips "no update" notification; manual check shows both outcomes

View

  • Update section at top of Settings tab: version display, check/homepage buttons, auto-check toggle, interval input, pre-release toggle
  • Localization strings added for both en and zh-Hans
// Startup check — runs on background thread, respects interval
_ = Task.Run(() => SettingsViewModel.CheckForUpdateOnStartupAsync(config, cancellationToken), cancellationToken);

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 1.1.1.1
    • Triggering command: REDACTED, pid is -1 (packet block)
    • Triggering command: /home/REDACTED/work/NatTypeTester/NatTypeTester/tests/UnitTest/bin/Debug/net10.0/UnitTest /home/REDACTED/work/NatTypeTester/NatTypeTester/tests/UnitTest/bin/Debug/net10.0/UnitTest @@ /tmp/tmpPVfC4W.tmp -collect-logs (packet block)
  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)
  • stun.hot-chilli.net
    • Triggering command: /home/REDACTED/work/NatTypeTester/NatTypeTester/tests/UnitTest/bin/Debug/net10.0/UnitTest /home/REDACTED/work/NatTypeTester/NatTypeTester/tests/UnitTest/bin/Debug/net10.0/UnitTest @@ /tmp/tmpPVfC4W.tmp -collect-logs (dns block)
  • www.nuget.org
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>feat: 新增启动时检查更新</issue_title>
<issue_description>- 设置增加检查更新按钮、用于跳转到主页的按钮、显示当前版本、现在最新版本

  • 设置增加检查更新相关的3个选项:启动时自动检查更新(默认开启),启动时自动检查更新间隔(默认1小时,避免频繁启动时重复检查),检查 prerelease 更新(默认不开启)
  • 使用 HMBSbige.UpdateChecker
  • 检查更新结果用已有的 INotificationService 通知,其中如果是启动时检查更新无更新时不通知
  • 定义 IUpdateService 在 Application.Contracts 层
  • 实现 UpdateService 在 Application;HttpClient 的创建应与现有的 StunServerListAppService.CreateHttpClient复用

注意:

  • 网络异常处理: 网络请求设置合理超时,异常不应影响应用正常使用
  • 时间存储: LastUpdateCheckTime 使用 DateTimeOffset 以正确处理时区
  • 线程安全: 配置读取和更新检查应在后台线程执行,避免阻塞 UI</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add update checking feature on application launch feat: add startup update checker using HMBSbige.UpdateChecker Mar 1, 2026
Add automatic update checking functionality with the following features:
- Check for updates on application startup with configurable interval
- Manual update check button in settings
- Support for pre-release versions
- Proxy support for update checks
- Localized UI for both English and Chinese
- Display current and latest version information
@HMBSbige HMBSbige force-pushed the copilot/add-update-check-on-startup branch from 60d4e72 to 6a557b7 Compare March 2, 2026 06:12
HMBSbige added 3 commits March 2, 2026 17:26
- Use ReactiveUI WhenActivated pattern instead of Task.Run for startup update check
- Add proper error handling with RxState.DefaultExceptionHandler
- Improve SettingsView UI with bordered sections and better spacing
- Optimize update check interval control layout
- Add DEBUG notification for update check on startup
@HMBSbige HMBSbige marked this pull request as ready for review March 2, 2026 16:25
@HMBSbige HMBSbige merged commit bb8f276 into master Mar 2, 2026
10 checks passed
@HMBSbige HMBSbige deleted the copilot/add-update-check-on-startup branch March 2, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 新增启动时检查更新

2 participants