PasteFerry (隔空贴): clipboard and file sync across macOS, Windows and Linux. Direct-first, end-to-end encrypted. Optional official access: no server to host. Independent self-hosting remains available.
Dart airdrop-alternativeclipboardclipboard-sharingclipboard-synccopy-pastecross-platformend-to-end-encryptionfile-syncfile-transferfluttergolanglinuxmacosnat-traversalp2pself-hostedtailscaleuniversal-clipboardwebrtcwindows
feat(ui): check for updates and update from the app
baiyuzee29107632d8b
diff --git a/ui/lib/app_state.dart b/ui/lib/app_state.dartindex 8105a1f..d36334e 100644--- a/ui/lib/app_state.dart+++ b/ui/lib/app_state.dart@@ -1,4 +1,5 @@import 'dart:async';+import 'dart:io' show pid;import 'package:flutter/foundation.dart';import 'package:grpc/grpc.dart';@@ -526,6 +527,38 @@ class AppState extends ChangeNotifier {notifyListeners();}+ // ─────────────────────────── 更新 ───────────────────────────++ /// 自动检查发现、要在侧边栏提示的新版本;空字符串表示没有。+ String get updateAvailable => _status?.updateAvailable ?? '';++ /// 刚完成的那次自动更新,后台服务过一会儿就不再带。+ UpdateResult? get lastUpdate =>+ _status?.hasLastUpdate() == true ? _status!.lastUpdate : null;++ bool get autoCheckUpdates => !(_config?.updateCheckDisabled ?? false);++ /// [language] 是更新日志的语言,见 [settingFromLocale]。+ Future<UpdateInfo> checkForUpdate(String language) =>+ _client.checkForUpdate(CheckForUpdateRequest(language: language));++ /// 下载并校验新版本。取消订阅即停止下载。+ Stream<UpdateProgress> downloadUpdate(String version) =>+ _client.downloadUpdate(DownloadUpdateRequest(version: version));++ /// 让后台服务启动更新助手。返回后界面要立即退出,助手等它退出后替换文件并重新打开。+ Future<void> installUpdate(String version) async {+ await _client.installUpdate(+ InstallUpdateRequest(version: version, uiPid: pid),+ );+ }++ Future<void> skipUpdate(String version) =>+ updateConfig(config!.deepCopy()..updateSkipVersion = version);++ Future<void> setAutoCheckUpdates(bool on) =>+ updateConfig(config!.deepCopy()..updateCheckDisabled = !on);+// ─────────────────────────── 反馈问题 ───────────────────────────/// 反馈问题用的诊断报告,由后台服务生成并脱敏,带上最近 [logLines] 行日志。diff --git a/ui/lib/i18n.dart b/ui/lib/i18n.dartindex 726fb58..521e6a5 100644--- a/ui/lib/i18n.dart+++ b/ui/lib/i18n.dart@@ -51,3 +51,22 @@ AppLocalizations appL10n = lookupAppLocalizations(resolveLocale(PlatformDispatchextension L10nContext on BuildContext {AppLocalizations get l10n => AppLocalizations.of(this);}++/// 界面语言 → Config.language 的写法,也是更新日志的语言代码。+String settingFromLocale(Locale l) {+ if (l.languageCode == 'zh') {+ if (l.countryCode == 'HK' || l.countryCode == 'MO') return 'zh-Hant-HK';+ if (l.scriptCode == 'Hant' || l.countryCode == 'TW') return 'zh-Hant-TW';+ return 'zh-Hans';+ }+ return l.languageCode == 'ja' ? 'ja' : 'en';+}++/// 官网下载页,按界面语言。中文页面上有 Gitee 国内镜像。+String downloadPageUrl(Locale l) => switch (settingFromLocale(l)) {+ 'zh-Hans' => 'https://pasteferry.cc/download/',+ 'zh-Hant-TW' => 'https://pasteferry.cc/zh-tw/download/',+ 'zh-Hant-HK' => 'https://pasteferry.cc/zh-hk/download/',+ 'ja' => 'https://pasteferry.cc/ja/download/',+ _ => 'https://pasteferry.cc/en/download/',+ };diff --git a/ui/lib/icons.dart b/ui/lib/icons.dartindex 45c7cbe..b3387df 100644--- a/ui/lib/icons.dart+++ b/ui/lib/icons.dart@@ -22,6 +22,8 @@ abstract final class AppIcons {_pick(CupertinoIcons.checkmark_circle, FluentIcons.checkmark_circle_24_regular);static IconData get xmark => _pick(CupertinoIcons.xmark, FluentIcons.dismiss_24_regular);static IconData get search => _pick(CupertinoIcons.search, FluentIcons.search_24_regular);+ static IconData get arrowDownCircle =>+ _pick(CupertinoIcons.arrow_down_circle, FluentIcons.arrow_circle_down_24_regular);static IconData get arrowClockwise =>_pick(CupertinoIcons.arrow_clockwise, FluentIcons.arrow_clockwise_24_regular);// 搜索框里的清除按钮:实心圆里一个叉,与系统的搜索框一致diff --git a/ui/lib/l10n/app_en.arb b/ui/lib/l10n/app_en.arbindex 9655451..0d39948 100644--- a/ui/lib/l10n/app_en.arb+++ b/ui/lib/l10n/app_en.arb@@ -541,6 +541,97 @@"officialDeviceID": "Device ID","officialWarning": "90% of the daily relay allowance has been used. Direct connections do not consume it.","officialAccounting": "Upload and download combined, including encryption overhead. Only official relay usage is measured; direct content and traffic are not recorded.",+ "updateCheck": "Check for updates",+ "updateCheckEllipsis": "Check for updates…",+ "updateAuto": "Check for updates automatically",+ "updateAutoDesc": "Once a day. Only reads the update list on GitHub and Gitee; nothing that identifies you is sent.",+ "updateChecking": "Checking for updates…",+ "updateUpToDate": "PasteFerry {version} is the latest version.",+ "@updateUpToDate": {+ "placeholders": {+ "version": {+ "type": "String"+ }+ }+ },+ "updateAvailableTitle": "PasteFerry {version} is available",+ "@updateAvailableTitle": {+ "placeholders": {+ "version": {+ "type": "String"+ }+ }+ },+ "updateCurrentSize": "You have {current}. Download size {size}.",+ "@updateCurrentSize": {+ "placeholders": {+ "current": {+ "type": "String"+ },+ "size": {+ "type": "String"+ }+ }+ },+ "updateNew": "New",+ "updateFixed": "Fixed",+ "updateSkip": "Skip this version",+ "updateLater": "Later",+ "updateInstall": "Download and install",+ "updateDownloading": "Downloading {done} of {total}",+ "@updateDownloading": {+ "placeholders": {+ "done": {+ "type": "String"+ },+ "total": {+ "type": "String"+ }+ }+ },+ "updateVerifying": "Checking the download…",+ "updateInstalling": "Installing. PasteFerry will reopen by itself.",+ "updateInstallingPassword": "Installing. Your system will ask for your password, because /opt needs administrator rights; PasteFerry then reopens by itself.",+ "updateCheckFailed": "Couldn't reach GitHub or Gitee. Try again later.",+ "updateDownloadFailed": "The download didn't finish. Try again, or download the new version from the website.",+ "updateInstallFailed": "Couldn't start the installation: {error}",+ "@updateInstallFailed": {+ "placeholders": {+ "error": {+ "type": "String"+ }+ }+ },+ "updateUnsupportedBuild": "This build can't check for updates.",+ "updateBlockedDev": "This is a development build, so it can't update itself.",+ "updateBlockedMustMove": "PasteFerry is running from the disk image. Drag it to Applications and open it from there to update automatically.",+ "updateBlockedReadOnly": "PasteFerry can't write to the folder it is installed in. Download the new version from the website instead.",+ "updateBlockedUnsupported": "There is no automatic update for this computer. Download the new version from the website.",+ "updateOpenDownload": "Open download page",+ "updateSidebar": "Version {version} is available",+ "@updateSidebar": {+ "placeholders": {+ "version": {+ "type": "String"+ }+ }+ },+ "updatedTo": "Updated to {version}",+ "@updatedTo": {+ "placeholders": {+ "version": {+ "type": "String"+ }+ }+ },+ "updateNotFinished": "The update didn't finish. You're still on {version}.",+ "@updateNotFinished": {+ "placeholders": {+ "version": {+ "type": "String"+ }+ }+ },"buildDetails": "UI {uiVersion} · Service {serviceVersion} · Build {build}","@buildDetails": {"placeholders": {diff --git a/ui/lib/l10n/app_ja.arb b/ui/lib/l10n/app_ja.arbindex 13db5ef..3d8f9ae 100644--- a/ui/lib/l10n/app_ja.arb+++ b/ui/lib/l10n/app_ja.arb@@ -274,6 +274,35 @@"officialDeviceID": "端末 ID","officialWarning": "本日の中継上限の90%を使用しました。直接接続ではこの残量は消費しません。","officialAccounting": "暗号化の通信量を含む送受信の合計です。公式中継のみ計測し、直接接続の内容や通信量は記録しません。",+ "updateCheck": "アップデートを確認",+ "updateCheckEllipsis": "アップデートを確認…",+ "updateAuto": "アップデートを自動で確認",+ "updateAutoDesc": "1 日 1 回、GitHub と Gitee のアップデート一覧を読むだけで、あなたを識別できる情報は送信しません。",+ "updateChecking": "アップデートを確認しています…",+ "updateUpToDate": "PasteFerry {version} は最新バージョンです。",+ "updateAvailableTitle": "PasteFerry {version} があります",+ "updateCurrentSize": "現在のバージョンは {current}、ダウンロードは {size} です。",+ "updateNew": "新機能",+ "updateFixed": "修正",+ "updateSkip": "このバージョンをスキップ",+ "updateLater": "後で",+ "updateInstall": "ダウンロードしてインストール",+ "updateDownloading": "ダウンロード中 {done} / {total}",+ "updateVerifying": "ダウンロードしたファイルを検証しています…",+ "updateInstalling": "インストールしています。PasteFerry は自動的に再び開きます。",+ "updateInstallingPassword": "インストールしています。/opt には管理者権限が必要なため、システムがパスワードを求めます。その後 PasteFerry は自動的に再び開きます。",+ "updateCheckFailed": "GitHub と Gitee に接続できません。しばらくしてからもう一度お試しください。",+ "updateDownloadFailed": "ダウンロードが完了しませんでした。もう一度試すか、ウェブサイトから新しいバージョンをダウンロードしてください。",+ "updateInstallFailed": "インストールを開始できませんでした:{error}",+ "updateUnsupportedBuild": "このビルドはアップデートを確認できません。",+ "updateBlockedDev": "開発ビルドのため、自動アップデートできません。",+ "updateBlockedMustMove": "PasteFerry をディスクイメージから直接開いています。「アプリケーション」フォルダにドラッグし、そこから開くと自動アップデートできます。",+ "updateBlockedReadOnly": "PasteFerry のインストール先フォルダに書き込めないため、自動アップデートできません。ウェブサイトから新しいバージョンをダウンロードしてください。",+ "updateBlockedUnsupported": "このコンピュータ用の自動アップデートはありません。ウェブサイトから新しいバージョンをダウンロードしてください。",+ "updateOpenDownload": "ダウンロードページを開く",+ "updateSidebar": "バージョン {version} があります",+ "updatedTo": "{version} にアップデートしました",+ "updateNotFinished": "アップデートが完了しませんでした。{version} のままです。","buildDetails": "UI {uiVersion} · サービス {serviceVersion} · ビルド {build}","notReceived": "未受信 — ペーストする前に受信してください","receivedPreserved": "受信済み。クリップボードに入れるとペーストできます",diff --git a/ui/lib/l10n/app_localizations.dart b/ui/lib/l10n/app_localizations.dartindex 07f4db3..5574e43 100644--- a/ui/lib/l10n/app_localizations.dart+++ b/ui/lib/l10n/app_localizations.dart@@ -1754,6 +1754,180 @@ abstract class AppLocalizations {/// **'Upload and download combined, including encryption overhead. Only official relay usage is measured; direct content and traffic are not recorded.'**String get officialAccounting;+ /// No description provided for @updateCheck.+ ///+ /// In en, this message translates to:+ /// **'Check for updates'**+ String get updateCheck;++ /// No description provided for @updateCheckEllipsis.+ ///+ /// In en, this message translates to:+ /// **'Check for updates…'**+ String get updateCheckEllipsis;++ /// No description provided for @updateAuto.+ ///+ /// In en, this message translates to:+ /// **'Check for updates automatically'**+ String get updateAuto;++ /// No description provided for @updateAutoDesc.+ ///+ /// In en, this message translates to:+ /// **'Once a day. Only reads the update list on GitHub and Gitee; nothing that identifies you is sent.'**+ String get updateAutoDesc;++ /// No description provided for @updateChecking.+ ///+ /// In en, this message translates to:+ /// **'Checking for updates…'**+ String get updateChecking;++ /// No description provided for @updateUpToDate.+ ///+ /// In en, this message translates to:+ /// **'PasteFerry {version} is the latest version.'**+ String updateUpToDate(String version);++ /// No description provided for @updateAvailableTitle.+ ///+ /// In en, this message translates to:+ /// **'PasteFerry {version} is available'**+ String updateAvailableTitle(String version);++ /// No description provided for @updateCurrentSize.+ ///+ /// In en, this message translates to:+ /// **'You have {current}. Download size {size}.'**+ String updateCurrentSize(String current, String size);++ /// No description provided for @updateNew.+ ///+ /// In en, this message translates to:+ /// **'New'**+ String get updateNew;++ /// No description provided for @updateFixed.+ ///+ /// In en, this message translates to:+ /// **'Fixed'**+ String get updateFixed;++ /// No description provided for @updateSkip.+ ///+ /// In en, this message translates to:+ /// **'Skip this version'**+ String get updateSkip;++ /// No description provided for @updateLater.+ ///+ /// In en, this message translates to:+ /// **'Later'**+ String get updateLater;++ /// No description provided for @updateInstall.+ ///+ /// In en, this message translates to:+ /// **'Download and install'**+ String get updateInstall;++ /// No description provided for @updateDownloading.+ ///+ /// In en, this message translates to:+ /// **'Downloading {done} of {total}'**+ String updateDownloading(String done, String total);++ /// No description provided for @updateVerifying.+ ///+ /// In en, this message translates to:+ /// **'Checking the download…'**+ String get updateVerifying;++ /// No description provided for @updateInstalling.+ ///+ /// In en, this message translates to:+ /// **'Installing. PasteFerry will reopen by itself.'**+ String get updateInstalling;++ /// No description provided for @updateInstallingPassword.+ ///+ /// In en, this message translates to:+ /// **'Installing. Your system will ask for your password, because /opt needs administrator rights; PasteFerry then reopens by itself.'**+ String get updateInstallingPassword;++ /// No description provided for @updateCheckFailed.+ ///+ /// In en, this message translates to:+ /// **'Couldn\'t reach GitHub or Gitee. Try again later.'**+ String get updateCheckFailed;++ /// No description provided for @updateDownloadFailed.+ ///+ /// In en, this message translates to:+ /// **'The download didn\'t finish. Try again, or download the new version from the website.'**+ String get updateDownloadFailed;++ /// No description provided for @updateInstallFailed.+ ///+ /// In en, this message translates to:+ /// **'Couldn\'t start the installation: {error}'**+ String updateInstallFailed(String error);++ /// No description provided for @updateUnsupportedBuild.+ ///+ /// In en, this message translates to:+ /// **'This build can\'t check for updates.'**+ String get updateUnsupportedBuild;++ /// No description provided for @updateBlockedDev.+ ///+ /// In en, this message translates to:+ /// **'This is a development build, so it can\'t update itself.'**+ String get updateBlockedDev;++ /// No description provided for @updateBlockedMustMove.+ ///+ /// In en, this message translates to:+ /// **'PasteFerry is running from the disk image. Drag it to Applications and open it from there to update automatically.'**+ String get updateBlockedMustMove;++ /// No description provided for @updateBlockedReadOnly.+ ///+ /// In en, this message translates to:+ /// **'PasteFerry can\'t write to the folder it is installed in. Download the new version from the website instead.'**+ String get updateBlockedReadOnly;++ /// No description provided for @updateBlockedUnsupported.+ ///+ /// In en, this message translates to:+ /// **'There is no automatic update for this computer. Download the new version from the website.'**+ String get updateBlockedUnsupported;++ /// No description provided for @updateOpenDownload.+ ///+ /// In en, this message translates to:+ /// **'Open download page'**+ String get updateOpenDownload;++ /// No description provided for @updateSidebar.+ ///+ /// In en, this message translates to:+ /// **'Version {version} is available'**+ String updateSidebar(String version);++ /// No description provided for @updatedTo.+ ///+ /// In en, this message translates to:+ /// **'Updated to {version}'**+ String updatedTo(String version);++ /// No description provided for @updateNotFinished.+ ///+ /// In en, this message translates to:+ /// **'The update didn\'t finish. You\'re still on {version}.'**+ String updateNotFinished(String version);+/// No description provided for @buildDetails.////// In en, this message translates to:diff --git a/ui/lib/l10n/app_localizations_en.dart b/ui/lib/l10n/app_localizations_en.dartindex dae9c81..eddb0b3 100644--- a/ui/lib/l10n/app_localizations_en.dart+++ b/ui/lib/l10n/app_localizations_en.dart@@ -1012,6 +1012,118 @@ class AppLocalizationsEn extends AppLocalizations {String get officialAccounting =>'Upload and download combined, including encryption overhead. Only official relay usage is measured; direct content and traffic are not recorded.';+ @override+ String get updateCheck => 'Check for updates';++ @override+ String get updateCheckEllipsis => 'Check for updates…';++ @override+ String get updateAuto => 'Check for updates automatically';++ @override+ String get updateAutoDesc =>+ 'Once a day. Only reads the update list on GitHub and Gitee; nothing that identifies you is sent.';++ @override+ String get updateChecking => 'Checking for updates…';++ @override+ String updateUpToDate(String version) {+ return 'PasteFerry $version is the latest version.';+ }++ @override+ String updateAvailableTitle(String version) {+ return 'PasteFerry $version is available';+ }++ @override+ String updateCurrentSize(String current, String size) {+ return 'You have $current. Download size $size.';+ }++ @override+ String get updateNew => 'New';++ @override+ String get updateFixed => 'Fixed';++ @override+ String get updateSkip => 'Skip this version';++ @override+ String get updateLater => 'Later';++ @override+ String get updateInstall => 'Download and install';++ @override+ String updateDownloading(String done, String total) {+ return 'Downloading $done of $total';+ }++ @override+ String get updateVerifying => 'Checking the download…';++ @override+ String get updateInstalling =>+ 'Installing. PasteFerry will reopen by itself.';++ @override+ String get updateInstallingPassword =>+ 'Installing. Your system will ask for your password, because /opt needs administrator rights; PasteFerry then reopens by itself.';++ @override+ String get updateCheckFailed =>+ 'Couldn\'t reach GitHub or Gitee. Try again later.';++ @override+ String get updateDownloadFailed =>+ 'The download didn\'t finish. Try again, or download the new version from the website.';++ @override+ String updateInstallFailed(String error) {+ return 'Couldn\'t start the installation: $error';+ }++ @override+ String get updateUnsupportedBuild => 'This build can\'t check for updates.';++ @override+ String get updateBlockedDev =>+ 'This is a development build, so it can\'t update itself.';++ @override+ String get updateBlockedMustMove =>+ 'PasteFerry is running from the disk image. Drag it to Applications and open it from there to update automatically.';++ @override+ String get updateBlockedReadOnly =>+ 'PasteFerry can\'t write to the folder it is installed in. Download the new version from the website instead.';++ @override+ String get updateBlockedUnsupported =>+ 'There is no automatic update for this computer. Download the new version from the website.';++ @override+ String get updateOpenDownload => 'Open download page';++ @override+ String updateSidebar(String version) {+ return 'Version $version is available';+ }++ @override+ String updatedTo(String version) {+ return 'Updated to $version';+ }++ @override+ String updateNotFinished(String version) {+ return 'The update didn\'t finish. You\'re still on $version.';+ }+@overrideString buildDetails(String uiVersion, String serviceVersion, String build) {return 'UI $uiVersion · Service $serviceVersion · Build $build';diff --git a/ui/lib/l10n/app_localizations_ja.dart b/ui/lib/l10n/app_localizations_ja.dartindex a805686..119ff38 100644--- a/ui/lib/l10n/app_localizations_ja.dart+++ b/ui/lib/l10n/app_localizations_ja.dart@@ -925,6 +925,116 @@ class AppLocalizationsJa extends AppLocalizations {String get officialAccounting =>'暗号化の通信量を含む送受信の合計です。公式中継のみ計測し、直接接続の内容や通信量は記録しません。';+ @override+ String get updateCheck => 'アップデートを確認';++ @override+ String get updateCheckEllipsis => 'アップデートを確認…';++ @override+ String get updateAuto => 'アップデートを自動で確認';++ @override+ String get updateAutoDesc =>+ '1 日 1 回、GitHub と Gitee のアップデート一覧を読むだけで、あなたを識別できる情報は送信しません。';++ @override+ String get updateChecking => 'アップデートを確認しています…';++ @override+ String updateUpToDate(String version) {+ return 'PasteFerry $version は最新バージョンです。';+ }++ @override+ String updateAvailableTitle(String version) {+ return 'PasteFerry $version があります';+ }++ @override+ String updateCurrentSize(String current, String size) {+ return '現在のバージョンは $current、ダウンロードは $size です。';+ }++ @override+ String get updateNew => '新機能';++ @override+ String get updateFixed => '修正';++ @override+ String get updateSkip => 'このバージョンをスキップ';++ @override+ String get updateLater => '後で';++ @override+ String get updateInstall => 'ダウンロードしてインストール';++ @override+ String updateDownloading(String done, String total) {+ return 'ダウンロード中 $done / $total';+ }++ @override+ String get updateVerifying => 'ダウンロードしたファイルを検証しています…';++ @override+ String get updateInstalling => 'インストールしています。PasteFerry は自動的に再び開きます。';++ @override+ String get updateInstallingPassword =>+ 'インストールしています。/opt には管理者権限が必要なため、システムがパスワードを求めます。その後 PasteFerry は自動的に再び開きます。';++ @override+ String get updateCheckFailed =>+ 'GitHub と Gitee に接続できません。しばらくしてからもう一度お試しください。';++ @override+ String get updateDownloadFailed =>+ 'ダウンロードが完了しませんでした。もう一度試すか、ウェブサイトから新しいバージョンをダウンロードしてください。';++ @override+ String updateInstallFailed(String error) {+ return 'インストールを開始できませんでした:$error';+ }++ @override+ String get updateUnsupportedBuild => 'このビルドはアップデートを確認できません。';++ @override+ String get updateBlockedDev => '開発ビルドのため、自動アップデートできません。';++ @override+ String get updateBlockedMustMove =>+ 'PasteFerry をディスクイメージから直接開いています。「アプリケーション」フォルダにドラッグし、そこから開くと自動アップデートできます。';++ @override+ String get updateBlockedReadOnly =>+ 'PasteFerry のインストール先フォルダに書き込めないため、自動アップデートできません。ウェブサイトから新しいバージョンをダウンロードしてください。';++ @override+ String get updateBlockedUnsupported =>+ 'このコンピュータ用の自動アップデートはありません。ウェブサイトから新しいバージョンをダウンロードしてください。';++ @override+ String get updateOpenDownload => 'ダウンロードページを開く';++ @override+ String updateSidebar(String version) {+ return 'バージョン $version があります';+ }++ @override+ String updatedTo(String version) {+ return '$version にアップデートしました';+ }++ @override+ String updateNotFinished(String version) {+ return 'アップデートが完了しませんでした。$version のままです。';+ }+@overrideString buildDetails(String uiVersion, String serviceVersion, String build) {return 'UI $uiVersion · サービス $serviceVersion · ビルド $build';diff --git a/ui/lib/l10n/app_localizations_zh.dart b/ui/lib/l10n/app_localizations_zh.dartindex c36dccc..0ae1e9a 100644--- a/ui/lib/l10n/app_localizations_zh.dart+++ b/ui/lib/l10n/app_localizations_zh.dart@@ -917,6 +917,111 @@ class AppLocalizationsZh extends AppLocalizations {@overrideString get officialAccounting => '上下行合计,包含加密传输开销;只统计官方中转,不统计直连内容或流量。';+ @override+ String get updateCheck => '检查更新';++ @override+ String get updateCheckEllipsis => '检查更新…';++ @override+ String get updateAuto => '自动检查更新';++ @override+ String get updateAutoDesc => '每天一次,只读取 GitHub 和 Gitee 上的更新清单,不发送任何能识别你的信息。';++ @override+ String get updateChecking => '正在检查更新…';++ @override+ String updateUpToDate(String version) {+ return '隔空贴 $version 已是最新版本。';+ }++ @override+ String updateAvailableTitle(String version) {+ return '有新版本:隔空贴 $version';+ }++ @override+ String updateCurrentSize(String current, String size) {+ return '当前版本 $current,需要下载 $size。';+ }++ @override+ String get updateNew => '新增';++ @override+ String get updateFixed => '修复';++ @override+ String get updateSkip => '跳过这个版本';++ @override+ String get updateLater => '以后再说';++ @override+ String get updateInstall => '下载并安装';++ @override+ String updateDownloading(String done, String total) {+ return '正在下载 $done / $total';+ }++ @override+ String get updateVerifying => '正在校验下载的文件…';++ @override+ String get updateInstalling => '正在安装,隔空贴会自动重新打开。';++ @override+ String get updateInstallingPassword =>+ '正在安装。安装到 /opt 需要管理员权限,系统会请你输入密码,之后隔空贴会自动重新打开。';++ @override+ String get updateCheckFailed => '暂时连不上 GitHub 和 Gitee,请稍后再试。';++ @override+ String get updateDownloadFailed => '下载没有完成。可以重试,或者到下载页手动下载新版本。';++ @override+ String updateInstallFailed(String error) {+ return '没能开始安装:$error';+ }++ @override+ String get updateUnsupportedBuild => '这个版本不支持检查更新。';++ @override+ String get updateBlockedDev => '这是开发构建,不能自动更新。';++ @override+ String get updateBlockedMustMove =>+ '隔空贴是直接从磁盘映像里打开的。把它拖到「应用程序」文件夹、从那里打开后,就能自动更新。';++ @override+ String get updateBlockedReadOnly => '隔空贴所在的文件夹不能写入,没法自动更新。请到下载页手动下载新版本。';++ @override+ String get updateBlockedUnsupported => '这台电脑没有可用的自动更新安装包,请到下载页手动下载新版本。';++ @override+ String get updateOpenDownload => '打开下载页';++ @override+ String updateSidebar(String version) {+ return '新版本 $version 可用';+ }++ @override+ String updatedTo(String version) {+ return '已更新到 $version';+ }++ @override+ String updateNotFinished(String version) {+ return '更新没有完成,仍是 $version。';+ }+@overrideString buildDetails(String uiVersion, String serviceVersion, String build) {return '界面 $uiVersion · 后台 $serviceVersion · 构建 $build';@@ -1920,6 +2025,111 @@ class AppLocalizationsZhHantHk extends AppLocalizationsZh {@overrideString get officialAccounting => '上下行合計,包含加密傳輸開銷;只統計官方中轉,不統計直連內容或流量。';+ @override+ String get updateCheck => '檢查更新';++ @override+ String get updateCheckEllipsis => '檢查更新…';++ @override+ String get updateAuto => '自動檢查更新';++ @override+ String get updateAutoDesc => '每天一次,只讀取 GitHub 和 Gitee 上的更新清單,不傳送任何能識別你的資料。';++ @override+ String get updateChecking => '正在檢查更新…';++ @override+ String updateUpToDate(String version) {+ return '隔空貼 $version 已是最新版本。';+ }++ @override+ String updateAvailableTitle(String version) {+ return '有新版本:隔空貼 $version';+ }++ @override+ String updateCurrentSize(String current, String size) {+ return '目前版本 $current,需要下載 $size。';+ }++ @override+ String get updateNew => '新增';++ @override+ String get updateFixed => '修正';++ @override+ String get updateSkip => '略過這個版本';++ @override+ String get updateLater => '稍後再說';++ @override+ String get updateInstall => '下載並安裝';++ @override+ String updateDownloading(String done, String total) {+ return '正在下載 $done / $total';+ }++ @override+ String get updateVerifying => '正在校驗下載的檔案…';++ @override+ String get updateInstalling => '正在安裝,隔空貼會自動重新開啟。';++ @override+ String get updateInstallingPassword =>+ '正在安裝。安裝到 /opt 需要管理員權限,系統會請你輸入密碼,之後隔空貼會自動重新開啟。';++ @override+ String get updateCheckFailed => '暫時連不上 GitHub 和 Gitee,請稍後再試。';++ @override+ String get updateDownloadFailed => '下載沒有完成。可以重試,或到下載頁手動下載新版本。';++ @override+ String updateInstallFailed(String error) {+ return '未能開始安裝:$error';+ }++ @override+ String get updateUnsupportedBuild => '這個版本不支援檢查更新。';++ @override+ String get updateBlockedDev => '這是開發版本,不能自動更新。';++ @override+ String get updateBlockedMustMove =>+ '隔空貼是直接從磁碟映像檔裏開啟的。把它拖到「應用程式」資料夾、從那裏開啟後,就能自動更新。';++ @override+ String get updateBlockedReadOnly => '隔空貼所在的資料夾無法寫入,沒法自動更新。請到下載頁手動下載新版本。';++ @override+ String get updateBlockedUnsupported => '這部電腦沒有可用的自動更新安裝檔,請到下載頁手動下載新版本。';++ @override+ String get updateOpenDownload => '開啟下載頁';++ @override+ String updateSidebar(String version) {+ return '新版本 $version 可用';+ }++ @override+ String updatedTo(String version) {+ return '已更新到 $version';+ }++ @override+ String updateNotFinished(String version) {+ return '更新沒有完成,仍是 $version。';+ }+@overrideString buildDetails(String uiVersion, String serviceVersion, String build) {return '介面 $uiVersion · 背景服務 $serviceVersion · 版本識別 $build';@@ -2923,6 +3133,111 @@ class AppLocalizationsZhHantTw extends AppLocalizationsZh {@overrideString get officialAccounting => '上下行合計,包含加密傳輸開銷;僅統計官方中繼,不統計直連內容或流量。';+ @override+ String get updateCheck => '檢查更新';++ @override+ String get updateCheckEllipsis => '檢查更新…';++ @override+ String get updateAuto => '自動檢查更新';++ @override+ String get updateAutoDesc => '每天一次,只讀取 GitHub 和 Gitee 上的更新清單,不傳送任何能識別你的資訊。';++ @override+ String get updateChecking => '正在檢查更新…';++ @override+ String updateUpToDate(String version) {+ return '隔空貼 $version 已是最新版本。';+ }++ @override+ String updateAvailableTitle(String version) {+ return '有新版本:隔空貼 $version';+ }++ @override+ String updateCurrentSize(String current, String size) {+ return '目前版本 $current,需要下載 $size。';+ }++ @override+ String get updateNew => '新增';++ @override+ String get updateFixed => '修正';++ @override+ String get updateSkip => '略過這個版本';++ @override+ String get updateLater => '以後再說';++ @override+ String get updateInstall => '下載並安裝';++ @override+ String updateDownloading(String done, String total) {+ return '正在下載 $done / $total';+ }++ @override+ String get updateVerifying => '正在驗證下載的檔案…';++ @override+ String get updateInstalling => '正在安裝,隔空貼會自動重新開啟。';++ @override+ String get updateInstallingPassword =>+ '正在安裝。安裝到 /opt 需要系統管理員權限,系統會請你輸入密碼,之後隔空貼會自動重新開啟。';++ @override+ String get updateCheckFailed => '暫時連不上 GitHub 和 Gitee,請稍後再試。';++ @override+ String get updateDownloadFailed => '下載沒有完成。可以重試,或到下載頁手動下載新版本。';++ @override+ String updateInstallFailed(String error) {+ return '沒能開始安裝:$error';+ }++ @override+ String get updateUnsupportedBuild => '這個版本不支援檢查更新。';++ @override+ String get updateBlockedDev => '這是開發版本,不能自動更新。';++ @override+ String get updateBlockedMustMove =>+ '隔空貼是直接從磁碟映像檔裡開啟的。把它拖到「應用程式」資料夾、從那裡開啟後,就能自動更新。';++ @override+ String get updateBlockedReadOnly => '隔空貼所在的資料夾無法寫入,沒辦法自動更新。請到下載頁手動下載新版本。';++ @override+ String get updateBlockedUnsupported => '這台電腦沒有可用的自動更新安裝檔,請到下載頁手動下載新版本。';++ @override+ String get updateOpenDownload => '開啟下載頁';++ @override+ String updateSidebar(String version) {+ return '新版本 $version 可用';+ }++ @override+ String updatedTo(String version) {+ return '已更新到 $version';+ }++ @override+ String updateNotFinished(String version) {+ return '更新沒有完成,仍是 $version。';+ }+@overrideString buildDetails(String uiVersion, String serviceVersion, String build) {return '介面 $uiVersion · 背景服務 $serviceVersion · 建置 $build';diff --git a/ui/lib/l10n/app_zh.arb b/ui/lib/l10n/app_zh.arbindex c1cf44a..c72ba5e 100644--- a/ui/lib/l10n/app_zh.arb+++ b/ui/lib/l10n/app_zh.arb@@ -274,6 +274,35 @@"officialDeviceID": "设备 ID","officialWarning": "今日中转额度已使用 90%,直连不消耗此额度。","officialAccounting": "上下行合计,包含加密传输开销;只统计官方中转,不统计直连内容或流量。",+ "updateCheck": "检查更新",+ "updateCheckEllipsis": "检查更新…",+ "updateAuto": "自动检查更新",+ "updateAutoDesc": "每天一次,只读取 GitHub 和 Gitee 上的更新清单,不发送任何能识别你的信息。",+ "updateChecking": "正在检查更新…",+ "updateUpToDate": "隔空贴 {version} 已是最新版本。",+ "updateAvailableTitle": "有新版本:隔空贴 {version}",+ "updateCurrentSize": "当前版本 {current},需要下载 {size}。",+ "updateNew": "新增",+ "updateFixed": "修复",+ "updateSkip": "跳过这个版本",+ "updateLater": "以后再说",+ "updateInstall": "下载并安装",+ "updateDownloading": "正在下载 {done} / {total}",+ "updateVerifying": "正在校验下载的文件…",+ "updateInstalling": "正在安装,隔空贴会自动重新打开。",+ "updateInstallingPassword": "正在安装。安装到 /opt 需要管理员权限,系统会请你输入密码,之后隔空贴会自动重新打开。",+ "updateCheckFailed": "暂时连不上 GitHub 和 Gitee,请稍后再试。",+ "updateDownloadFailed": "下载没有完成。可以重试,或者到下载页手动下载新版本。",+ "updateInstallFailed": "没能开始安装:{error}",+ "updateUnsupportedBuild": "这个版本不支持检查更新。",+ "updateBlockedDev": "这是开发构建,不能自动更新。",+ "updateBlockedMustMove": "隔空贴是直接从磁盘映像里打开的。把它拖到「应用程序」文件夹、从那里打开后,就能自动更新。",+ "updateBlockedReadOnly": "隔空贴所在的文件夹不能写入,没法自动更新。请到下载页手动下载新版本。",+ "updateBlockedUnsupported": "这台电脑没有可用的自动更新安装包,请到下载页手动下载新版本。",+ "updateOpenDownload": "打开下载页",+ "updateSidebar": "新版本 {version} 可用",+ "updatedTo": "已更新到 {version}",+ "updateNotFinished": "更新没有完成,仍是 {version}。","buildDetails": "界面 {uiVersion} · 后台 {serviceVersion} · 构建 {build}","notReceived": "尚未接收,暂不可粘贴","receivedPreserved": "已接收,点击放入剪贴板后可粘贴",diff --git a/ui/lib/l10n/app_zh_Hant_HK.arb b/ui/lib/l10n/app_zh_Hant_HK.arbindex fa8860e..dd7eeab 100644--- a/ui/lib/l10n/app_zh_Hant_HK.arb+++ b/ui/lib/l10n/app_zh_Hant_HK.arb@@ -274,6 +274,35 @@"officialDeviceID": "裝置 ID","officialWarning": "今日中轉額度已使用 90%,直連不消耗此額度。","officialAccounting": "上下行合計,包含加密傳輸開銷;只統計官方中轉,不統計直連內容或流量。",+ "updateCheck": "檢查更新",+ "updateCheckEllipsis": "檢查更新…",+ "updateAuto": "自動檢查更新",+ "updateAutoDesc": "每天一次,只讀取 GitHub 和 Gitee 上的更新清單,不傳送任何能識別你的資料。",+ "updateChecking": "正在檢查更新…",+ "updateUpToDate": "隔空貼 {version} 已是最新版本。",+ "updateAvailableTitle": "有新版本:隔空貼 {version}",+ "updateCurrentSize": "目前版本 {current},需要下載 {size}。",+ "updateNew": "新增",+ "updateFixed": "修正",+ "updateSkip": "略過這個版本",+ "updateLater": "稍後再說",+ "updateInstall": "下載並安裝",+ "updateDownloading": "正在下載 {done} / {total}",+ "updateVerifying": "正在校驗下載的檔案…",+ "updateInstalling": "正在安裝,隔空貼會自動重新開啟。",+ "updateInstallingPassword": "正在安裝。安裝到 /opt 需要管理員權限,系統會請你輸入密碼,之後隔空貼會自動重新開啟。",+ "updateCheckFailed": "暫時連不上 GitHub 和 Gitee,請稍後再試。",+ "updateDownloadFailed": "下載沒有完成。可以重試,或到下載頁手動下載新版本。",+ "updateInstallFailed": "未能開始安裝:{error}",+ "updateUnsupportedBuild": "這個版本不支援檢查更新。",+ "updateBlockedDev": "這是開發版本,不能自動更新。",+ "updateBlockedMustMove": "隔空貼是直接從磁碟映像檔裏開啟的。把它拖到「應用程式」資料夾、從那裏開啟後,就能自動更新。",+ "updateBlockedReadOnly": "隔空貼所在的資料夾無法寫入,沒法自動更新。請到下載頁手動下載新版本。",+ "updateBlockedUnsupported": "這部電腦沒有可用的自動更新安裝檔,請到下載頁手動下載新版本。",+ "updateOpenDownload": "開啟下載頁",+ "updateSidebar": "新版本 {version} 可用",+ "updatedTo": "已更新到 {version}",+ "updateNotFinished": "更新沒有完成,仍是 {version}。","buildDetails": "介面 {uiVersion} · 背景服務 {serviceVersion} · 版本識別 {build}","notReceived": "尚未接收,暫不可貼上","receivedPreserved": "已接收,按放入剪貼簿後即可貼上",diff --git a/ui/lib/l10n/app_zh_Hant_TW.arb b/ui/lib/l10n/app_zh_Hant_TW.arbindex 04f6964..da8fb1b 100644--- a/ui/lib/l10n/app_zh_Hant_TW.arb+++ b/ui/lib/l10n/app_zh_Hant_TW.arb@@ -274,6 +274,35 @@"officialDeviceID": "裝置 ID","officialWarning": "今日中繼額度已使用 90%,直連不消耗此額度。","officialAccounting": "上下行合計,包含加密傳輸開銷;僅統計官方中繼,不統計直連內容或流量。",+ "updateCheck": "檢查更新",+ "updateCheckEllipsis": "檢查更新…",+ "updateAuto": "自動檢查更新",+ "updateAutoDesc": "每天一次,只讀取 GitHub 和 Gitee 上的更新清單,不傳送任何能識別你的資訊。",+ "updateChecking": "正在檢查更新…",+ "updateUpToDate": "隔空貼 {version} 已是最新版本。",+ "updateAvailableTitle": "有新版本:隔空貼 {version}",+ "updateCurrentSize": "目前版本 {current},需要下載 {size}。",+ "updateNew": "新增",+ "updateFixed": "修正",+ "updateSkip": "略過這個版本",+ "updateLater": "以後再說",+ "updateInstall": "下載並安裝",+ "updateDownloading": "正在下載 {done} / {total}",+ "updateVerifying": "正在驗證下載的檔案…",+ "updateInstalling": "正在安裝,隔空貼會自動重新開啟。",+ "updateInstallingPassword": "正在安裝。安裝到 /opt 需要系統管理員權限,系統會請你輸入密碼,之後隔空貼會自動重新開啟。",+ "updateCheckFailed": "暫時連不上 GitHub 和 Gitee,請稍後再試。",+ "updateDownloadFailed": "下載沒有完成。可以重試,或到下載頁手動下載新版本。",+ "updateInstallFailed": "沒能開始安裝:{error}",+ "updateUnsupportedBuild": "這個版本不支援檢查更新。",+ "updateBlockedDev": "這是開發版本,不能自動更新。",+ "updateBlockedMustMove": "隔空貼是直接從磁碟映像檔裡開啟的。把它拖到「應用程式」資料夾、從那裡開啟後,就能自動更新。",+ "updateBlockedReadOnly": "隔空貼所在的資料夾無法寫入,沒辦法自動更新。請到下載頁手動下載新版本。",+ "updateBlockedUnsupported": "這台電腦沒有可用的自動更新安裝檔,請到下載頁手動下載新版本。",+ "updateOpenDownload": "開啟下載頁",+ "updateSidebar": "新版本 {version} 可用",+ "updatedTo": "已更新到 {version}",+ "updateNotFinished": "更新沒有完成,仍是 {version}。","buildDetails": "介面 {uiVersion} · 背景服務 {serviceVersion} · 建置 {build}","notReceived": "尚未接收,暫不可貼上","receivedPreserved": "已接收,點選放入剪貼簿後即可貼上",diff --git a/ui/lib/main.dart b/ui/lib/main.dartindex 0874765..36cfec4 100644--- a/ui/lib/main.dart+++ b/ui/lib/main.dart@@ -13,6 +13,7 @@ import 'pages/official_service_page.dart';import 'theme.dart';import 'widgets/common.dart';import 'widgets/pairing_dialog.dart';+import 'widgets/update_dialog.dart';import 'icons.dart';void main() => runApp(const PasteFerryApp());@@ -125,6 +126,7 @@ class _ShellState extends State<Shell> with WidgetsBindingObserver {bool _pairingDialogOpen = false;bool _officialDialogOpen = false;int _seenOfficialNavigation = 0;+ String? _shownUpdateResult;AppLifecycleState _lifecycle = AppLifecycleState.resumed;@override@@ -232,6 +234,24 @@ class _ShellState extends State<Shell> with WidgetsBindingObserver {});}+ // 自动更新后重新打开时提示一次结果+ final updated = state.lastUpdate;+ if (updated != null) {+ final key = '${updated.fromVersion}>${updated.toVersion}@${updated.atUnix}';+ if (key != _shownUpdateResult) {+ _shownUpdateResult = key;+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (!mounted) return;+ final l = context.l10n;+ showToast(+ context,+ updated.ok ? l.updatedTo(updated.toVersion) : l.updateNotFinished(updated.fromVersion),+ error: !updated.ok,+ );+ });+ }+ }+// 后台服务没装或没在跑时,其他页面都无从谈起,先引导把它启用final service = state.serviceState;final needsService =@@ -328,6 +348,7 @@ class _Sidebar extends StatelessWidget {onTap: () => onSelect(Section.settings),),const Spacer(),+ const _UpdateHint(),const _ConnectionFooter(),],),@@ -406,6 +427,34 @@ class _NavItemState extends State<_NavItem> {}}+/// 自动检查发现新版本时,侧边栏底部多一行,点开是更新窗口。不弹窗打扰。+class _UpdateHint extends StatelessWidget {+ const _UpdateHint();++ @override+ Widget build(BuildContext context) {+ final version = AppScope.of(context).updateAvailable;+ if (version.isEmpty) return const SizedBox.shrink();+ final p = context.palette;+ return Padding(+ padding: const EdgeInsets.fromLTRB(Insets.sm, 0, Insets.sm, Insets.xs),+ child: TextButton.icon(+ style: TextButton.styleFrom(+ alignment: Alignment.centerLeft,+ foregroundColor: p.accent,+ padding: const EdgeInsets.symmetric(horizontal: 10),+ ),+ onPressed: () => showUpdateDialog(context),+ icon: Icon(AppIcons.arrowDownCircle, size: 16),+ label: Text(+ context.l10n.updateSidebar(version),+ overflow: TextOverflow.ellipsis,+ ),+ ),+ );+ }+}+/// 侧边栏底部的连接状态。常驻可见,用户不必进设置页就知道能不能用。class _ConnectionFooter extends StatelessWidget {const _ConnectionFooter();diff --git a/ui/lib/pages/settings_page.dart b/ui/lib/pages/settings_page.dartindex d027612..3852788 100644--- a/ui/lib/pages/settings_page.dart+++ b/ui/lib/pages/settings_page.dart@@ -11,6 +11,7 @@ import '../main.dart';import '../theme.dart';import '../widgets/common.dart';import '../widgets/feedback_dialog.dart';+import '../widgets/update_dialog.dart';import '../icons.dart';import '../platform.dart';@@ -414,6 +415,24 @@ class _SettingsPageState extends State<SettingsPage> {],),),+ SettingRow(+ title: l.updateAuto,+ description: l.updateAutoDesc,+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ TextButton(+ onPressed: () => showUpdateDialog(context),+ child: Text(l.updateCheckEllipsis),+ ),+ const SizedBox(width: Insets.sm),+ SmallSwitch(+ value: !cfg.updateCheckDisabled,+ onChanged: (v) => _update(state, cfg..updateCheckDisabled = !v),+ ),+ ],+ ),+ ),],),),diff --git a/ui/lib/widgets/update_dialog.dart b/ui/lib/widgets/update_dialog.dartnew file mode 100644index 0000000..a9ad662--- /dev/null+++ b/ui/lib/widgets/update_dialog.dart@@ -0,0 +1,315 @@+import 'dart:async';+import 'dart:io' show exit;++import 'package:flutter/material.dart';+import 'package:grpc/grpc.dart' show GrpcError, StatusCode;++import '../gen/pasteferry/v1/daemon.pb.dart';+import '../i18n.dart';+import '../main.dart';+import '../platform.dart';+import '../theme.dart';+import 'common.dart';++/// 打开更新窗口:先检查,有新版本时列出各版的更新日志,用户确认后下载、校验、安装并自动重新打开。+Future<void> showUpdateDialog(BuildContext context) => showDialog<void>(+ context: context,+ barrierDismissible: false,+ builder: (_) => const UpdateDialog(),+ );++/// 安装开始后界面要退出,让更新助手替换文件。测试里换成不退出的实现。+@visibleForTesting+void Function() quitForUpdate = () => exit(0);++enum _Phase { checking, failed, upToDate, available, downloading, verifying, installing, downloadFailed }++class UpdateDialog extends StatefulWidget {+ const UpdateDialog({super.key});++ @override+ State<UpdateDialog> createState() => _UpdateDialogState();+}++class _UpdateDialogState extends State<UpdateDialog> {+ _Phase _phase = _Phase.checking;+ UpdateInfo? _info;+ String? _error;+ int _done = 0, _total = 0;+ StreamSubscription<UpdateProgress>? _download;++ @override+ void initState() {+ super.initState();+ WidgetsBinding.instance.addPostFrameCallback((_) => _check());+ }++ @override+ void dispose() {+ _download?.cancel();+ super.dispose();+ }++ Future<void> _check() async {+ setState(() {+ _phase = _Phase.checking;+ _error = null;+ });+ final state = AppScope.read(context);+ final language = settingFromLocale(Localizations.localeOf(context));+ try {+ final info = await state.checkForUpdate(language);+ if (!mounted) return;+ setState(() {+ _info = info;+ _phase = info.available ? _Phase.available : _Phase.upToDate;+ });+ } catch (e) {+ if (!mounted) return;+ final unsupported = e is GrpcError && e.code == StatusCode.unimplemented;+ setState(() {+ _phase = _Phase.failed;+ _error = unsupported ? context.l10n.updateUnsupportedBuild : context.l10n.updateCheckFailed;+ });+ }+ }++ void _startDownload() {+ final info = _info!;+ setState(() {+ _phase = _Phase.downloading;+ _done = 0;+ _total = info.downloadBytes.toInt();+ });+ _download = AppScope.read(context).downloadUpdate(info.latestVersion).listen(+ (p) {+ if (!mounted) return;+ setState(() {+ if (p.done) {+ _phase = _Phase.verifying;+ } else {+ _done = p.downloaded.toInt();+ _total = p.total.toInt();+ }+ });+ },+ onError: (Object e) {+ if (mounted) setState(() => _phase = _Phase.downloadFailed);+ },+ onDone: () {+ if (!mounted) return;+ if (_phase == _Phase.verifying) {+ _install();+ } else if (_phase == _Phase.downloading) {+ setState(() => _phase = _Phase.downloadFailed);+ }+ },+ cancelOnError: true,+ );+ }++ Future<void> _cancelDownload() async {+ await _download?.cancel();+ _download = null;+ if (mounted) setState(() => _phase = _Phase.available);+ }++ Future<void> _install() async {+ setState(() => _phase = _Phase.installing);+ try {+ await AppScope.read(context).installUpdate(_info!.latestVersion);+ // 给用户一点时间看到「正在安装」,再退出让更新助手接手+ await Future<void>.delayed(const Duration(milliseconds: 600));+ quitForUpdate();+ } catch (e) {+ if (!mounted) return;+ final message = e is GrpcError ? (e.message ?? '') : e.toString();+ setState(() {+ _phase = _Phase.failed;+ _error = context.l10n.updateInstallFailed(message);+ });+ }+ }++ Future<void> _skip() async {+ final version = _info!.latestVersion;+ final state = AppScope.read(context);+ Navigator.pop(context);+ try {+ await state.skipUpdate(version);+ } catch (_) {+ // 跳过只是不再提示,记不住也不影响使用+ }+ }++ void _openDownloadPage() => openUrl(downloadPageUrl(Localizations.localeOf(context)));++ @override+ Widget build(BuildContext context) {+ final l = context.l10n;+ final info = _info;+ return AlertDialog(+ title: Text(switch (_phase) {+ _Phase.upToDate || _Phase.checking || _Phase.failed => l.updateCheck,+ _ => l.updateAvailableTitle(info!.latestVersion),+ }),+ content: SizedBox(width: 440, child: _body(context)),+ actions: _actions(context),+ );+ }++ Widget _body(BuildContext context) {+ final l = context.l10n;+ final p = context.palette;+ final info = _info;+ switch (_phase) {+ case _Phase.checking:+ return _busy(context, l.updateChecking);+ case _Phase.failed:+ return Text(_error ?? '', style: context.text.bodyMedium?.copyWith(color: p.danger));+ case _Phase.upToDate:+ return Text(l.updateUpToDate(info!.currentVersion), style: context.text.bodyMedium);+ case _Phase.downloading:+ final fraction = _total > 0 ? (_done / _total).clamp(0.0, 1.0) : null;+ return Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Text(l.updateDownloading(humanBytes(_done), humanBytes(_total)), style: context.text.bodyMedium),+ const SizedBox(height: Insets.md),+ ClipRRect(+ borderRadius: BorderRadius.circular(3),+ child: LinearProgressIndicator(value: fraction, minHeight: 6, color: p.accent, backgroundColor: p.fill),+ ),+ ],+ );+ case _Phase.verifying:+ return _busy(context, l.updateVerifying);+ case _Phase.installing:+ return _busy(context, info!.installKind == 'linux-deb' ? l.updateInstallingPassword : l.updateInstalling);+ case _Phase.downloadFailed:+ return Text(l.updateDownloadFailed, style: context.text.bodyMedium?.copyWith(color: p.danger));+ case _Phase.available:+ return _notes(context, info!);+ }+ }++ Widget _busy(BuildContext context, String text) => Row(+ children: [+ const SizedBox(width: 18, height: 18, child: CircularProgressIndicator(strokeWidth: 2)),+ const SizedBox(width: Insets.md),+ Expanded(child: Text(text, style: context.text.bodyMedium)),+ ],+ );++ /// 比当前新的各版更新日志:落后不止一版时逐版列出,每版分「新增」与「修复」。+ Widget _notes(BuildContext context, UpdateInfo info) {+ final l = context.l10n;+ final p = context.palette;+ final blocker = switch (info.installBlocker) {+ '' => null,+ 'dev' => l.updateBlockedDev,+ 'must_move' => l.updateBlockedMustMove,+ 'read_only' => l.updateBlockedReadOnly,+ _ => l.updateBlockedUnsupported,+ };+ final several = info.releases.length > 1;+ Widget list(String title, List<String> items) => Padding(+ padding: const EdgeInsets.only(top: Insets.sm),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(title, style: context.text.labelMedium),+ const SizedBox(height: 4),+ for (final item in items)+ Padding(+ padding: const EdgeInsets.only(bottom: 4),+ child: Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text('· ', style: context.text.bodyMedium?.copyWith(color: p.textDim)),+ Expanded(child: Text(item, style: context.text.bodyMedium)),+ ],+ ),+ ),+ ],+ ),+ );+ return Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Text(+ l.updateCurrentSize(info.currentVersion, humanBytes(info.downloadBytes.toInt())),+ style: context.text.bodySmall,+ ),+ const SizedBox(height: Insets.md),+ ConstrainedBox(+ // 最小窗口只有 560 高:日志区让出标题、说明与按钮的位置,其余滚动+ constraints: BoxConstraints(maxHeight: (MediaQuery.sizeOf(context).height - 340).clamp(96.0, 320.0)),+ child: SingleChildScrollView(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ for (final r in info.releases) ...[+ if (several)+ Padding(+ padding: const EdgeInsets.only(top: Insets.sm),+ child: Text(r.date.isEmpty ? r.version : '${r.version} · ${r.date}', style: context.text.titleSmall),+ ),+ if (r.changes.isNotEmpty) list(l.updateNew, r.changes),+ if (r.fixes.isNotEmpty) list(l.updateFixed, r.fixes),+ ],+ ],+ ),+ ),+ ),+ if (blocker != null) ...[+ const SizedBox(height: Insets.md),+ Text(blocker, style: context.text.bodySmall?.copyWith(color: p.warning)),+ ],+ ],+ );+ }++ List<Widget> _actions(BuildContext context) {+ final l = context.l10n;+ final info = _info;+ void close() => Navigator.pop(context);+ switch (_phase) {+ case _Phase.checking:+ return [TextButton(onPressed: close, child: Text(l.cancel))];+ case _Phase.failed:+ return [+ if (info != null && info.available) TextButton(onPressed: _openDownloadPage, child: Text(l.updateOpenDownload)),+ TextButton(onPressed: close, child: Text(l.close)),+ FilledButton(onPressed: _check, child: Text(l.retry)),+ ];+ case _Phase.upToDate:+ return [FilledButton(onPressed: close, child: Text(l.close))];+ case _Phase.available:+ if (info!.installBlocker.isNotEmpty) {+ return [+ TextButton(onPressed: close, child: Text(l.updateLater)),+ FilledButton(onPressed: _openDownloadPage, child: Text(l.updateOpenDownload)),+ ];+ }+ return [+ TextButton(onPressed: _skip, child: Text(l.updateSkip)),+ TextButton(onPressed: close, child: Text(l.updateLater)),+ FilledButton(onPressed: _startDownload, child: Text(l.updateInstall)),+ ];+ case _Phase.downloading:+ return [TextButton(onPressed: _cancelDownload, child: Text(l.cancel))];+ case _Phase.verifying:+ case _Phase.installing:+ return const [];+ case _Phase.downloadFailed:+ return [+ TextButton(onPressed: _openDownloadPage, child: Text(l.updateOpenDownload)),+ TextButton(onPressed: close, child: Text(l.close)),+ FilledButton(onPressed: _startDownload, child: Text(l.retry)),+ ];+ }+ }+}diff --git a/ui/test/update_test.dart b/ui/test/update_test.dartnew file mode 100644index 0000000..0fde5e3--- /dev/null+++ b/ui/test/update_test.dart@@ -0,0 +1,209 @@+import 'dart:async';++import 'package:fixnum/fixnum.dart';+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:pasteferry_ui/app_state.dart';+import 'package:pasteferry_ui/gen/pasteferry/v1/daemon.pb.dart';+import 'package:pasteferry_ui/main.dart';+import 'package:pasteferry_ui/pages/settings_page.dart';+import 'package:pasteferry_ui/widgets/common.dart';+import 'package:pasteferry_ui/widgets/update_dialog.dart';++/// 不连后台服务:检查、下载、安装都由测试给出结果。+class UpdateTestState extends AppState {+ UpdateTestState({String language = 'zh-Hans', this.info, String available = '', UpdateResult? last}) {+ final status = Status(deviceId: 'abcdefghijklmnopqrstuvwxyz', version: '2.3.0', updateAvailable: available);+ if (last != null) status.lastUpdate = last;+ debugSeed(+ status: status,+ config: Config(serviceMode: ServiceMode.SERVICE_MODE_LAN, language: language),+ self: Device(id: 'abcdefghijklmnopqrstuvwxyz'),+ );+ }++ UpdateInfo? info;+ String? language;+ final progress = StreamController<UpdateProgress>();+ String? installed, skipped;++ @override+ Future<UpdateInfo> checkForUpdate(String language) async {+ this.language = language;+ return info!;+ }++ @override+ Stream<UpdateProgress> downloadUpdate(String version) => progress.stream;++ @override+ Future<void> installUpdate(String version) async => installed = version;++ @override+ Future<void> skipUpdate(String version) async => skipped = version;++ @override+ Future<void> updateConfig(Config next) async =>+ debugSeed(status: status!, config: next, self: self!);+}++UpdateInfo available({String blocker = '', String kind = 'mac-app'}) => UpdateInfo(+ currentVersion: '2.3.0',+ latestVersion: '2.3.2',+ available: true,+ downloadBytes: Int64(24 * 1024 * 1024),+ installBlocker: blocker,+ installKind: kind,+ releases: [+ UpdateRelease(version: '2.3.2', date: '2026-11-02', changes: ['新增甲'], fixes: ['修复乙']),+ UpdateRelease(version: '2.3.1', date: '2026-10-25', changes: ['新增丙']),+ ],+ );++Future<void> openDialog(WidgetTester tester, AppState state) async {+ await tester.pumpWidget(PasteFerryApp(state: state));+ await tester.pumpAndSettle();+ final context = tester.element(find.byType(Shell));+ unawaited(showUpdateDialog(context));+ await tester.pumpAndSettle();+}++void main() {+ late bool quit;+ setUp(() {+ quit = false;+ quitForUpdate = () => quit = true;+ });++ testWidgets('up to date', (tester) async {+ final state = UpdateTestState(info: UpdateInfo(currentVersion: '2.3.0', latestVersion: '2.3.0'));+ await openDialog(tester, state);+ expect(state.language, 'zh-Hans');+ expect(find.text('隔空贴 2.3.0 已是最新版本。'), findsOneWidget);+ });++ testWidgets('lists every newer release, then downloads, installs and quits', (tester) async {+ final state = UpdateTestState(info: available());+ await openDialog(tester, state);+ expect(find.text('有新版本:隔空贴 2.3.2'), findsOneWidget);+ expect(find.text('2.3.2 · 2026-11-02'), findsOneWidget);+ expect(find.text('2.3.1 · 2026-10-25'), findsOneWidget);+ for (final t in ['新增甲', '修复乙', '新增丙']) {+ expect(find.text(t), findsOneWidget);+ }+ expect(find.text('当前版本 2.3.0,需要下载 24.0 MB。'), findsOneWidget);++ await tester.tap(find.text('下载并安装'));+ await tester.pump();+ state.progress.add(UpdateProgress(downloaded: Int64(12 * 1024 * 1024), total: Int64(24 * 1024 * 1024)));+ await tester.pump();+ await tester.pump();+ expect(find.text('正在下载 12.0 MB / 24.0 MB'), findsOneWidget);+ expect(tester.widget<LinearProgressIndicator>(find.byType(LinearProgressIndicator)).value, 0.5);++ state.progress.add(UpdateProgress(done: true));+ await state.progress.close();+ await tester.pump();+ await tester.pump();+ expect(state.installed, '2.3.2');+ expect(find.text('正在安装,隔空贴会自动重新打开。'), findsOneWidget);+ await tester.pump(const Duration(seconds: 1));+ expect(quit, isTrue);+ });++ testWidgets('a .deb install warns about the password prompt', (tester) async {+ final state = UpdateTestState(info: available(kind: 'linux-deb'));+ await openDialog(tester, state);+ await tester.tap(find.text('下载并安装'));+ await tester.pump();+ state.progress.add(UpdateProgress(done: true));+ await state.progress.close();+ await tester.pump();+ await tester.pump();+ expect(find.textContaining('系统会请你输入密码'), findsOneWidget);+ await tester.pump(const Duration(seconds: 1));+ });++ testWidgets('a broken download offers retry and the download page', (tester) async {+ final state = UpdateTestState(info: available());+ await openDialog(tester, state);+ await tester.tap(find.text('下载并安装'));+ await tester.pump();+ state.progress.addError(Exception('mirror down'));+ await tester.pumpAndSettle();+ expect(find.text('下载没有完成。可以重试,或者到下载页手动下载新版本。'), findsOneWidget);+ expect(find.text('打开下载页'), findsOneWidget);+ expect(find.text('重试'), findsOneWidget);+ expect(quit, isFalse);+ });++ testWidgets('an install that cannot update itself only offers the download page', (tester) async {+ final state = UpdateTestState(info: available(blocker: 'must_move'));+ await openDialog(tester, state);+ expect(find.textContaining('直接从磁盘映像里打开'), findsOneWidget);+ expect(find.text('下载并安装'), findsNothing);+ expect(find.text('打开下载页'), findsOneWidget);+ });++ testWidgets('skipping remembers the version', (tester) async {+ final state = UpdateTestState(info: available());+ await openDialog(tester, state);+ await tester.tap(find.text('跳过这个版本'));+ await tester.pumpAndSettle();+ expect(state.skipped, '2.3.2');+ expect(find.byType(UpdateDialog), findsNothing);+ });++ testWidgets('the sidebar hints at an available version and opens the dialog', (tester) async {+ final state = UpdateTestState(info: available(), available: '2.3.2');+ await tester.pumpWidget(PasteFerryApp(state: state));+ await tester.pumpAndSettle();+ await tester.tap(find.text('新版本 2.3.2 可用'));+ await tester.pumpAndSettle();+ expect(find.byType(UpdateDialog), findsOneWidget);+ });++ testWidgets('after an automatic update the result is shown once', (tester) async {+ final state = UpdateTestState(+ last: UpdateResult(fromVersion: '2.3.0', toVersion: '2.3.2', ok: true, atUnix: Int64(1)),+ );+ await tester.pumpWidget(PasteFerryApp(state: state));+ await tester.pumpAndSettle();+ expect(find.text('已更新到 2.3.2'), findsOneWidget);+ });++ testWidgets('the settings switch turns automatic checks off', (tester) async {+ final state = UpdateTestState();+ await tester.pumpWidget(PasteFerryApp(state: state));+ await tester.pumpAndSettle();+ await tester.tap(find.text('设置').first);+ await tester.pumpAndSettle();+ final page = find.byType(SettingsPage);+ await tester.scrollUntilVisible(find.text('自动检查更新'), 200,+ scrollable: find.descendant(of: page, matching: find.byType(Scrollable)).first);+ final row = find.ancestor(of: find.text('自动检查更新'), matching: find.byType(SettingRow));+ await tester.tap(find.descendant(of: row, matching: find.byType(SmallSwitch)));+ await tester.pumpAndSettle();+ expect(state.config!.updateCheckDisabled, isTrue);+ expect(state.autoCheckUpdates, isFalse);+ });++ for (final language in ['en', 'zh-Hans', 'zh-Hant-TW', 'zh-Hant-HK', 'ja']) {+ testWidgets('update dialog fits the minimum window in $language', (tester) async {+ tester.view.physicalSize = const Size(760, 560);+ tester.view.devicePixelRatio = 1;+ addTearDown(tester.view.resetPhysicalSize);+ addTearDown(tester.view.resetDevicePixelRatio);+ final long = List.generate(12, (i) => 'A fairly long line describing change number $i in some detail.');+ final state = UpdateTestState(+ language: language,+ info: available(blocker: 'read_only')+ ..releases.first.changes.addAll(long)+ ..releases.first.fixes.addAll(long),+ );+ await openDialog(tester, state);+ expect(find.byType(UpdateDialog), findsOneWidget);+ expect(tester.takeException(), isNull);+ });+ }+}diff --git a/ui/tool/l10n/strings.py b/ui/tool/l10n/strings.pyindex 3f8479b..8a2cf21 100644--- a/ui/tool/l10n/strings.py+++ b/ui/tool/l10n/strings.py@@ -317,6 +317,37 @@ S = [('officialWarning', '90% of the daily relay allowance has been used. Direct connections do not consume it.', '今日中转额度已使用 90%,直连不消耗此额度。', '本日の中継上限の90%を使用しました。直接接続ではこの残量は消費しません。', '今日中繼額度已使用 90%,直連不消耗此額度。', '今日中轉額度已使用 90%,直連不消耗此額度。'),('officialAccounting', 'Upload and download combined, including encryption overhead. Only official relay usage is measured; direct content and traffic are not recorded.', '上下行合计,包含加密传输开销;只统计官方中转,不统计直连内容或流量。', '暗号化の通信量を含む送受信の合計です。公式中継のみ計測し、直接接続の内容や通信量は記録しません。', '上下行合計,包含加密傳輸開銷;僅統計官方中繼,不統計直連內容或流量。', '上下行合計,包含加密傳輸開銷;只統計官方中轉,不統計直連內容或流量。'),+ # Updates: checked against the signed update list on GitHub and Gitee.+ ("updateCheck", "Check for updates", "检查更新", "アップデートを確認", "檢查更新", "檢查更新"),+ ("updateCheckEllipsis", "Check for updates…", "检查更新…", "アップデートを確認…", "檢查更新…", "檢查更新…"),+ ("updateAuto", "Check for updates automatically", "自动检查更新", "アップデートを自動で確認", "自動檢查更新", "自動檢查更新"),+ ("updateAutoDesc", "Once a day. Only reads the update list on GitHub and Gitee; nothing that identifies you is sent.", "每天一次,只读取 GitHub 和 Gitee 上的更新清单,不发送任何能识别你的信息。", "1 日 1 回、GitHub と Gitee のアップデート一覧を読むだけで、あなたを識別できる情報は送信しません。", "每天一次,只讀取 GitHub 和 Gitee 上的更新清單,不傳送任何能識別你的資訊。", "每天一次,只讀取 GitHub 和 Gitee 上的更新清單,不傳送任何能識別你的資料。"),+ ("updateChecking", "Checking for updates…", "正在检查更新…", "アップデートを確認しています…", "正在檢查更新…", "正在檢查更新…"),+ ("updateUpToDate", "PasteFerry {version} is the latest version.", "隔空贴 {version} 已是最新版本。", "PasteFerry {version} は最新バージョンです。", "隔空貼 {version} 已是最新版本。", "隔空貼 {version} 已是最新版本。"),+ ("updateAvailableTitle", "PasteFerry {version} is available", "有新版本:隔空贴 {version}", "PasteFerry {version} があります", "有新版本:隔空貼 {version}", "有新版本:隔空貼 {version}"),+ ("updateCurrentSize", "You have {current}. Download size {size}.", "当前版本 {current},需要下载 {size}。", "現在のバージョンは {current}、ダウンロードは {size} です。", "目前版本 {current},需要下載 {size}。", "目前版本 {current},需要下載 {size}。"),+ ("updateNew", "New", "新增", "新機能", "新增", "新增"),+ ("updateFixed", "Fixed", "修复", "修正", "修正", "修正"),+ ("updateSkip", "Skip this version", "跳过这个版本", "このバージョンをスキップ", "略過這個版本", "略過這個版本"),+ ("updateLater", "Later", "以后再说", "後で", "以後再說", "稍後再說"),+ ("updateInstall", "Download and install", "下载并安装", "ダウンロードしてインストール", "下載並安裝", "下載並安裝"),+ ("updateDownloading", "Downloading {done} of {total}", "正在下载 {done} / {total}", "ダウンロード中 {done} / {total}", "正在下載 {done} / {total}", "正在下載 {done} / {total}"),+ ("updateVerifying", "Checking the download…", "正在校验下载的文件…", "ダウンロードしたファイルを検証しています…", "正在驗證下載的檔案…", "正在校驗下載的檔案…"),+ ("updateInstalling", "Installing. PasteFerry will reopen by itself.", "正在安装,隔空贴会自动重新打开。", "インストールしています。PasteFerry は自動的に再び開きます。", "正在安裝,隔空貼會自動重新開啟。", "正在安裝,隔空貼會自動重新開啟。"),+ ("updateInstallingPassword", "Installing. Your system will ask for your password, because /opt needs administrator rights; PasteFerry then reopens by itself.", "正在安装。安装到 /opt 需要管理员权限,系统会请你输入密码,之后隔空贴会自动重新打开。", "インストールしています。/opt には管理者権限が必要なため、システムがパスワードを求めます。その後 PasteFerry は自動的に再び開きます。", "正在安裝。安裝到 /opt 需要系統管理員權限,系統會請你輸入密碼,之後隔空貼會自動重新開啟。", "正在安裝。安裝到 /opt 需要管理員權限,系統會請你輸入密碼,之後隔空貼會自動重新開啟。"),+ ("updateCheckFailed", "Couldn't reach GitHub or Gitee. Try again later.", "暂时连不上 GitHub 和 Gitee,请稍后再试。", "GitHub と Gitee に接続できません。しばらくしてからもう一度お試しください。", "暫時連不上 GitHub 和 Gitee,請稍後再試。", "暫時連不上 GitHub 和 Gitee,請稍後再試。"),+ ("updateDownloadFailed", "The download didn't finish. Try again, or download the new version from the website.", "下载没有完成。可以重试,或者到下载页手动下载新版本。", "ダウンロードが完了しませんでした。もう一度試すか、ウェブサイトから新しいバージョンをダウンロードしてください。", "下載沒有完成。可以重試,或到下載頁手動下載新版本。", "下載沒有完成。可以重試,或到下載頁手動下載新版本。"),+ ("updateInstallFailed", "Couldn't start the installation: {error}", "没能开始安装:{error}", "インストールを開始できませんでした:{error}", "沒能開始安裝:{error}", "未能開始安裝:{error}"),+ ("updateUnsupportedBuild", "This build can't check for updates.", "这个版本不支持检查更新。", "このビルドはアップデートを確認できません。", "這個版本不支援檢查更新。", "這個版本不支援檢查更新。"),+ ("updateBlockedDev", "This is a development build, so it can't update itself.", "这是开发构建,不能自动更新。", "開発ビルドのため、自動アップデートできません。", "這是開發版本,不能自動更新。", "這是開發版本,不能自動更新。"),+ ("updateBlockedMustMove", "PasteFerry is running from the disk image. Drag it to Applications and open it from there to update automatically.", "隔空贴是直接从磁盘映像里打开的。把它拖到「应用程序」文件夹、从那里打开后,就能自动更新。", "PasteFerry をディスクイメージから直接開いています。「アプリケーション」フォルダにドラッグし、そこから開くと自動アップデートできます。", "隔空貼是直接從磁碟映像檔裡開啟的。把它拖到「應用程式」資料夾、從那裡開啟後,就能自動更新。", "隔空貼是直接從磁碟映像檔裏開啟的。把它拖到「應用程式」資料夾、從那裏開啟後,就能自動更新。"),+ ("updateBlockedReadOnly", "PasteFerry can't write to the folder it is installed in. Download the new version from the website instead.", "隔空贴所在的文件夹不能写入,没法自动更新。请到下载页手动下载新版本。", "PasteFerry のインストール先フォルダに書き込めないため、自動アップデートできません。ウェブサイトから新しいバージョンをダウンロードしてください。", "隔空貼所在的資料夾無法寫入,沒辦法自動更新。請到下載頁手動下載新版本。", "隔空貼所在的資料夾無法寫入,沒法自動更新。請到下載頁手動下載新版本。"),+ ("updateBlockedUnsupported", "There is no automatic update for this computer. Download the new version from the website.", "这台电脑没有可用的自动更新安装包,请到下载页手动下载新版本。", "このコンピュータ用の自動アップデートはありません。ウェブサイトから新しいバージョンをダウンロードしてください。", "這台電腦沒有可用的自動更新安裝檔,請到下載頁手動下載新版本。", "這部電腦沒有可用的自動更新安裝檔,請到下載頁手動下載新版本。"),+ ("updateOpenDownload", "Open download page", "打开下载页", "ダウンロードページを開く", "開啟下載頁", "開啟下載頁"),+ ("updateSidebar", "Version {version} is available", "新版本 {version} 可用", "バージョン {version} があります", "新版本 {version} 可用", "新版本 {version} 可用"),+ ("updatedTo", "Updated to {version}", "已更新到 {version}", "{version} にアップデートしました", "已更新到 {version}", "已更新到 {version}"),+ ("updateNotFinished", "The update didn't finish. You're still on {version}.", "更新没有完成,仍是 {version}。", "アップデートが完了しませんでした。{version} のままです。", "更新沒有完成,仍是 {version}。", "更新沒有完成,仍是 {version}。"),+# Desktop notifications and build identity.("buildDetails", "UI {uiVersion} · Service {serviceVersion} · Build {build}", "界面 {uiVersion} · 后台 {serviceVersion} · 构建 {build}", "UI {uiVersion} · サービス {serviceVersion} · ビルド {build}", "介面 {uiVersion} · 背景服務 {serviceVersion} · 建置 {build}", "介面 {uiVersion} · 背景服務 {serviceVersion} · 版本識別 {build}"),("notReceived", "Not received — receive before pasting", "尚未接收,暂不可粘贴", "未受信 — ペーストする前に受信してください", "尚未接收,暫不可貼上", "尚未接收,暫不可貼上"),