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
fix(core): say why an automatic update failed
baiyuzeef705c2c6c11
diff --git a/client-core/cmd/pasteferryd/updates.go b/client-core/cmd/pasteferryd/updates.goindex aee694b..d948c04 100644--- a/client-core/cmd/pasteferryd/updates.go+++ b/client-core/cmd/pasteferryd/updates.go@@ -54,6 +54,7 @@ func wireUpdater(deps *rpc.Deps, svc *update.Service) {return svc.Install(version, uiPID)}deps.UpdateNotice = svc.Notice+ deps.UpdaterLog = svc.HelperLogdeps.LastUpdate = func() *pb.UpdateResult {r := svc.LastResult()if r == nil {diff --git a/client-core/internal/diag/report.go b/client-core/internal/diag/report.goindex dd228b8..7342b00 100644--- a/client-core/internal/diag/report.go+++ b/client-core/internal/diag/report.go@@ -30,7 +30,9 @@ type Input struct {LogFiles []string // 按时间先后,轮转出去的旧文件在前CrashLog string // 未处理的 panic 写在这里;Mac 上没有,panic 直接进日志- LogLines int+ // 最近一次更新助手的日志:更新失败时助手在这里写原因,后台服务的日志里没有+ UpdaterLog string+ LogLines intHome string // 用户目录,换成 ~FileNames []string // 复制过的文件名,换成 <file>@@ -79,6 +81,14 @@ func Build(in Input) string {row("Clipboard access", strings.ToLower(strings.TrimPrefix(st.GetClipboardPermission().String(), "CLIPBOARD_PERMISSION_")))row("Cache", fmt.Sprintf("%d MB", st.GetCacheBytesUsed()>>20))}+ if u := in.Status.GetLastUpdate(); u != nil {+ res := "ok"+ if !u.GetOk() {+ res = "failed: " + or(u.GetError(), "no reason given")+ }+ row("Last update", fmt.Sprintf("%s -> %s at %s, %s", u.GetFromVersion(), u.GetToVersion(),+ time.Unix(u.GetAtUnix(), 0).In(in.Now.Location()).Format("15:04"), res))+ }if in.VerboseUntil.IsZero() {row("Detailed logging", "off")} else {@@ -138,6 +148,15 @@ func Build(in Input) string {for _, l := range logs {line("%s", l)}+ if u := in.Status.GetLastUpdate(); u != nil && !u.GetOk() && in.UpdaterLog != "" {+ if lines := tailLines([]string{in.UpdaterLog}, 40); len(lines) > 0 {+ line("")+ line("Updater log (%s)", lastLines(len(lines)))+ for _, l := range lines {+ line("%s", l)+ }+ }+ }if crash := tailLines([]string{in.CrashLog}, 100); in.CrashLog != "" && len(crash) > 0 {line("")line("Crash log (%s)", lastLines(len(crash)))diff --git a/client-core/internal/rpc/server.go b/client-core/internal/rpc/server.goindex f41c52f..d659022 100644--- a/client-core/internal/rpc/server.go+++ b/client-core/internal/rpc/server.go@@ -93,6 +93,8 @@ type Deps struct {InstallUpdate func(version string, uiPID int) errorUpdateNotice func() stringLastUpdate func() *pb.UpdateResult+ // UpdaterLog 是最近一次更新助手的日志文件,诊断报告在更新失败时带上它+ UpdaterLog func() string// Transfers 是隔空传送;为 nil 时相应的方法返回 UnimplementedTransfers Transfers@@ -492,6 +494,9 @@ func (s *Server) ExportDiagnostics(ctx context.Context, req *pb.ExportDiagnosticif s.deps.LogFiles != nil {in.LogFiles, in.CrashLog = s.deps.LogFiles()}+ if s.deps.UpdaterLog != nil {+ in.UpdaterLog = s.deps.UpdaterLog()+ }in.Home, _ = os.UserHomeDir()if s.deps.Store != nil {// 名字取不全只是少换掉几个,报告照样能用diff --git a/client-core/internal/update/service.go b/client-core/internal/update/service.goindex fa40767..8bd1e67 100644--- a/client-core/internal/update/service.go+++ b/client-core/internal/update/service.go@@ -138,6 +138,10 @@ func (s *Service) LastResult() *Result {defer s.mu.Unlock()if st, err := os.Stat(filepath.Join(s.Root, "updates", "result.json")); err == nil && !st.ModTime().Equal(s.resultMod) {s.result, s.resultMod = ReadResult(s.Root), st.ModTime()+ // 安装失败时后台服务没被重启,启动时的那条日志不会有:在这里记下来,诊断报告里才看得到+ if r := s.result; r != nil && s.Log != nil {+ s.Log.Info("更新助手的结果", "from", r.From, "to", r.To, "ok", r.OK, "err", r.Error)+ }}if s.result == nil || time.Since(time.Unix(s.result.At, 0)) > resultFresh {return nil@@ -145,6 +149,19 @@ func (s *Service) LastResult() *Result {return s.result}+// HelperLog 是最近一次更新助手的日志(<data>/updates/<版本>/updater.log),没有就返回空字符串。+func (s *Service) HelperLog() string {+ logs, _ := filepath.Glob(filepath.Join(s.Root, "updates", "*", "updater.log"))+ var newest string+ var at time.Time+ for _, l := range logs {+ if st, err := os.Stat(l); err == nil && st.ModTime().After(at) {+ newest, at = l, st.ModTime()+ }+ }+ return newest+}+// Asset 是这台电脑要下载的安装包。func (s *Service) Asset(m *Manifest) (Asset, bool) {a, ok := m.Assets[s.Target.Asset]diff --git a/ui/lib/l10n/app_en.arb b/ui/lib/l10n/app_en.arbindex 1d87cb1..67f0bdb 100644--- a/ui/lib/l10n/app_en.arb+++ b/ui/lib/l10n/app_en.arb@@ -809,6 +809,17 @@}}},+ "updateNotFinishedWhy": "The update didn't finish. You're still on {version}. {detail}",+ "@updateNotFinishedWhy": {+ "placeholders": {+ "version": {+ "type": "String"+ },+ "detail": {+ "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 d0a3b4c..9d0d208 100644--- a/ui/lib/l10n/app_ja.arb+++ b/ui/lib/l10n/app_ja.arb@@ -359,6 +359,7 @@"updateSidebar": "バージョン {version} があります","updatedTo": "{version} にアップデートしました","updateNotFinished": "アップデートが完了しませんでした。{version} のままです。",+ "updateNotFinishedWhy": "アップデートが完了しませんでした。{version} のままです。{detail}","buildDetails": "UI {uiVersion} · サービス {serviceVersion} · ビルド {build}","notReceived": "未受信 — ペーストする前に受信してください","receivedPreserved": "受信済み。クリップボードに入れるとペーストできます",diff --git a/ui/lib/l10n/app_localizations.dart b/ui/lib/l10n/app_localizations.dartindex daada8a..c9e224a 100644--- a/ui/lib/l10n/app_localizations.dart+++ b/ui/lib/l10n/app_localizations.dart@@ -2264,6 +2264,12 @@ abstract class AppLocalizations {/// **'The update didn\'t finish. You\'re still on {version}.'**String updateNotFinished(String version);+ /// No description provided for @updateNotFinishedWhy.+ ///+ /// In en, this message translates to:+ /// **'The update didn\'t finish. You\'re still on {version}. {detail}'**+ String updateNotFinishedWhy(String version, String detail);+/// 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 a32ce51..79cd1d6 100644--- a/ui/lib/l10n/app_localizations_en.dart+++ b/ui/lib/l10n/app_localizations_en.dart@@ -1353,6 +1353,11 @@ class AppLocalizationsEn extends AppLocalizations {return 'The update didn\'t finish. You\'re still on $version.';}+ @override+ String updateNotFinishedWhy(String version, String detail) {+ return 'The update didn\'t finish. You\'re still on $version. $detail';+ }+@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 0bf3563..f753b19 100644--- a/ui/lib/l10n/app_localizations_ja.dart+++ b/ui/lib/l10n/app_localizations_ja.dart@@ -1237,6 +1237,11 @@ class AppLocalizationsJa extends AppLocalizations {return 'アップデートが完了しませんでした。$version のままです。';}+ @override+ String updateNotFinishedWhy(String version, String detail) {+ return 'アップデートが完了しませんでした。$version のままです。$detail';+ }+@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 46dfcac..bece878 100644--- a/ui/lib/l10n/app_localizations_zh.dart+++ b/ui/lib/l10n/app_localizations_zh.dart@@ -1222,6 +1222,11 @@ class AppLocalizationsZh extends AppLocalizations {return '更新没有完成,仍是 $version。';}+ @override+ String updateNotFinishedWhy(String version, String detail) {+ return '更新没有完成,仍是 $version。$detail';+ }+@overrideString buildDetails(String uiVersion, String serviceVersion, String build) {return '界面 $uiVersion · 后台 $serviceVersion · 构建 $build';@@ -3347,6 +3352,11 @@ class AppLocalizationsZhHantHk extends AppLocalizationsZh {return '更新沒有完成,仍是 $version。';}+ @override+ String updateNotFinishedWhy(String version, String detail) {+ return '更新沒有完成,仍是 $version。$detail';+ }+@overrideString buildDetails(String uiVersion, String serviceVersion, String build) {return '介面 $uiVersion · 背景服務 $serviceVersion · 版本識別 $build';@@ -5472,6 +5482,11 @@ class AppLocalizationsZhHantTw extends AppLocalizationsZh {return '更新沒有完成,仍是 $version。';}+ @override+ String updateNotFinishedWhy(String version, String detail) {+ return '更新沒有完成,仍是 $version。$detail';+ }+@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 7dbe8b5..9088c04 100644--- a/ui/lib/l10n/app_zh.arb+++ b/ui/lib/l10n/app_zh.arb@@ -359,6 +359,7 @@"updateSidebar": "新版本 {version} 可用","updatedTo": "已更新到 {version}","updateNotFinished": "更新没有完成,仍是 {version}。",+ "updateNotFinishedWhy": "更新没有完成,仍是 {version}。{detail}","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 569d901..70645b5 100644--- a/ui/lib/l10n/app_zh_Hant_HK.arb+++ b/ui/lib/l10n/app_zh_Hant_HK.arb@@ -359,6 +359,7 @@"updateSidebar": "新版本 {version} 可用","updatedTo": "已更新到 {version}","updateNotFinished": "更新沒有完成,仍是 {version}。",+ "updateNotFinishedWhy": "更新沒有完成,仍是 {version}。{detail}","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 54ffd97..bced5f4 100644--- a/ui/lib/l10n/app_zh_Hant_TW.arb+++ b/ui/lib/l10n/app_zh_Hant_TW.arb@@ -359,6 +359,7 @@"updateSidebar": "新版本 {version} 可用","updatedTo": "已更新到 {version}","updateNotFinished": "更新沒有完成,仍是 {version}。",+ "updateNotFinishedWhy": "更新沒有完成,仍是 {version}。{detail}","buildDetails": "介面 {uiVersion} · 背景服務 {serviceVersion} · 建置 {build}","notReceived": "尚未接收,暫不可貼上","receivedPreserved": "已接收,點選放入剪貼簿後即可貼上",diff --git a/ui/lib/main.dart b/ui/lib/main.dartindex 95c2d62..b7fc034 100644--- a/ui/lib/main.dart+++ b/ui/lib/main.dart@@ -304,7 +304,9 @@ class _ShellState extends State<Shell> with WidgetsBindingObserver {context,updated.ok? l.updatedTo(updated.toVersion)- : l.updateNotFinished(updated.fromVersion),+ : updated.error.isEmpty+ ? l.updateNotFinished(updated.fromVersion)+ : l.updateNotFinishedWhy(updated.fromVersion, updated.error),error: !updated.ok,);});