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(core): add favorites, link filter and quick paste session
baiyuzee6e68730e8ea
diff --git a/client-core/cmd/pasteferryd/main.go b/client-core/cmd/pasteferryd/main.goindex aeddc26..0757b6b 100644--- a/client-core/cmd/pasteferryd/main.go+++ b/client-core/cmd/pasteferryd/main.go@@ -201,6 +201,11 @@ func run(dataDir string) error {if err := blobs.CleanTemp(); err != nil {slog.Debug("清理临时文件失败", "err", err)}+ // 收藏另存的图片与文件,与缓存分开放:缓存会过期,收藏不会+ favorites, err := cache.New(paths.Favorites)+ if err != nil {+ return err+ }// ── 配置的并发安全读写 ──var cfgMu sync.RWMutex@@ -296,6 +301,7 @@ func run(dataDir string) error {engine = syncengine.New(syncengine.Options{Store: db,Cache: blobs,+ Favorites: favorites,Watcher: watcher,DeviceID: id.DeviceID,DeviceName: func() string { return loadCfg().DeviceName },@@ -328,6 +334,9 @@ func run(dataDir string) error {OnRecord: func(r *pb.ClipRecord) {hub.Publish(rpc.EventClipAdded(r))},+ OnRemoved: func(id string) {+ hub.Publish(rpc.EventClipRemoved(id))+ },OnProgress: func(p *pb.TransferProgress) {hub.Publish(rpc.EventProgress(p))},@@ -348,6 +357,7 @@ func run(dataDir string) error {collector := gc.New(gc.Options{Store: db,Cache: blobs,+ Favorites: favorites,LoadConfig: loadCfg,OnRemoved: func(ids []string) {for _, cid := range ids {@@ -357,6 +367,9 @@ func run(dataDir string) error {})go collector.Run(ctx)+ // 快捷粘贴窗口(Windows、Linux 上由这里拉起,Mac 上由 LaunchAgent),见 quickpaste.go+ quickPaste := newQuickPasteRunner(ctx, dataDir == "", !cfg.QuickPasteDisabled)+// 改了服务器地址要立即重连,否则用户得重启 daemon 才生效saveCfgAndApply := func(c config.Config) error {prev := loadCfg()@@ -377,6 +390,9 @@ func run(dataDir string) error {default:}}+ // 快捷窗口据此重新注册快捷键、换语言;关掉快捷粘贴时它自己退出+ hub.Publish(rpc.EventConfigChanged(rpc.ConfigToProto(c)))+ quickPaste.SetEnabled(!c.QuickPasteDisabled)return nil}@@ -417,8 +433,10 @@ func run(dataDir string) error {OpenLocalNetworkSettings: lan.RequestPermission,Fetch: engine.Fetch,FetchForPreview: engine.FetchForPreview,- ApplyToClipboard: engine.ApplyToClipboard,+ ApplyToClipboard: engine.ApplyToClipboardAs,SearchHistory: engine.SearchHistory,+ SetFavorite: engine.SetFavorite,+ ClipDetail: engine.ClipDetail,ImagePreview: engine.ImagePreview,CacheBytesUsed: blobs.Size,OfficialUsage: peerMgr.OfficialUsage,diff --git a/client-core/cmd/pasteferryd/quickpaste.go b/client-core/cmd/pasteferryd/quickpaste.gonew file mode 100644index 0000000..fc175b2--- /dev/null+++ b/client-core/cmd/pasteferryd/quickpaste.go@@ -0,0 +1,125 @@+package main++import (+ "context"+ "log/slog"+ "os"+ "os/exec"+ "sync"+ "time"+)++// quickPasteRunner 在 Windows 与 Linux 上拉起并照看快捷粘贴窗口进程:界面程序加上 --picker 参数。+// 它崩溃了过 10 秒再拉起;后台服务退出时它也跟着结束(Windows 用 Job Object,Linux 用 Pdeathsig)。+// Mac 上快捷窗口是单独的辅助程序,由界面登记的 LaunchAgent 照看,这里什么都不做。+// 见 design/quick-paste-and-favorites.md 第 6.1 节。+type quickPasteRunner struct {+ mu sync.Mutex+ enabled bool+ wake chan struct{}+}++// pickerRestartDelay 是快捷窗口退出后过多久再拉起。+const pickerRestartDelay = 10 * time.Second++// newQuickPasteRunner 在 active(不是测试用的独立数据目录)且找得到界面程序时开始照看快捷窗口。+func newQuickPasteRunner(ctx context.Context, active, enabled bool) *quickPasteRunner {+ r := &quickPasteRunner{enabled: enabled, wake: make(chan struct{}, 1)}+ exe := pickerExecutable()+ if !active || exe == "" {+ return r+ }+ if _, err := os.Stat(exe); err != nil {+ slog.Debug("没有界面程序(开发构建),不拉起快捷粘贴窗口", "path", exe)+ return r+ }+ go r.run(ctx, exe)+ return r+}++// SetEnabled 在设置里开关快捷粘贴时调用。关掉时快捷窗口收到 config_changed 会自己退出,+// 几秒内没退出就结束它。+func (r *quickPasteRunner) SetEnabled(on bool) {+ r.mu.Lock()+ changed := r.enabled != on+ r.enabled = on+ r.mu.Unlock()+ if changed {+ select {+ case r.wake <- struct{}{}:+ default:+ }+ }+}++func (r *quickPasteRunner) isEnabled() bool {+ r.mu.Lock()+ defer r.mu.Unlock()+ return r.enabled+}++func (r *quickPasteRunner) run(ctx context.Context, exe string) {+ for {+ if !r.isEnabled() {+ select {+ case <-ctx.Done():+ return+ case <-r.wake:+ continue+ }+ }+ cmd := exec.Command(exe, "--picker")+ cmd.SysProcAttr = pickerAttr()+ if err := cmd.Start(); err != nil {+ slog.Warn("拉起快捷粘贴窗口失败", "err", err)+ if !r.sleep(ctx, pickerRestartDelay) {+ return+ }+ continue+ }+ bindPicker(cmd.Process)+ slog.Info("快捷粘贴窗口已启动", "pid", cmd.Process.Pid)+ exited := make(chan error, 1)+ go func() { exited <- cmd.Wait() }()++ stopped := false+ for !stopped {+ select {+ case <-ctx.Done():+ _ = cmd.Process.Kill()+ <-exited+ return+ case err := <-exited:+ slog.Info("快捷粘贴窗口已退出", "err", err)+ stopped = true+ case <-r.wake:+ if r.isEnabled() {+ continue+ }+ select {+ case <-exited:+ case <-time.After(3 * time.Second):+ _ = cmd.Process.Kill()+ <-exited+ }+ stopped = true+ }+ }+ if r.isEnabled() && !r.sleep(ctx, pickerRestartDelay) {+ return+ }+ }+}++// sleep 等 d,期间开关变了就提前醒来。返回 false 表示后台服务要退出了。+func (r *quickPasteRunner) sleep(ctx context.Context, d time.Duration) bool {+ t := time.NewTimer(d)+ defer t.Stop()+ select {+ case <-ctx.Done():+ return false+ case <-t.C:+ case <-r.wake:+ }+ return true+}diff --git a/client-core/cmd/pasteferryd/quickpaste_linux.go b/client-core/cmd/pasteferryd/quickpaste_linux.gonew file mode 100644index 0000000..eab43cb--- /dev/null+++ b/client-core/cmd/pasteferryd/quickpaste_linux.go@@ -0,0 +1,25 @@+//go:build linux++package main++import (+ "os"+ "path/filepath"+ "syscall"+)++// 界面程序与后台服务在同一个目录(.deb 装在 /opt/PasteFerry)。+func pickerExecutable() string {+ exe, err := os.Executable()+ if err != nil {+ return ""+ }+ return filepath.Join(filepath.Dir(exe), "pasteferry")+}++// 后台服务退出时快捷窗口随之结束,不会留下一个没人照看、连不上后台服务的窗口。+func pickerAttr() *syscall.SysProcAttr {+ return &syscall.SysProcAttr{Pdeathsig: syscall.SIGTERM}+}++func bindPicker(*os.Process) {}diff --git a/client-core/cmd/pasteferryd/quickpaste_other.go b/client-core/cmd/pasteferryd/quickpaste_other.gonew file mode 100644index 0000000..50a1a91--- /dev/null+++ b/client-core/cmd/pasteferryd/quickpaste_other.go@@ -0,0 +1,15 @@+//go:build !windows && !linux++package main++import (+ "os"+ "syscall"+)++// Mac 上快捷窗口是 App 包里单独的辅助程序(PasteFerryPicker.app),由界面登记的 LaunchAgent 拉起和照看。+func pickerExecutable() string { return "" }++func pickerAttr() *syscall.SysProcAttr { return nil }++func bindPicker(*os.Process) {}diff --git a/client-core/cmd/pasteferryd/quickpaste_windows.go b/client-core/cmd/pasteferryd/quickpaste_windows.gonew file mode 100644index 0000000..5aed6ed--- /dev/null+++ b/client-core/cmd/pasteferryd/quickpaste_windows.go@@ -0,0 +1,62 @@+//go:build windows++package main++import (+ "log/slog"+ "os"+ "path/filepath"+ "sync"+ "syscall"+ "unsafe"++ "golang.org/x/sys/windows"+)++// 界面程序 PasteFerry.exe 与后台服务在同一个文件夹。+func pickerExecutable() string {+ exe, err := os.Executable()+ if err != nil {+ return ""+ }+ return filepath.Join(filepath.Dir(exe), "PasteFerry.exe")+}++func pickerAttr() *syscall.SysProcAttr { return nil }++var (+ pickerJobOnce sync.Once+ pickerJob windows.Handle+)++// bindPicker 把快捷窗口放进一个 Job Object:后台服务退出(哪怕是被结束进程)时,+// 系统关掉这个 Job,快捷窗口随之结束。+func bindPicker(p *os.Process) {+ pickerJobOnce.Do(func() {+ job, err := windows.CreateJobObject(nil, nil)+ if err != nil {+ slog.Debug("创建 Job Object 失败", "err", err)+ return+ }+ info := windows.JOBOBJECT_EXTENDED_LIMIT_INFORMATION{}+ info.BasicLimitInformation.LimitFlags = windows.JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE+ if _, err := windows.SetInformationJobObject(job, windows.JobObjectExtendedLimitInformation,+ uintptr(unsafe.Pointer(&info)), uint32(unsafe.Sizeof(info))); err != nil {+ slog.Debug("设置 Job Object 失败", "err", err)+ windows.CloseHandle(job)+ return+ }+ pickerJob = job+ })+ if pickerJob == 0 {+ return+ }+ h, err := windows.OpenProcess(windows.PROCESS_SET_QUOTA|windows.PROCESS_TERMINATE, false, uint32(p.Pid))+ if err != nil {+ return+ }+ defer windows.CloseHandle(h)+ if err := windows.AssignProcessToJobObject(pickerJob, h); err != nil {+ slog.Debug("把快捷窗口放进 Job Object 失败", "err", err)+ }+}diff --git a/client-core/internal/config/config.go b/client-core/internal/config/config.goindex 1163120..b89af79 100644--- a/client-core/internal/config/config.go+++ b/client-core/internal/config/config.go@@ -58,6 +58,14 @@ type Config struct {UpdateCheckDisabled bool `json:"update_check_disabled,omitempty"`// UpdateSkipVersion 是用户选择跳过的版本:自动检查不再提示它UpdateSkipVersion string `json:"update_skip_version,omitempty"`++ // QuickPasteDisabled 关掉快捷粘贴窗口。写成反向的,旧配置文件没有这一项时就是开启。+ QuickPasteDisabled bool `json:"quick_paste_disabled,omitempty"`+ // QuickPasteHotkey 是呼出快捷窗口的快捷键,写法见 NormalizeHotkey;+ // 空字符串表示默认:Mac 上 ⌥V,其他平台 Alt+V+ QuickPasteHotkey string `json:"quick_paste_hotkey,omitempty"`+ // QuickPasteCopyOnly 选中后只放进剪贴板,不模拟粘贴+ QuickPasteCopyOnly bool `json:"quick_paste_copy_only,omitempty"`}// CurrentVersion 是当前的配置格式版本。@@ -146,15 +154,19 @@ func (c *Config) Validate() {default:c.Language = ""}+ // 写不对的快捷键当作默认的+ c.QuickPasteHotkey = NormalizeHotkey(c.QuickPasteHotkey)}// ─────────────────────────── 目录布局 ───────────────────────────// Paths 是 daemon 用到的全部路径。集中在一处,便于测试时重定向。type Paths struct {- Root string // 配置与数据库- Cache string // 收到的文件内容- Config string+ Root string // 配置与数据库+ Cache string // 收到的文件内容+ // 收藏另存的图片与文件。不能放在 Cache 里面:GC 会把缓存目录里不认识的文件夹当成孤儿删掉+ Favorites string+ Config stringDB string// daemon 启动后把 gRPC 端口和一次性 token 写在这里,供 UI 发现Endpoint string@@ -196,9 +208,10 @@ func DefaultPaths() (Paths, error) {func pathsUnder(root string) Paths {return Paths{- Root: root,- Cache: filepath.Join(root, "cache"),- Config: filepath.Join(root, "config.json"),+ Root: root,+ Cache: filepath.Join(root, "cache"),+ Favorites: filepath.Join(root, "favorites"),+ Config: filepath.Join(root, "config.json"),DB: filepath.Join(root, "pasteferry.db"),Endpoint: filepath.Join(root, "daemon.json"),}@@ -250,7 +263,7 @@ func legacyRoot(root string) string {}func (p Paths) EnsureDirs() error {- for _, d := range []string{p.Root, p.Cache} {+ for _, d := range []string{p.Root, p.Cache, p.Favorites} {if err := os.MkdirAll(d, 0o700); err != nil {return fmt.Errorf("创建目录 %s: %w", d, err)}diff --git a/client-core/internal/config/hotkey.go b/client-core/internal/config/hotkey.gonew file mode 100644index 0000000..f52c872--- /dev/null+++ b/client-core/internal/config/hotkey.go@@ -0,0 +1,85 @@+package config++import (+ "strings"+)++// 快捷键的写法:修饰键在前、按 ctrl、alt、shift、meta 的顺序,最后是一个键,用 + 连起来,全小写,+// 如 "alt+v"、"ctrl+shift+v"、"meta+f9"。meta 是 Mac 上的 ⌘、Windows 上的 Win 键、Linux 上的 Super 键。+// 界面(ui/lib/hotkey.dart)与快捷窗口的原生外壳按同样的写法解析。++var hotkeyModifiers = []string{"ctrl", "alt", "shift", "meta"}++// hotkeyAliases 是常见的别名,存的时候统一换成标准写法。+var hotkeyAliases = map[string]string{+ "control": "ctrl", "option": "alt", "opt": "alt",+ "cmd": "meta", "command": "meta", "win": "meta", "super": "meta",+}++// hotkeyNamedKeys 是除了字母、数字、F1–F24 以外能用的键。+var hotkeyNamedKeys = map[string]bool{+ "space": true, "tab": true, "enter": true, "backspace": true, "delete": true,+ "insert": true, "home": true, "end": true, "pageup": true, "pagedown": true,+ "up": true, "down": true, "left": true, "right": true,+ "comma": true, "period": true, "slash": true, "semicolon": true, "quote": true,+ "bracketleft": true, "bracketright": true, "backslash": true,+ "minus": true, "equal": true, "backquote": true,+}++// NormalizeHotkey 把快捷键换成标准写法;写不对的返回空字符串(即默认快捷键)。+// 至少要有一个修饰键,单独的 F1–F24 除外:全局快捷键不该吃掉一个普通字母。+func NormalizeHotkey(s string) string {+ s = strings.ToLower(strings.ReplaceAll(strings.TrimSpace(s), " ", ""))+ if s == "" {+ return ""+ }+ parts := strings.Split(s, "+")+ key := parts[len(parts)-1]+ mods := map[string]bool{}+ for _, p := range parts[:len(parts)-1] {+ if a, ok := hotkeyAliases[p]; ok {+ p = a+ }+ if !contains(hotkeyModifiers, p) || mods[p] {+ return ""+ }+ mods[p] = true+ }+ fkey := isFunctionKey(key)+ if !fkey && !hotkeyNamedKeys[key] && !(len(key) == 1 && (key[0] >= 'a' && key[0] <= 'z' || key[0] >= '0' && key[0] <= '9')) {+ return ""+ }+ if len(mods) == 0 && !fkey {+ return ""+ }+ var out []string+ for _, m := range hotkeyModifiers {+ if mods[m] {+ out = append(out, m)+ }+ }+ return strings.Join(append(out, key), "+")+}++func isFunctionKey(k string) bool {+ if len(k) < 2 || k[0] != 'f' {+ return false+ }+ n := 0+ for _, c := range k[1:] {+ if c < '0' || c > '9' {+ return false+ }+ n = n*10 + int(c-'0')+ }+ return n >= 1 && n <= 24 && k[1] != '0'+}++func contains(list []string, s string) bool {+ for _, v := range list {+ if v == s {+ return true+ }+ }+ return false+}diff --git a/client-core/internal/config/hotkey_test.go b/client-core/internal/config/hotkey_test.gonew file mode 100644index 0000000..28e7662--- /dev/null+++ b/client-core/internal/config/hotkey_test.go@@ -0,0 +1,46 @@+package config++import "testing"++func TestNormalizeHotkey(t *testing.T) {+ for in, want := range map[string]string{+ "": "",+ "alt+v": "alt+v",+ "Alt+V": "alt+v",+ " option + v ": "alt+v",+ "shift+ctrl+v": "ctrl+shift+v",+ "cmd+shift+space": "shift+meta+space",+ "win+v": "meta+v",+ "f9": "f9",+ "ctrl+f24": "ctrl+f24",+ "v": "", // 没有修饰键+ "alt": "", // 没有键+ "alt+alt+v": "", // 重复的修饰键+ "hyper+v": "", // 不认识的修饰键+ "alt+vv": "", // 不认识的键+ "f0": "",+ "f25": "",+ "f01": "",+ "ctrl+alt+comma": "ctrl+alt+comma",+ "alt+backquote": "alt+backquote",+ "ctrl+alt+shift+1": "ctrl+alt+shift+1",+ } {+ if got := NormalizeHotkey(in); got != want {+ t.Errorf("NormalizeHotkey(%q) = %q, want %q", in, got, want)+ }+ }+}++func TestValidateDropsBadHotkey(t *testing.T) {+ c := Default()+ c.QuickPasteHotkey = "Option+V"+ c.Validate()+ if c.QuickPasteHotkey != "alt+v" {+ t.Fatalf("hotkey = %q", c.QuickPasteHotkey)+ }+ c.QuickPasteHotkey = "v"+ c.Validate()+ if c.QuickPasteHotkey != "" {+ t.Fatalf("hotkey = %q, want default", c.QuickPasteHotkey)+ }+}diff --git a/client-core/internal/gc/gc.go b/client-core/internal/gc/gc.goindex fbb8a87..391459d 100644--- a/client-core/internal/gc/gc.go+++ b/client-core/internal/gc/gc.go@@ -25,6 +25,7 @@ type Collector struct {log *slog.Loggerstore *store.Storecache *cache.Cache+ favorites *cache.CacheloadConfig func() config.ConfigonRemoved func(ids []string)// 便于测试注入假时钟@@ -32,9 +33,11 @@ type Collector struct {}type Options struct {- Logger *slog.Logger- Store *store.Store- Cache *cache.Cache+ Logger *slog.Logger+ Store *store.Store+ Cache *cache.Cache+ // Favorites 是收藏另存的目录。收藏不会过期,这里只清掉崩溃留下、没有收藏引用的副本+ Favorites *cache.CacheLoadConfig func() config.ConfigOnRemoved func(ids []string)}@@ -48,6 +51,7 @@ func New(opts Options) *Collector {log: log,store: opts.Store,cache: opts.Cache,+ favorites: opts.Favorites,loadConfig: opts.LoadConfig,onRemoved: opts.OnRemoved,now: time.Now,@@ -126,20 +130,10 @@ func (c *Collector) Collect() Result {}// ── 第三步:与磁盘对账,清掉无人引用的孤儿目录 ──- referenced, err := c.store.CachePaths()- if err != nil {- c.log.Warn("读取缓存引用失败", "err", err)- } else {- orphans, err := c.cache.Orphans(referenced)- if err != nil {- c.log.Warn("扫描孤儿缓存失败", "err", err)- } else {- for _, o := range orphans {- if removed, err := c.cache.RemoveOrphan(o, c.store.CacheReferenced); err == nil && removed {- res.OrphansRemoved++- }- }- }+ res.OrphansRemoved += c.removeOrphans(c.cache, c.store.CachePaths, c.store.CacheReferenced)+ // 收藏目录也一样:另存到一半崩溃、或者取消收藏挪走到一半,都可能留下没人认领的副本+ if c.favorites != nil {+ res.OrphansRemoved += c.removeOrphans(c.favorites, c.store.FavoritePaths, c.store.FavoriteReferenced)}if res.RecordsRemoved+res.CachesRemoved+res.OrphansRemoved > 0 {@@ -151,6 +145,28 @@ func (c *Collector) Collect() Result {return res}+// removeOrphans 删掉目录 dir 里不再有记录引用的子目录,返回删了几个。+func (c *Collector) removeOrphans(dir *cache.Cache, paths func() (map[string]struct{}, error),+ referenced func(string) (bool, error)) int {+ refs, err := paths()+ if err != nil {+ c.log.Warn("读取缓存引用失败", "dir", dir.Root(), "err", err)+ return 0+ }+ orphans, err := dir.Orphans(refs)+ if err != nil {+ c.log.Warn("扫描孤儿缓存失败", "dir", dir.Root(), "err", err)+ return 0+ }+ var n int+ for _, o := range orphans {+ if removed, err := dir.RemoveOrphan(o, referenced); err == nil && removed {+ n+++ }+ }+ return n+}+// expireStaleCaches 释放超过 cacheTTL 的缓存文件,但保留记录本身。func (c *Collector) expireStaleCaches(now time.Time, cacheTTL time.Duration) int {clips, err := c.store.ListClips(500, time.Time{}, store.KindUnspecified)diff --git a/client-core/internal/gc/gc_test.go b/client-core/internal/gc/gc_test.gonew file mode 100644index 0000000..7d06d4b--- /dev/null+++ b/client-core/internal/gc/gc_test.go@@ -0,0 +1,74 @@+package gc++import (+ "io"+ "log/slog"+ "os"+ "path/filepath"+ "testing"+ "time"++ "github.com/baiyuze/pasteferry/client-core/internal/cache"+ "github.com/baiyuze/pasteferry/client-core/internal/config"+ "github.com/baiyuze/pasteferry/client-core/internal/store"+)++// 收藏不会过期:GC 只清复制记录,以及两个目录里没人引用的副本。+func TestCollectKeepsFavorites(t *testing.T) {+ dir := t.TempDir()+ db, err := store.Open(filepath.Join(dir, "pasteferry.db"))+ if err != nil {+ t.Fatal(err)+ }+ defer db.Close()+ blobs, _ := cache.New(filepath.Join(dir, "cache"))+ favs, _ := cache.New(filepath.Join(dir, "favorites"))++ mkdir := func(c *cache.Cache, id string) string {+ rel, abs, err := c.Dir(id)+ if err != nil {+ t.Fatal(err)+ }+ if err := os.WriteFile(filepath.Join(abs, "a.png"), []byte("png"), 0o600); err != nil {+ t.Fatal(err)+ }+ return rel+ }+ old := time.Now().Add(-30 * 24 * time.Hour)+ expired := store.Clip{ID: "expired", Kind: store.KindImage, Status: store.StatusReady,+ CachePath: mkdir(blobs, "expired"), CreatedAt: old, ExpiresAt: old.Add(time.Hour)}+ fav := store.Clip{ID: "fav", Kind: store.KindImage, Status: store.StatusReady, Favorite: true,+ FavoritedAt: old, CachePath: mkdir(favs, "fav"), CreatedAt: old, ExpiresAt: store.FavoriteExpiry}+ for _, c := range []store.Clip{expired, fav} {+ if err := db.PutClip(c); err != nil {+ t.Fatal(err)+ }+ }+ orphan := mkdir(favs, "orphan")++ cfg := config.Default()+ cfg.CacheTTL = config.Duration(time.Hour) // 比记录保留时间短,也会清缓存+ c := New(Options{+ Logger: slog.New(slog.NewTextHandler(io.Discard, nil)),+ Store: db, Cache: blobs, Favorites: favs,+ LoadConfig: func() config.Config { return cfg },+ })+ res := c.Collect()++ if _, err := db.GetClip("expired"); err == nil {+ t.Error("过期的复制记录没删")+ }+ got, err := db.GetClip("fav")+ if err != nil || got.Status != store.StatusReady {+ t.Fatalf("收藏被动了:%+v %v", got, err)+ }+ if !favs.Exists(fav.CachePath) {+ t.Error("收藏的副本被删了")+ }+ if favs.Exists(orphan) {+ t.Error("收藏目录里没人引用的副本没清掉")+ }+ if res.RecordsRemoved != 1 {+ t.Errorf("result = %+v", res)+ }+}diff --git a/client-core/internal/rpc/convert.go b/client-core/internal/rpc/convert.goindex d68822e..68c026b 100644--- a/client-core/internal/rpc/convert.go+++ b/client-core/internal/rpc/convert.go@@ -23,7 +23,7 @@ func clipToProto(c store.Clip) *pb.ClipRecord {ContentType: it.ContentType,})}- return &pb.ClipRecord{+ r := &pb.ClipRecord{Id: c.ID,Kind: pb.ClipKind(c.Kind),Status: pb.ClipStatus(c.Status),@@ -37,7 +37,29 @@ func clipToProto(c store.Clip) *pb.ClipRecord {ExpiresAtUnix: c.ExpiresAt.Unix(),Error: c.Error,ImageCount: imagepreview.ImageCount(c),+ Favorite: c.Favorite,+ Favorited: c.Favorited,+ IsLink: c.IsLink,}+ if c.Favorite {+ r.ExpiresAtUnix = 0 // 收藏不会过期+ r.FavoritedAtUnix = c.FavoritedAt.Unix()+ }+ return r+}++// filterFromProto 把界面的筛选条件换成 store 的。kind_filter 为 TEXT 是界面上的「文字」:+// 纯文本与网页格式,不含链接。+func filterFromProto(req *pb.ListHistoryRequest) store.Filter {+ f := store.Filter{Favorites: req.GetFavorites(), LinksOnly: req.GetLinksOnly()}+ switch k := req.GetKindFilter(); k {+ case pb.ClipKind_CLIP_KIND_UNSPECIFIED:+ case pb.ClipKind_CLIP_KIND_TEXT:+ f.Text = true+ default:+ f.Kind = store.Kind(k)+ }+ return f}func configToProto(c config.Config) *pb.Config {@@ -59,6 +81,9 @@ func configToProto(c config.Config) *pb.Config {ServiceMode: serviceModeToProto(c), CustomSignalingUrl: c.CustomSignalingURL, OfficialNoticeAck: c.OfficialNoticeAck,UpdateCheckDisabled: c.UpdateCheckDisabled,UpdateSkipVersion: c.UpdateSkipVersion,+ QuickPasteDisabled: c.QuickPasteDisabled,+ QuickPasteHotkey: c.QuickPasteHotkey,+ QuickPasteCopyOnly: c.QuickPasteCopyOnly,}}@@ -125,6 +150,10 @@ func configFromProto(in *pb.Config, base config.Config) config.Config {c.LANDisabled = in.GetLanDisabled()c.UpdateCheckDisabled = in.GetUpdateCheckDisabled()c.UpdateSkipVersion = in.GetUpdateSkipVersion()+ c.QuickPasteDisabled = in.GetQuickPasteDisabled()+ // 空字符串就是默认快捷键+ c.QuickPasteHotkey = in.GetQuickPasteHotkey()+ c.QuickPasteCopyOnly = in.GetQuickPasteCopyOnly()return c}@@ -163,3 +192,6 @@ func permissionToProto(p clipboard.Permission) pb.ClipboardPermission {// ClipToProto exposes the same record projection to desktop notifications.func ClipToProto(c store.Clip) *pb.ClipRecord { return clipToProto(c) }++// ConfigToProto 用于设置保存后推送 config_changed。+func ConfigToProto(c config.Config) *pb.Config { return configToProto(c) }diff --git a/client-core/internal/rpc/quickpaste.go b/client-core/internal/rpc/quickpaste.gonew file mode 100644index 0000000..45b0115--- /dev/null+++ b/client-core/internal/rpc/quickpaste.go@@ -0,0 +1,146 @@+package rpc++import (+ "context"+ "errors"+ "io"+ "sync"++ "google.golang.org/grpc"+ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/status"+ "google.golang.org/protobuf/proto"++ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++// quickPaste 记着快捷粘贴窗口的连接:它在 QuickPasteSession 里往上报状态、往下收命令。+// 界面与快捷窗口之间不直接通信,设置页读状态、发命令都经过这里。+type quickPaste struct {+ mu sync.Mutex+ id int // 当前连接的编号,0 表示没有连接+ nextID int+ cmds chan *pb.QuickPasteCommand+ status *pb.QuickPasteStatus+}++// attach 登记一条新的连接。快捷窗口重启时新连接可能先于旧连接断开到达,以新的为准。+func (q *quickPaste) attach() (int, chan *pb.QuickPasteCommand) {+ q.mu.Lock()+ defer q.mu.Unlock()+ q.nextID+++ q.id = q.nextID+ q.cmds = make(chan *pb.QuickPasteCommand, 8)+ q.status = &pb.QuickPasteStatus{Running: true}+ return q.id, q.cmds+}++// update 记下连接 id 报上来的状态,返回是否有变化。旧连接报的不算。+func (q *quickPaste) update(id int, st *pb.QuickPasteStatus) (*pb.QuickPasteStatus, bool) {+ q.mu.Lock()+ defer q.mu.Unlock()+ if id != q.id {+ return nil, false+ }+ st = proto.Clone(st).(*pb.QuickPasteStatus)+ st.Running = true+ if proto.Equal(st, q.status) {+ return nil, false+ }+ q.status = st+ return proto.Clone(st).(*pb.QuickPasteStatus), true+}++// detach 在连接 id 断开时调用,返回快捷窗口是否因此算作没在运行。+func (q *quickPaste) detach(id int) bool {+ q.mu.Lock()+ defer q.mu.Unlock()+ if id != q.id {+ return false+ }+ q.id, q.cmds, q.status = 0, nil, nil+ return true+}++func (q *quickPaste) current() *pb.QuickPasteStatus {+ q.mu.Lock()+ defer q.mu.Unlock()+ if q.status == nil {+ return &pb.QuickPasteStatus{}+ }+ return proto.Clone(q.status).(*pb.QuickPasteStatus)+}++func (q *quickPaste) send(c *pb.QuickPasteCommand) bool {+ q.mu.Lock()+ defer q.mu.Unlock()+ if q.cmds == nil {+ return false+ }+ select {+ case q.cmds <- c:+ return true+ default:+ return false // 快捷窗口一直没取走命令,多半卡住了+ }+}++func EventQuickPasteChanged(s *pb.QuickPasteStatus) *pb.Event {+ return &pb.Event{Payload: &pb.Event_QuickPasteChanged{QuickPasteChanged: s}}+}++func EventConfigChanged(c *pb.Config) *pb.Event {+ return &pb.Event{Payload: &pb.Event_ConfigChanged{ConfigChanged: c}}+}++// QuickPasteSession 由快捷窗口进程调用,一直保持到它退出。+func (s *Server) QuickPasteSession(stream grpc.BidiStreamingServer[pb.QuickPasteStatus, pb.QuickPasteCommand]) error {+ id, cmds := s.quickPaste.attach()+ s.hub.Publish(EventQuickPasteChanged(s.quickPaste.current()))+ defer func() {+ if s.quickPaste.detach(id) {+ s.hub.Publish(EventQuickPasteChanged(&pb.QuickPasteStatus{}))+ }+ }()++ recvErr := make(chan error, 1)+ go func() {+ for {+ st, err := stream.Recv()+ if err != nil {+ recvErr <- err+ return+ }+ if changed, ok := s.quickPaste.update(id, st); ok {+ s.hub.Publish(EventQuickPasteChanged(changed))+ }+ }+ }()++ for {+ select {+ case <-stream.Context().Done():+ return nil+ case err := <-recvErr:+ if errors.Is(err, io.EOF) {+ return nil+ }+ return err+ case c := <-cmds:+ if err := stream.Send(c); err != nil {+ return err+ }+ }+ }+}++func (s *Server) GetQuickPasteStatus(_ context.Context, _ *pb.Empty) (*pb.QuickPasteStatus, error) {+ return s.quickPaste.current(), nil+}++func (s *Server) SendQuickPasteCommand(_ context.Context, c *pb.QuickPasteCommand) (*pb.Empty, error) {+ if !s.quickPaste.send(c) {+ return nil, status.Error(codes.FailedPrecondition, "快捷粘贴窗口没有运行")+ }+ return &pb.Empty{}, nil+}diff --git a/client-core/internal/rpc/quickpaste_test.go b/client-core/internal/rpc/quickpaste_test.gonew file mode 100644index 0000000..979545a--- /dev/null+++ b/client-core/internal/rpc/quickpaste_test.go@@ -0,0 +1,86 @@+package rpc++import (+ "context"+ "fmt"+ "testing"+ "time"++ "google.golang.org/grpc"+ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/credentials/insecure"+ "google.golang.org/grpc/metadata"+ "google.golang.org/grpc/status"++ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++// 快捷窗口连着 QuickPasteSession 时:状态推给界面,设置页的命令转给它;断开后算作没在运行。+func TestQuickPasteSession(t *testing.T) {+ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)+ defer cancel()+ hub := NewHub()+ s := NewServer(Deps{}, hub, "tok")+ port, _, err := s.Serve(ctx)+ if err != nil {+ t.Fatal(err)+ }+ conn, err := grpc.NewClient(fmt.Sprintf("127.0.0.1:%d", port), grpc.WithTransportCredentials(insecure.NewCredentials()))+ if err != nil {+ t.Fatal(err)+ }+ defer conn.Close()+ client := pb.NewDaemonServiceClient(conn)+ authed := metadata.AppendToOutgoingContext(ctx, tokenHeader, "tok")+ events, unsubscribe := hub.Subscribe()+ defer unsubscribe()+ nextStatus := func() *pb.QuickPasteStatus {+ t.Helper()+ for {+ select {+ case e := <-events:+ if st := e.GetQuickPasteChanged(); st != nil {+ return st+ }+ case <-ctx.Done():+ t.Fatal("没等到 quick_paste_changed")+ }+ }+ }++ if _, err := client.SendQuickPasteCommand(authed, &pb.QuickPasteCommand{Command: "show"}); status.Code(err) != codes.FailedPrecondition {+ t.Fatalf("快捷窗口没运行时发命令:%v", err)+ }++ sessionCtx, endSession := context.WithCancel(authed)+ session, err := client.QuickPasteSession(sessionCtx)+ if err != nil {+ t.Fatal(err)+ }+ if err := session.Send(&pb.QuickPasteStatus{Hotkey: "alt+v", PasteAvailable: true}); err != nil {+ t.Fatal(err)+ }+ for st := nextStatus(); st.GetHotkey() != "alt+v"; st = nextStatus() {+ if !st.GetRunning() {+ t.Fatalf("连上之后应算作在运行:%v", st)+ }+ }+ if st, _ := client.GetQuickPasteStatus(authed, &pb.Empty{}); !st.GetRunning() || !st.GetPasteAvailable() {+ t.Fatalf("GetQuickPasteStatus = %v", st)+ }++ if _, err := client.SendQuickPasteCommand(authed, &pb.QuickPasteCommand{Command: "request_permission"}); err != nil {+ t.Fatal(err)+ }+ cmd, err := session.Recv()+ if err != nil || cmd.GetCommand() != "request_permission" {+ t.Fatalf("命令没转给快捷窗口:%v %v", cmd, err)+ }++ endSession()+ for st := nextStatus(); st.GetRunning(); st = nextStatus() {+ }+ if st, _ := client.GetQuickPasteStatus(authed, &pb.Empty{}); st.GetRunning() {+ t.Fatalf("断开后仍算作在运行:%v", st)+ }+}diff --git a/client-core/internal/rpc/search_test.go b/client-core/internal/rpc/search_test.goindex b1a926e..1070e7b 100644--- a/client-core/internal/rpc/search_test.go+++ b/client-core/internal/rpc/search_test.go@@ -10,8 +10,9 @@ import (func TestListHistorySearch(t *testing.T) {var gotQuery string- s := NewServer(Deps{SearchHistory: func(query string, limit int) ([]store.Clip, error) {- gotQuery = query+ var gotFilter store.Filter+ s := NewServer(Deps{SearchHistory: func(query string, limit int, f store.Filter) ([]store.Clip, error) {+ gotQuery, gotFilter = query, freturn []store.Clip{{ID: "t", Kind: store.KindText, TextPreview: "季度汇报"},{ID: "f", Kind: store.KindFile, Items: []store.Item{{Name: "季度汇报.key"}}},@@ -26,13 +27,26 @@ func TestListHistorySearch(t *testing.T) {if !resp.GetSearched() || len(resp.GetRecords()) != 2 || gotQuery != "季度" {t.Fatalf("searched=%v records=%d query=%q", resp.GetSearched(), len(resp.GetRecords()), gotQuery)}-- resp, err = s.ListHistory(context.Background(), &pb.ListHistoryRequest{- Query: "季度", KindFilter: pb.ClipKind_CLIP_KIND_FILE})- if err != nil {- t.Fatal(err)+ if gotFilter != (store.Filter{}) {+ t.Errorf("没选筛选条件时 filter = %+v", gotFilter)}- if len(resp.GetRecords()) != 1 || resp.GetRecords()[0].GetId() != "f" {- t.Errorf("搜索结果没有按类型过滤:%v", resp.GetRecords())++ // 筛选条件交给后台服务在数据库里筛,不是搜完再过滤+ for _, tc := range []struct {+ req *pb.ListHistoryRequest+ want store.Filter+ }{+ {&pb.ListHistoryRequest{Query: "季度", KindFilter: pb.ClipKind_CLIP_KIND_FILE}, store.Filter{Kind: store.KindFile}},+ {&pb.ListHistoryRequest{Query: "季度", KindFilter: pb.ClipKind_CLIP_KIND_TEXT}, store.Filter{Text: true}},+ {&pb.ListHistoryRequest{Query: "季度", LinksOnly: true}, store.Filter{LinksOnly: true}},+ {&pb.ListHistoryRequest{Query: "季度", Favorites: true, KindFilter: pb.ClipKind_CLIP_KIND_IMAGE},+ store.Filter{Favorites: true, Kind: store.KindImage}},+ } {+ if _, err := s.ListHistory(context.Background(), tc.req); err != nil {+ t.Fatal(err)+ }+ if gotFilter != tc.want {+ t.Errorf("%v: filter = %+v, want %+v", tc.req, gotFilter, tc.want)+ }}}diff --git a/client-core/internal/rpc/server.go b/client-core/internal/rpc/server.goindex 5ad0872..6ed1e4b 100644--- a/client-core/internal/rpc/server.go+++ b/client-core/internal/rpc/server.go@@ -41,14 +41,18 @@ type Deps struct {SaveConfig func(config.Config) error// 以下在对应里程碑接上,未实现时为 nil,方法返回 Unimplemented- Fetch func(ctx context.Context, clipID string) error- FetchForPreview func(ctx context.Context, clipID string) error- ApplyToClipboard func(ctx context.Context, clipID string) error+ Fetch func(ctx context.Context, clipID string) error+ FetchForPreview func(ctx context.Context, clipID string) error+ // ApplyToClipboard 把记录放进剪贴板;plain 时文字只写纯文本+ ApplyToClipboard func(ctx context.Context, clipID string, plain bool) errorImagePreview func(ctx context.Context, clipID string, index int) (path, name string, count int, err error)Permission func() clipboard.PermissionOpenPermissionSettings func() error- // SearchHistory 按文字内容与文件名搜索复制记录,见 sync.Engine.SearchHistory- SearchHistory func(query string, limit int) ([]store.Clip, error)+ // SearchHistory 按文字内容与文件名搜索复制记录或收藏,见 sync.Engine.SearchHistory+ SearchHistory func(query string, limit int, f store.Filter) ([]store.Clip, error)+ // SetFavorite 收藏或取消收藏,ClipDetail 是悬停提示框的完整内容,见 sync/favorite.go+ SetFavorite func(ctx context.Context, clipID string, favorite bool) (store.Clip, error)+ ClipDetail func(clipID string) (*pb.ClipDetail, error)// 诊断报告要读的日志文件(轮转出去的旧文件在前)与崩溃日志LogFiles func() (logs []string, crash string)// VerboseLog 临时打开详细日志,d 不大于 0 时关闭;VerboseUntil 是打开到什么时候@@ -116,6 +120,8 @@ type Server struct {deps Depshub *Hubtoken string+ // quickPaste 是快捷粘贴窗口的连接与状态,见 quickpaste.go+ quickPaste quickPaste}func NewServer(deps Deps, hub *Hub, token string) *Server {@@ -242,7 +248,7 @@ func (s *Server) ListHistory(_ context.Context,if req.GetBeforeUnix() > 0 {before = time.Unix(req.GetBeforeUnix(), 0)}- clips, err := s.deps.Store.ListClips(int(req.GetLimit()), before, store.Kind(req.GetKindFilter()))+ clips, err := s.deps.Store.ListRecords(int(req.GetLimit()), before, filterFromProto(req))if err != nil {return nil, status.Errorf(codes.Internal, "读取历史: %v", err)}@@ -257,21 +263,24 @@ func (s *Server) searchHistory(query string, req *pb.ListHistoryRequest) (*pb.Liif s.deps.SearchHistory == nil {return nil, status.Error(codes.Unimplemented, "搜索未接入")}- clips, err := s.deps.SearchHistory(query, int(req.GetLimit()))+ clips, err := s.deps.SearchHistory(query, int(req.GetLimit()), filterFromProto(req))if err != nil {return nil, status.Errorf(codes.Internal, "搜索历史: %v", err)}out := make([]*pb.ClipRecord, 0, len(clips))for _, c := range clips {- if k := req.GetKindFilter(); k != pb.ClipKind_CLIP_KIND_UNSPECIFIED && pb.ClipKind(c.Kind) != k {- continue- }out = append(out, clipToProto(c))}return &pb.ListHistoryResponse{Records: out, Searched: true}, nil}+// DeleteHistory 只删复制记录。收藏里没有删除,要先取消收藏(放回复制记录)再删。func (s *Server) DeleteHistory(_ context.Context, req *pb.DeleteHistoryRequest) (*pb.Empty, error) {+ for _, id := range req.GetIds() {+ if c, err := s.deps.Store.GetClip(id); err == nil && c.Favorite {+ return nil, status.Error(codes.InvalidArgument, "收藏不能直接删除,请先取消收藏")+ }+ }var err errorif req.GetAll() {err = s.deps.Store.DeleteAllClips()@@ -306,12 +315,40 @@ func (s *Server) ApplyToClipboard(ctx context.Context,if s.deps.ApplyToClipboard == nil {return nil, status.Error(codes.Unimplemented, "剪贴板写入尚未接入(M3)")}- if err := s.deps.ApplyToClipboard(ctx, req.GetClipId()); err != nil {+ if err := s.deps.ApplyToClipboard(ctx, req.GetClipId(), req.GetPlainText()); err != nil {return nil, status.Errorf(codes.Internal, "写入剪贴板失败: %v", err)}return &pb.Empty{}, nil}+func (s *Server) SetFavorite(ctx context.Context, req *pb.SetFavoriteRequest) (*pb.ClipRecord, error) {+ if s.deps.SetFavorite == nil {+ return nil, status.Error(codes.Unimplemented, "当前版本不支持收藏")+ }+ clip, err := s.deps.SetFavorite(ctx, req.GetClipId(), req.GetFavorite())+ if errors.Is(err, store.ErrNotFound) {+ return nil, status.Error(codes.NotFound, "找不到这条记录")+ }+ if err != nil {+ return nil, status.Error(codes.FailedPrecondition, err.Error())+ }+ return clipToProto(clip), nil+}++func (s *Server) GetClipDetail(_ context.Context, req *pb.GetClipDetailRequest) (*pb.ClipDetail, error) {+ if s.deps.ClipDetail == nil {+ return nil, status.Error(codes.Unimplemented, "当前版本不支持查看完整内容")+ }+ d, err := s.deps.ClipDetail(req.GetClipId())+ if errors.Is(err, store.ErrNotFound) {+ return nil, status.Error(codes.NotFound, "找不到这条记录")+ }+ if err != nil {+ return nil, status.Error(codes.Internal, err.Error())+ }+ return d, nil+}+func (s *Server) GetImagePreview(ctx context.Context,req *pb.GetImagePreviewRequest) (*pb.GetImagePreviewResponse, error) {if req.GetClipId() == "" {diff --git a/client-core/internal/store/favorite_test.go b/client-core/internal/store/favorite_test.gonew file mode 100644index 0000000..2cf1747--- /dev/null+++ b/client-core/internal/store/favorite_test.go@@ -0,0 +1,198 @@+package store++import (+ "database/sql"+ "path/filepath"+ "testing"+ "time"+)++func TestIsLink(t *testing.T) {+ for text, want := range map[string]bool{+ "https://github.com/baiyuze/pasteferry": true,+ " http://example.com/a?b=1#c \n": true, // 首尾空白不算+ "HTTPS://EXAMPLE.COM": true,+ "https://例子.中国/路径": true,+ "看这个 https://example.com": false, // 一段话里夹着网址+ "https://example.com\nhttps://example.org": false, // 两个网址+ "https://example.com/a b": false,+ "ftp://example.com": false,+ "example.com": false,+ "https://": false,+ "mailto:[email protected]": false,+ "": false,+ } {+ if got := IsLink(text); got != want {+ t.Errorf("IsLink(%q) = %v, want %v", text, got, want)+ }+ }+}++func textClip(id, text string, kind Kind, at time.Time) Clip {+ return Clip{ID: id, Kind: kind, Status: StatusReady, TextContent: text, TextPreview: text,+ CreatedAt: at, ExpiresAt: at.Add(time.Hour)}+}++// 筛选:「文字」含网页格式、不含链接;收藏与复制记录各查各的。+func TestListRecordsFilter(t *testing.T) {+ s := openTest(t)+ now := time.Now()+ clips := []Clip{+ textClip("text", "会议改到周四", KindText, now.Add(1*time.Second)),+ textClip("html", "<b>粗体</b>", KindHTML, now.Add(2*time.Second)),+ textClip("link", "https://pasteferry.cc/download/", KindText, now.Add(3*time.Second)),+ sampleClip("file", now.Add(4*time.Second)),+ }+ fav := textClip("fav", "收藏的文字", KindText, now)+ fav.Favorite, fav.FavoritedAt, fav.SourceClipID, fav.ExpiresAt = true, now, "text", FavoriteExpiry+ for _, c := range append(clips, fav) {+ if err := s.PutClip(c); err != nil {+ t.Fatal(err)+ }+ }+ ids := func(f Filter) []string {+ got, err := s.ListRecords(10, time.Time{}, f)+ if err != nil {+ t.Fatal(err)+ }+ var out []string+ for _, c := range got {+ out = append(out, c.ID)+ }+ return out+ }+ for _, tc := range []struct {+ f Filter+ want []string+ }{+ {Filter{}, []string{"file", "link", "html", "text"}},+ {Filter{Text: true}, []string{"html", "text"}},+ {Filter{LinksOnly: true}, []string{"link"}},+ {Filter{Kind: KindFile}, []string{"file"}},+ {Filter{Favorites: true}, []string{"fav"}},+ {Filter{Favorites: true, LinksOnly: true}, nil},+ } {+ if got := ids(tc.f); !equal(got, tc.want) {+ t.Errorf("%+v: %v, want %v", tc.f, got, tc.want)+ }+ }++ text, err := s.GetClip("text")+ if err != nil {+ t.Fatal(err)+ }+ if !text.Favorited {+ t.Error("收藏过的复制记录 Favorited 应为 true")+ }+ link, _ := s.GetClip("link")+ if !link.IsLink || link.Favorited {+ t.Errorf("link: IsLink=%v Favorited=%v", link.IsLink, link.Favorited)+ }++ got, err := s.SearchRecords("收藏", 10, Filter{Favorites: true})+ if err != nil {+ t.Fatal(err)+ }+ if len(got) != 1 || got[0].ID != "fav" {+ t.Errorf("在收藏里搜:%v", got)+ }+ got, err = s.SearchRecords("收藏", 10, Filter{})+ if err != nil {+ t.Fatal(err)+ }+ if len(got) != 0 {+ t.Errorf("在复制记录里搜不该搜到收藏:%v", got)+ }++ // 清空、过期与对账都只管复制记录+ if err := s.DeleteAllClips(); err != nil {+ t.Fatal(err)+ }+ if got := ids(Filter{Favorites: true}); !equal(got, []string{"fav"}) {+ t.Errorf("清空复制记录后收藏:%v", got)+ }+}++func equal(a, b []string) bool {+ if len(a) != len(b) {+ return false+ }+ for i := range a {+ if a[i] != b[i] {+ return false+ }+ }+ return true+}++// 收藏的副本在收藏目录里,缓存目录的对账不能把同名的东西当成还在用。+func TestFavoritePathsSeparateFromCache(t *testing.T) {+ s := openTest(t)+ now := time.Now()+ c := sampleClip("history", now)+ f := sampleClip("fav", now)+ f.Favorite, f.FavoritedAt, f.ExpiresAt = true, now, FavoriteExpiry+ for _, x := range []Clip{c, f} {+ if err := s.PutClip(x); err != nil {+ t.Fatal(err)+ }+ }+ cache, err := s.CachePaths()+ if err != nil {+ t.Fatal(err)+ }+ favs, err := s.FavoritePaths()+ if err != nil {+ t.Fatal(err)+ }+ if _, ok := cache["fav.bin"]; ok || len(cache) != 1 {+ t.Errorf("缓存引用:%v", cache)+ }+ if _, ok := favs["fav.bin"]; !ok || len(favs) != 1 {+ t.Errorf("收藏引用:%v", favs)+ }+ if used, _ := s.CacheReferenced("fav.bin"); used {+ t.Error("收藏的路径不算缓存引用")+ }+ if used, _ := s.FavoriteReferenced("fav.bin"); !used {+ t.Error("收藏的路径要算收藏引用")+ }+}++// 加 is_link 列之前存下的文字记录,升级后第一次打开时补算。+func TestBackfillLinksOnUpgrade(t *testing.T) {+ path := filepath.Join(t.TempDir(), "old.db")+ db, err := sql.Open("sqlite", path)+ if err != nil {+ t.Fatal(err)+ }+ // 2.3.0 的表结构+ if _, err := db.Exec(`+CREATE TABLE clips (+ id TEXT PRIMARY KEY, kind INTEGER NOT NULL, status INTEGER NOT NULL,+ origin_device_id TEXT NOT NULL DEFAULT '', origin_device_name TEXT NOT NULL DEFAULT '',+ outgoing INTEGER NOT NULL DEFAULT 0, total_size INTEGER NOT NULL DEFAULT 0,+ text_preview TEXT NOT NULL DEFAULT '', text_content TEXT NOT NULL DEFAULT '',+ text_plain TEXT NOT NULL DEFAULT '', cache_path TEXT NOT NULL DEFAULT '',+ source_paths TEXT NOT NULL DEFAULT '[]', error TEXT NOT NULL DEFAULT '',+ created_at INTEGER NOT NULL, expires_at INTEGER NOT NULL);+INSERT INTO clips (id, kind, status, text_content, created_at, expires_at) VALUES+ ('link', 1, 1, 'https://example.com', 1, 9999999999),+ ('text', 1, 1, '不是网址', 1, 9999999999);`); err != nil {+ t.Fatal(err)+ }+ db.Close()++ s, err := Open(path)+ if err != nil {+ t.Fatal(err)+ }+ defer s.Close()+ links, err := s.ListRecords(10, time.Time{}, Filter{LinksOnly: true})+ if err != nil {+ t.Fatal(err)+ }+ if len(links) != 1 || links[0].ID != "link" {+ t.Fatalf("补算后的链接:%v", links)+ }+}diff --git a/client-core/internal/store/link.go b/client-core/internal/store/link.gonew file mode 100644index 0000000..0802e67--- /dev/null+++ b/client-core/internal/store/link.go@@ -0,0 +1,25 @@+package store++import (+ "net/url"+ "strings"+ "unicode"+)++// maxLinkLength 以上的文字不当作链接:浏览器地址栏也放不下这么长的网址,多半是一段数据。+const maxLinkLength = 8192++// IsLink 判断一段文字是不是「链接」:去掉首尾空白后,整段就是一个 http 或 https 网址,+// 中间没有空格,也没有换行。一段话里夹着网址的仍然算文字。+func IsLink(text string) bool {+ s := strings.TrimSpace(text)+ if s == "" || len(s) > maxLinkLength || strings.IndexFunc(s, unicode.IsSpace) >= 0 {+ return false+ }+ u, err := url.Parse(s)+ if err != nil {+ return false+ }+ scheme := strings.ToLower(u.Scheme)+ return (scheme == "http" || scheme == "https") && u.Host != ""+}diff --git a/client-core/internal/store/store.go b/client-core/internal/store/store.goindex 4b500fd..120c280 100644--- a/client-core/internal/store/store.go+++ b/client-core/internal/store/store.go@@ -62,6 +62,48 @@ type Clip struct {Error stringCreatedAt time.TimeExpiresAt time.Time++ // Favorite 表示这一行是收藏:另存的一份,不会过期,见 design/quick-paste-and-favorites.md 第 3 节。+ // 收藏的 CachePath 相对于收藏目录(favorites/),不是缓存目录+ Favorite bool+ FavoritedAt time.Time+ // SourceClipID 是从复制记录里哪一条收藏来的+ SourceClipID string+ // Favorited 只在读出复制记录时有意义:已经有一条收藏来自它。由查询算出,不存库+ Favorited bool+ // IsLink 表示整条文字就是一个网址,写入时由 PutClip 算好+ IsLink bool+}++// FavoriteExpiry 是收藏行的 expires_at。不用 0:降级到不认识收藏的旧版后台服务时,+// 收藏会被当成普通记录,要让它们留在列表里,而不是马上被当成过期记录删掉。+var FavoriteExpiry = time.Date(9999, 1, 1, 0, 0, 0, 0, time.UTC)++// Filter 选出复制记录或收藏中的某一类。+type Filter struct {+ Favorites bool // true 查收藏,false 查复制记录+ Kind Kind // 只要这种类型;KindUnspecified 不限+ // Text 是界面上的「文字」:纯文本与网页格式,不含链接。设置了它就忽略 Kind+ Text bool+ // LinksOnly 只要链接+ LinksOnly bool+}++// where 返回这个筛选条件对应的 SQL 片段(以 AND 开头)与参数。+func (f Filter) where() (string, []any) {+ q := ` AND favorite = ?`+ args := []any{f.Favorites}+ switch {+ case f.LinksOnly:+ q += ` AND is_link = 1`+ case f.Text:+ q += ` AND kind IN (?, ?) AND is_link = 0`+ args = append(args, KindText, KindHTML)+ case f.Kind != KindUnspecified:+ q += ` AND kind = ?`+ args = append(args, f.Kind)+ }+ return q, args}type Device struct {@@ -191,7 +233,57 @@ CREATE TABLE IF NOT EXISTS meta (return fmt.Errorf("建表: %w", err)}// 建表语句对已有的库不生效,后加的列要单独补上- return s.addColumnIfMissing("clips", "text_plain", "TEXT NOT NULL DEFAULT ''")+ for _, col := range []struct{ name, decl string }{+ {"text_plain", "TEXT NOT NULL DEFAULT ''"},+ {"favorite", "INTEGER NOT NULL DEFAULT 0"},+ {"favorited_at", "INTEGER NOT NULL DEFAULT 0"},+ {"source_clip_id", "TEXT NOT NULL DEFAULT ''"},+ {"is_link", "INTEGER NOT NULL DEFAULT 0"},+ } {+ if err := s.addColumnIfMissing("clips", col.name, col.decl); err != nil {+ return err+ }+ }+ if _, err := s.db.Exec(`+CREATE INDEX IF NOT EXISTS idx_clips_source ON clips(source_clip_id) WHERE source_clip_id <> '';+CREATE INDEX IF NOT EXISTS idx_clips_favorite ON clips(favorite, favorited_at DESC);`); err != nil {+ return fmt.Errorf("建索引: %w", err)+ }+ return s.backfillLinks()+}++// backfillLinks 给加 is_link 列之前存进来的文字记录补算一次,记下已补算过,以后不再重复。+func (s *Store) backfillLinks() error {+ const key = "links_backfilled"+ if _, err := s.GetMeta(key); err == nil {+ return nil+ }+ rows, err := s.db.Query(`SELECT id, text_content FROM clips WHERE kind = ?`, KindText)+ if err != nil {+ return err+ }+ var links []string+ for rows.Next() {+ var id, text string+ if err := rows.Scan(&id, &text); err != nil {+ rows.Close()+ return err+ }+ if IsLink(text) {+ links = append(links, id)+ }+ }+ err = rows.Err()+ rows.Close() // 只有一个数据库连接,先放掉再写+ if err != nil {+ return err+ }+ for _, id := range links {+ if _, err := s.db.Exec(`UPDATE clips SET is_link = 1 WHERE id = ?`, id); err != nil {+ return err+ }+ }+ return s.SetMeta(key, "1")}func (s *Store) addColumnIfMissing(table, column, decl string) error {@@ -232,20 +324,28 @@ func (s *Store) PutClip(c Clip) error {return err}+ var favoritedAt int64+ if c.Favorite {+ favoritedAt = c.FavoritedAt.Unix()+ }_, err = tx.Exec(`INSERT INTO clips (id, kind, status, origin_device_id, origin_device_name, outgoing,total_size, text_preview, text_content, text_plain, cache_path,- source_paths, error, created_at, expires_at)-VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)+ source_paths, error, created_at, expires_at,+ favorite, favorited_at, source_clip_id, is_link)+VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)ON CONFLICT(id) DO UPDATE SETstatus=excluded.status, total_size=excluded.total_size,text_preview=excluded.text_preview, text_content=excluded.text_content,text_plain=excluded.text_plain,cache_path=excluded.cache_path, source_paths=excluded.source_paths,- error=excluded.error, expires_at=excluded.expires_at`,+ error=excluded.error, expires_at=excluded.expires_at,+ favorite=excluded.favorite, favorited_at=excluded.favorited_at,+ source_clip_id=excluded.source_clip_id, is_link=excluded.is_link`,c.ID, c.Kind, c.Status, c.OriginDeviceID, c.OriginDeviceName, c.Outgoing,c.TotalSize, c.TextPreview, c.TextContent, c.TextPlain, c.CachePath,- string(srcJSON), c.Error, c.CreatedAt.Unix(), c.ExpiresAt.Unix())+ string(srcJSON), c.Error, c.CreatedAt.Unix(), c.ExpiresAt.Unix(),+ c.Favorite, favoritedAt, c.SourceClipID, c.Kind == KindText && IsLink(c.TextContent))if err != nil {return fmt.Errorf("写入 clip: %w", err)}@@ -277,22 +377,27 @@ func (s *Store) GetClip(id string) (Clip, error) {return rows[0], nil}-// ListClips 按时间倒序分页。before 为零值表示从最新开始。+// ListClips 按时间倒序分页列出复制记录(不含收藏)。before 为零值表示从最新开始。func (s *Store) ListClips(limit int, before time.Time, kind Kind) ([]Clip, error) {+ return s.ListRecords(limit, before, Filter{Kind: kind})+}++// ListRecords 按筛选条件列出复制记录或收藏。复制记录按复制时间倒序、用 before 分页;+// 收藏按收藏时间倒序,不分页(before 被忽略)。+func (s *Store) ListRecords(limit int, before time.Time, f Filter) ([]Clip, error) {if limit <= 0 || limit > 500 {limit = 100}- q := `SELECT ` + clipCols + ` FROM clips WHERE 1=1`- var args []any- if !before.IsZero() {+ where, args := f.where()+ q := `SELECT ` + clipCols + ` FROM clips WHERE 1=1` + where+ order := ` ORDER BY created_at DESC`+ if f.Favorites {+ order = ` ORDER BY favorited_at DESC, created_at DESC`+ } else if !before.IsZero() {q += ` AND created_at < ?`args = append(args, before.Unix())}- if kind != KindUnspecified {- q += ` AND kind = ?`- args = append(args, kind)- }- q += ` ORDER BY created_at DESC LIMIT ?`+ q += order + ` LIMIT ?`args = append(args, limit)return s.queryClips(q, args...)}@@ -303,16 +408,28 @@ func (s *Store) ListClips(limit int, before time.Time, kind Kind) ([]Clip, error// 标签名也会命中。由调用方按纯文本再核对一遍(见 sync.Engine.SearchHistory)。// 剪贴板图片的文件名是生成的(image.png),界面上也不显示,不参与匹配。func (s *Store) SearchClips(query string, limit int) ([]Clip, error) {+ return s.SearchRecords(query, limit, Filter{})+}++// SearchRecords 与 SearchClips 相同,只在筛选条件 f 选出的范围里找。+func (s *Store) SearchRecords(query string, limit int, f Filter) ([]Clip, error) {if limit <= 0 || limit > 500 {limit = 100}like := "%" + strings.NewReplacer(`\`, `\\`, `%`, `\%`, `_`, `\_`).Replace(query) + "%"+ where, fargs := f.where()+ order := `created_at DESC`+ if f.Favorites {+ order = `favorited_at DESC, created_at DESC`+ }+ args := append([]any{KindText, like, KindHTML, like, like, KindImage, like}, fargs...)+ args = append(args, limit)return s.queryClips(`SELECT `+clipCols+` FROM clips-WHERE (kind = ? AND text_content LIKE ? ESCAPE '\')+WHERE ((kind = ? AND text_content LIKE ? ESCAPE '\')OR (kind = ? AND (text_plain LIKE ? ESCAPE '\' OR (text_plain = '' AND text_content LIKE ? ESCAPE '\')))- OR (kind <> ? AND EXISTS (SELECT 1 FROM clip_items i WHERE i.clip_id = clips.id AND i.name LIKE ? ESCAPE '\'))-ORDER BY created_at DESC LIMIT ?`,- KindText, like, KindHTML, like, like, KindImage, like, limit)+ OR (kind <> ? AND EXISTS (SELECT 1 FROM clip_items i WHERE i.clip_id = clips.id AND i.name LIKE ? ESCAPE '\')))`++ where+`+ORDER BY `+order+` LIMIT ?`, args...)}// FileNames 返回复制过的文件、文件夹名,以及它们在源电脑上的完整路径(去重,最多 limit 个)。@@ -337,9 +454,14 @@ LIMIT ?`, limit)return out, rows.Err()}+// clipCols 是读出一行 clips 的列。最后一列是算出来的:这条复制记录有没有收藏过,+// 要求外层查询的表名就是 clips(不起别名)。const clipCols = `id, kind, status, origin_device_id, origin_device_name, outgoing,total_size, text_preview, text_content, text_plain, cache_path,- source_paths, error, created_at, expires_at`+ source_paths, error, created_at, expires_at,+ favorite, favorited_at, source_clip_id, is_link,+ (favorite = 0 AND EXISTS (SELECT 1 FROM clips f+ WHERE f.favorite = 1 AND f.source_clip_id = clips.id))`func (s *Store) queryClips(query string, args ...any) ([]Clip, error) {rows, err := s.db.Query(query, args...)@@ -352,14 +474,18 @@ func (s *Store) queryClips(query string, args ...any) ([]Clip, error) {for rows.Next() {var c Clipvar srcJSON string- var created, expires int64+ var created, expires, favoritedAt int64if err := rows.Scan(&c.ID, &c.Kind, &c.Status, &c.OriginDeviceID, &c.OriginDeviceName,&c.Outgoing, &c.TotalSize, &c.TextPreview, &c.TextContent, &c.TextPlain,- &c.CachePath, &srcJSON, &c.Error, &created, &expires); err != nil {+ &c.CachePath, &srcJSON, &c.Error, &created, &expires,+ &c.Favorite, &favoritedAt, &c.SourceClipID, &c.IsLink, &c.Favorited); err != nil {return nil, err}c.CreatedAt = time.Unix(created, 0)c.ExpiresAt = time.Unix(expires, 0)+ if c.Favorite {+ c.FavoritedAt = time.Unix(favoritedAt, 0)+ }_ = json.Unmarshal([]byte(srcJSON), &c.SourcePaths)out = append(out, c)}@@ -412,14 +538,26 @@ func (s *Store) SetClipboardError(id, message string) (bool, error) {// RecoverReceives runs once before the daemon accepts connections. There are// no live streams after a restart; show a retry action instead of a stale spinner.+// 收藏正在另存时后台服务退出了,也一样改成失败,可以重试。func (s *Store) RecoverReceives() error {+ if _, err := s.db.Exec(`UPDATE clips SET status=?, error=? WHERE status=? AND favorite=1`, StatusFailed, "保存已中断,请重试", StatusFetching); err != nil {+ return err+ }_, err := s.db.Exec(`UPDATE clips SET status=?, error=? WHERE status=? AND outgoing=0`, StatusFailed, "接收已中断,请重试", StatusFetching)return err}+// CacheReferenced 判断缓存目录里的 rel 是否还有复制记录在用。收藏的路径在另一个目录里,不算。func (s *Store) CacheReferenced(rel string) (bool, error) {var used bool- err := s.db.QueryRow(`SELECT EXISTS(SELECT 1 FROM clips WHERE cache_path=?)`, rel).Scan(&used)+ err := s.db.QueryRow(`SELECT EXISTS(SELECT 1 FROM clips WHERE cache_path=? AND favorite=0)`, rel).Scan(&used)+ return used, err+}++// FavoriteReferenced 判断收藏目录里的 rel 是否还有收藏在用。+func (s *Store) FavoriteReferenced(rel string) (bool, error) {+ var used bool+ err := s.db.QueryRow(`SELECT EXISTS(SELECT 1 FROM clips WHERE cache_path=? AND favorite=1)`, rel).Scan(&used)return used, err}@@ -444,19 +582,73 @@ func (s *Store) DeleteClips(ids []string) error {return tx.Commit()}+// DeleteAllClips 清空复制记录。收藏不受影响。func (s *Store) DeleteAllClips() error {- _, err := s.db.Exec(`DELETE FROM clips`)+ _, err := s.db.Exec(`DELETE FROM clips WHERE favorite=0`)return err}-// ExpiredClips 返回已过期的记录,交由 GC 先删缓存文件再删行。+// ExpiredClips 返回已过期的复制记录,交由 GC 先删缓存文件再删行。收藏不会过期。func (s *Store) ExpiredClips(now time.Time) ([]Clip, error) {- return s.queryClips(`SELECT `+clipCols+` FROM clips WHERE expires_at <= ?`, now.Unix())+ return s.queryClips(`SELECT `+clipCols+` FROM clips WHERE expires_at <= ? AND favorite=0`, now.Unix())+}++// FavoriteOf 返回从复制记录 sourceID 收藏来的那一条收藏。+func (s *Store) FavoriteOf(sourceID string) (Clip, error) {+ return s.first(`SELECT `+clipCols+` FROM clips WHERE favorite=1 AND source_clip_id=?+ORDER BY favorited_at DESC LIMIT 1`, sourceID)+}++// FavoriteWithText 返回文字内容完全相同的收藏:同样的文字不重复收藏。+func (s *Store) FavoriteWithText(kind Kind, text string) (Clip, error) {+ return s.first(`SELECT `+clipCols+` FROM clips WHERE favorite=1 AND kind=? AND text_content=?+ORDER BY favorited_at DESC LIMIT 1`, kind, text)+}++// PendingFavorites 返回在等复制记录 sourceID 下载完、还没另存好的收藏。+func (s *Store) PendingFavorites(sourceID string) ([]Clip, error) {+ return s.queryClips(`SELECT `+clipCols+` FROM clips WHERE favorite=1 AND source_clip_id=? AND status<>?`,+ sourceID, StatusReady)+}++func (s *Store) first(query string, args ...any) (Clip, error) {+ rows, err := s.queryClips(query, args...)+ if err != nil {+ return Clip{}, err+ }+ if len(rows) == 0 {+ return Clip{}, ErrNotFound+ }+ return rows[0], nil+}++// TouchFavorite 把一条收藏挪到收藏的最上面,并记下这次是从哪一条复制记录收藏的。+func (s *Store) TouchFavorite(id, sourceID string, at time.Time) error {+ _, err := s.db.Exec(`UPDATE clips SET favorited_at=?, source_clip_id=? WHERE id=? AND favorite=1`,+ at.Unix(), sourceID, id)+ return err+}++// Unfavorite 把一条收藏改回复制记录:时间改成 now,保留期到 expires,内容的位置改成缓存目录里的 cacheRel。+func (s *Store) Unfavorite(id string, now, expires time.Time, cacheRel string) error {+ _, err := s.db.Exec(`+UPDATE clips SET favorite=0, favorited_at=0, source_clip_id='', created_at=?, expires_at=?, cache_path=?+WHERE id=? AND favorite=1`, now.Unix(), expires.Unix(), cacheRel, id)+ return err}-// CachePaths 返回所有仍被引用的缓存路径,供 GC 与磁盘对账、清理孤儿文件。+// CachePaths 返回复制记录仍在引用的缓存路径,供 GC 与缓存目录对账、清理孤儿文件。func (s *Store) CachePaths() (map[string]struct{}, error) {- rows, err := s.db.Query(`SELECT cache_path FROM clips WHERE cache_path <> ''`)+ return s.paths(false)+}++// FavoritePaths 返回收藏仍在引用的路径,供 GC 与收藏目录对账。+func (s *Store) FavoritePaths() (map[string]struct{}, error) {+ return s.paths(true)+}++func (s *Store) paths(favorite bool) (map[string]struct{}, error) {+ rows, err := s.db.Query(`SELECT cache_path FROM clips WHERE cache_path <> '' AND favorite=?`, favorite)if err != nil {return nil, err}diff --git a/client-core/internal/sync/engine.go b/client-core/internal/sync/engine.goindex 0e46ecc..cce3ab6 100644--- a/client-core/internal/sync/engine.go+++ b/client-core/internal/sync/engine.go@@ -59,6 +59,9 @@ type Engine struct {store *store.Storecache *cache.Cachewatcher *clipboard.Watcher+ // favorites 是收藏另存的图片与文件,见 favorite.go。favMu 让收藏操作一个一个来,连点两下不会存两份+ favorites *cache.Cache+ favMu sync.MutexdeviceID stringdeviceName func() string@@ -71,6 +74,7 @@ type Engine struct {// 事件回传给界面onRecord func(*pb.ClipRecord)+ onRemoved func(clipID string)onProgress func(*pb.TransferProgress)onReceive func(ReceiveEvent)onClipboardResult func(*pb.ClipboardWriteResult)@@ -96,6 +100,7 @@ type Options struct {Logger *slog.LoggerStore *store.StoreCache *cache.Cache+ Favorites *cache.CacheWatcher *clipboard.WatcherDeviceID stringDeviceName func() string@@ -105,6 +110,8 @@ type Options struct {// PairedPeers 返回所有已配对设备,不论在线与否:连不上的记进待补发PairedPeers func() []stringOnRecord func(*pb.ClipRecord)+ // OnRemoved 在引擎自己删掉一条记录时调用(取消收藏时合并掉的原记录等)+ OnRemoved func(clipID string)OnProgress func(*pb.TransferProgress)OnReceive func(ReceiveEvent)OnClipboardResult func(*pb.ClipboardWriteResult)@@ -120,6 +127,7 @@ func New(opts Options) *Engine {log: log,store: opts.Store,cache: opts.Cache,+ favorites: opts.Favorites,watcher: opts.Watcher,deviceID: opts.DeviceID,deviceName: opts.DeviceName,@@ -128,6 +136,7 @@ func New(opts Options) *Engine {openStream: opts.OpenStream,pairedPeers: opts.PairedPeers,onRecord: opts.OnRecord,+ onRemoved: opts.OnRemoved,onProgress: opts.OnProgress,onReceive: opts.OnReceive,onClipboardResult: opts.OnClipboardResult,@@ -710,6 +719,7 @@ func (e *Engine) finishReceive(r *receiver, cacheRel string, tops []string) boolreturn false}e.emitRecord(clip)+ e.completePendingFavorites(clip)result := &pb.ClipboardWriteResult{ClipId: clip.ID, Outcome: pb.ClipboardWriteOutcome_CLIPBOARD_WRITE_OUTCOME_PRESERVED}if e.loadConfig().AutoApplyToClipboard && !quiet {ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)@@ -758,10 +768,18 @@ func (e *Engine) FetchForPreview(ctx context.Context, clipID string) error {// ApplyToClipboard 把某条已就绪的记录写入本机剪贴板。func (e *Engine) ApplyToClipboard(ctx context.Context, clipID string) error {+ return e.ApplyToClipboardAs(ctx, clipID, false)+}++// ApplyToClipboardAs 与 ApplyToClipboard 相同;plain 时文字与网页格式只写纯文本。+func (e *Engine) ApplyToClipboardAs(ctx context.Context, clipID string, plain bool) error {clip, err := e.store.GetClip(clipID)if err != nil {return err}+ if plain && (clip.Kind == store.KindHTML || clip.Kind == store.KindText) {+ clip.TextContent, clip.Kind = plainText(clip), store.KindText+ }result := e.writeClipboard(ctx, clip, nil)e.clipboardResult(result)if result.Outcome == pb.ClipboardWriteOutcome_CLIPBOARD_WRITE_OUTCOME_FAILED {@@ -857,7 +875,12 @@ func (e *Engine) ImagePreview(_ context.Context, clipID string, index int) (path// localPaths 返回这条记录在本机可用的实际路径。func (e *Engine) localPaths(clip store.Clip) ([]string, error) {- if clip.CachePath != "" && e.cache.Exists(clip.CachePath) {+ if clip.Favorite {+ // 收藏另存在收藏目录里;那里的东西被用户手动删掉了,才退回原来的位置+ if clip.CachePath != "" && e.favorites != nil && e.favorites.Exists(clip.CachePath) {+ return e.favorites.Entries(clip.CachePath)+ }+ } else if clip.CachePath != "" && e.cache.Exists(clip.CachePath) {return e.cache.Entries(clip.CachePath)}if len(clip.SourcePaths) > 0 {@@ -889,7 +912,7 @@ func recordProto(clip store.Clip) *pb.ClipRecord {Name: it.Name, Size: it.Size, IsDir: it.IsDir, ContentType: it.ContentType,})}- return &pb.ClipRecord{+ r := &pb.ClipRecord{Id: clip.ID,Kind: pb.ClipKind(clip.Kind),Status: pb.ClipStatus(clip.Status),@@ -903,7 +926,15 @@ func recordProto(clip store.Clip) *pb.ClipRecord {ExpiresAtUnix: clip.ExpiresAt.Unix(),Error: clip.Error,ImageCount: imagepreview.ImageCount(clip),+ Favorite: clip.Favorite,+ Favorited: clip.Favorited,+ IsLink: clip.IsLink,+ }+ if clip.Favorite {+ r.ExpiresAtUnix = 0 // 收藏不会过期+ r.FavoritedAtUnix = clip.FavoritedAt.Unix()}+ return r}// progressInterval 是同一次传输两次进度上报之间的最小间隔。diff --git a/client-core/internal/sync/favorite.go b/client-core/internal/sync/favorite.gonew file mode 100644index 0000000..fde3f05--- /dev/null+++ b/client-core/internal/sync/favorite.go@@ -0,0 +1,360 @@+package sync++// 收藏:另存一份、不会过期,取消时放回复制记录。见 design/quick-paste-and-favorites.md 第 3 节。+//+// 收藏和复制记录存在同一张表里,各占独立的一行(store.Clip.Favorite)。图片与文件另存到+// 收藏目录:从缓存来的用硬链接,本机的原文件先试写时复制(APFS clonefile、Linux reflink),+// 都不行再整份复制。只有元数据的大文件先在后台下载(不覆盖剪贴板),下完再另存。++import (+ "context"+ "errors"+ "fmt"+ "os"+ "path/filepath"+ "strings"+ "time"++ "github.com/baiyuze/pasteferry/client-core/internal/store"+ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++// ErrCannotFavorite 表示这条记录的内容已经不在本机,收藏不了。+var ErrCannotFavorite = errors.New("内容已不在本机,不能收藏")++// saveWait 是收藏图片、文件时最多等另存完成多久再返回。硬链接与写时复制几乎瞬间完成,+// 返回时就是已收好的状态;整份复制大文件则先返回「正在保存」,完成后再推送更新。+const saveWait = 500 * time.Millisecond++// SetFavorite 收藏(favorite 为 true)或取消收藏 id 这一条。收藏时 id 是复制记录;+// 取消时 id 是收藏或它的原记录都可以。返回收藏后的那条收藏,或取消后放回复制记录的那一条。+func (e *Engine) SetFavorite(ctx context.Context, id string, favorite bool) (store.Clip, error) {+ e.favMu.Lock()+ defer e.favMu.Unlock()+ clip, err := e.store.GetClip(id)+ if err != nil {+ return store.Clip{}, err+ }+ if !favorite {+ return e.unfavorite(clip)+ }+ if clip.Favorite {+ if clip.Status == store.StatusReady {+ return e.touchFavorite(clip, clip.SourceClipID)+ }+ return e.retryFavorite(ctx, clip)+ }+ if existing, err := e.store.FavoriteOf(clip.ID); err == nil {+ return e.touchFavorite(existing, clip.ID)+ }++ switch clip.Kind {+ case store.KindText, store.KindHTML:+ // 同样的文字不重复收藏,只把已有的那条挪到最上面+ if existing, err := e.store.FavoriteWithText(clip.Kind, clip.TextContent); err == nil {+ return e.touchFavorite(existing, clip.ID)+ }+ fav := newFavorite(clip)+ fav.Status = store.StatusReady+ return e.putFavorite(fav)+ }++ switch clip.Status {+ case store.StatusReady:+ fav := newFavorite(clip)+ fav.Status = store.StatusFetching // 界面上显示「正在保存」+ if _, err := e.putFavorite(fav); err != nil {+ return store.Clip{}, err+ }+ return e.saveAndWait(fav, clip), nil+ case store.StatusRemoteOnly, store.StatusFetching:+ fav := newFavorite(clip)+ fav.Status = store.StatusFetching+ if _, err := e.putFavorite(fav); err != nil {+ return store.Clip{}, err+ }+ if clip.Status == store.StatusRemoteOnly {+ // 下载失败时 failReceive 会把这条收藏一起标成失败+ _ = e.FetchForPreview(ctx, clip.ID)+ }+ return e.store.GetClip(fav.ID)+ default:+ return store.Clip{}, ErrCannotFavorite+ }+}++// newFavorite 由复制记录 src 生成一条收藏:新的 ID,保留原来的复制时间与来源。+func newFavorite(src store.Clip) store.Clip {+ fav := src+ fav.ID = newID()+ fav.Favorite = true+ fav.FavoritedAt = time.Now()+ fav.SourceClipID = src.ID+ fav.Favorited = false+ fav.ExpiresAt = store.FavoriteExpiry+ fav.CachePath = ""+ fav.Error = ""+ return fav+}++func (e *Engine) putFavorite(fav store.Clip) (store.Clip, error) {+ if err := e.store.PutClip(fav); err != nil {+ return store.Clip{}, err+ }+ return e.emitStored(fav.ID, fav.SourceClipID)+}++// touchFavorite 把已有的收藏挪到收藏的最上面。+func (e *Engine) touchFavorite(fav store.Clip, sourceID string) (store.Clip, error) {+ if err := e.store.TouchFavorite(fav.ID, sourceID, time.Now()); err != nil {+ return store.Clip{}, err+ }+ return e.emitStored(fav.ID, sourceID)+}++// emitStored 重新读出 id 并推送给界面;原记录 sourceID 的星标随之变化,也推一次。+func (e *Engine) emitStored(id, sourceID string) (store.Clip, error) {+ if sourceID != "" {+ if src, err := e.store.GetClip(sourceID); err == nil {+ e.emitRecord(src)+ }+ }+ clip, err := e.store.GetClip(id)+ if err != nil {+ return store.Clip{}, err+ }+ e.emitRecord(clip)+ return clip, nil+}++// retryFavorite 重新另存一条失败了的收藏。+func (e *Engine) retryFavorite(ctx context.Context, fav store.Clip) (store.Clip, error) {+ if fav.Status == store.StatusFetching {+ return fav, nil+ }+ src, err := e.store.GetClip(fav.SourceClipID)+ if err != nil || src.Favorite {+ // 原记录已经没了:本机复制的文件还能从原来的位置再存一次+ if !fav.Outgoing || fav.Kind != store.KindFile {+ return store.Clip{}, errors.New("原记录已不在本机,无法重新保存")+ }+ src = fav+ src.Favorite, src.CachePath = false, ""+ }+ if err := e.store.SetClipStatus(fav.ID, store.StatusFetching, ""); err != nil {+ return store.Clip{}, err+ }+ fav.Status, fav.Error = store.StatusFetching, ""+ switch src.Status {+ case store.StatusReady:+ return e.saveAndWait(fav, src), nil+ case store.StatusRemoteOnly, store.StatusFailed:+ _ = e.FetchForPreview(ctx, src.ID)+ case store.StatusFetching:+ default:+ e.failFavorite(fav.ID, ErrCannotFavorite)+ }+ return e.emitStored(fav.ID, "")+}++// saveAndWait 在后台把 src 的内容另存给收藏 fav,最多等 saveWait。+func (e *Engine) saveAndWait(fav, src store.Clip) store.Clip {+ done := make(chan store.Clip, 1)+ go func() { done <- e.saveFavorite(fav, src) }()+ select {+ case c := <-done:+ return c+ case <-time.After(saveWait):+ if c, err := e.store.GetClip(fav.ID); err == nil {+ return c+ }+ return fav+ }+}++// saveFavorite 把复制记录 src 的图片或文件另存到收藏目录,完成后把收藏标成就绪并推送给界面。+func (e *Engine) saveFavorite(fav, src store.Clip) store.Clip {+ rel, err := e.copyToFavorites(fav.ID, src)+ if err != nil {+ e.log.Warn("另存收藏失败", "clip", fav.ID, "err", err)+ e.failFavorite(fav.ID, err)+ } else if err := e.store.SetClipCache(fav.ID, rel, fav.TotalSize); err != nil {+ _ = e.favorites.Remove(rel)+ e.failFavorite(fav.ID, err)+ }+ c, err := e.emitStored(fav.ID, src.ID)+ if err != nil {+ return fav+ }+ return c+}++func (e *Engine) failFavorite(id string, failure error) {+ _ = e.store.SetClipStatus(id, store.StatusFailed, failure.Error())+}++// copyToFavorites 把 src 的全部内容复制进收藏目录里属于 favID 的子目录,返回它的相对路径。+func (e *Engine) copyToFavorites(favID string, src store.Clip) (string, error) {+ if e.favorites == nil {+ return "", errors.New("收藏目录不可用")+ }+ paths, err := e.localPaths(src)+ if err != nil {+ return "", ErrCannotFavorite+ }+ rel, abs, err := e.favorites.Dir(favID)+ if err != nil {+ return "", err+ }+ for _, p := range paths {+ dst := uniquePath(filepath.Join(abs, filepath.Base(p)))+ // 缓存里的是隔空贴自己的文件,不会被用户改动,可以硬链接;+ // 本机的原文件用户随时可能改,要另存一份+ if err := copyEntry(p, dst, e.inCache(p)); err != nil {+ _ = e.favorites.Remove(rel)+ return "", fmt.Errorf("另存 %s: %w", filepath.Base(p), err)+ }+ }+ return rel, nil+}++func (e *Engine) inCache(p string) bool {+ root := filepath.Clean(e.cache.Root()) + string(filepath.Separator)+ return strings.HasPrefix(filepath.Clean(p), root)+}++// uniquePath 在 p 已经存在时(来自不同文件夹的同名文件)加上序号。+func uniquePath(p string) string {+ if _, err := os.Lstat(p); err != nil {+ return p+ }+ ext := filepath.Ext(p)+ base := strings.TrimSuffix(p, ext)+ for i := 2; ; i++ {+ c := fmt.Sprintf("%s (%d)%s", base, i, ext)+ if _, err := os.Lstat(c); err != nil {+ return c+ }+ }+}++// completePendingFavorites 在复制记录 src 下载完成后,另存等着它的收藏。+func (e *Engine) completePendingFavorites(src store.Clip) {+ pending, err := e.store.PendingFavorites(src.ID)+ if err != nil {+ return+ }+ for _, fav := range pending {+ if fav.Status == store.StatusFetching {+ go e.saveFavorite(fav, src)+ }+ }+}++// failPendingFavorites 在复制记录 sourceID 下载失败时,把等着它的收藏也标成失败。+func (e *Engine) failPendingFavorites(sourceID string, failure error) {+ pending, err := e.store.PendingFavorites(sourceID)+ if err != nil {+ return+ }+ for _, fav := range pending {+ e.failFavorite(fav.ID, failure)+ if c, err := e.store.GetClip(fav.ID); err == nil {+ e.emitRecord(c)+ }+ }+}++// unfavorite 取消收藏:把收藏放回复制记录的最上面,保留期从现在重新算。+// 原记录还在的话先删掉它,免得出现两条一样的。+func (e *Engine) unfavorite(clip store.Clip) (store.Clip, error) {+ fav := clip+ if !clip.Favorite {+ var err error+ if fav, err = e.store.FavoriteOf(clip.ID); err != nil {+ return clip, nil // 本来就没收藏+ }+ }+ src, srcErr := e.store.GetClip(fav.SourceClipID)+ hasSource := srcErr == nil && !src.Favorite++ if fav.Status != store.StatusReady && hasSource {+ // 还没另存好:原记录就是它,直接去掉这条收藏+ if fav.CachePath != "" && e.favorites != nil {+ _ = e.favorites.Remove(fav.CachePath)+ }+ if err := e.store.DeleteClips([]string{fav.ID}); err != nil {+ return store.Clip{}, err+ }+ e.emitRemoved(fav.ID)+ return e.emitStored(src.ID, "")+ }++ rel := ""+ if fav.CachePath != "" && e.favorites != nil && e.favorites.Exists(fav.CachePath) {+ var err error+ if rel, err = e.moveToCache(fav.CachePath); err != nil {+ return store.Clip{}, err+ }+ }+ if hasSource {+ if src.CachePath != "" {+ _ = e.cache.Remove(src.CachePath)+ }+ if err := e.store.DeleteClips([]string{src.ID}); err != nil {+ return store.Clip{}, err+ }+ e.emitRemoved(src.ID)+ }+ now := time.Now()+ if err := e.store.Unfavorite(fav.ID, now, now.Add(e.loadConfig().HistoryTTL.Std()), rel); err != nil {+ return store.Clip{}, err+ }+ return e.emitStored(fav.ID, "")+}++// moveToCache 把收藏目录里的 rel 挪进缓存目录(两者在同一块磁盘上,改名即可),返回它在缓存目录里的相对路径。+func (e *Engine) moveToCache(rel string) (string, error) {+ from := e.favorites.Abs(rel)+ to := e.cache.Abs(rel)+ if _, err := os.Lstat(to); err == nil {+ return "", fmt.Errorf("缓存目录里已有 %s", rel)+ }+ if err := os.Rename(from, to); err != nil {+ // 数据目录被挪到了别处、两个目录不在同一块磁盘上:复制一份再删掉+ if err := copyEntry(from, to, false); err != nil {+ _ = os.RemoveAll(to)+ return "", err+ }+ _ = e.favorites.Remove(rel)+ }+ return rel, nil+}++func (e *Engine) emitRemoved(id string) {+ if e.onRemoved != nil {+ e.onRemoved(id)+ }+}++// ClipDetail 返回悬停提示框要显示的完整内容。+func (e *Engine) ClipDetail(id string) (*pb.ClipDetail, error) {+ clip, err := e.store.GetClip(id)+ if err != nil {+ return nil, err+ }+ const maxRunes = 4000+ d := &pb.ClipDetail{}+ if clip.Kind == store.KindText || clip.Kind == store.KindHTML {+ r := []rune(plainText(clip))+ d.TextLength = int32(len(r))+ if len(r) > maxRunes {+ r = r[:maxRunes]+ }+ d.Text = string(r)+ }+ if clip.Kind == store.KindFile && clip.Outgoing {+ d.SourcePaths = clip.SourcePaths+ }+ return d, nil+}diff --git a/client-core/internal/sync/favorite_clone_darwin.go b/client-core/internal/sync/favorite_clone_darwin.gonew file mode 100644index 0000000..f7cebf3--- /dev/null+++ b/client-core/internal/sync/favorite_clone_darwin.go@@ -0,0 +1,12 @@+//go:build darwin++package sync++import "golang.org/x/sys/unix"++// APFS 的 clonefile 能整个复制一个文件夹,几乎不花时间,也不占额外空间。+// 不在 APFS 上(外接的 exFAT 盘等)会失败,调用方再退回逐个文件复制。++func cloneTree(src, dst string) error { return unix.Clonefile(src, dst, unix.CLONE_NOFOLLOW) }++func cloneFile(src, dst string) error { return unix.Clonefile(src, dst, unix.CLONE_NOFOLLOW) }diff --git a/client-core/internal/sync/favorite_clone_linux.go b/client-core/internal/sync/favorite_clone_linux.gonew file mode 100644index 0000000..245b0b9--- /dev/null+++ b/client-core/internal/sync/favorite_clone_linux.go@@ -0,0 +1,34 @@+//go:build linux++package sync++import (+ "errors"+ "os"++ "golang.org/x/sys/unix"+)++// Linux 上只有单个文件的写时复制(FICLONE,btrfs、XFS 等支持),文件夹由调用方逐个文件处理。+func cloneTree(string, string) error { return errors.ErrUnsupported }++func cloneFile(src, dst string) error {+ in, err := os.Open(src)+ if err != nil {+ return err+ }+ defer in.Close()+ out, err := os.OpenFile(dst, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0o600)+ if err != nil {+ return err+ }+ if err := unix.IoctlFileClone(int(out.Fd()), int(in.Fd())); err != nil {+ out.Close()+ os.Remove(dst)+ return err+ }+ if info, err := in.Stat(); err == nil {+ _ = out.Chmod(info.Mode().Perm() | 0o600)+ }+ return out.Close()+}diff --git a/client-core/internal/sync/favorite_clone_other.go b/client-core/internal/sync/favorite_clone_other.gonew file mode 100644index 0000000..9951876--- /dev/null+++ b/client-core/internal/sync/favorite_clone_other.go@@ -0,0 +1,10 @@+//go:build !darwin && !linux++package sync++import "errors"++// Windows 上的 NTFS 没有写时复制,整份复制。+func cloneTree(string, string) error { return errors.ErrUnsupported }++func cloneFile(string, string) error { return errors.ErrUnsupported }diff --git a/client-core/internal/sync/favorite_copy.go b/client-core/internal/sync/favorite_copy.gonew file mode 100644index 0000000..e384464--- /dev/null+++ b/client-core/internal/sync/favorite_copy.go@@ -0,0 +1,83 @@+package sync++import (+ "io"+ "os"+ "path/filepath"+)++// copyEntry 把 src(文件或文件夹)另存到 dst,dst 不能已经存在。+//+// linkOK 时文件先试硬链接:只用于缓存里的内容,那是隔空贴自己的文件,不会被用户改动。+// 否则先试写时复制(APFS clonefile、btrfs/XFS reflink):几乎瞬间完成,不占额外空间,+// 之后改原文件也不影响副本。都不行再整份复制。+func copyEntry(src, dst string, linkOK bool) error {+ info, err := os.Lstat(src)+ if err != nil {+ return err+ }+ if !linkOK && cloneTree(src, dst) == nil {+ return nil+ }+ switch {+ case info.Mode()&os.ModeSymlink != 0:+ target, err := os.Readlink(src)+ if err == nil && os.Symlink(target, dst) == nil {+ return nil+ }+ // 建不了符号链接(Windows 上要特殊权限):存一份它指向的内容+ if info, err = os.Stat(src); err != nil {+ return nil // 指向的东西已经不在了,跳过+ }+ if info.IsDir() {+ return copyDir(src, dst, linkOK)+ }+ return copyRegular(src, dst, info.Mode().Perm(), linkOK)+ case info.IsDir():+ return copyDir(src, dst, linkOK)+ case info.Mode().IsRegular():+ return copyRegular(src, dst, info.Mode().Perm(), linkOK)+ default:+ return nil // 设备文件、管道之类,剪贴板里不会有,跳过+ }+}++func copyDir(src, dst string, linkOK bool) error {+ if err := os.MkdirAll(dst, 0o700); err != nil {+ return err+ }+ entries, err := os.ReadDir(src)+ if err != nil {+ return err+ }+ for _, e := range entries {+ if err := copyEntry(filepath.Join(src, e.Name()), filepath.Join(dst, e.Name()), linkOK); err != nil {+ return err+ }+ }+ return nil+}++func copyRegular(src, dst string, perm os.FileMode, linkOK bool) error {+ if linkOK && os.Link(src, dst) == nil {+ return nil+ }+ if cloneFile(src, dst) == nil {+ return nil+ }+ in, err := os.Open(src)+ if err != nil {+ return err+ }+ defer in.Close()+ out, err := os.OpenFile(dst, os.O_CREATE|os.O_EXCL|os.O_WRONLY, perm|0o600)+ if err != nil {+ return err+ }+ if _, err := io.Copy(out, in); err != nil {+ out.Close()+ os.Remove(dst)+ return err+ }+ return out.Close()+}diff --git a/client-core/internal/sync/favorite_test.go b/client-core/internal/sync/favorite_test.gonew file mode 100644index 0000000..8c06f7b--- /dev/null+++ b/client-core/internal/sync/favorite_test.go@@ -0,0 +1,369 @@+package sync++import (+ "context"+ "errors"+ "io"+ "log/slog"+ "os"+ "path/filepath"+ "strings"+ "testing"+ "time"++ "github.com/baiyuze/pasteferry/client-core/internal/cache"+ "github.com/baiyuze/pasteferry/client-core/internal/config"+ "github.com/baiyuze/pasteferry/client-core/internal/store"+ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++type favoriteEnv struct {+ e *Engine+ removed []string+}++func newFavoriteEngine(t *testing.T) *favoriteEnv {+ t.Helper()+ dir := t.TempDir()+ db, err := store.Open(filepath.Join(dir, "pasteferry.db"))+ if err != nil {+ t.Fatal(err)+ }+ t.Cleanup(func() { db.Close() })+ blobs, err := cache.New(filepath.Join(dir, "cache"))+ if err != nil {+ t.Fatal(err)+ }+ favs, err := cache.New(filepath.Join(dir, "favorites"))+ if err != nil {+ t.Fatal(err)+ }+ cfg := config.Default()+ env := &favoriteEnv{}+ env.e = &Engine{+ log: slog.New(slog.NewTextHandler(io.Discard, nil)),+ store: db,+ cache: blobs,+ favorites: favs,+ loadConfig: func() config.Config { return cfg },+ send: func(string, *pb.PeerMessage) error { return errors.New("对端不在线") },+ quiet: map[string]bool{},+ lastProgress: map[string]time.Time{},+ receives: map[string]*receiveAttempt{},+ incoming: map[string]*receiver{},+ onRemoved: func(id string) { env.removed = append(env.removed, id) },+ }+ return env+}++func (env *favoriteEnv) get(t *testing.T, id string) store.Clip {+ t.Helper()+ c, err := env.e.store.GetClip(id)+ if err != nil {+ t.Fatalf("读取 %s: %v", id, err)+ }+ return c+}++// waitReady 等另存完成:整份复制可能比 saveWait 慢。+func (env *favoriteEnv) waitReady(t *testing.T, id string) store.Clip {+ t.Helper()+ deadline := time.Now().Add(5 * time.Second)+ for {+ c := env.get(t, id)+ if c.Status != store.StatusFetching || time.Now().After(deadline) {+ return c+ }+ time.Sleep(20 * time.Millisecond)+ }+}++// 收藏是另存的一份:原记录被删掉后收藏还在,也不会被当成过期记录清理。+func TestFavoriteTextIsIndependentCopy(t *testing.T) {+ env := newFavoriteEngine(t)+ ctx := context.Background()+ src := putText(t, env.e, "src", "收货地址:上海市徐汇区", time.Now().Add(-time.Hour))++ fav, err := env.e.SetFavorite(ctx, src.ID, true)+ if err != nil {+ t.Fatal(err)+ }+ if !fav.Favorite || fav.ID == src.ID || fav.SourceClipID != src.ID || fav.TextContent != src.TextContent {+ t.Fatalf("收藏不对:%+v", fav)+ }+ if fav.CreatedAt.Unix() != src.CreatedAt.Unix() {+ t.Errorf("收藏要保留原来的复制时间:%v != %v", fav.CreatedAt, src.CreatedAt)+ }+ if !env.get(t, src.ID).Favorited {+ t.Error("原记录的星标没亮")+ }+ if p := recordProto(fav); p.GetExpiresAtUnix() != 0 || !p.GetFavorite() || p.GetFavoritedAtUnix() == 0 {+ t.Errorf("收藏的 ClipRecord 不对:%v", p)+ }++ if err := env.e.store.DeleteAllClips(); err != nil {+ t.Fatal(err)+ }+ expired, err := env.e.store.ExpiredClips(time.Now().AddDate(100, 0, 0))+ if err != nil {+ t.Fatal(err)+ }+ if len(expired) != 0 {+ t.Errorf("收藏不该过期:%v", expired)+ }+ if got := env.get(t, fav.ID); !got.Favorite || got.TextContent != src.TextContent {+ t.Errorf("清空复制记录后收藏不对:%+v", got)+ }+}++// 同样的文字不重复收藏,只把已有的那条挪到最上面;再收藏同一条记录也一样。+func TestFavoriteSameTextNotDuplicated(t *testing.T) {+ env := newFavoriteEngine(t)+ ctx := context.Background()+ now := time.Now()+ a := putText(t, env.e, "a", "pnpm install", now.Add(-2*time.Minute))+ b := putText(t, env.e, "b", "pnpm install", now.Add(-time.Minute))++ first, err := env.e.SetFavorite(ctx, a.ID, true)+ if err != nil {+ t.Fatal(err)+ }+ again, err := env.e.SetFavorite(ctx, a.ID, true)+ if err != nil {+ t.Fatal(err)+ }+ second, err := env.e.SetFavorite(ctx, b.ID, true)+ if err != nil {+ t.Fatal(err)+ }+ if again.ID != first.ID || second.ID != first.ID {+ t.Fatalf("重复收藏了:%s %s %s", first.ID, again.ID, second.ID)+ }+ favs, err := env.e.store.ListRecords(100, time.Time{}, store.Filter{Favorites: true})+ if err != nil {+ t.Fatal(err)+ }+ if len(favs) != 1 || favs[0].SourceClipID != b.ID {+ t.Fatalf("收藏应只有一条、来自最后收藏的那条记录:%+v", favs)+ }+}++// 本机复制的文件收藏时另存一份:之后改动、删除原文件,收藏里的内容都不变。+func TestFavoriteLocalFileIsSnapshot(t *testing.T) {+ env := newFavoriteEngine(t)+ ctx := context.Background()+ userDir := t.TempDir()+ doc := filepath.Join(userDir, "合同.txt")+ folder := filepath.Join(userDir, "资料")+ if err := os.WriteFile(doc, []byte("第一版"), 0o644); err != nil {+ t.Fatal(err)+ }+ if err := os.MkdirAll(filepath.Join(folder, "子目录"), 0o755); err != nil {+ t.Fatal(err)+ }+ if err := os.WriteFile(filepath.Join(folder, "子目录", "a.md"), []byte("内容"), 0o644); err != nil {+ t.Fatal(err)+ }+ src := store.Clip{+ ID: "files", Kind: store.KindFile, Status: store.StatusReady, Outgoing: true,+ SourcePaths: []string{doc, folder}, TotalSize: 15,+ Items: []store.Item{{Name: "合同.txt", Size: 9}, {Name: "资料", IsDir: true}},+ CreatedAt: time.Now(), ExpiresAt: time.Now().Add(time.Hour),+ }+ if err := env.e.store.PutClip(src); err != nil {+ t.Fatal(err)+ }++ fav, err := env.e.SetFavorite(ctx, src.ID, true)+ if err != nil {+ t.Fatal(err)+ }+ fav = env.waitReady(t, fav.ID)+ if fav.Status != store.StatusReady || fav.CachePath == "" {+ t.Fatalf("另存没完成:%+v", fav)+ }++ if err := os.WriteFile(doc, []byte("改过的第二版"), 0o644); err != nil {+ t.Fatal(err)+ }+ if err := os.RemoveAll(folder); err != nil {+ t.Fatal(err)+ }+ paths, err := env.e.localPaths(fav)+ if err != nil {+ t.Fatal(err)+ }+ got := map[string]string{}+ for _, p := range paths {+ if !strings.HasPrefix(p, env.e.favorites.Root()) {+ t.Errorf("收藏的内容不在收藏目录里:%s", p)+ }+ got[filepath.Base(p)] = p+ }+ if data, _ := os.ReadFile(got["合同.txt"]); string(data) != "第一版" {+ t.Errorf("原文件改动影响了收藏:%q", data)+ }+ if data, _ := os.ReadFile(filepath.Join(got["资料"], "子目录", "a.md")); string(data) != "内容" {+ t.Errorf("文件夹没另存完整:%q", data)+ }+}++// 取消收藏:放回复制记录的最上面,保留期从现在重新算;原记录还在时合并成一条。+func TestUnfavoriteMovesBackToHistory(t *testing.T) {+ env := newFavoriteEngine(t)+ ctx := context.Background()+ src := putText(t, env.e, "src", "会议改到周四", time.Now().Add(-48*time.Hour))+ fav, err := env.e.SetFavorite(ctx, src.ID, true)+ if err != nil {+ t.Fatal(err)+ }++ before := time.Now().Add(-time.Second)+ back, err := env.e.SetFavorite(ctx, fav.ID, false)+ if err != nil {+ t.Fatal(err)+ }+ if back.ID != fav.ID || back.Favorite || back.CreatedAt.Before(before) {+ t.Fatalf("没有放回复制记录的最上面:%+v", back)+ }+ ttl := env.e.loadConfig().HistoryTTL.Std()+ if back.ExpiresAt.Before(before.Add(ttl)) {+ t.Errorf("保留期没有从现在重新算:%v", back.ExpiresAt)+ }+ if _, err := env.e.store.GetClip(src.ID); !errors.Is(err, store.ErrNotFound) {+ t.Errorf("原记录应该合并掉:%v", err)+ }+ if len(env.removed) != 1 || env.removed[0] != src.ID {+ t.Errorf("要通知界面原记录已删:%v", env.removed)+ }+ history, err := env.e.store.ListClips(10, time.Time{}, store.KindUnspecified)+ if err != nil {+ t.Fatal(err)+ }+ if len(history) != 1 || history[0].ID != fav.ID {+ t.Errorf("复制记录里应只有放回来的那一条:%+v", history)+ }++ // 撤销:再收藏一次+ again, err := env.e.SetFavorite(ctx, back.ID, true)+ if err != nil {+ t.Fatal(err)+ }+ if !again.Favorite || again.TextContent != src.TextContent {+ t.Errorf("撤销后没有重新收藏:%+v", again)+ }+}++// 取消收藏文件时,另存的内容从收藏目录挪进缓存目录,仍然能粘贴。+func TestUnfavoriteFileMovesContentToCache(t *testing.T) {+ env := newFavoriteEngine(t)+ ctx := context.Background()+ doc := filepath.Join(t.TempDir(), "报价.pdf")+ if err := os.WriteFile(doc, []byte("pdf"), 0o644); err != nil {+ t.Fatal(err)+ }+ src := store.Clip{+ ID: "file", Kind: store.KindFile, Status: store.StatusReady, Outgoing: true,+ SourcePaths: []string{doc}, Items: []store.Item{{Name: "报价.pdf", Size: 3}},+ CreatedAt: time.Now(), ExpiresAt: time.Now().Add(time.Hour),+ }+ if err := env.e.store.PutClip(src); err != nil {+ t.Fatal(err)+ }+ fav, err := env.e.SetFavorite(ctx, src.ID, true)+ if err != nil {+ t.Fatal(err)+ }+ fav = env.waitReady(t, fav.ID)+ if err := os.Remove(doc); err != nil {+ t.Fatal(err)+ }++ back, err := env.e.SetFavorite(ctx, fav.ID, false)+ if err != nil {+ t.Fatal(err)+ }+ if env.e.favorites.Exists(fav.CachePath) {+ t.Error("收藏目录里的副本没挪走")+ }+ paths, err := env.e.localPaths(back)+ if err != nil || len(paths) != 1 || !strings.HasPrefix(paths[0], env.e.cache.Root()) {+ t.Fatalf("放回去的记录找不到内容:%v %v", paths, err)+ }+ if data, _ := os.ReadFile(paths[0]); string(data) != "pdf" {+ t.Errorf("内容不对:%q", data)+ }+}++// 内容已经不在本机的图片、文件不能收藏。+func TestCannotFavoriteExpiredFile(t *testing.T) {+ env := newFavoriteEngine(t)+ src := store.Clip{+ ID: "old", Kind: store.KindImage, Status: store.StatusExpired,+ Items: []store.Item{{Name: "image.png"}}, CreatedAt: time.Now(), ExpiresAt: time.Now().Add(time.Hour),+ }+ if err := env.e.store.PutClip(src); err != nil {+ t.Fatal(err)+ }+ if _, err := env.e.SetFavorite(context.Background(), src.ID, true); !errors.Is(err, ErrCannotFavorite) {+ t.Fatalf("err = %v", err)+ }+}++// 只有元数据的大文件:先下载再另存。源设备不在线时收藏标成失败,下载完成后另存好。+func TestFavoriteRemoteOnlyWaitsForDownload(t *testing.T) {+ env := newFavoriteEngine(t)+ ctx := context.Background()+ src := store.Clip{+ ID: "remote", Kind: store.KindFile, Status: store.StatusRemoteOnly, OriginDeviceID: "office",+ Items: []store.Item{{Name: "安装包.dmg", Size: 800 << 20}}, TotalSize: 800 << 20,+ CreatedAt: time.Now(), ExpiresAt: time.Now().Add(time.Hour),+ }+ if err := env.e.store.PutClip(src); err != nil {+ t.Fatal(err)+ }+ fav, err := env.e.SetFavorite(ctx, src.ID, true)+ if err != nil {+ t.Fatal(err)+ }+ if fav.Status != store.StatusFailed || fav.Error == "" {+ t.Fatalf("源设备不在线时收藏应标成失败:%+v", fav)+ }++ // 模拟下载完成:缓存里有了内容,记录就绪+ rel, abs, err := env.e.cache.Dir("remote-dl")+ if err != nil {+ t.Fatal(err)+ }+ if err := os.WriteFile(filepath.Join(abs, "安装包.dmg"), []byte("dmg"), 0o600); err != nil {+ t.Fatal(err)+ }+ if err := env.e.store.SetClipCache(src.ID, rel, 3); err != nil {+ t.Fatal(err)+ }+ if err := env.e.store.SetClipStatus(fav.ID, store.StatusFetching, ""); err != nil {+ t.Fatal(err)+ }+ env.e.completePendingFavorites(env.get(t, src.ID))+ got := env.waitReady(t, fav.ID)+ if got.Status != store.StatusReady {+ t.Fatalf("下载完成后没有另存:%+v", got)+ }+ paths, err := env.e.localPaths(got)+ if err != nil || len(paths) != 1 || !strings.HasPrefix(paths[0], env.e.favorites.Root()) {+ t.Fatalf("另存的位置不对:%v %v", paths, err)+ }+}++func TestClipDetail(t *testing.T) {+ env := newFavoriteEngine(t)+ long := strings.Repeat("行\n", 3000) // 6000 个字,保留换行+ putText(t, env.e, "long", long, time.Now())+ d, err := env.e.ClipDetail("long")+ if err != nil {+ t.Fatal(err)+ }+ if d.GetTextLength() != 6000 || len([]rune(d.GetText())) != 4000 || !strings.HasPrefix(d.GetText(), "行\n行\n") {+ t.Fatalf("length=%d text=%d", d.GetTextLength(), len([]rune(d.GetText())))+ }+}diff --git a/client-core/internal/sync/receive.go b/client-core/internal/sync/receive.goindex cf3bb5b..1baaf71 100644--- a/client-core/internal/sync/receive.go+++ b/client-core/internal/sync/receive.go@@ -160,6 +160,7 @@ func (e *Engine) failReceive(id string, expected *receiveAttempt, failure error)e.receiveEvent(clip, ReceiveFailed, nil)}}+ e.failPendingFavorites(id, failure)}func (e *Engine) writeClipboard(ctx context.Context, clip store.Clip, revision *int64) *pb.ClipboardWriteResult {diff --git a/client-core/internal/sync/search.go b/client-core/internal/sync/search.goindex 1ce96d3..2da6c80 100644--- a/client-core/internal/sync/search.go+++ b/client-core/internal/sync/search.go@@ -13,12 +13,14 @@ import (// 数据库只能粗筛(见 store.SearchClips),这里按用户看得到的文字再核对一遍:// HTML 记录看纯文本,不看标签。匹配处不在预览片段里的文字记录,预览换成匹配处前后的一段,// 列表里一眼能看出为什么搜到了它。-func (e *Engine) SearchHistory(query string, limit int) ([]store.Clip, error) {+//+// f 选定在复制记录还是收藏里搜、只搜哪一类,见 store.Filter。+func (e *Engine) SearchHistory(query string, limit int, f store.Filter) ([]store.Clip, error) {q := []rune(strings.Map(unicode.ToLower, strings.TrimSpace(query)))if len(q) == 0 {return nil, nil}- candidates, err := e.store.SearchClips(string(q), limit)+ candidates, err := e.store.SearchRecords(string(q), limit, f)if err != nil {return nil, err}diff --git a/client-core/internal/sync/search_test.go b/client-core/internal/sync/search_test.goindex 9814c11..ae72994 100644--- a/client-core/internal/sync/search_test.go+++ b/client-core/internal/sync/search_test.go@@ -30,7 +30,7 @@ func TestSearchHistory(t *testing.T) {}find := func(query string) []store.Clip {- got, err := e.SearchHistory(query, 50)+ got, err := e.SearchHistory(query, 50, store.Filter{})if err != nil {t.Fatal(err)}diff --git a/client-core/internal/update/apply_darwin.go b/client-core/internal/update/apply_darwin.goindex 162b6b9..2d504a6 100644--- a/client-core/internal/update/apply_darwin.go+++ b/client-core/internal/update/apply_darwin.go@@ -12,6 +12,9 @@ import (// launchdLabel 与界面登记的 LaunchAgent 相同,见 ui/lib/background_service.dart。const launchdLabel = "com.pasteferry.daemon"+// pickerLabel 是快捷粘贴窗口的 LaunchAgent,由界面登记(见 ui/lib/quick_paste_service.dart)+const pickerLabel = "com.pasteferry.picker"+// prepare 挂载 DMG,把新 App 复制到旧 App 旁边(同一个磁盘,替换时只需改名),// 核对版本号、Bundle ID 与签名。func prepare(p *Plan, work string) error {@@ -79,14 +82,17 @@ func apply(p *Plan, log *slog.Logger) error {return nil}-// relaunch 让 launchd 按新 App 里的程序重启后台服务(只在 LaunchAgent 指向这个 App 时),再打开界面。+// relaunch 让 launchd 按新 App 里的程序重启后台服务与快捷粘贴窗口(只在 LaunchAgent 指向这个 App 时),+// 再打开界面。快捷窗口不重启的话会一直跑着旧版本,它的程序文件已经随旧 App 删掉了func relaunch(p *Plan, log *slog.Logger) error {home, _ := os.UserHomeDir()- plist := filepath.Join(home, "Library", "LaunchAgents", launchdLabel+".plist")- if raw, err := os.ReadFile(plist); err == nil && strings.Contains(string(raw), p.App+"/") {- target := fmt.Sprintf("gui/%d/%s", os.Getuid(), launchdLabel)- if out, err := exec.Command("launchctl", "kickstart", "-k", target).CombinedOutput(); err != nil {- log.Warn("重启后台服务失败", "err", err, "out", string(out))+ for _, label := range []string{launchdLabel, pickerLabel} {+ plist := filepath.Join(home, "Library", "LaunchAgents", label+".plist")+ if raw, err := os.ReadFile(plist); err == nil && strings.Contains(string(raw), p.App+"/") {+ target := fmt.Sprintf("gui/%d/%s", os.Getuid(), label)+ if out, err := exec.Command("launchctl", "kickstart", "-k", target).CombinedOutput(); err != nil {+ log.Warn("重启失败", "label", label, "err", err, "out", string(out))+ }}}// open 启动的 App 不继承这里的环境变量:把 HOME 明确带过去,界面才会连回同一个数据目录。diff --git a/proto/gen/pasteferry/v1/daemon.pb.go b/proto/gen/pasteferry/v1/daemon.pb.goindex 6379acb..da4cd76 100644--- a/proto/gen/pasteferry/v1/daemon.pb.go+++ b/proto/gen/pasteferry/v1/daemon.pb.go@@ -475,7 +475,14 @@ type ClipRecord struct {Error string `protobuf:"bytes,12,opt,name=error,proto3" json:"error,omitempty"` // status=FAILED 时的具体原因// 能在界面里预览的图片数:剪贴板图片为 1,文件记录是其中图片文件的个数。// 由本机后台服务按文件名判断,HEIC、TIFF 这类格式只有能转换它的平台才算。- ImageCount int32 `protobuf:"varint,13,opt,name=image_count,json=imageCount,proto3" json:"image_count,omitempty"`+ ImageCount int32 `protobuf:"varint,13,opt,name=image_count,json=imageCount,proto3" json:"image_count,omitempty"`+ // 这一条是收藏,不是复制记录。收藏的 expires_at_unix 为 0,表示不会过期+ Favorite bool `protobuf:"varint,14,opt,name=favorite,proto3" json:"favorite,omitempty"`+ // 复制记录里的这一条已经收藏过(星标亮着)+ Favorited bool `protobuf:"varint,15,opt,name=favorited,proto3" json:"favorited,omitempty"`+ FavoritedAtUnix int64 `protobuf:"varint,16,opt,name=favorited_at_unix,json=favoritedAtUnix,proto3" json:"favorited_at_unix,omitempty"`+ // 整条文字就是一个 http(s) 网址+ IsLink bool `protobuf:"varint,17,opt,name=is_link,json=isLink,proto3" json:"is_link,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}@@ -601,6 +608,34 @@ func (x *ClipRecord) GetImageCount() int32 {return 0}+func (x *ClipRecord) GetFavorite() bool {+ if x != nil {+ return x.Favorite+ }+ return false+}++func (x *ClipRecord) GetFavorited() bool {+ if x != nil {+ return x.Favorited+ }+ return false+}++func (x *ClipRecord) GetFavoritedAtUnix() int64 {+ if x != nil {+ return x.FavoritedAtUnix+ }+ return 0+}++func (x *ClipRecord) GetIsLink() bool {+ if x != nil {+ return x.IsLink+ }+ return false+}+type SubscribeRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// 断线重连时带上最后收到的记录时间,daemon 补发这之后的记录@@ -829,6 +864,8 @@ type Event struct {// *Event_PermissionChanged// *Event_StatusChanged// *Event_ClipboardWritten+ // *Event_ConfigChanged+ // *Event_QuickPasteChangedPayload isEvent_Payload `protobuf_oneof:"payload"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -943,6 +980,24 @@ func (x *Event) GetClipboardWritten() *ClipboardWriteResult {return nil}+func (x *Event) GetConfigChanged() *Config {+ if x != nil {+ if x, ok := x.Payload.(*Event_ConfigChanged); ok {+ return x.ConfigChanged+ }+ }+ return nil+}++func (x *Event) GetQuickPasteChanged() *QuickPasteStatus {+ if x != nil {+ if x, ok := x.Payload.(*Event_QuickPasteChanged); ok {+ return x.QuickPasteChanged+ }+ }+ return nil+}+type isEvent_Payload interface {isEvent_Payload()}@@ -979,6 +1034,15 @@ type Event_ClipboardWritten struct {ClipboardWritten *ClipboardWriteResult `protobuf:"bytes,8,opt,name=clipboard_written,json=clipboardWritten,proto3,oneof"`}+type Event_ConfigChanged struct {+ // 设置保存后推送,快捷窗口据此重新注册快捷键+ ConfigChanged *Config `protobuf:"bytes,9,opt,name=config_changed,json=configChanged,proto3,oneof"`+}++type Event_QuickPasteChanged struct {+ QuickPasteChanged *QuickPasteStatus `protobuf:"bytes,10,opt,name=quick_paste_changed,json=quickPasteChanged,proto3,oneof"`+}+func (*Event_ClipAdded) isEvent_Payload() {}func (*Event_ClipUpdated) isEvent_Payload() {}@@ -995,6 +1059,10 @@ func (*Event_StatusChanged) isEvent_Payload() {}func (*Event_ClipboardWritten) isEvent_Payload() {}+func (*Event_ConfigChanged) isEvent_Payload() {}++func (*Event_QuickPasteChanged) isEvent_Payload() {}+type NotificationStatus struct {state protoimpl.MessageState `protogen:"open.v1"`Supported bool `protobuf:"varint,1,opt,name=supported,proto3" json:"supported,omitempty"`@@ -1172,11 +1240,16 @@ func (x *ClipboardWriteResult) GetError() string {type ListHistoryRequest struct {state protoimpl.MessageState `protogen:"open.v1"`Limit int32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"`- BeforeUnix int64 `protobuf:"varint,2,opt,name=before_unix,json=beforeUnix,proto3" json:"before_unix,omitempty"` // 分页游标- KindFilter ClipKind `protobuf:"varint,3,opt,name=kind_filter,json=kindFilter,proto3,enum=pasteferry.v1.ClipKind" json:"kind_filter,omitempty"` // UNSPECIFIED 表示不过滤+ BeforeUnix int64 `protobuf:"varint,2,opt,name=before_unix,json=beforeUnix,proto3" json:"before_unix,omitempty"` // 分页游标+ // UNSPECIFIED 表示不过滤。TEXT 是界面上的「文字」:纯文本与网页格式,不含链接+ KindFilter ClipKind `protobuf:"varint,3,opt,name=kind_filter,json=kindFilter,proto3,enum=pasteferry.v1.ClipKind" json:"kind_filter,omitempty"`// 搜索词:非空时只返回文字内容或文件名包含它的记录(不分大小写),按时间倒序,// 忽略 before_unix。匹配处不在预览片段里的文字记录,text_preview 换成匹配处前后的一段。- Query string `protobuf:"bytes,4,opt,name=query,proto3" json:"query,omitempty"`+ Query string `protobuf:"bytes,4,opt,name=query,proto3" json:"query,omitempty"`+ // true 时只返回收藏,按收藏时间倒序,忽略 before_unix;false 时只返回复制记录+ Favorites bool `protobuf:"varint,5,opt,name=favorites,proto3" json:"favorites,omitempty"`+ // 只返回链接(is_link)+ LinksOnly bool `protobuf:"varint,6,opt,name=links_only,json=linksOnly,proto3" json:"links_only,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}@@ -1239,6 +1312,20 @@ func (x *ListHistoryRequest) GetQuery() string {return ""}+func (x *ListHistoryRequest) GetFavorites() bool {+ if x != nil {+ return x.Favorites+ }+ return false+}++func (x *ListHistoryRequest) GetLinksOnly() bool {+ if x != nil {+ return x.LinksOnly+ }+ return false+}+type ListHistoryResponse struct {state protoimpl.MessageState `protogen:"open.v1"`Records []*ClipRecord `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`@@ -1397,8 +1484,10 @@ func (x *FetchRequest) GetPreserveClipboard() bool {}type ApplyToClipboardRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- ClipId string `protobuf:"bytes,1,opt,name=clip_id,json=clipId,proto3" json:"clip_id,omitempty"`+ state protoimpl.MessageState `protogen:"open.v1"`+ ClipId string `protobuf:"bytes,1,opt,name=clip_id,json=clipId,proto3" json:"clip_id,omitempty"`+ // 只写纯文本,去掉网页格式(快捷窗口里按 ⇧回车)+ PlainText bool `protobuf:"varint,2,opt,name=plain_text,json=plainText,proto3" json:"plain_text,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}@@ -1440,6 +1529,321 @@ func (x *ApplyToClipboardRequest) GetClipId() string {return ""}+func (x *ApplyToClipboardRequest) GetPlainText() bool {+ if x != nil {+ return x.PlainText+ }+ return false+}++type SetFavoriteRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // 收藏时传复制记录的 ID;取消收藏时传收藏的 ID 或原记录的 ID 都可以+ ClipId string `protobuf:"bytes,1,opt,name=clip_id,json=clipId,proto3" json:"clip_id,omitempty"`+ Favorite bool `protobuf:"varint,2,opt,name=favorite,proto3" json:"favorite,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *SetFavoriteRequest) Reset() {+ *x = SetFavoriteRequest{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[15]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *SetFavoriteRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*SetFavoriteRequest) ProtoMessage() {}++func (x *SetFavoriteRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[15]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use SetFavoriteRequest.ProtoReflect.Descriptor instead.+func (*SetFavoriteRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{15}+}++func (x *SetFavoriteRequest) GetClipId() string {+ if x != nil {+ return x.ClipId+ }+ return ""+}++func (x *SetFavoriteRequest) GetFavorite() bool {+ if x != nil {+ return x.Favorite+ }+ return false+}++type GetClipDetailRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ ClipId string `protobuf:"bytes,1,opt,name=clip_id,json=clipId,proto3" json:"clip_id,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *GetClipDetailRequest) Reset() {+ *x = GetClipDetailRequest{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[16]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *GetClipDetailRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*GetClipDetailRequest) ProtoMessage() {}++func (x *GetClipDetailRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[16]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use GetClipDetailRequest.ProtoReflect.Descriptor instead.+func (*GetClipDetailRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{16}+}++func (x *GetClipDetailRequest) GetClipId() string {+ if x != nil {+ return x.ClipId+ }+ return ""+}++type ClipDetail struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // 文字的全文,网页格式给纯文本。最多前 4000 个字,保留换行+ Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`+ // 全文的字数+ TextLength int32 `protobuf:"varint,2,opt,name=text_length,json=textLength,proto3" json:"text_length,omitempty"`+ // 本机复制的文件在本机的完整路径+ SourcePaths []string `protobuf:"bytes,3,rep,name=source_paths,json=sourcePaths,proto3" json:"source_paths,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ClipDetail) Reset() {+ *x = ClipDetail{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[17]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ClipDetail) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ClipDetail) ProtoMessage() {}++func (x *ClipDetail) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[17]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use ClipDetail.ProtoReflect.Descriptor instead.+func (*ClipDetail) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{17}+}++func (x *ClipDetail) GetText() string {+ if x != nil {+ return x.Text+ }+ return ""+}++func (x *ClipDetail) GetTextLength() int32 {+ if x != nil {+ return x.TextLength+ }+ return 0+}++func (x *ClipDetail) GetSourcePaths() []string {+ if x != nil {+ return x.SourcePaths+ }+ return nil+}++type QuickPasteStatus struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // 快捷窗口进程在运行(QuickPasteSession 连着)+ Running bool `protobuf:"varint,1,opt,name=running,proto3" json:"running,omitempty"`+ // 快捷键注册失败的原因:空表示成功;in_use(被其他程序占用)、invalid、unsupported,+ // 或者平台给出的原文+ HotkeyError string `protobuf:"bytes,2,opt,name=hotkey_error,json=hotkeyError,proto3" json:"hotkey_error,omitempty"`+ // 实际生效的快捷键,与 Config.quick_paste_hotkey 同样的写法。Wayland 上是门户里用户设定的组合+ Hotkey string `protobuf:"bytes,3,opt,name=hotkey,proto3" json:"hotkey,omitempty"`+ // 选中后能自动粘贴+ PasteAvailable bool `protobuf:"varint,4,opt,name=paste_available,json=pasteAvailable,proto3" json:"paste_available,omitempty"`+ // 不能自动粘贴的原因:not_trusted(Mac 未授予辅助功能)、wayland、copy_only(设置里选了只复制)+ PasteUnavailableReason string `protobuf:"bytes,5,opt,name=paste_unavailable_reason,json=pasteUnavailableReason,proto3" json:"paste_unavailable_reason,omitempty"`+ // 快捷键由谁触发:native(程序自己注册)、portal(Wayland 全局快捷键门户)、+ // system_shortcut(Wayland 上要用户在系统设置里添加快捷键)+ HotkeySource string `protobuf:"bytes,6,opt,name=hotkey_source,json=hotkeySource,proto3" json:"hotkey_source,omitempty"`+ // 快捷窗口的版本。App 更新后还在跑旧版的,界面让它按新的程序重新启动+ Version string `protobuf:"bytes,7,opt,name=version,proto3" json:"version,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *QuickPasteStatus) Reset() {+ *x = QuickPasteStatus{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[18]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *QuickPasteStatus) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*QuickPasteStatus) ProtoMessage() {}++func (x *QuickPasteStatus) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[18]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use QuickPasteStatus.ProtoReflect.Descriptor instead.+func (*QuickPasteStatus) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{18}+}++func (x *QuickPasteStatus) GetRunning() bool {+ if x != nil {+ return x.Running+ }+ return false+}++func (x *QuickPasteStatus) GetHotkeyError() string {+ if x != nil {+ return x.HotkeyError+ }+ return ""+}++func (x *QuickPasteStatus) GetHotkey() string {+ if x != nil {+ return x.Hotkey+ }+ return ""+}++func (x *QuickPasteStatus) GetPasteAvailable() bool {+ if x != nil {+ return x.PasteAvailable+ }+ return false+}++func (x *QuickPasteStatus) GetPasteUnavailableReason() string {+ if x != nil {+ return x.PasteUnavailableReason+ }+ return ""+}++func (x *QuickPasteStatus) GetHotkeySource() string {+ if x != nil {+ return x.HotkeySource+ }+ return ""+}++func (x *QuickPasteStatus) GetVersion() string {+ if x != nil {+ return x.Version+ }+ return ""+}++type QuickPasteCommand struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // request_permission:Mac 上请求辅助功能权限;+ // suspend_hotkey / resume_hotkey:设置页录制快捷键期间暂停全局快捷键;+ // show:呼出快捷窗口+ Command string `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *QuickPasteCommand) Reset() {+ *x = QuickPasteCommand{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[19]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *QuickPasteCommand) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*QuickPasteCommand) ProtoMessage() {}++func (x *QuickPasteCommand) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[19]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use QuickPasteCommand.ProtoReflect.Descriptor instead.+func (*QuickPasteCommand) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{19}+}++func (x *QuickPasteCommand) GetCommand() string {+ if x != nil {+ return x.Command+ }+ return ""+}+type ListDevicesResponse struct {state protoimpl.MessageState `protogen:"open.v1"`Self *Device `protobuf:"bytes,1,opt,name=self,proto3" json:"self,omitempty"`@@ -1450,7 +1854,7 @@ type ListDevicesResponse struct {func (x *ListDevicesResponse) Reset() {*x = ListDevicesResponse{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[15]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[20]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1462,7 +1866,7 @@ func (x *ListDevicesResponse) String() string {func (*ListDevicesResponse) ProtoMessage() {}func (x *ListDevicesResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[15]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[20]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1475,7 +1879,7 @@ func (x *ListDevicesResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListDevicesResponse.ProtoReflect.Descriptor instead.func (*ListDevicesResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{15}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{20}}func (x *ListDevicesResponse) GetSelf() *Device {@@ -1505,7 +1909,7 @@ type CreatePairingCodeResponse struct {func (x *CreatePairingCodeResponse) Reset() {*x = CreatePairingCodeResponse{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[16]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[21]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1517,7 +1921,7 @@ func (x *CreatePairingCodeResponse) String() string {func (*CreatePairingCodeResponse) ProtoMessage() {}func (x *CreatePairingCodeResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[16]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[21]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1530,7 +1934,7 @@ func (x *CreatePairingCodeResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use CreatePairingCodeResponse.ProtoReflect.Descriptor instead.func (*CreatePairingCodeResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{16}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{21}}func (x *CreatePairingCodeResponse) GetCode() string {@@ -1567,7 +1971,7 @@ type RedeemPairingCodeRequest struct {func (x *RedeemPairingCodeRequest) Reset() {*x = RedeemPairingCodeRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[17]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[22]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1579,7 +1983,7 @@ func (x *RedeemPairingCodeRequest) String() string {func (*RedeemPairingCodeRequest) ProtoMessage() {}func (x *RedeemPairingCodeRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[17]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[22]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1592,7 +1996,7 @@ func (x *RedeemPairingCodeRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use RedeemPairingCodeRequest.ProtoReflect.Descriptor instead.func (*RedeemPairingCodeRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{17}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{22}}func (x *RedeemPairingCodeRequest) GetCode() string {@@ -1620,7 +2024,7 @@ type RedeemPairingCodeResponse struct {func (x *RedeemPairingCodeResponse) Reset() {*x = RedeemPairingCodeResponse{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[18]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[23]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1632,7 +2036,7 @@ func (x *RedeemPairingCodeResponse) String() string {func (*RedeemPairingCodeResponse) ProtoMessage() {}func (x *RedeemPairingCodeResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[18]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[23]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1645,7 +2049,7 @@ func (x *RedeemPairingCodeResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use RedeemPairingCodeResponse.ProtoReflect.Descriptor instead.func (*RedeemPairingCodeResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{18}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{23}}func (x *RedeemPairingCodeResponse) GetPeer() *Device {@@ -1672,7 +2076,7 @@ type ConfirmPairingRequest struct {func (x *ConfirmPairingRequest) Reset() {*x = ConfirmPairingRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[19]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[24]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1684,7 +2088,7 @@ func (x *ConfirmPairingRequest) String() string {func (*ConfirmPairingRequest) ProtoMessage() {}func (x *ConfirmPairingRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[19]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[24]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1697,7 +2101,7 @@ func (x *ConfirmPairingRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ConfirmPairingRequest.ProtoReflect.Descriptor instead.func (*ConfirmPairingRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{19}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{24}}func (x *ConfirmPairingRequest) GetPairingSession() string {@@ -1727,7 +2131,7 @@ type NearbyDevice struct {func (x *NearbyDevice) Reset() {*x = NearbyDevice{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[20]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[25]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1739,7 +2143,7 @@ func (x *NearbyDevice) String() string {func (*NearbyDevice) ProtoMessage() {}func (x *NearbyDevice) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[20]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[25]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1752,7 +2156,7 @@ func (x *NearbyDevice) ProtoReflect() protoreflect.Message {// Deprecated: Use NearbyDevice.ProtoReflect.Descriptor instead.func (*NearbyDevice) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{20}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{25}}func (x *NearbyDevice) GetId() string {@@ -1792,7 +2196,7 @@ type NearbyDevices struct {func (x *NearbyDevices) Reset() {*x = NearbyDevices{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[21]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[26]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1804,7 +2208,7 @@ func (x *NearbyDevices) String() string {func (*NearbyDevices) ProtoMessage() {}func (x *NearbyDevices) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[21]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[26]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1817,7 +2221,7 @@ func (x *NearbyDevices) ProtoReflect() protoreflect.Message {// Deprecated: Use NearbyDevices.ProtoReflect.Descriptor instead.func (*NearbyDevices) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{21}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{26}}func (x *NearbyDevices) GetDevices() []*NearbyDevice {@@ -1836,7 +2240,7 @@ type PairNearbyRequest struct {func (x *PairNearbyRequest) Reset() {*x = PairNearbyRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[22]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[27]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1848,7 +2252,7 @@ func (x *PairNearbyRequest) String() string {func (*PairNearbyRequest) ProtoMessage() {}func (x *PairNearbyRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[22]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[27]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1861,7 +2265,7 @@ func (x *PairNearbyRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use PairNearbyRequest.ProtoReflect.Descriptor instead.func (*PairNearbyRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{22}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{27}}func (x *PairNearbyRequest) GetId() string {@@ -1880,7 +2284,7 @@ type UnpairRequest struct {func (x *UnpairRequest) Reset() {*x = UnpairRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[23]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[28]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1892,7 +2296,7 @@ func (x *UnpairRequest) String() string {func (*UnpairRequest) ProtoMessage() {}func (x *UnpairRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[23]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[28]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1905,7 +2309,7 @@ func (x *UnpairRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use UnpairRequest.ProtoReflect.Descriptor instead.func (*UnpairRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{23}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{28}}func (x *UnpairRequest) GetDeviceId() string {@@ -1925,7 +2329,7 @@ type SetDeviceAddressRequest struct {func (x *SetDeviceAddressRequest) Reset() {*x = SetDeviceAddressRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[24]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[29]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1937,7 +2341,7 @@ func (x *SetDeviceAddressRequest) String() string {func (*SetDeviceAddressRequest) ProtoMessage() {}func (x *SetDeviceAddressRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[24]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[29]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1950,7 +2354,7 @@ func (x *SetDeviceAddressRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use SetDeviceAddressRequest.ProtoReflect.Descriptor instead.func (*SetDeviceAddressRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{24}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{29}}func (x *SetDeviceAddressRequest) GetDeviceId() string {@@ -1999,13 +2403,20 @@ type Config struct {UpdateCheckDisabled bool `protobuf:"varint,18,opt,name=update_check_disabled,json=updateCheckDisabled,proto3" json:"update_check_disabled,omitempty"`// 用户选择跳过的版本,自动检查不再提示它;手动检查照常显示UpdateSkipVersion string `protobuf:"bytes,19,opt,name=update_skip_version,json=updateSkipVersion,proto3" json:"update_skip_version,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache+ // 关掉快捷粘贴窗口。写成反向的:旧配置没有这一项时就是开启+ QuickPasteDisabled bool `protobuf:"varint,20,opt,name=quick_paste_disabled,json=quickPasteDisabled,proto3" json:"quick_paste_disabled,omitempty"`+ // 快捷键,如 "alt+v"、"ctrl+alt+v",修饰键按 ctrl、alt、shift、meta 的顺序。+ // 空字符串表示默认:Mac 上 ⌥V,其他平台 Alt+V+ QuickPasteHotkey string `protobuf:"bytes,21,opt,name=quick_paste_hotkey,json=quickPasteHotkey,proto3" json:"quick_paste_hotkey,omitempty"`+ // 选中后只放进剪贴板,不模拟粘贴+ QuickPasteCopyOnly bool `protobuf:"varint,22,opt,name=quick_paste_copy_only,json=quickPasteCopyOnly,proto3" json:"quick_paste_copy_only,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}func (x *Config) Reset() {*x = Config{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[25]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[30]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2017,7 +2428,7 @@ func (x *Config) String() string {func (*Config) ProtoMessage() {}func (x *Config) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[25]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[30]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2030,7 +2441,7 @@ func (x *Config) ProtoReflect() protoreflect.Message {// Deprecated: Use Config.ProtoReflect.Descriptor instead.func (*Config) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{25}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{30}}func (x *Config) GetAutoSyncThresholdBytes() int64 {@@ -2166,6 +2577,27 @@ func (x *Config) GetUpdateSkipVersion() string {return ""}+func (x *Config) GetQuickPasteDisabled() bool {+ if x != nil {+ return x.QuickPasteDisabled+ }+ return false+}++func (x *Config) GetQuickPasteHotkey() string {+ if x != nil {+ return x.QuickPasteHotkey+ }+ return ""+}++func (x *Config) GetQuickPasteCopyOnly() bool {+ if x != nil {+ return x.QuickPasteCopyOnly+ }+ return false+}+type OfficialUsage struct {state protoimpl.MessageState `protogen:"open.v1"`Available bool `protobuf:"varint,1,opt,name=available,proto3" json:"available,omitempty"`@@ -2184,7 +2616,7 @@ type OfficialUsage struct {func (x *OfficialUsage) Reset() {*x = OfficialUsage{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[26]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[31]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2196,7 +2628,7 @@ func (x *OfficialUsage) String() string {func (*OfficialUsage) ProtoMessage() {}func (x *OfficialUsage) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[26]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[31]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2209,7 +2641,7 @@ func (x *OfficialUsage) ProtoReflect() protoreflect.Message {// Deprecated: Use OfficialUsage.ProtoReflect.Descriptor instead.func (*OfficialUsage) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{26}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{31}}func (x *OfficialUsage) GetAvailable() bool {@@ -2297,7 +2729,7 @@ type NetworkInfo struct {func (x *NetworkInfo) Reset() {*x = NetworkInfo{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[27]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[32]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2309,7 +2741,7 @@ func (x *NetworkInfo) String() string {func (*NetworkInfo) ProtoMessage() {}func (x *NetworkInfo) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[27]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[32]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2322,7 +2754,7 @@ func (x *NetworkInfo) ProtoReflect() protoreflect.Message {// Deprecated: Use NetworkInfo.ProtoReflect.Descriptor instead.func (*NetworkInfo) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{27}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{32}}func (x *NetworkInfo) GetLocalPort() int32 {@@ -2382,7 +2814,7 @@ type LanInfo struct {func (x *LanInfo) Reset() {*x = LanInfo{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[28]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[33]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2394,7 +2826,7 @@ func (x *LanInfo) String() string {func (*LanInfo) ProtoMessage() {}func (x *LanInfo) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[28]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[33]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2407,7 +2839,7 @@ func (x *LanInfo) ProtoReflect() protoreflect.Message {// Deprecated: Use LanInfo.ProtoReflect.Descriptor instead.func (*LanInfo) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{28}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{33}}func (x *LanInfo) GetEnabled() bool {@@ -2466,7 +2898,7 @@ type LanPeer struct {func (x *LanPeer) Reset() {*x = LanPeer{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[29]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[34]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2478,7 +2910,7 @@ func (x *LanPeer) String() string {func (*LanPeer) ProtoMessage() {}func (x *LanPeer) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[29]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[34]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2491,7 +2923,7 @@ func (x *LanPeer) ProtoReflect() protoreflect.Message {// Deprecated: Use LanPeer.ProtoReflect.Descriptor instead.func (*LanPeer) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{29}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{34}}func (x *LanPeer) GetDeviceId() string {@@ -2548,7 +2980,7 @@ type NetworkEgress struct {func (x *NetworkEgress) Reset() {*x = NetworkEgress{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[30]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[35]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2560,7 +2992,7 @@ func (x *NetworkEgress) String() string {func (*NetworkEgress) ProtoMessage() {}func (x *NetworkEgress) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[30]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[35]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2573,7 +3005,7 @@ func (x *NetworkEgress) ProtoReflect() protoreflect.Message {// Deprecated: Use NetworkEgress.ProtoReflect.Descriptor instead.func (*NetworkEgress) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{30}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{35}}func (x *NetworkEgress) GetAddress() string {@@ -2631,7 +3063,7 @@ type Status struct {func (x *Status) Reset() {*x = Status{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[31]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[36]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2643,7 +3075,7 @@ func (x *Status) String() string {func (*Status) ProtoMessage() {}func (x *Status) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[31]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[36]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2656,7 +3088,7 @@ func (x *Status) ProtoReflect() protoreflect.Message {// Deprecated: Use Status.ProtoReflect.Descriptor instead.func (*Status) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{31}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{36}}func (x *Status) GetDeviceId() string {@@ -2767,7 +3199,7 @@ type CheckForUpdateRequest struct {func (x *CheckForUpdateRequest) Reset() {*x = CheckForUpdateRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[32]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[37]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2779,7 +3211,7 @@ func (x *CheckForUpdateRequest) String() string {func (*CheckForUpdateRequest) ProtoMessage() {}func (x *CheckForUpdateRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[32]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[37]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2792,7 +3224,7 @@ func (x *CheckForUpdateRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use CheckForUpdateRequest.ProtoReflect.Descriptor instead.func (*CheckForUpdateRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{32}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{37}}func (x *CheckForUpdateRequest) GetLanguage() string {@@ -2814,7 +3246,7 @@ type UpdateRelease struct {func (x *UpdateRelease) Reset() {*x = UpdateRelease{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[33]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[38]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2826,7 +3258,7 @@ func (x *UpdateRelease) String() string {func (*UpdateRelease) ProtoMessage() {}func (x *UpdateRelease) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[33]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[38]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2839,7 +3271,7 @@ func (x *UpdateRelease) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateRelease.ProtoReflect.Descriptor instead.func (*UpdateRelease) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{33}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{38}}func (x *UpdateRelease) GetVersion() string {@@ -2894,7 +3326,7 @@ type UpdateInfo struct {func (x *UpdateInfo) Reset() {*x = UpdateInfo{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[34]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[39]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2906,7 +3338,7 @@ func (x *UpdateInfo) String() string {func (*UpdateInfo) ProtoMessage() {}func (x *UpdateInfo) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[34]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[39]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2919,7 +3351,7 @@ func (x *UpdateInfo) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateInfo.ProtoReflect.Descriptor instead.func (*UpdateInfo) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{34}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{39}}func (x *UpdateInfo) GetCurrentVersion() string {@@ -2994,7 +3426,7 @@ type DownloadUpdateRequest struct {func (x *DownloadUpdateRequest) Reset() {*x = DownloadUpdateRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[35]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[40]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3006,7 +3438,7 @@ func (x *DownloadUpdateRequest) String() string {func (*DownloadUpdateRequest) ProtoMessage() {}func (x *DownloadUpdateRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[35]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[40]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3019,7 +3451,7 @@ func (x *DownloadUpdateRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use DownloadUpdateRequest.ProtoReflect.Descriptor instead.func (*DownloadUpdateRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{35}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{40}}func (x *DownloadUpdateRequest) GetVersion() string {@@ -3041,7 +3473,7 @@ type UpdateProgress struct {func (x *UpdateProgress) Reset() {*x = UpdateProgress{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[36]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[41]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3053,7 +3485,7 @@ func (x *UpdateProgress) String() string {func (*UpdateProgress) ProtoMessage() {}func (x *UpdateProgress) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[36]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[41]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3066,7 +3498,7 @@ func (x *UpdateProgress) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateProgress.ProtoReflect.Descriptor instead.func (*UpdateProgress) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{36}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{41}}func (x *UpdateProgress) GetDownloaded() int64 {@@ -3101,7 +3533,7 @@ type InstallUpdateRequest struct {func (x *InstallUpdateRequest) Reset() {*x = InstallUpdateRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[37]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[42]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3113,7 +3545,7 @@ func (x *InstallUpdateRequest) String() string {func (*InstallUpdateRequest) ProtoMessage() {}func (x *InstallUpdateRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[37]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[42]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3126,7 +3558,7 @@ func (x *InstallUpdateRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use InstallUpdateRequest.ProtoReflect.Descriptor instead.func (*InstallUpdateRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{37}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{42}}func (x *InstallUpdateRequest) GetVersion() string {@@ -3156,7 +3588,7 @@ type UpdateResult struct {func (x *UpdateResult) Reset() {*x = UpdateResult{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[38]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[43]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3168,7 +3600,7 @@ func (x *UpdateResult) String() string {func (*UpdateResult) ProtoMessage() {}func (x *UpdateResult) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[38]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[43]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3181,7 +3613,7 @@ func (x *UpdateResult) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateResult.ProtoReflect.Descriptor instead.func (*UpdateResult) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{38}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{43}}func (x *UpdateResult) GetFromVersion() string {@@ -3229,7 +3661,7 @@ type ExportDiagnosticsRequest struct {func (x *ExportDiagnosticsRequest) Reset() {*x = ExportDiagnosticsRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[39]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[44]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3241,7 +3673,7 @@ func (x *ExportDiagnosticsRequest) String() string {func (*ExportDiagnosticsRequest) ProtoMessage() {}func (x *ExportDiagnosticsRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[39]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[44]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3254,7 +3686,7 @@ func (x *ExportDiagnosticsRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ExportDiagnosticsRequest.ProtoReflect.Descriptor instead.func (*ExportDiagnosticsRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{39}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{44}}func (x *ExportDiagnosticsRequest) GetLogLines() int32 {@@ -3280,7 +3712,7 @@ type Diagnostics struct {func (x *Diagnostics) Reset() {*x = Diagnostics{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[40]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[45]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3292,7 +3724,7 @@ func (x *Diagnostics) String() string {func (*Diagnostics) ProtoMessage() {}func (x *Diagnostics) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[40]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[45]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3305,7 +3737,7 @@ func (x *Diagnostics) ProtoReflect() protoreflect.Message {// Deprecated: Use Diagnostics.ProtoReflect.Descriptor instead.func (*Diagnostics) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{40}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{45}}func (x *Diagnostics) GetReport() string {@@ -3324,7 +3756,7 @@ type SetVerboseLogRequest struct {func (x *SetVerboseLogRequest) Reset() {*x = SetVerboseLogRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[41]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[46]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3336,7 +3768,7 @@ func (x *SetVerboseLogRequest) String() string {func (*SetVerboseLogRequest) ProtoMessage() {}func (x *SetVerboseLogRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[41]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[46]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3349,7 +3781,7 @@ func (x *SetVerboseLogRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use SetVerboseLogRequest.ProtoReflect.Descriptor instead.func (*SetVerboseLogRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{41}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{46}}func (x *SetVerboseLogRequest) GetMinutes() int32 {@@ -3369,7 +3801,7 @@ type GetImagePreviewRequest struct {func (x *GetImagePreviewRequest) Reset() {*x = GetImagePreviewRequest{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[42]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[47]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3381,7 +3813,7 @@ func (x *GetImagePreviewRequest) String() string {func (*GetImagePreviewRequest) ProtoMessage() {}func (x *GetImagePreviewRequest) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[42]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[47]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3394,7 +3826,7 @@ func (x *GetImagePreviewRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use GetImagePreviewRequest.ProtoReflect.Descriptor instead.func (*GetImagePreviewRequest) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{42}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{47}}func (x *GetImagePreviewRequest) GetClipId() string {@@ -3422,7 +3854,7 @@ type GetImagePreviewResponse struct {func (x *GetImagePreviewResponse) Reset() {*x = GetImagePreviewResponse{}- mi := &file_pasteferry_v1_daemon_proto_msgTypes[43]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[48]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3434,7 +3866,7 @@ func (x *GetImagePreviewResponse) String() string {func (*GetImagePreviewResponse) ProtoMessage() {}func (x *GetImagePreviewResponse) ProtoReflect() protoreflect.Message {- mi := &file_pasteferry_v1_daemon_proto_msgTypes[43]+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[48]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3447,7 +3879,7 @@ func (x *GetImagePreviewResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use GetImagePreviewResponse.ProtoReflect.Descriptor instead.func (*GetImagePreviewResponse) Descriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{43}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{48}}func (x *GetImagePreviewResponse) GetPath() string {@@ -3481,7 +3913,7 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" +"\x04size\x18\x02 \x01(\x03R\x04size\x12\x15\n" +"\x06is_dir\x18\x03 \x01(\bR\x05isDir\x12!\n" +- "\fcontent_type\x18\x04 \x01(\tR\vcontentType\"\xe8\x03\n" ++ "\fcontent_type\x18\x04 \x01(\tR\vcontentType\"\xe7\x04\n" +"\n" +"ClipRecord\x12\x0e\n" +"\x02id\x18\x01 \x01(\tR\x02id\x12+\n" +@@ -3499,7 +3931,11 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x0fexpires_at_unix\x18\v \x01(\x03R\rexpiresAtUnix\x12\x14\n" +"\x05error\x18\f \x01(\tR\x05error\x12\x1f\n" +"\vimage_count\x18\r \x01(\x05R\n" +- "imageCount\"1\n" ++ "imageCount\x12\x1a\n" ++ "\bfavorite\x18\x0e \x01(\bR\bfavorite\x12\x1c\n" ++ "\tfavorited\x18\x0f \x01(\bR\tfavorited\x12*\n" ++ "\x11favorited_at_unix\x18\x10 \x01(\x03R\x0ffavoritedAtUnix\x12\x17\n" ++ "\ais_link\x18\x11 \x01(\bR\x06isLink\"1\n" +"\x10SubscribeRequest\x12\x1d\n" +"\n" +"since_unix\x18\x01 \x01(\x03R\tsinceUnix\"\x8d\x01\n" +@@ -3518,7 +3954,7 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"connection\x124\n" +"\x16public_key_fingerprint\x18\x06 \x01(\tR\x14publicKeyFingerprint\x12$\n" +"\x0epaired_at_unix\x18\a \x01(\x03R\fpairedAtUnix\x12'\n" +- "\x0fpairing_session\x18\b \x01(\tR\x0epairingSession\"\x9b\x04\n" ++ "\x0fpairing_session\x18\b \x01(\tR\x0epairingSession\"\xae\x05\n" +"\x05Event\x12:\n" +"\n" +"clip_added\x18\x01 \x01(\v2\x19.pasteferry.v1.ClipRecordH\x00R\tclipAdded\x12>\n" +@@ -3528,7 +3964,10 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x0edevice_changed\x18\x05 \x01(\v2\x15.pasteferry.v1.DeviceH\x00R\rdeviceChanged\x12S\n" +"\x12permission_changed\x18\x06 \x01(\x0e2\".pasteferry.v1.ClipboardPermissionH\x00R\x11permissionChanged\x12>\n" +"\x0estatus_changed\x18\a \x01(\v2\x15.pasteferry.v1.StatusH\x00R\rstatusChanged\x12R\n" +- "\x11clipboard_written\x18\b \x01(\v2#.pasteferry.v1.ClipboardWriteResultH\x00R\x10clipboardWrittenB\t\n" ++ "\x11clipboard_written\x18\b \x01(\v2#.pasteferry.v1.ClipboardWriteResultH\x00R\x10clipboardWritten\x12>\n" ++ "\x0econfig_changed\x18\t \x01(\v2\x15.pasteferry.v1.ConfigH\x00R\rconfigChanged\x12Q\n" ++ "\x13quick_paste_changed\x18\n" ++ " \x01(\v2\x1f.pasteferry.v1.QuickPasteStatusH\x00R\x11quickPasteChangedB\t\n" +"\apayload\"\x7f\n" +"\x12NotificationStatus\x12\x1c\n" +"\tsupported\x18\x01 \x01(\bR\tsupported\x12+\n" +@@ -3542,14 +3981,17 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x14ClipboardWriteResult\x12\x17\n" +"\aclip_id\x18\x01 \x01(\tR\x06clipId\x12>\n" +"\aoutcome\x18\x02 \x01(\x0e2$.pasteferry.v1.ClipboardWriteOutcomeR\aoutcome\x12\x14\n" +- "\x05error\x18\x03 \x01(\tR\x05error\"\x9b\x01\n" ++ "\x05error\x18\x03 \x01(\tR\x05error\"\xd8\x01\n" +"\x12ListHistoryRequest\x12\x14\n" +"\x05limit\x18\x01 \x01(\x05R\x05limit\x12\x1f\n" +"\vbefore_unix\x18\x02 \x01(\x03R\n" +"beforeUnix\x128\n" +"\vkind_filter\x18\x03 \x01(\x0e2\x17.pasteferry.v1.ClipKindR\n" +"kindFilter\x12\x14\n" +- "\x05query\x18\x04 \x01(\tR\x05query\"f\n" ++ "\x05query\x18\x04 \x01(\tR\x05query\x12\x1c\n" ++ "\tfavorites\x18\x05 \x01(\bR\tfavorites\x12\x1d\n" ++ "\n" ++ "links_only\x18\x06 \x01(\bR\tlinksOnly\"f\n" +"\x13ListHistoryResponse\x123\n" +"\arecords\x18\x01 \x03(\v2\x19.pasteferry.v1.ClipRecordR\arecords\x12\x1a\n" +"\bsearched\x18\x02 \x01(\bR\bsearched\":\n" +@@ -3558,9 +4000,32 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x03all\x18\x02 \x01(\bR\x03all\"V\n" +"\fFetchRequest\x12\x17\n" +"\aclip_id\x18\x01 \x01(\tR\x06clipId\x12-\n" +- "\x12preserve_clipboard\x18\x02 \x01(\bR\x11preserveClipboard\"2\n" ++ "\x12preserve_clipboard\x18\x02 \x01(\bR\x11preserveClipboard\"Q\n" +"\x17ApplyToClipboardRequest\x12\x17\n" +- "\aclip_id\x18\x01 \x01(\tR\x06clipId\"m\n" ++ "\aclip_id\x18\x01 \x01(\tR\x06clipId\x12\x1d\n" ++ "\n" ++ "plain_text\x18\x02 \x01(\bR\tplainText\"I\n" ++ "\x12SetFavoriteRequest\x12\x17\n" ++ "\aclip_id\x18\x01 \x01(\tR\x06clipId\x12\x1a\n" ++ "\bfavorite\x18\x02 \x01(\bR\bfavorite\"/\n" ++ "\x14GetClipDetailRequest\x12\x17\n" ++ "\aclip_id\x18\x01 \x01(\tR\x06clipId\"d\n" ++ "\n" ++ "ClipDetail\x12\x12\n" ++ "\x04text\x18\x01 \x01(\tR\x04text\x12\x1f\n" ++ "\vtext_length\x18\x02 \x01(\x05R\n" ++ "textLength\x12!\n" ++ "\fsource_paths\x18\x03 \x03(\tR\vsourcePaths\"\x89\x02\n" ++ "\x10QuickPasteStatus\x12\x18\n" ++ "\arunning\x18\x01 \x01(\bR\arunning\x12!\n" ++ "\fhotkey_error\x18\x02 \x01(\tR\vhotkeyError\x12\x16\n" ++ "\x06hotkey\x18\x03 \x01(\tR\x06hotkey\x12'\n" ++ "\x0fpaste_available\x18\x04 \x01(\bR\x0epasteAvailable\x128\n" ++ "\x18paste_unavailable_reason\x18\x05 \x01(\tR\x16pasteUnavailableReason\x12#\n" ++ "\rhotkey_source\x18\x06 \x01(\tR\fhotkeySource\x12\x18\n" ++ "\aversion\x18\a \x01(\tR\aversion\"-\n" ++ "\x11QuickPasteCommand\x12\x18\n" ++ "\acommand\x18\x01 \x01(\tR\acommand\"m\n" +"\x13ListDevicesResponse\x12)\n" +"\x04self\x18\x01 \x01(\v2\x15.pasteferry.v1.DeviceR\x04self\x12+\n" +"\x05peers\x18\x02 \x03(\v2\x15.pasteferry.v1.DeviceR\x05peers\"|\n" +@@ -3590,7 +4055,7 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\tdevice_id\x18\x01 \x01(\tR\bdeviceId\"P\n" +"\x17SetDeviceAddressRequest\x12\x1b\n" +"\tdevice_id\x18\x01 \x01(\tR\bdeviceId\x12\x18\n" +- "\aaddress\x18\x02 \x01(\tR\aaddress\"\xa2\x06\n" ++ "\aaddress\x18\x02 \x01(\tR\aaddress\"\xb5\a\n" +"\x06Config\x129\n" +"\x19auto_sync_threshold_bytes\x18\x01 \x01(\x03R\x16autoSyncThresholdBytes\x12.\n" +"\x13history_ttl_seconds\x18\x02 \x01(\x03R\x11historyTtlSeconds\x12*\n" +@@ -3613,7 +4078,10 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x14custom_signaling_url\x18\x10 \x01(\tR\x12customSignalingUrl\x12.\n" +"\x13official_notice_ack\x18\x11 \x01(\tR\x11officialNoticeAck\x122\n" +"\x15update_check_disabled\x18\x12 \x01(\bR\x13updateCheckDisabled\x12.\n" +- "\x13update_skip_version\x18\x13 \x01(\tR\x11updateSkipVersion\"\xd8\x02\n" ++ "\x13update_skip_version\x18\x13 \x01(\tR\x11updateSkipVersion\x120\n" ++ "\x14quick_paste_disabled\x18\x14 \x01(\bR\x12quickPasteDisabled\x12,\n" ++ "\x12quick_paste_hotkey\x18\x15 \x01(\tR\x10quickPasteHotkey\x121\n" ++ "\x15quick_paste_copy_only\x18\x16 \x01(\bR\x12quickPasteCopyOnly\"\xd8\x02\n" +"\rOfficialUsage\x12\x1c\n" +"\tavailable\x18\x01 \x01(\bR\tavailable\x12\x10\n" +"\x03day\x18\x02 \x01(\tR\x03day\x12\x1f\n" +@@ -3764,7 +4232,7 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x18SERVICE_MODE_UNSPECIFIED\x10\x00\x12\x14\n" +"\x10SERVICE_MODE_LAN\x10\x01\x12\x19\n" +"\x15SERVICE_MODE_OFFICIAL\x10\x02\x12\x17\n" +- "\x13SERVICE_MODE_CUSTOM\x10\x032\x8f\x11\n" ++ "\x13SERVICE_MODE_CUSTOM\x10\x032\xa8\x14\n" +"\rDaemonService\x12D\n" +"\tSubscribe\x12\x1f.pasteferry.v1.SubscribeRequest\x1a\x14.pasteferry.v1.Event0\x01\x12T\n" +"\vListHistory\x12!.pasteferry.v1.ListHistoryRequest\x1a\".pasteferry.v1.ListHistoryResponse\x12J\n" +@@ -3795,7 +4263,12 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\rSetVerboseLog\x12#.pasteferry.v1.SetVerboseLogRequest\x1a\x15.pasteferry.v1.Status\x12Q\n" +"\x0eCheckForUpdate\x12$.pasteferry.v1.CheckForUpdateRequest\x1a\x19.pasteferry.v1.UpdateInfo\x12W\n" +"\x0eDownloadUpdate\x12$.pasteferry.v1.DownloadUpdateRequest\x1a\x1d.pasteferry.v1.UpdateProgress0\x01\x12J\n" +- "\rInstallUpdate\x12#.pasteferry.v1.InstallUpdateRequest\x1a\x14.pasteferry.v1.EmptyBDZBgithub.com/baiyuze/pasteferry/proto/gen/pasteferry/v1;pasteferryv1b\x06proto3"+ "\rInstallUpdate\x12#.pasteferry.v1.InstallUpdateRequest\x1a\x14.pasteferry.v1.Empty\x12K\n" ++ "\vSetFavorite\x12!.pasteferry.v1.SetFavoriteRequest\x1a\x19.pasteferry.v1.ClipRecord\x12O\n" ++ "\rGetClipDetail\x12#.pasteferry.v1.GetClipDetailRequest\x1a\x19.pasteferry.v1.ClipDetail\x12Z\n" ++ "\x11QuickPasteSession\x12\x1f.pasteferry.v1.QuickPasteStatus\x1a .pasteferry.v1.QuickPasteCommand(\x010\x01\x12L\n" ++ "\x13GetQuickPasteStatus\x12\x14.pasteferry.v1.Empty\x1a\x1f.pasteferry.v1.QuickPasteStatus\x12O\n" ++ "\x15SendQuickPasteCommand\x12 .pasteferry.v1.QuickPasteCommand\x1a\x14.pasteferry.v1.EmptyBDZBgithub.com/baiyuze/pasteferry/proto/gen/pasteferry/v1;pasteferryv1b\x06proto3"var (file_pasteferry_v1_daemon_proto_rawDescOnce sync.Once@@ -3810,7 +4283,7 @@ func file_pasteferry_v1_daemon_proto_rawDescGZIP() []byte {}var file_pasteferry_v1_daemon_proto_enumTypes = make([]protoimpl.EnumInfo, 6)-var file_pasteferry_v1_daemon_proto_msgTypes = make([]protoimpl.MessageInfo, 44)+var file_pasteferry_v1_daemon_proto_msgTypes = make([]protoimpl.MessageInfo, 49)var file_pasteferry_v1_daemon_proto_goTypes = []any{(ClipKind)(0), // 0: pasteferry.v1.ClipKind(ClipStatus)(0), // 1: pasteferry.v1.ClipStatus@@ -3833,35 +4306,40 @@ var file_pasteferry_v1_daemon_proto_goTypes = []any{(*DeleteHistoryRequest)(nil), // 18: pasteferry.v1.DeleteHistoryRequest(*FetchRequest)(nil), // 19: pasteferry.v1.FetchRequest(*ApplyToClipboardRequest)(nil), // 20: pasteferry.v1.ApplyToClipboardRequest- (*ListDevicesResponse)(nil), // 21: pasteferry.v1.ListDevicesResponse- (*CreatePairingCodeResponse)(nil), // 22: pasteferry.v1.CreatePairingCodeResponse- (*RedeemPairingCodeRequest)(nil), // 23: pasteferry.v1.RedeemPairingCodeRequest- (*RedeemPairingCodeResponse)(nil), // 24: pasteferry.v1.RedeemPairingCodeResponse- (*ConfirmPairingRequest)(nil), // 25: pasteferry.v1.ConfirmPairingRequest- (*NearbyDevice)(nil), // 26: pasteferry.v1.NearbyDevice- (*NearbyDevices)(nil), // 27: pasteferry.v1.NearbyDevices- (*PairNearbyRequest)(nil), // 28: pasteferry.v1.PairNearbyRequest- (*UnpairRequest)(nil), // 29: pasteferry.v1.UnpairRequest- (*SetDeviceAddressRequest)(nil), // 30: pasteferry.v1.SetDeviceAddressRequest- (*Config)(nil), // 31: pasteferry.v1.Config- (*OfficialUsage)(nil), // 32: pasteferry.v1.OfficialUsage- (*NetworkInfo)(nil), // 33: pasteferry.v1.NetworkInfo- (*LanInfo)(nil), // 34: pasteferry.v1.LanInfo- (*LanPeer)(nil), // 35: pasteferry.v1.LanPeer- (*NetworkEgress)(nil), // 36: pasteferry.v1.NetworkEgress- (*Status)(nil), // 37: pasteferry.v1.Status- (*CheckForUpdateRequest)(nil), // 38: pasteferry.v1.CheckForUpdateRequest- (*UpdateRelease)(nil), // 39: pasteferry.v1.UpdateRelease- (*UpdateInfo)(nil), // 40: pasteferry.v1.UpdateInfo- (*DownloadUpdateRequest)(nil), // 41: pasteferry.v1.DownloadUpdateRequest- (*UpdateProgress)(nil), // 42: pasteferry.v1.UpdateProgress- (*InstallUpdateRequest)(nil), // 43: pasteferry.v1.InstallUpdateRequest- (*UpdateResult)(nil), // 44: pasteferry.v1.UpdateResult- (*ExportDiagnosticsRequest)(nil), // 45: pasteferry.v1.ExportDiagnosticsRequest- (*Diagnostics)(nil), // 46: pasteferry.v1.Diagnostics- (*SetVerboseLogRequest)(nil), // 47: pasteferry.v1.SetVerboseLogRequest- (*GetImagePreviewRequest)(nil), // 48: pasteferry.v1.GetImagePreviewRequest- (*GetImagePreviewResponse)(nil), // 49: pasteferry.v1.GetImagePreviewResponse+ (*SetFavoriteRequest)(nil), // 21: pasteferry.v1.SetFavoriteRequest+ (*GetClipDetailRequest)(nil), // 22: pasteferry.v1.GetClipDetailRequest+ (*ClipDetail)(nil), // 23: pasteferry.v1.ClipDetail+ (*QuickPasteStatus)(nil), // 24: pasteferry.v1.QuickPasteStatus+ (*QuickPasteCommand)(nil), // 25: pasteferry.v1.QuickPasteCommand+ (*ListDevicesResponse)(nil), // 26: pasteferry.v1.ListDevicesResponse+ (*CreatePairingCodeResponse)(nil), // 27: pasteferry.v1.CreatePairingCodeResponse+ (*RedeemPairingCodeRequest)(nil), // 28: pasteferry.v1.RedeemPairingCodeRequest+ (*RedeemPairingCodeResponse)(nil), // 29: pasteferry.v1.RedeemPairingCodeResponse+ (*ConfirmPairingRequest)(nil), // 30: pasteferry.v1.ConfirmPairingRequest+ (*NearbyDevice)(nil), // 31: pasteferry.v1.NearbyDevice+ (*NearbyDevices)(nil), // 32: pasteferry.v1.NearbyDevices+ (*PairNearbyRequest)(nil), // 33: pasteferry.v1.PairNearbyRequest+ (*UnpairRequest)(nil), // 34: pasteferry.v1.UnpairRequest+ (*SetDeviceAddressRequest)(nil), // 35: pasteferry.v1.SetDeviceAddressRequest+ (*Config)(nil), // 36: pasteferry.v1.Config+ (*OfficialUsage)(nil), // 37: pasteferry.v1.OfficialUsage+ (*NetworkInfo)(nil), // 38: pasteferry.v1.NetworkInfo+ (*LanInfo)(nil), // 39: pasteferry.v1.LanInfo+ (*LanPeer)(nil), // 40: pasteferry.v1.LanPeer+ (*NetworkEgress)(nil), // 41: pasteferry.v1.NetworkEgress+ (*Status)(nil), // 42: pasteferry.v1.Status+ (*CheckForUpdateRequest)(nil), // 43: pasteferry.v1.CheckForUpdateRequest+ (*UpdateRelease)(nil), // 44: pasteferry.v1.UpdateRelease+ (*UpdateInfo)(nil), // 45: pasteferry.v1.UpdateInfo+ (*DownloadUpdateRequest)(nil), // 46: pasteferry.v1.DownloadUpdateRequest+ (*UpdateProgress)(nil), // 47: pasteferry.v1.UpdateProgress+ (*InstallUpdateRequest)(nil), // 48: pasteferry.v1.InstallUpdateRequest+ (*UpdateResult)(nil), // 49: pasteferry.v1.UpdateResult+ (*ExportDiagnosticsRequest)(nil), // 50: pasteferry.v1.ExportDiagnosticsRequest+ (*Diagnostics)(nil), // 51: pasteferry.v1.Diagnostics+ (*SetVerboseLogRequest)(nil), // 52: pasteferry.v1.SetVerboseLogRequest+ (*GetImagePreviewRequest)(nil), // 53: pasteferry.v1.GetImagePreviewRequest+ (*GetImagePreviewResponse)(nil), // 54: pasteferry.v1.GetImagePreviewResponse}var file_pasteferry_v1_daemon_proto_depIdxs = []int32{0, // 0: pasteferry.v1.ClipRecord.kind:type_name -> pasteferry.v1.ClipKind@@ -3873,84 +4351,96 @@ var file_pasteferry_v1_daemon_proto_depIdxs = []int32{10, // 6: pasteferry.v1.Event.progress:type_name -> pasteferry.v1.TransferProgress11, // 7: pasteferry.v1.Event.device_changed:type_name -> pasteferry.v1.Device3, // 8: pasteferry.v1.Event.permission_changed:type_name -> pasteferry.v1.ClipboardPermission- 37, // 9: pasteferry.v1.Event.status_changed:type_name -> pasteferry.v1.Status+ 42, // 9: pasteferry.v1.Event.status_changed:type_name -> pasteferry.v1.Status15, // 10: pasteferry.v1.Event.clipboard_written:type_name -> pasteferry.v1.ClipboardWriteResult- 4, // 11: pasteferry.v1.ClipboardWriteResult.outcome:type_name -> pasteferry.v1.ClipboardWriteOutcome- 0, // 12: pasteferry.v1.ListHistoryRequest.kind_filter:type_name -> pasteferry.v1.ClipKind- 8, // 13: pasteferry.v1.ListHistoryResponse.records:type_name -> pasteferry.v1.ClipRecord- 11, // 14: pasteferry.v1.ListDevicesResponse.self:type_name -> pasteferry.v1.Device- 11, // 15: pasteferry.v1.ListDevicesResponse.peers:type_name -> pasteferry.v1.Device- 11, // 16: pasteferry.v1.RedeemPairingCodeResponse.peer:type_name -> pasteferry.v1.Device- 26, // 17: pasteferry.v1.NearbyDevices.devices:type_name -> pasteferry.v1.NearbyDevice- 5, // 18: pasteferry.v1.Config.service_mode:type_name -> pasteferry.v1.ServiceMode- 36, // 19: pasteferry.v1.NetworkInfo.egresses:type_name -> pasteferry.v1.NetworkEgress- 34, // 20: pasteferry.v1.NetworkInfo.lan:type_name -> pasteferry.v1.LanInfo- 35, // 21: pasteferry.v1.LanInfo.peers:type_name -> pasteferry.v1.LanPeer- 3, // 22: pasteferry.v1.Status.clipboard_permission:type_name -> pasteferry.v1.ClipboardPermission- 32, // 23: pasteferry.v1.Status.official_usage:type_name -> pasteferry.v1.OfficialUsage- 44, // 24: pasteferry.v1.Status.last_update:type_name -> pasteferry.v1.UpdateResult- 39, // 25: pasteferry.v1.UpdateInfo.releases:type_name -> pasteferry.v1.UpdateRelease- 9, // 26: pasteferry.v1.DaemonService.Subscribe:input_type -> pasteferry.v1.SubscribeRequest- 16, // 27: pasteferry.v1.DaemonService.ListHistory:input_type -> pasteferry.v1.ListHistoryRequest- 18, // 28: pasteferry.v1.DaemonService.DeleteHistory:input_type -> pasteferry.v1.DeleteHistoryRequest- 19, // 29: pasteferry.v1.DaemonService.Fetch:input_type -> pasteferry.v1.FetchRequest- 20, // 30: pasteferry.v1.DaemonService.ApplyToClipboard:input_type -> pasteferry.v1.ApplyToClipboardRequest- 48, // 31: pasteferry.v1.DaemonService.GetImagePreview:input_type -> pasteferry.v1.GetImagePreviewRequest- 6, // 32: pasteferry.v1.DaemonService.ListDevices:input_type -> pasteferry.v1.Empty- 6, // 33: pasteferry.v1.DaemonService.CreatePairingCode:input_type -> pasteferry.v1.Empty- 23, // 34: pasteferry.v1.DaemonService.RedeemPairingCode:input_type -> pasteferry.v1.RedeemPairingCodeRequest- 25, // 35: pasteferry.v1.DaemonService.ConfirmPairing:input_type -> pasteferry.v1.ConfirmPairingRequest- 29, // 36: pasteferry.v1.DaemonService.Unpair:input_type -> pasteferry.v1.UnpairRequest- 30, // 37: pasteferry.v1.DaemonService.SetDeviceAddress:input_type -> pasteferry.v1.SetDeviceAddressRequest- 6, // 38: pasteferry.v1.DaemonService.WatchNearby:input_type -> pasteferry.v1.Empty- 28, // 39: pasteferry.v1.DaemonService.PairNearby:input_type -> pasteferry.v1.PairNearbyRequest- 6, // 40: pasteferry.v1.DaemonService.GetConfig:input_type -> pasteferry.v1.Empty- 31, // 41: pasteferry.v1.DaemonService.UpdateConfig:input_type -> pasteferry.v1.Config- 6, // 42: pasteferry.v1.DaemonService.GetStatus:input_type -> pasteferry.v1.Empty- 6, // 43: pasteferry.v1.DaemonService.RequestClipboardPermission:input_type -> pasteferry.v1.Empty- 6, // 44: pasteferry.v1.DaemonService.RequestLocalNetworkPermission:input_type -> pasteferry.v1.Empty- 6, // 45: pasteferry.v1.DaemonService.GetNotificationStatus:input_type -> pasteferry.v1.Empty- 6, // 46: pasteferry.v1.DaemonService.RequestNotificationPermission:input_type -> pasteferry.v1.Empty- 14, // 47: pasteferry.v1.DaemonService.ActivateNotification:input_type -> pasteferry.v1.NotificationAction- 6, // 48: pasteferry.v1.DaemonService.GetNetwork:input_type -> pasteferry.v1.Empty- 45, // 49: pasteferry.v1.DaemonService.ExportDiagnostics:input_type -> pasteferry.v1.ExportDiagnosticsRequest- 47, // 50: pasteferry.v1.DaemonService.SetVerboseLog:input_type -> pasteferry.v1.SetVerboseLogRequest- 38, // 51: pasteferry.v1.DaemonService.CheckForUpdate:input_type -> pasteferry.v1.CheckForUpdateRequest- 41, // 52: pasteferry.v1.DaemonService.DownloadUpdate:input_type -> pasteferry.v1.DownloadUpdateRequest- 43, // 53: pasteferry.v1.DaemonService.InstallUpdate:input_type -> pasteferry.v1.InstallUpdateRequest- 12, // 54: pasteferry.v1.DaemonService.Subscribe:output_type -> pasteferry.v1.Event- 17, // 55: pasteferry.v1.DaemonService.ListHistory:output_type -> pasteferry.v1.ListHistoryResponse- 6, // 56: pasteferry.v1.DaemonService.DeleteHistory:output_type -> pasteferry.v1.Empty- 6, // 57: pasteferry.v1.DaemonService.Fetch:output_type -> pasteferry.v1.Empty- 6, // 58: pasteferry.v1.DaemonService.ApplyToClipboard:output_type -> pasteferry.v1.Empty- 49, // 59: pasteferry.v1.DaemonService.GetImagePreview:output_type -> pasteferry.v1.GetImagePreviewResponse- 21, // 60: pasteferry.v1.DaemonService.ListDevices:output_type -> pasteferry.v1.ListDevicesResponse- 22, // 61: pasteferry.v1.DaemonService.CreatePairingCode:output_type -> pasteferry.v1.CreatePairingCodeResponse- 24, // 62: pasteferry.v1.DaemonService.RedeemPairingCode:output_type -> pasteferry.v1.RedeemPairingCodeResponse- 6, // 63: pasteferry.v1.DaemonService.ConfirmPairing:output_type -> pasteferry.v1.Empty- 6, // 64: pasteferry.v1.DaemonService.Unpair:output_type -> pasteferry.v1.Empty- 6, // 65: pasteferry.v1.DaemonService.SetDeviceAddress:output_type -> pasteferry.v1.Empty- 27, // 66: pasteferry.v1.DaemonService.WatchNearby:output_type -> pasteferry.v1.NearbyDevices- 24, // 67: pasteferry.v1.DaemonService.PairNearby:output_type -> pasteferry.v1.RedeemPairingCodeResponse- 31, // 68: pasteferry.v1.DaemonService.GetConfig:output_type -> pasteferry.v1.Config- 31, // 69: pasteferry.v1.DaemonService.UpdateConfig:output_type -> pasteferry.v1.Config- 37, // 70: pasteferry.v1.DaemonService.GetStatus:output_type -> pasteferry.v1.Status- 6, // 71: pasteferry.v1.DaemonService.RequestClipboardPermission:output_type -> pasteferry.v1.Empty- 6, // 72: pasteferry.v1.DaemonService.RequestLocalNetworkPermission:output_type -> pasteferry.v1.Empty- 13, // 73: pasteferry.v1.DaemonService.GetNotificationStatus:output_type -> pasteferry.v1.NotificationStatus- 13, // 74: pasteferry.v1.DaemonService.RequestNotificationPermission:output_type -> pasteferry.v1.NotificationStatus- 6, // 75: pasteferry.v1.DaemonService.ActivateNotification:output_type -> pasteferry.v1.Empty- 33, // 76: pasteferry.v1.DaemonService.GetNetwork:output_type -> pasteferry.v1.NetworkInfo- 46, // 77: pasteferry.v1.DaemonService.ExportDiagnostics:output_type -> pasteferry.v1.Diagnostics- 37, // 78: pasteferry.v1.DaemonService.SetVerboseLog:output_type -> pasteferry.v1.Status- 40, // 79: pasteferry.v1.DaemonService.CheckForUpdate:output_type -> pasteferry.v1.UpdateInfo- 42, // 80: pasteferry.v1.DaemonService.DownloadUpdate:output_type -> pasteferry.v1.UpdateProgress- 6, // 81: pasteferry.v1.DaemonService.InstallUpdate:output_type -> pasteferry.v1.Empty- 54, // [54:82] is the sub-list for method output_type- 26, // [26:54] is the sub-list for method input_type- 26, // [26:26] is the sub-list for extension type_name- 26, // [26:26] is the sub-list for extension extendee- 0, // [0:26] is the sub-list for field type_name+ 36, // 11: pasteferry.v1.Event.config_changed:type_name -> pasteferry.v1.Config+ 24, // 12: pasteferry.v1.Event.quick_paste_changed:type_name -> pasteferry.v1.QuickPasteStatus+ 4, // 13: pasteferry.v1.ClipboardWriteResult.outcome:type_name -> pasteferry.v1.ClipboardWriteOutcome+ 0, // 14: pasteferry.v1.ListHistoryRequest.kind_filter:type_name -> pasteferry.v1.ClipKind+ 8, // 15: pasteferry.v1.ListHistoryResponse.records:type_name -> pasteferry.v1.ClipRecord+ 11, // 16: pasteferry.v1.ListDevicesResponse.self:type_name -> pasteferry.v1.Device+ 11, // 17: pasteferry.v1.ListDevicesResponse.peers:type_name -> pasteferry.v1.Device+ 11, // 18: pasteferry.v1.RedeemPairingCodeResponse.peer:type_name -> pasteferry.v1.Device+ 31, // 19: pasteferry.v1.NearbyDevices.devices:type_name -> pasteferry.v1.NearbyDevice+ 5, // 20: pasteferry.v1.Config.service_mode:type_name -> pasteferry.v1.ServiceMode+ 41, // 21: pasteferry.v1.NetworkInfo.egresses:type_name -> pasteferry.v1.NetworkEgress+ 39, // 22: pasteferry.v1.NetworkInfo.lan:type_name -> pasteferry.v1.LanInfo+ 40, // 23: pasteferry.v1.LanInfo.peers:type_name -> pasteferry.v1.LanPeer+ 3, // 24: pasteferry.v1.Status.clipboard_permission:type_name -> pasteferry.v1.ClipboardPermission+ 37, // 25: pasteferry.v1.Status.official_usage:type_name -> pasteferry.v1.OfficialUsage+ 49, // 26: pasteferry.v1.Status.last_update:type_name -> pasteferry.v1.UpdateResult+ 44, // 27: pasteferry.v1.UpdateInfo.releases:type_name -> pasteferry.v1.UpdateRelease+ 9, // 28: pasteferry.v1.DaemonService.Subscribe:input_type -> pasteferry.v1.SubscribeRequest+ 16, // 29: pasteferry.v1.DaemonService.ListHistory:input_type -> pasteferry.v1.ListHistoryRequest+ 18, // 30: pasteferry.v1.DaemonService.DeleteHistory:input_type -> pasteferry.v1.DeleteHistoryRequest+ 19, // 31: pasteferry.v1.DaemonService.Fetch:input_type -> pasteferry.v1.FetchRequest+ 20, // 32: pasteferry.v1.DaemonService.ApplyToClipboard:input_type -> pasteferry.v1.ApplyToClipboardRequest+ 53, // 33: pasteferry.v1.DaemonService.GetImagePreview:input_type -> pasteferry.v1.GetImagePreviewRequest+ 6, // 34: pasteferry.v1.DaemonService.ListDevices:input_type -> pasteferry.v1.Empty+ 6, // 35: pasteferry.v1.DaemonService.CreatePairingCode:input_type -> pasteferry.v1.Empty+ 28, // 36: pasteferry.v1.DaemonService.RedeemPairingCode:input_type -> pasteferry.v1.RedeemPairingCodeRequest+ 30, // 37: pasteferry.v1.DaemonService.ConfirmPairing:input_type -> pasteferry.v1.ConfirmPairingRequest+ 34, // 38: pasteferry.v1.DaemonService.Unpair:input_type -> pasteferry.v1.UnpairRequest+ 35, // 39: pasteferry.v1.DaemonService.SetDeviceAddress:input_type -> pasteferry.v1.SetDeviceAddressRequest+ 6, // 40: pasteferry.v1.DaemonService.WatchNearby:input_type -> pasteferry.v1.Empty+ 33, // 41: pasteferry.v1.DaemonService.PairNearby:input_type -> pasteferry.v1.PairNearbyRequest+ 6, // 42: pasteferry.v1.DaemonService.GetConfig:input_type -> pasteferry.v1.Empty+ 36, // 43: pasteferry.v1.DaemonService.UpdateConfig:input_type -> pasteferry.v1.Config+ 6, // 44: pasteferry.v1.DaemonService.GetStatus:input_type -> pasteferry.v1.Empty+ 6, // 45: pasteferry.v1.DaemonService.RequestClipboardPermission:input_type -> pasteferry.v1.Empty+ 6, // 46: pasteferry.v1.DaemonService.RequestLocalNetworkPermission:input_type -> pasteferry.v1.Empty+ 6, // 47: pasteferry.v1.DaemonService.GetNotificationStatus:input_type -> pasteferry.v1.Empty+ 6, // 48: pasteferry.v1.DaemonService.RequestNotificationPermission:input_type -> pasteferry.v1.Empty+ 14, // 49: pasteferry.v1.DaemonService.ActivateNotification:input_type -> pasteferry.v1.NotificationAction+ 6, // 50: pasteferry.v1.DaemonService.GetNetwork:input_type -> pasteferry.v1.Empty+ 50, // 51: pasteferry.v1.DaemonService.ExportDiagnostics:input_type -> pasteferry.v1.ExportDiagnosticsRequest+ 52, // 52: pasteferry.v1.DaemonService.SetVerboseLog:input_type -> pasteferry.v1.SetVerboseLogRequest+ 43, // 53: pasteferry.v1.DaemonService.CheckForUpdate:input_type -> pasteferry.v1.CheckForUpdateRequest+ 46, // 54: pasteferry.v1.DaemonService.DownloadUpdate:input_type -> pasteferry.v1.DownloadUpdateRequest+ 48, // 55: pasteferry.v1.DaemonService.InstallUpdate:input_type -> pasteferry.v1.InstallUpdateRequest+ 21, // 56: pasteferry.v1.DaemonService.SetFavorite:input_type -> pasteferry.v1.SetFavoriteRequest+ 22, // 57: pasteferry.v1.DaemonService.GetClipDetail:input_type -> pasteferry.v1.GetClipDetailRequest+ 24, // 58: pasteferry.v1.DaemonService.QuickPasteSession:input_type -> pasteferry.v1.QuickPasteStatus+ 6, // 59: pasteferry.v1.DaemonService.GetQuickPasteStatus:input_type -> pasteferry.v1.Empty+ 25, // 60: pasteferry.v1.DaemonService.SendQuickPasteCommand:input_type -> pasteferry.v1.QuickPasteCommand+ 12, // 61: pasteferry.v1.DaemonService.Subscribe:output_type -> pasteferry.v1.Event+ 17, // 62: pasteferry.v1.DaemonService.ListHistory:output_type -> pasteferry.v1.ListHistoryResponse+ 6, // 63: pasteferry.v1.DaemonService.DeleteHistory:output_type -> pasteferry.v1.Empty+ 6, // 64: pasteferry.v1.DaemonService.Fetch:output_type -> pasteferry.v1.Empty+ 6, // 65: pasteferry.v1.DaemonService.ApplyToClipboard:output_type -> pasteferry.v1.Empty+ 54, // 66: pasteferry.v1.DaemonService.GetImagePreview:output_type -> pasteferry.v1.GetImagePreviewResponse+ 26, // 67: pasteferry.v1.DaemonService.ListDevices:output_type -> pasteferry.v1.ListDevicesResponse+ 27, // 68: pasteferry.v1.DaemonService.CreatePairingCode:output_type -> pasteferry.v1.CreatePairingCodeResponse+ 29, // 69: pasteferry.v1.DaemonService.RedeemPairingCode:output_type -> pasteferry.v1.RedeemPairingCodeResponse+ 6, // 70: pasteferry.v1.DaemonService.ConfirmPairing:output_type -> pasteferry.v1.Empty+ 6, // 71: pasteferry.v1.DaemonService.Unpair:output_type -> pasteferry.v1.Empty+ 6, // 72: pasteferry.v1.DaemonService.SetDeviceAddress:output_type -> pasteferry.v1.Empty+ 32, // 73: pasteferry.v1.DaemonService.WatchNearby:output_type -> pasteferry.v1.NearbyDevices+ 29, // 74: pasteferry.v1.DaemonService.PairNearby:output_type -> pasteferry.v1.RedeemPairingCodeResponse+ 36, // 75: pasteferry.v1.DaemonService.GetConfig:output_type -> pasteferry.v1.Config+ 36, // 76: pasteferry.v1.DaemonService.UpdateConfig:output_type -> pasteferry.v1.Config+ 42, // 77: pasteferry.v1.DaemonService.GetStatus:output_type -> pasteferry.v1.Status+ 6, // 78: pasteferry.v1.DaemonService.RequestClipboardPermission:output_type -> pasteferry.v1.Empty+ 6, // 79: pasteferry.v1.DaemonService.RequestLocalNetworkPermission:output_type -> pasteferry.v1.Empty+ 13, // 80: pasteferry.v1.DaemonService.GetNotificationStatus:output_type -> pasteferry.v1.NotificationStatus+ 13, // 81: pasteferry.v1.DaemonService.RequestNotificationPermission:output_type -> pasteferry.v1.NotificationStatus+ 6, // 82: pasteferry.v1.DaemonService.ActivateNotification:output_type -> pasteferry.v1.Empty+ 38, // 83: pasteferry.v1.DaemonService.GetNetwork:output_type -> pasteferry.v1.NetworkInfo+ 51, // 84: pasteferry.v1.DaemonService.ExportDiagnostics:output_type -> pasteferry.v1.Diagnostics+ 42, // 85: pasteferry.v1.DaemonService.SetVerboseLog:output_type -> pasteferry.v1.Status+ 45, // 86: pasteferry.v1.DaemonService.CheckForUpdate:output_type -> pasteferry.v1.UpdateInfo+ 47, // 87: pasteferry.v1.DaemonService.DownloadUpdate:output_type -> pasteferry.v1.UpdateProgress+ 6, // 88: pasteferry.v1.DaemonService.InstallUpdate:output_type -> pasteferry.v1.Empty+ 8, // 89: pasteferry.v1.DaemonService.SetFavorite:output_type -> pasteferry.v1.ClipRecord+ 23, // 90: pasteferry.v1.DaemonService.GetClipDetail:output_type -> pasteferry.v1.ClipDetail+ 25, // 91: pasteferry.v1.DaemonService.QuickPasteSession:output_type -> pasteferry.v1.QuickPasteCommand+ 24, // 92: pasteferry.v1.DaemonService.GetQuickPasteStatus:output_type -> pasteferry.v1.QuickPasteStatus+ 6, // 93: pasteferry.v1.DaemonService.SendQuickPasteCommand:output_type -> pasteferry.v1.Empty+ 61, // [61:94] is the sub-list for method output_type+ 28, // [28:61] is the sub-list for method input_type+ 28, // [28:28] is the sub-list for extension type_name+ 28, // [28:28] is the sub-list for extension extendee+ 0, // [0:28] is the sub-list for field type_name}func init() { file_pasteferry_v1_daemon_proto_init() }@@ -3967,6 +4457,8 @@ func file_pasteferry_v1_daemon_proto_init() {(*Event_PermissionChanged)(nil),(*Event_StatusChanged)(nil),(*Event_ClipboardWritten)(nil),+ (*Event_ConfigChanged)(nil),+ (*Event_QuickPasteChanged)(nil),}type x struct{}out := protoimpl.TypeBuilder{@@ -3974,7 +4466,7 @@ func file_pasteferry_v1_daemon_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_pasteferry_v1_daemon_proto_rawDesc), len(file_pasteferry_v1_daemon_proto_rawDesc)),NumEnums: 6,- NumMessages: 44,+ NumMessages: 49,NumExtensions: 0,NumServices: 1,},diff --git a/proto/gen/pasteferry/v1/daemon_grpc.pb.go b/proto/gen/pasteferry/v1/daemon_grpc.pb.goindex 3fecc4a..f432c37 100644--- a/proto/gen/pasteferry/v1/daemon_grpc.pb.go+++ b/proto/gen/pasteferry/v1/daemon_grpc.pb.go@@ -52,6 +52,11 @@ const (DaemonService_CheckForUpdate_FullMethodName = "/pasteferry.v1.DaemonService/CheckForUpdate"DaemonService_DownloadUpdate_FullMethodName = "/pasteferry.v1.DaemonService/DownloadUpdate"DaemonService_InstallUpdate_FullMethodName = "/pasteferry.v1.DaemonService/InstallUpdate"+ DaemonService_SetFavorite_FullMethodName = "/pasteferry.v1.DaemonService/SetFavorite"+ DaemonService_GetClipDetail_FullMethodName = "/pasteferry.v1.DaemonService/GetClipDetail"+ DaemonService_QuickPasteSession_FullMethodName = "/pasteferry.v1.DaemonService/QuickPasteSession"+ DaemonService_GetQuickPasteStatus_FullMethodName = "/pasteferry.v1.DaemonService/GetQuickPasteStatus"+ DaemonService_SendQuickPasteCommand_FullMethodName = "/pasteferry.v1.DaemonService/SendQuickPasteCommand")// DaemonServiceClient is the client API for DaemonService service.@@ -106,6 +111,19 @@ type DaemonServiceClient interface {DownloadUpdate(ctx context.Context, in *DownloadUpdateRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[UpdateProgress], error)// 准备好新版本并启动更新助手。返回后界面应当立即退出:助手等它退出后替换文件,再重新打开InstallUpdate(ctx context.Context, in *InstallUpdateRequest, opts ...grpc.CallOption) (*Empty, error)+ // 收藏或取消收藏,见 design/quick-paste-and-favorites.md 第 3 节。+ // 收藏时另存一份,返回新的收藏记录;取消时把收藏放回复制记录的最上面,返回放回去的那一条。+ // 过程中照常推送 clip_added / clip_removed。已过期或已失败的图片、文件返回 FAILED_PRECONDITION+ SetFavorite(ctx context.Context, in *SetFavoriteRequest, opts ...grpc.CallOption) (*ClipRecord, error)+ // 悬停提示框要显示的完整内容。ClipRecord 的 text_preview 最多 120 个字、换行被压平,不够用+ GetClipDetail(ctx context.Context, in *GetClipDetailRequest, opts ...grpc.CallOption) (*ClipDetail, error)+ // 快捷粘贴窗口进程启动后一直保持这个调用:往上报自己的状态,往下收设置页发来的命令。+ // 调用断开就当作快捷窗口没在运行+ QuickPasteSession(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[QuickPasteStatus, QuickPasteCommand], error)+ // 设置页读快捷窗口的状态;状态变化时另有 quick_paste_changed 事件+ GetQuickPasteStatus(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*QuickPasteStatus, error)+ // 设置页转给快捷窗口的命令。快捷窗口没在运行时返回 FAILED_PRECONDITION+ SendQuickPasteCommand(ctx context.Context, in *QuickPasteCommand, opts ...grpc.CallOption) (*Empty, error)}type daemonServiceClient struct {@@ -423,6 +441,59 @@ func (c *daemonServiceClient) InstallUpdate(ctx context.Context, in *InstallUpdareturn out, nil}+func (c *daemonServiceClient) SetFavorite(ctx context.Context, in *SetFavoriteRequest, opts ...grpc.CallOption) (*ClipRecord, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(ClipRecord)+ err := c.cc.Invoke(ctx, DaemonService_SetFavorite_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) GetClipDetail(ctx context.Context, in *GetClipDetailRequest, opts ...grpc.CallOption) (*ClipDetail, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(ClipDetail)+ err := c.cc.Invoke(ctx, DaemonService_GetClipDetail_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) QuickPasteSession(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[QuickPasteStatus, QuickPasteCommand], error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ stream, err := c.cc.NewStream(ctx, &DaemonService_ServiceDesc.Streams[3], DaemonService_QuickPasteSession_FullMethodName, cOpts...)+ if err != nil {+ return nil, err+ }+ x := &grpc.GenericClientStream[QuickPasteStatus, QuickPasteCommand]{ClientStream: stream}+ return x, nil+}++// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.+type DaemonService_QuickPasteSessionClient = grpc.BidiStreamingClient[QuickPasteStatus, QuickPasteCommand]++func (c *daemonServiceClient) GetQuickPasteStatus(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*QuickPasteStatus, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(QuickPasteStatus)+ err := c.cc.Invoke(ctx, DaemonService_GetQuickPasteStatus_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) SendQuickPasteCommand(ctx context.Context, in *QuickPasteCommand, opts ...grpc.CallOption) (*Empty, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Empty)+ err := c.cc.Invoke(ctx, DaemonService_SendQuickPasteCommand_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}+// DaemonServiceServer is the server API for DaemonService service.// All implementations must embed UnimplementedDaemonServiceServer// for forward compatibility.@@ -475,6 +546,19 @@ type DaemonServiceServer interface {DownloadUpdate(*DownloadUpdateRequest, grpc.ServerStreamingServer[UpdateProgress]) error// 准备好新版本并启动更新助手。返回后界面应当立即退出:助手等它退出后替换文件,再重新打开InstallUpdate(context.Context, *InstallUpdateRequest) (*Empty, error)+ // 收藏或取消收藏,见 design/quick-paste-and-favorites.md 第 3 节。+ // 收藏时另存一份,返回新的收藏记录;取消时把收藏放回复制记录的最上面,返回放回去的那一条。+ // 过程中照常推送 clip_added / clip_removed。已过期或已失败的图片、文件返回 FAILED_PRECONDITION+ SetFavorite(context.Context, *SetFavoriteRequest) (*ClipRecord, error)+ // 悬停提示框要显示的完整内容。ClipRecord 的 text_preview 最多 120 个字、换行被压平,不够用+ GetClipDetail(context.Context, *GetClipDetailRequest) (*ClipDetail, error)+ // 快捷粘贴窗口进程启动后一直保持这个调用:往上报自己的状态,往下收设置页发来的命令。+ // 调用断开就当作快捷窗口没在运行+ QuickPasteSession(grpc.BidiStreamingServer[QuickPasteStatus, QuickPasteCommand]) error+ // 设置页读快捷窗口的状态;状态变化时另有 quick_paste_changed 事件+ GetQuickPasteStatus(context.Context, *Empty) (*QuickPasteStatus, error)+ // 设置页转给快捷窗口的命令。快捷窗口没在运行时返回 FAILED_PRECONDITION+ SendQuickPasteCommand(context.Context, *QuickPasteCommand) (*Empty, error)mustEmbedUnimplementedDaemonServiceServer()}@@ -569,6 +653,21 @@ func (UnimplementedDaemonServiceServer) DownloadUpdate(*DownloadUpdateRequest, gfunc (UnimplementedDaemonServiceServer) InstallUpdate(context.Context, *InstallUpdateRequest) (*Empty, error) {return nil, status.Error(codes.Unimplemented, "method InstallUpdate not implemented")}+func (UnimplementedDaemonServiceServer) SetFavorite(context.Context, *SetFavoriteRequest) (*ClipRecord, error) {+ return nil, status.Error(codes.Unimplemented, "method SetFavorite not implemented")+}+func (UnimplementedDaemonServiceServer) GetClipDetail(context.Context, *GetClipDetailRequest) (*ClipDetail, error) {+ return nil, status.Error(codes.Unimplemented, "method GetClipDetail not implemented")+}+func (UnimplementedDaemonServiceServer) QuickPasteSession(grpc.BidiStreamingServer[QuickPasteStatus, QuickPasteCommand]) error {+ return status.Error(codes.Unimplemented, "method QuickPasteSession not implemented")+}+func (UnimplementedDaemonServiceServer) GetQuickPasteStatus(context.Context, *Empty) (*QuickPasteStatus, error) {+ return nil, status.Error(codes.Unimplemented, "method GetQuickPasteStatus not implemented")+}+func (UnimplementedDaemonServiceServer) SendQuickPasteCommand(context.Context, *QuickPasteCommand) (*Empty, error) {+ return nil, status.Error(codes.Unimplemented, "method SendQuickPasteCommand not implemented")+}func (UnimplementedDaemonServiceServer) mustEmbedUnimplementedDaemonServiceServer() {}func (UnimplementedDaemonServiceServer) testEmbeddedByValue() {}@@ -1073,6 +1172,85 @@ func _DaemonService_InstallUpdate_Handler(srv interface{}, ctx context.Context,return interceptor(ctx, in, info, handler)}+func _DaemonService_SetFavorite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(SetFavoriteRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).SetFavorite(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_SetFavorite_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).SetFavorite(ctx, req.(*SetFavoriteRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_GetClipDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(GetClipDetailRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).GetClipDetail(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_GetClipDetail_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).GetClipDetail(ctx, req.(*GetClipDetailRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_QuickPasteSession_Handler(srv interface{}, stream grpc.ServerStream) error {+ return srv.(DaemonServiceServer).QuickPasteSession(&grpc.GenericServerStream[QuickPasteStatus, QuickPasteCommand]{ServerStream: stream})+}++// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.+type DaemonService_QuickPasteSessionServer = grpc.BidiStreamingServer[QuickPasteStatus, QuickPasteCommand]++func _DaemonService_GetQuickPasteStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(Empty)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).GetQuickPasteStatus(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_GetQuickPasteStatus_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).GetQuickPasteStatus(ctx, req.(*Empty))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_SendQuickPasteCommand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(QuickPasteCommand)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).SendQuickPasteCommand(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_SendQuickPasteCommand_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).SendQuickPasteCommand(ctx, req.(*QuickPasteCommand))+ }+ return interceptor(ctx, in, info, handler)+}+// DaemonService_ServiceDesc is the grpc.ServiceDesc for DaemonService service.// It's only intended for direct use with grpc.RegisterService,// and not to be introspected or modified (even as a copy)@@ -1180,6 +1358,22 @@ var DaemonService_ServiceDesc = grpc.ServiceDesc{MethodName: "InstallUpdate",Handler: _DaemonService_InstallUpdate_Handler,},+ {+ MethodName: "SetFavorite",+ Handler: _DaemonService_SetFavorite_Handler,+ },+ {+ MethodName: "GetClipDetail",+ Handler: _DaemonService_GetClipDetail_Handler,+ },+ {+ MethodName: "GetQuickPasteStatus",+ Handler: _DaemonService_GetQuickPasteStatus_Handler,+ },+ {+ MethodName: "SendQuickPasteCommand",+ Handler: _DaemonService_SendQuickPasteCommand_Handler,+ },},Streams: []grpc.StreamDesc{{@@ -1197,6 +1391,12 @@ var DaemonService_ServiceDesc = grpc.ServiceDesc{Handler: _DaemonService_DownloadUpdate_Handler,ServerStreams: true,},+ {+ StreamName: "QuickPasteSession",+ Handler: _DaemonService_QuickPasteSession_Handler,+ ServerStreams: true,+ ClientStreams: true,+ },},Metadata: "pasteferry/v1/daemon.proto",}diff --git a/proto/pasteferry/v1/daemon.proto b/proto/pasteferry/v1/daemon.protoindex 97a8c9f..79b8e0d 100644--- a/proto/pasteferry/v1/daemon.proto+++ b/proto/pasteferry/v1/daemon.proto@@ -67,6 +67,21 @@ service DaemonService {rpc DownloadUpdate(DownloadUpdateRequest) returns (stream UpdateProgress);// 准备好新版本并启动更新助手。返回后界面应当立即退出:助手等它退出后替换文件,再重新打开rpc InstallUpdate(InstallUpdateRequest) returns (Empty);++ // 收藏或取消收藏,见 design/quick-paste-and-favorites.md 第 3 节。+ // 收藏时另存一份,返回新的收藏记录;取消时把收藏放回复制记录的最上面,返回放回去的那一条。+ // 过程中照常推送 clip_added / clip_removed。已过期或已失败的图片、文件返回 FAILED_PRECONDITION+ rpc SetFavorite(SetFavoriteRequest) returns (ClipRecord);+ // 悬停提示框要显示的完整内容。ClipRecord 的 text_preview 最多 120 个字、换行被压平,不够用+ rpc GetClipDetail(GetClipDetailRequest) returns (ClipDetail);++ // 快捷粘贴窗口进程启动后一直保持这个调用:往上报自己的状态,往下收设置页发来的命令。+ // 调用断开就当作快捷窗口没在运行+ rpc QuickPasteSession(stream QuickPasteStatus) returns (stream QuickPasteCommand);+ // 设置页读快捷窗口的状态;状态变化时另有 quick_paste_changed 事件+ rpc GetQuickPasteStatus(Empty) returns (QuickPasteStatus);+ // 设置页转给快捷窗口的命令。快捷窗口没在运行时返回 FAILED_PRECONDITION+ rpc SendQuickPasteCommand(QuickPasteCommand) returns (Empty);}message Empty {}@@ -117,6 +132,14 @@ message ClipRecord {// 能在界面里预览的图片数:剪贴板图片为 1,文件记录是其中图片文件的个数。// 由本机后台服务按文件名判断,HEIC、TIFF 这类格式只有能转换它的平台才算。int32 image_count = 13;++ // 这一条是收藏,不是复制记录。收藏的 expires_at_unix 为 0,表示不会过期+ bool favorite = 14;+ // 复制记录里的这一条已经收藏过(星标亮着)+ bool favorited = 15;+ int64 favorited_at_unix = 16;+ // 整条文字就是一个 http(s) 网址+ bool is_link = 17;}// ─────────────────────────── 事件流 ───────────────────────────@@ -176,6 +199,9 @@ message Event {ClipboardPermission permission_changed = 6;Status status_changed = 7;ClipboardWriteResult clipboard_written = 8;+ // 设置保存后推送,快捷窗口据此重新注册快捷键+ Config config_changed = 9;+ QuickPasteStatus quick_paste_changed = 10;}}@@ -210,11 +236,17 @@ message ClipboardWriteResult {message ListHistoryRequest {int32 limit = 1;int64 before_unix = 2; // 分页游标- ClipKind kind_filter = 3; // UNSPECIFIED 表示不过滤+ // UNSPECIFIED 表示不过滤。TEXT 是界面上的「文字」:纯文本与网页格式,不含链接+ ClipKind kind_filter = 3;// 搜索词:非空时只返回文字内容或文件名包含它的记录(不分大小写),按时间倒序,// 忽略 before_unix。匹配处不在预览片段里的文字记录,text_preview 换成匹配处前后的一段。string query = 4;++ // true 时只返回收藏,按收藏时间倒序,忽略 before_unix;false 时只返回复制记录+ bool favorites = 5;+ // 只返回链接(is_link)+ bool links_only = 6;}message ListHistoryResponse {@@ -235,6 +267,55 @@ message FetchRequest {message ApplyToClipboardRequest {string clip_id = 1;+ // 只写纯文本,去掉网页格式(快捷窗口里按 ⇧回车)+ bool plain_text = 2;+}++message SetFavoriteRequest {+ // 收藏时传复制记录的 ID;取消收藏时传收藏的 ID 或原记录的 ID 都可以+ string clip_id = 1;+ bool favorite = 2;+}++message GetClipDetailRequest {+ string clip_id = 1;+}++message ClipDetail {+ // 文字的全文,网页格式给纯文本。最多前 4000 个字,保留换行+ string text = 1;+ // 全文的字数+ int32 text_length = 2;+ // 本机复制的文件在本机的完整路径+ repeated string source_paths = 3;+}++// ─────────────────────────── 快捷粘贴窗口 ───────────────────────────++message QuickPasteStatus {+ // 快捷窗口进程在运行(QuickPasteSession 连着)+ bool running = 1;+ // 快捷键注册失败的原因:空表示成功;in_use(被其他程序占用)、invalid、unsupported,+ // 或者平台给出的原文+ string hotkey_error = 2;+ // 实际生效的快捷键,与 Config.quick_paste_hotkey 同样的写法。Wayland 上是门户里用户设定的组合+ string hotkey = 3;+ // 选中后能自动粘贴+ bool paste_available = 4;+ // 不能自动粘贴的原因:not_trusted(Mac 未授予辅助功能)、wayland、copy_only(设置里选了只复制)+ string paste_unavailable_reason = 5;+ // 快捷键由谁触发:native(程序自己注册)、portal(Wayland 全局快捷键门户)、+ // system_shortcut(Wayland 上要用户在系统设置里添加快捷键)+ string hotkey_source = 6;+ // 快捷窗口的版本。App 更新后还在跑旧版的,界面让它按新的程序重新启动+ string version = 7;+}++message QuickPasteCommand {+ // request_permission:Mac 上请求辅助功能权限;+ // suspend_hotkey / resume_hotkey:设置页录制快捷键期间暂停全局快捷键;+ // show:呼出快捷窗口+ string command = 1;}// ─────────────────────────── 设备与配对 ───────────────────────────@@ -337,6 +418,14 @@ message Config {bool update_check_disabled = 18;// 用户选择跳过的版本,自动检查不再提示它;手动检查照常显示string update_skip_version = 19;++ // 关掉快捷粘贴窗口。写成反向的:旧配置没有这一项时就是开启+ bool quick_paste_disabled = 20;+ // 快捷键,如 "alt+v"、"ctrl+alt+v",修饰键按 ctrl、alt、shift、meta 的顺序。+ // 空字符串表示默认:Mac 上 ⌥V,其他平台 Alt+V+ string quick_paste_hotkey = 21;+ // 选中后只放进剪贴板,不模拟粘贴+ bool quick_paste_copy_only = 22;}enum ServiceMode {diff --git a/ui/lib/gen/pasteferry/v1/daemon.pb.dart b/ui/lib/gen/pasteferry/v1/daemon.pb.dartindex 2cbe7e1..a846839 100644--- a/ui/lib/gen/pasteferry/v1/daemon.pb.dart+++ b/ui/lib/gen/pasteferry/v1/daemon.pb.dart@@ -166,6 +166,10 @@ class ClipRecord extends $pb.GeneratedMessage {$fixnum.Int64? expiresAtUnix,$core.String? error,$core.int? imageCount,+ $core.bool? favorite,+ $core.bool? favorited,+ $fixnum.Int64? favoritedAtUnix,+ $core.bool? isLink,}) {final result = ClipRecord._();if (id != null) result.id = id;@@ -181,6 +185,10 @@ class ClipRecord extends $pb.GeneratedMessage {if (expiresAtUnix != null) result.expiresAtUnix = expiresAtUnix;if (error != null) result.error = error;if (imageCount != null) result.imageCount = imageCount;+ if (favorite != null) result.favorite = favorite;+ if (favorited != null) result.favorited = favorited;+ if (favoritedAtUnix != null) result.favoritedAtUnix = favoritedAtUnix;+ if (isLink != null) result.isLink = isLink;return result;}@@ -213,6 +221,10 @@ class ClipRecord extends $pb.GeneratedMessage {..aInt64(11, _omitFieldNames ? '' : 'expiresAtUnix')..aOS(12, _omitFieldNames ? '' : 'error')..aI(13, _omitFieldNames ? '' : 'imageCount')+ ..aOB(14, _omitFieldNames ? '' : 'favorite')+ ..aOB(15, _omitFieldNames ? '' : 'favorited')+ ..aInt64(16, _omitFieldNames ? '' : 'favoritedAtUnix')+ ..aOB(17, _omitFieldNames ? '' : 'isLink')..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -347,6 +359,45 @@ class ClipRecord extends $pb.GeneratedMessage {$core.bool hasImageCount() => $_has(12);@$pb.TagNumber(13)void clearImageCount() => $_clearField(13);++ /// 这一条是收藏,不是复制记录。收藏的 expires_at_unix 为 0,表示不会过期+ @$pb.TagNumber(14)+ $core.bool get favorite => $_getBF(13);+ @$pb.TagNumber(14)+ set favorite($core.bool value) => $_setBool(13, value);+ @$pb.TagNumber(14)+ $core.bool hasFavorite() => $_has(13);+ @$pb.TagNumber(14)+ void clearFavorite() => $_clearField(14);++ /// 复制记录里的这一条已经收藏过(星标亮着)+ @$pb.TagNumber(15)+ $core.bool get favorited => $_getBF(14);+ @$pb.TagNumber(15)+ set favorited($core.bool value) => $_setBool(14, value);+ @$pb.TagNumber(15)+ $core.bool hasFavorited() => $_has(14);+ @$pb.TagNumber(15)+ void clearFavorited() => $_clearField(15);++ @$pb.TagNumber(16)+ $fixnum.Int64 get favoritedAtUnix => $_getI64(15);+ @$pb.TagNumber(16)+ set favoritedAtUnix($fixnum.Int64 value) => $_setInt64(15, value);+ @$pb.TagNumber(16)+ $core.bool hasFavoritedAtUnix() => $_has(15);+ @$pb.TagNumber(16)+ void clearFavoritedAtUnix() => $_clearField(16);++ /// 整条文字就是一个 http(s) 网址+ @$pb.TagNumber(17)+ $core.bool get isLink => $_getBF(16);+ @$pb.TagNumber(17)+ set isLink($core.bool value) => $_setBool(16, value);+ @$pb.TagNumber(17)+ $core.bool hasIsLink() => $_has(16);+ @$pb.TagNumber(17)+ void clearIsLink() => $_clearField(17);}class SubscribeRequest extends $pb.GeneratedMessage {@@ -653,6 +704,8 @@ enum Event_Payload {permissionChanged,statusChanged,clipboardWritten,+ configChanged,+ quickPasteChanged,notSet}@@ -666,6 +719,8 @@ class Event extends $pb.GeneratedMessage {ClipboardPermission? permissionChanged,Status? statusChanged,ClipboardWriteResult? clipboardWritten,+ Config? configChanged,+ QuickPasteStatus? quickPasteChanged,}) {final result = Event._();if (clipAdded != null) result.clipAdded = clipAdded;@@ -676,6 +731,8 @@ class Event extends $pb.GeneratedMessage {if (permissionChanged != null) result.permissionChanged = permissionChanged;if (statusChanged != null) result.statusChanged = statusChanged;if (clipboardWritten != null) result.clipboardWritten = clipboardWritten;+ if (configChanged != null) result.configChanged = configChanged;+ if (quickPasteChanged != null) result.quickPasteChanged = quickPasteChanged;return result;}@@ -697,13 +754,15 @@ class Event extends $pb.GeneratedMessage {6: Event_Payload.permissionChanged,7: Event_Payload.statusChanged,8: Event_Payload.clipboardWritten,+ 9: Event_Payload.configChanged,+ 10: Event_Payload.quickPasteChanged,0: Event_Payload.notSet};static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Event',package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),createEmptyInstance: Event.$_createMessage)- ..oo(0, [1, 2, 3, 4, 5, 6, 7, 8])+ ..oo(0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])..aOM<ClipRecord>(1, _omitFieldNames ? '' : 'clipAdded',subBuilder: ClipRecord.$_createMessage)..aOM<ClipRecord>(2, _omitFieldNames ? '' : 'clipUpdated',@@ -719,6 +778,10 @@ class Event extends $pb.GeneratedMessage {subBuilder: Status.$_createMessage)..aOM<ClipboardWriteResult>(8, _omitFieldNames ? '' : 'clipboardWritten',subBuilder: ClipboardWriteResult.$_createMessage)+ ..aOM<Config>(9, _omitFieldNames ? '' : 'configChanged',+ subBuilder: Config.$_createMessage)+ ..aOM<QuickPasteStatus>(10, _omitFieldNames ? '' : 'quickPasteChanged',+ subBuilder: QuickPasteStatus.$_createMessage)..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -749,6 +812,8 @@ class Event extends $pb.GeneratedMessage {@$pb.TagNumber(6)@$pb.TagNumber(7)@$pb.TagNumber(8)+ @$pb.TagNumber(9)+ @$pb.TagNumber(10)Event_Payload whichPayload() => _Event_PayloadByTag[$_whichOneof(0)]!;@$pb.TagNumber(1)@$pb.TagNumber(2)@@ -758,6 +823,8 @@ class Event extends $pb.GeneratedMessage {@$pb.TagNumber(6)@$pb.TagNumber(7)@$pb.TagNumber(8)+ @$pb.TagNumber(9)+ @$pb.TagNumber(10)void clearPayload() => $_clearField($_whichOneof(0));@$pb.TagNumber(1)@@ -843,6 +910,29 @@ class Event extends $pb.GeneratedMessage {void clearClipboardWritten() => $_clearField(8);@$pb.TagNumber(8)ClipboardWriteResult ensureClipboardWritten() => $_ensure(7);++ /// 设置保存后推送,快捷窗口据此重新注册快捷键+ @$pb.TagNumber(9)+ Config get configChanged => $_getN(8);+ @$pb.TagNumber(9)+ set configChanged(Config value) => $_setField(9, value);+ @$pb.TagNumber(9)+ $core.bool hasConfigChanged() => $_has(8);+ @$pb.TagNumber(9)+ void clearConfigChanged() => $_clearField(9);+ @$pb.TagNumber(9)+ Config ensureConfigChanged() => $_ensure(8);++ @$pb.TagNumber(10)+ QuickPasteStatus get quickPasteChanged => $_getN(9);+ @$pb.TagNumber(10)+ set quickPasteChanged(QuickPasteStatus value) => $_setField(10, value);+ @$pb.TagNumber(10)+ $core.bool hasQuickPasteChanged() => $_has(9);+ @$pb.TagNumber(10)+ void clearQuickPasteChanged() => $_clearField(10);+ @$pb.TagNumber(10)+ QuickPasteStatus ensureQuickPasteChanged() => $_ensure(9);}class NotificationStatus extends $pb.GeneratedMessage {@@ -1086,12 +1176,16 @@ class ListHistoryRequest extends $pb.GeneratedMessage {$fixnum.Int64? beforeUnix,ClipKind? kindFilter,$core.String? query,+ $core.bool? favorites,+ $core.bool? linksOnly,}) {final result = ListHistoryRequest._();if (limit != null) result.limit = limit;if (beforeUnix != null) result.beforeUnix = beforeUnix;if (kindFilter != null) result.kindFilter = kindFilter;if (query != null) result.query = query;+ if (favorites != null) result.favorites = favorites;+ if (linksOnly != null) result.linksOnly = linksOnly;return result;}@@ -1113,6 +1207,8 @@ class ListHistoryRequest extends $pb.GeneratedMessage {..aE<ClipKind>(3, _omitFieldNames ? '' : 'kindFilter',enumValues: ClipKind.values)..aOS(4, _omitFieldNames ? '' : 'query')+ ..aOB(5, _omitFieldNames ? '' : 'favorites')+ ..aOB(6, _omitFieldNames ? '' : 'linksOnly')..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -1155,6 +1251,7 @@ class ListHistoryRequest extends $pb.GeneratedMessage {@$pb.TagNumber(2)void clearBeforeUnix() => $_clearField(2);+ /// UNSPECIFIED 表示不过滤。TEXT 是界面上的「文字」:纯文本与网页格式,不含链接@$pb.TagNumber(3)ClipKind get kindFilter => $_getN(2);@$pb.TagNumber(3)@@ -1174,6 +1271,26 @@ class ListHistoryRequest extends $pb.GeneratedMessage {$core.bool hasQuery() => $_has(3);@$pb.TagNumber(4)void clearQuery() => $_clearField(4);++ /// true 时只返回收藏,按收藏时间倒序,忽略 before_unix;false 时只返回复制记录+ @$pb.TagNumber(5)+ $core.bool get favorites => $_getBF(4);+ @$pb.TagNumber(5)+ set favorites($core.bool value) => $_setBool(4, value);+ @$pb.TagNumber(5)+ $core.bool hasFavorites() => $_has(4);+ @$pb.TagNumber(5)+ void clearFavorites() => $_clearField(5);++ /// 只返回链接(is_link)+ @$pb.TagNumber(6)+ $core.bool get linksOnly => $_getBF(5);+ @$pb.TagNumber(6)+ set linksOnly($core.bool value) => $_setBool(5, value);+ @$pb.TagNumber(6)+ $core.bool hasLinksOnly() => $_has(5);+ @$pb.TagNumber(6)+ void clearLinksOnly() => $_clearField(6);}class ListHistoryResponse extends $pb.GeneratedMessage {@@ -1378,9 +1495,11 @@ class FetchRequest extends $pb.GeneratedMessage {class ApplyToClipboardRequest extends $pb.GeneratedMessage {factory ApplyToClipboardRequest({$core.String? clipId,+ $core.bool? plainText,}) {final result = ApplyToClipboardRequest._();if (clipId != null) result.clipId = clipId;+ if (plainText != null) result.plainText = plainText;return result;}@@ -1398,6 +1517,7 @@ class ApplyToClipboardRequest extends $pb.GeneratedMessage {package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),createEmptyInstance: ApplyToClipboardRequest.$_createMessage)..aOS(1, _omitFieldNames ? '' : 'clipId')+ ..aOB(2, _omitFieldNames ? '' : 'plainText')..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -1432,6 +1552,419 @@ class ApplyToClipboardRequest extends $pb.GeneratedMessage {$core.bool hasClipId() => $_has(0);@$pb.TagNumber(1)void clearClipId() => $_clearField(1);++ /// 只写纯文本,去掉网页格式(快捷窗口里按 ⇧回车)+ @$pb.TagNumber(2)+ $core.bool get plainText => $_getBF(1);+ @$pb.TagNumber(2)+ set plainText($core.bool value) => $_setBool(1, value);+ @$pb.TagNumber(2)+ $core.bool hasPlainText() => $_has(1);+ @$pb.TagNumber(2)+ void clearPlainText() => $_clearField(2);+}++class SetFavoriteRequest extends $pb.GeneratedMessage {+ factory SetFavoriteRequest({+ $core.String? clipId,+ $core.bool? favorite,+ }) {+ final result = SetFavoriteRequest._();+ if (clipId != null) result.clipId = clipId;+ if (favorite != null) result.favorite = favorite;+ return result;+ }++ SetFavoriteRequest._();++ factory SetFavoriteRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ SetFavoriteRequest()..mergeFromBuffer(data, registry);+ factory SetFavoriteRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ SetFavoriteRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'SetFavoriteRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: SetFavoriteRequest.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'clipId')+ ..aOB(2, _omitFieldNames ? '' : 'favorite')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ SetFavoriteRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ SetFavoriteRequest copyWith(void Function(SetFavoriteRequest) updates) =>+ super.copyWith((message) => updates(message as SetFavoriteRequest))+ as SetFavoriteRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use SetFavoriteRequest() / SetFavoriteRequest.new instead')+ static SetFavoriteRequest create() => SetFavoriteRequest._();+ static $pb.GeneratedMessage $_createMessage() => SetFavoriteRequest._();+ @$core.override+ SetFavoriteRequest createEmptyInstance() => SetFavoriteRequest._();+ @$core.pragma('dart2js:noInline')+ static SetFavoriteRequest getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<SetFavoriteRequest>(+ SetFavoriteRequest.$_createMessage);+ static SetFavoriteRequest? _defaultInstance;++ /// 收藏时传复制记录的 ID;取消收藏时传收藏的 ID 或原记录的 ID 都可以+ @$pb.TagNumber(1)+ $core.String get clipId => $_getSZ(0);+ @$pb.TagNumber(1)+ set clipId($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasClipId() => $_has(0);+ @$pb.TagNumber(1)+ void clearClipId() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.bool get favorite => $_getBF(1);+ @$pb.TagNumber(2)+ set favorite($core.bool value) => $_setBool(1, value);+ @$pb.TagNumber(2)+ $core.bool hasFavorite() => $_has(1);+ @$pb.TagNumber(2)+ void clearFavorite() => $_clearField(2);+}++class GetClipDetailRequest extends $pb.GeneratedMessage {+ factory GetClipDetailRequest({+ $core.String? clipId,+ }) {+ final result = GetClipDetailRequest._();+ if (clipId != null) result.clipId = clipId;+ return result;+ }++ GetClipDetailRequest._();++ factory GetClipDetailRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ GetClipDetailRequest()..mergeFromBuffer(data, registry);+ factory GetClipDetailRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ GetClipDetailRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'GetClipDetailRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: GetClipDetailRequest.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'clipId')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ GetClipDetailRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ GetClipDetailRequest copyWith(void Function(GetClipDetailRequest) updates) =>+ super.copyWith((message) => updates(message as GetClipDetailRequest))+ as GetClipDetailRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated(+ 'Use GetClipDetailRequest() / GetClipDetailRequest.new instead')+ static GetClipDetailRequest create() => GetClipDetailRequest._();+ static $pb.GeneratedMessage $_createMessage() => GetClipDetailRequest._();+ @$core.override+ GetClipDetailRequest createEmptyInstance() => GetClipDetailRequest._();+ @$core.pragma('dart2js:noInline')+ static GetClipDetailRequest getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<GetClipDetailRequest>(+ GetClipDetailRequest.$_createMessage);+ static GetClipDetailRequest? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get clipId => $_getSZ(0);+ @$pb.TagNumber(1)+ set clipId($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasClipId() => $_has(0);+ @$pb.TagNumber(1)+ void clearClipId() => $_clearField(1);+}++class ClipDetail extends $pb.GeneratedMessage {+ factory ClipDetail({+ $core.String? text,+ $core.int? textLength,+ $core.Iterable<$core.String>? sourcePaths,+ }) {+ final result = ClipDetail._();+ if (text != null) result.text = text;+ if (textLength != null) result.textLength = textLength;+ if (sourcePaths != null) result.sourcePaths.addAll(sourcePaths);+ return result;+ }++ ClipDetail._();++ factory ClipDetail.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ClipDetail()..mergeFromBuffer(data, registry);+ factory ClipDetail.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ClipDetail()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'ClipDetail',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: ClipDetail.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'text')+ ..aI(2, _omitFieldNames ? '' : 'textLength')+ ..pPS(3, _omitFieldNames ? '' : 'sourcePaths')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ClipDetail clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ClipDetail copyWith(void Function(ClipDetail) updates) =>+ super.copyWith((message) => updates(message as ClipDetail)) as ClipDetail;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use ClipDetail() / ClipDetail.new instead')+ static ClipDetail create() => ClipDetail._();+ static $pb.GeneratedMessage $_createMessage() => ClipDetail._();+ @$core.override+ ClipDetail createEmptyInstance() => ClipDetail._();+ @$core.pragma('dart2js:noInline')+ static ClipDetail getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<ClipDetail>(ClipDetail.$_createMessage);+ static ClipDetail? _defaultInstance;++ /// 文字的全文,网页格式给纯文本。最多前 4000 个字,保留换行+ @$pb.TagNumber(1)+ $core.String get text => $_getSZ(0);+ @$pb.TagNumber(1)+ set text($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasText() => $_has(0);+ @$pb.TagNumber(1)+ void clearText() => $_clearField(1);++ /// 全文的字数+ @$pb.TagNumber(2)+ $core.int get textLength => $_getIZ(1);+ @$pb.TagNumber(2)+ set textLength($core.int value) => $_setSignedInt32(1, value);+ @$pb.TagNumber(2)+ $core.bool hasTextLength() => $_has(1);+ @$pb.TagNumber(2)+ void clearTextLength() => $_clearField(2);++ /// 本机复制的文件在本机的完整路径+ @$pb.TagNumber(3)+ $pb.PbList<$core.String> get sourcePaths => $_getList(2);+}++class QuickPasteStatus extends $pb.GeneratedMessage {+ factory QuickPasteStatus({+ $core.bool? running,+ $core.String? hotkeyError,+ $core.String? hotkey,+ $core.bool? pasteAvailable,+ $core.String? pasteUnavailableReason,+ $core.String? hotkeySource,+ $core.String? version,+ }) {+ final result = QuickPasteStatus._();+ if (running != null) result.running = running;+ if (hotkeyError != null) result.hotkeyError = hotkeyError;+ if (hotkey != null) result.hotkey = hotkey;+ if (pasteAvailable != null) result.pasteAvailable = pasteAvailable;+ if (pasteUnavailableReason != null)+ result.pasteUnavailableReason = pasteUnavailableReason;+ if (hotkeySource != null) result.hotkeySource = hotkeySource;+ if (version != null) result.version = version;+ return result;+ }++ QuickPasteStatus._();++ factory QuickPasteStatus.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ QuickPasteStatus()..mergeFromBuffer(data, registry);+ factory QuickPasteStatus.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ QuickPasteStatus()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'QuickPasteStatus',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: QuickPasteStatus.$_createMessage)+ ..aOB(1, _omitFieldNames ? '' : 'running')+ ..aOS(2, _omitFieldNames ? '' : 'hotkeyError')+ ..aOS(3, _omitFieldNames ? '' : 'hotkey')+ ..aOB(4, _omitFieldNames ? '' : 'pasteAvailable')+ ..aOS(5, _omitFieldNames ? '' : 'pasteUnavailableReason')+ ..aOS(6, _omitFieldNames ? '' : 'hotkeySource')+ ..aOS(7, _omitFieldNames ? '' : 'version')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ QuickPasteStatus clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ QuickPasteStatus copyWith(void Function(QuickPasteStatus) updates) =>+ super.copyWith((message) => updates(message as QuickPasteStatus))+ as QuickPasteStatus;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use QuickPasteStatus() / QuickPasteStatus.new instead')+ static QuickPasteStatus create() => QuickPasteStatus._();+ static $pb.GeneratedMessage $_createMessage() => QuickPasteStatus._();+ @$core.override+ QuickPasteStatus createEmptyInstance() => QuickPasteStatus._();+ @$core.pragma('dart2js:noInline')+ static QuickPasteStatus getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<QuickPasteStatus>(+ QuickPasteStatus.$_createMessage);+ static QuickPasteStatus? _defaultInstance;++ /// 快捷窗口进程在运行(QuickPasteSession 连着)+ @$pb.TagNumber(1)+ $core.bool get running => $_getBF(0);+ @$pb.TagNumber(1)+ set running($core.bool value) => $_setBool(0, value);+ @$pb.TagNumber(1)+ $core.bool hasRunning() => $_has(0);+ @$pb.TagNumber(1)+ void clearRunning() => $_clearField(1);++ /// 快捷键注册失败的原因:空表示成功;in_use(被其他程序占用)、invalid、unsupported,+ /// 或者平台给出的原文+ @$pb.TagNumber(2)+ $core.String get hotkeyError => $_getSZ(1);+ @$pb.TagNumber(2)+ set hotkeyError($core.String value) => $_setString(1, value);+ @$pb.TagNumber(2)+ $core.bool hasHotkeyError() => $_has(1);+ @$pb.TagNumber(2)+ void clearHotkeyError() => $_clearField(2);++ /// 实际生效的快捷键,与 Config.quick_paste_hotkey 同样的写法。Wayland 上是门户里用户设定的组合+ @$pb.TagNumber(3)+ $core.String get hotkey => $_getSZ(2);+ @$pb.TagNumber(3)+ set hotkey($core.String value) => $_setString(2, value);+ @$pb.TagNumber(3)+ $core.bool hasHotkey() => $_has(2);+ @$pb.TagNumber(3)+ void clearHotkey() => $_clearField(3);++ /// 选中后能自动粘贴+ @$pb.TagNumber(4)+ $core.bool get pasteAvailable => $_getBF(3);+ @$pb.TagNumber(4)+ set pasteAvailable($core.bool value) => $_setBool(3, value);+ @$pb.TagNumber(4)+ $core.bool hasPasteAvailable() => $_has(3);+ @$pb.TagNumber(4)+ void clearPasteAvailable() => $_clearField(4);++ /// 不能自动粘贴的原因:not_trusted(Mac 未授予辅助功能)、wayland、copy_only(设置里选了只复制)+ @$pb.TagNumber(5)+ $core.String get pasteUnavailableReason => $_getSZ(4);+ @$pb.TagNumber(5)+ set pasteUnavailableReason($core.String value) => $_setString(4, value);+ @$pb.TagNumber(5)+ $core.bool hasPasteUnavailableReason() => $_has(4);+ @$pb.TagNumber(5)+ void clearPasteUnavailableReason() => $_clearField(5);++ /// 快捷键由谁触发:native(程序自己注册)、portal(Wayland 全局快捷键门户)、+ /// system_shortcut(Wayland 上要用户在系统设置里添加快捷键)+ @$pb.TagNumber(6)+ $core.String get hotkeySource => $_getSZ(5);+ @$pb.TagNumber(6)+ set hotkeySource($core.String value) => $_setString(5, value);+ @$pb.TagNumber(6)+ $core.bool hasHotkeySource() => $_has(5);+ @$pb.TagNumber(6)+ void clearHotkeySource() => $_clearField(6);++ /// 快捷窗口的版本。App 更新后还在跑旧版的,界面让它按新的程序重新启动+ @$pb.TagNumber(7)+ $core.String get version => $_getSZ(6);+ @$pb.TagNumber(7)+ set version($core.String value) => $_setString(6, value);+ @$pb.TagNumber(7)+ $core.bool hasVersion() => $_has(6);+ @$pb.TagNumber(7)+ void clearVersion() => $_clearField(7);+}++class QuickPasteCommand extends $pb.GeneratedMessage {+ factory QuickPasteCommand({+ $core.String? command,+ }) {+ final result = QuickPasteCommand._();+ if (command != null) result.command = command;+ return result;+ }++ QuickPasteCommand._();++ factory QuickPasteCommand.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ QuickPasteCommand()..mergeFromBuffer(data, registry);+ factory QuickPasteCommand.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ QuickPasteCommand()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'QuickPasteCommand',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: QuickPasteCommand.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'command')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ QuickPasteCommand clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ QuickPasteCommand copyWith(void Function(QuickPasteCommand) updates) =>+ super.copyWith((message) => updates(message as QuickPasteCommand))+ as QuickPasteCommand;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use QuickPasteCommand() / QuickPasteCommand.new instead')+ static QuickPasteCommand create() => QuickPasteCommand._();+ static $pb.GeneratedMessage $_createMessage() => QuickPasteCommand._();+ @$core.override+ QuickPasteCommand createEmptyInstance() => QuickPasteCommand._();+ @$core.pragma('dart2js:noInline')+ static QuickPasteCommand getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<QuickPasteCommand>(+ QuickPasteCommand.$_createMessage);+ static QuickPasteCommand? _defaultInstance;++ /// request_permission:Mac 上请求辅助功能权限;+ /// suspend_hotkey / resume_hotkey:设置页录制快捷键期间暂停全局快捷键;+ /// show:呼出快捷窗口+ @$pb.TagNumber(1)+ $core.String get command => $_getSZ(0);+ @$pb.TagNumber(1)+ set command($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasCommand() => $_has(0);+ @$pb.TagNumber(1)+ void clearCommand() => $_clearField(1);}class ListDevicesResponse extends $pb.GeneratedMessage {@@ -2158,6 +2691,9 @@ class Config extends $pb.GeneratedMessage {$core.String? officialNoticeAck,$core.bool? updateCheckDisabled,$core.String? updateSkipVersion,+ $core.bool? quickPasteDisabled,+ $core.String? quickPasteHotkey,+ $core.bool? quickPasteCopyOnly,}) {final result = Config._();if (autoSyncThresholdBytes != null)@@ -2183,6 +2719,11 @@ class Config extends $pb.GeneratedMessage {if (updateCheckDisabled != null)result.updateCheckDisabled = updateCheckDisabled;if (updateSkipVersion != null) result.updateSkipVersion = updateSkipVersion;+ if (quickPasteDisabled != null)+ result.quickPasteDisabled = quickPasteDisabled;+ if (quickPasteHotkey != null) result.quickPasteHotkey = quickPasteHotkey;+ if (quickPasteCopyOnly != null)+ result.quickPasteCopyOnly = quickPasteCopyOnly;return result;}@@ -2219,6 +2760,9 @@ class Config extends $pb.GeneratedMessage {..aOS(17, _omitFieldNames ? '' : 'officialNoticeAck')..aOB(18, _omitFieldNames ? '' : 'updateCheckDisabled')..aOS(19, _omitFieldNames ? '' : 'updateSkipVersion')+ ..aOB(20, _omitFieldNames ? '' : 'quickPasteDisabled')+ ..aOS(21, _omitFieldNames ? '' : 'quickPasteHotkey')+ ..aOB(22, _omitFieldNames ? '' : 'quickPasteCopyOnly')..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -2422,6 +2966,37 @@ class Config extends $pb.GeneratedMessage {$core.bool hasUpdateSkipVersion() => $_has(18);@$pb.TagNumber(19)void clearUpdateSkipVersion() => $_clearField(19);++ /// 关掉快捷粘贴窗口。写成反向的:旧配置没有这一项时就是开启+ @$pb.TagNumber(20)+ $core.bool get quickPasteDisabled => $_getBF(19);+ @$pb.TagNumber(20)+ set quickPasteDisabled($core.bool value) => $_setBool(19, value);+ @$pb.TagNumber(20)+ $core.bool hasQuickPasteDisabled() => $_has(19);+ @$pb.TagNumber(20)+ void clearQuickPasteDisabled() => $_clearField(20);++ /// 快捷键,如 "alt+v"、"ctrl+alt+v",修饰键按 ctrl、alt、shift、meta 的顺序。+ /// 空字符串表示默认:Mac 上 ⌥V,其他平台 Alt+V+ @$pb.TagNumber(21)+ $core.String get quickPasteHotkey => $_getSZ(20);+ @$pb.TagNumber(21)+ set quickPasteHotkey($core.String value) => $_setString(20, value);+ @$pb.TagNumber(21)+ $core.bool hasQuickPasteHotkey() => $_has(20);+ @$pb.TagNumber(21)+ void clearQuickPasteHotkey() => $_clearField(21);++ /// 选中后只放进剪贴板,不模拟粘贴+ @$pb.TagNumber(22)+ $core.bool get quickPasteCopyOnly => $_getBF(21);+ @$pb.TagNumber(22)+ set quickPasteCopyOnly($core.bool value) => $_setBool(21, value);+ @$pb.TagNumber(22)+ $core.bool hasQuickPasteCopyOnly() => $_has(21);+ @$pb.TagNumber(22)+ void clearQuickPasteCopyOnly() => $_clearField(22);}class OfficialUsage extends $pb.GeneratedMessage {diff --git a/ui/lib/gen/pasteferry/v1/daemon.pbgrpc.dart b/ui/lib/gen/pasteferry/v1/daemon.pbgrpc.dartindex 12872d4..6d768ae 100644--- a/ui/lib/gen/pasteferry/v1/daemon.pbgrpc.dart+++ b/ui/lib/gen/pasteferry/v1/daemon.pbgrpc.dart@@ -257,6 +257,49 @@ class DaemonServiceClient extends $grpc.Client {return $createUnaryCall(_$installUpdate, request, options: options);}+ /// 收藏或取消收藏,见 design/quick-paste-and-favorites.md 第 3 节。+ /// 收藏时另存一份,返回新的收藏记录;取消时把收藏放回复制记录的最上面,返回放回去的那一条。+ /// 过程中照常推送 clip_added / clip_removed。已过期或已失败的图片、文件返回 FAILED_PRECONDITION+ $grpc.ResponseFuture<$0.ClipRecord> setFavorite(+ $0.SetFavoriteRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$setFavorite, request, options: options);+ }++ /// 悬停提示框要显示的完整内容。ClipRecord 的 text_preview 最多 120 个字、换行被压平,不够用+ $grpc.ResponseFuture<$0.ClipDetail> getClipDetail(+ $0.GetClipDetailRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$getClipDetail, request, options: options);+ }++ /// 快捷粘贴窗口进程启动后一直保持这个调用:往上报自己的状态,往下收设置页发来的命令。+ /// 调用断开就当作快捷窗口没在运行+ $grpc.ResponseStream<$0.QuickPasteCommand> quickPasteSession(+ $async.Stream<$0.QuickPasteStatus> request, {+ $grpc.CallOptions? options,+ }) {+ return $createStreamingCall(_$quickPasteSession, request, options: options);+ }++ /// 设置页读快捷窗口的状态;状态变化时另有 quick_paste_changed 事件+ $grpc.ResponseFuture<$0.QuickPasteStatus> getQuickPasteStatus(+ $0.Empty request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$getQuickPasteStatus, request, options: options);+ }++ /// 设置页转给快捷窗口的命令。快捷窗口没在运行时返回 FAILED_PRECONDITION+ $grpc.ResponseFuture<$0.Empty> sendQuickPasteCommand(+ $0.QuickPasteCommand request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$sendQuickPasteCommand, request, options: options);+ }+// method descriptorsstatic final _$subscribe = $grpc.ClientMethod<$0.SubscribeRequest, $0.Event>(@@ -391,6 +434,31 @@ class DaemonServiceClient extends $grpc.Client {'/pasteferry.v1.DaemonService/InstallUpdate',($0.InstallUpdateRequest value) => value.writeToBuffer(),$0.Empty.fromBuffer);+ static final _$setFavorite =+ $grpc.ClientMethod<$0.SetFavoriteRequest, $0.ClipRecord>(+ '/pasteferry.v1.DaemonService/SetFavorite',+ ($0.SetFavoriteRequest value) => value.writeToBuffer(),+ $0.ClipRecord.fromBuffer);+ static final _$getClipDetail =+ $grpc.ClientMethod<$0.GetClipDetailRequest, $0.ClipDetail>(+ '/pasteferry.v1.DaemonService/GetClipDetail',+ ($0.GetClipDetailRequest value) => value.writeToBuffer(),+ $0.ClipDetail.fromBuffer);+ static final _$quickPasteSession =+ $grpc.ClientMethod<$0.QuickPasteStatus, $0.QuickPasteCommand>(+ '/pasteferry.v1.DaemonService/QuickPasteSession',+ ($0.QuickPasteStatus value) => value.writeToBuffer(),+ $0.QuickPasteCommand.fromBuffer);+ static final _$getQuickPasteStatus =+ $grpc.ClientMethod<$0.Empty, $0.QuickPasteStatus>(+ '/pasteferry.v1.DaemonService/GetQuickPasteStatus',+ ($0.Empty value) => value.writeToBuffer(),+ $0.QuickPasteStatus.fromBuffer);+ static final _$sendQuickPasteCommand =+ $grpc.ClientMethod<$0.QuickPasteCommand, $0.Empty>(+ '/pasteferry.v1.DaemonService/SendQuickPasteCommand',+ ($0.QuickPasteCommand value) => value.writeToBuffer(),+ $0.Empty.fromBuffer);}@$pb.GrpcServiceName('pasteferry.v1.DaemonService')@@ -612,6 +680,43 @@ abstract class DaemonServiceBase extends $grpc.Service {($core.List<$core.int> value) =>$0.InstallUpdateRequest.fromBuffer(value),($0.Empty value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.SetFavoriteRequest, $0.ClipRecord>(+ 'SetFavorite',+ setFavorite_Pre,+ false,+ false,+ ($core.List<$core.int> value) =>+ $0.SetFavoriteRequest.fromBuffer(value),+ ($0.ClipRecord value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.GetClipDetailRequest, $0.ClipDetail>(+ 'GetClipDetail',+ getClipDetail_Pre,+ false,+ false,+ ($core.List<$core.int> value) =>+ $0.GetClipDetailRequest.fromBuffer(value),+ ($0.ClipDetail value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.QuickPasteStatus, $0.QuickPasteCommand>(+ 'QuickPasteSession',+ quickPasteSession,+ true,+ true,+ ($core.List<$core.int> value) => $0.QuickPasteStatus.fromBuffer(value),+ ($0.QuickPasteCommand value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.Empty, $0.QuickPasteStatus>(+ 'GetQuickPasteStatus',+ getQuickPasteStatus_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.Empty.fromBuffer(value),+ ($0.QuickPasteStatus value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.QuickPasteCommand, $0.Empty>(+ 'SendQuickPasteCommand',+ sendQuickPasteCommand_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.QuickPasteCommand.fromBuffer(value),+ ($0.Empty value) => value.writeToBuffer()));}$async.Stream<$0.Event> subscribe_Pre($grpc.ServiceCall $call,@@ -838,4 +943,39 @@ abstract class DaemonServiceBase extends $grpc.Service {$async.Future<$0.Empty> installUpdate($grpc.ServiceCall call, $0.InstallUpdateRequest request);++ $async.Future<$0.ClipRecord> setFavorite_Pre($grpc.ServiceCall $call,+ $async.Future<$0.SetFavoriteRequest> $request) async {+ return setFavorite($call, await $request);+ }++ $async.Future<$0.ClipRecord> setFavorite(+ $grpc.ServiceCall call, $0.SetFavoriteRequest request);++ $async.Future<$0.ClipDetail> getClipDetail_Pre($grpc.ServiceCall $call,+ $async.Future<$0.GetClipDetailRequest> $request) async {+ return getClipDetail($call, await $request);+ }++ $async.Future<$0.ClipDetail> getClipDetail(+ $grpc.ServiceCall call, $0.GetClipDetailRequest request);++ $async.Stream<$0.QuickPasteCommand> quickPasteSession(+ $grpc.ServiceCall call, $async.Stream<$0.QuickPasteStatus> request);++ $async.Future<$0.QuickPasteStatus> getQuickPasteStatus_Pre(+ $grpc.ServiceCall $call, $async.Future<$0.Empty> $request) async {+ return getQuickPasteStatus($call, await $request);+ }++ $async.Future<$0.QuickPasteStatus> getQuickPasteStatus(+ $grpc.ServiceCall call, $0.Empty request);++ $async.Future<$0.Empty> sendQuickPasteCommand_Pre($grpc.ServiceCall $call,+ $async.Future<$0.QuickPasteCommand> $request) async {+ return sendQuickPasteCommand($call, await $request);+ }++ $async.Future<$0.Empty> sendQuickPasteCommand(+ $grpc.ServiceCall call, $0.QuickPasteCommand request);}diff --git a/ui/lib/gen/pasteferry/v1/daemon.pbjson.dart b/ui/lib/gen/pasteferry/v1/daemon.pbjson.dartindex f23ef0e..f1ee33e 100644--- a/ui/lib/gen/pasteferry/v1/daemon.pbjson.dart+++ b/ui/lib/gen/pasteferry/v1/daemon.pbjson.dart@@ -195,6 +195,16 @@ const ClipRecord$json = {{'1': 'expires_at_unix', '3': 11, '4': 1, '5': 3, '10': 'expiresAtUnix'},{'1': 'error', '3': 12, '4': 1, '5': 9, '10': 'error'},{'1': 'image_count', '3': 13, '4': 1, '5': 5, '10': 'imageCount'},+ {'1': 'favorite', '3': 14, '4': 1, '5': 8, '10': 'favorite'},+ {'1': 'favorited', '3': 15, '4': 1, '5': 8, '10': 'favorited'},+ {+ '1': 'favorited_at_unix',+ '3': 16,+ '4': 1,+ '5': 3,+ '10': 'favoritedAtUnix'+ },+ {'1': 'is_link', '3': 17, '4': 1, '5': 8, '10': 'isLink'},],};@@ -208,7 +218,10 @@ final $typed_data.Uint8List clipRecordDescriptor = $convert.base64Decode('RlbVIFaXRlbXMSHQoKdG90YWxfc2l6ZRgIIAEoA1IJdG90YWxTaXplEiEKDHRleHRfcHJldmll''dxgJIAEoCVILdGV4dFByZXZpZXcSJgoPY3JlYXRlZF9hdF91bml4GAogASgDUg1jcmVhdGVkQX''RVbml4EiYKD2V4cGlyZXNfYXRfdW5peBgLIAEoA1INZXhwaXJlc0F0VW5peBIUCgVlcnJvchgM'- 'IAEoCVIFZXJyb3ISHwoLaW1hZ2VfY291bnQYDSABKAVSCmltYWdlQ291bnQ=');+ 'IAEoCVIFZXJyb3ISHwoLaW1hZ2VfY291bnQYDSABKAVSCmltYWdlQ291bnQSGgoIZmF2b3JpdG'+ 'UYDiABKAhSCGZhdm9yaXRlEhwKCWZhdm9yaXRlZBgPIAEoCFIJZmF2b3JpdGVkEioKEWZhdm9y'+ 'aXRlZF9hdF91bml4GBAgASgDUg9mYXZvcml0ZWRBdFVuaXgSFwoHaXNfbGluaxgRIAEoCFIGaX'+ 'NMaW5r');@$core.Deprecated('Use subscribeRequestDescriptor instead')const SubscribeRequest$json = {@@ -344,6 +357,24 @@ const Event$json = {'9': 0,'10': 'clipboardWritten'},+ {+ '1': 'config_changed',+ '3': 9,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.Config',+ '9': 0,+ '10': 'configChanged'+ },+ {+ '1': 'quick_paste_changed',+ '3': 10,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.QuickPasteStatus',+ '9': 0,+ '10': 'quickPasteChanged'+ },],'8': [{'1': 'payload'},@@ -361,7 +392,10 @@ final $typed_data.Uint8List eventDescriptor = $convert.base64Decode('cnJ5LnYxLkNsaXBib2FyZFBlcm1pc3Npb25IAFIRcGVybWlzc2lvbkNoYW5nZWQSPgoOc3RhdH''VzX2NoYW5nZWQYByABKAsyFS5wYXN0ZWZlcnJ5LnYxLlN0YXR1c0gAUg1zdGF0dXNDaGFuZ2Vk''ElIKEWNsaXBib2FyZF93cml0dGVuGAggASgLMiMucGFzdGVmZXJyeS52MS5DbGlwYm9hcmRXcm'- 'l0ZVJlc3VsdEgAUhBjbGlwYm9hcmRXcml0dGVuQgkKB3BheWxvYWQ=');+ 'l0ZVJlc3VsdEgAUhBjbGlwYm9hcmRXcml0dGVuEj4KDmNvbmZpZ19jaGFuZ2VkGAkgASgLMhUu'+ 'cGFzdGVmZXJyeS52MS5Db25maWdIAFINY29uZmlnQ2hhbmdlZBJRChNxdWlja19wYXN0ZV9jaG'+ 'FuZ2VkGAogASgLMh8ucGFzdGVmZXJyeS52MS5RdWlja1Bhc3RlU3RhdHVzSABSEXF1aWNrUGFz'+ 'dGVDaGFuZ2VkQgkKB3BheWxvYWQ=');@$core.Deprecated('Use notificationStatusDescriptor instead')const NotificationStatus$json = {@@ -437,6 +471,8 @@ const ListHistoryRequest$json = {'10': 'kindFilter'},{'1': 'query', '3': 4, '4': 1, '5': 9, '10': 'query'},+ {'1': 'favorites', '3': 5, '4': 1, '5': 8, '10': 'favorites'},+ {'1': 'links_only', '3': 6, '4': 1, '5': 8, '10': 'linksOnly'},],};@@ -444,7 +480,8 @@ const ListHistoryRequest$json = {final $typed_data.Uint8List listHistoryRequestDescriptor = $convert.base64Decode('ChJMaXN0SGlzdG9yeVJlcXVlc3QSFAoFbGltaXQYASABKAVSBWxpbWl0Eh8KC2JlZm9yZV91bm''l4GAIgASgDUgpiZWZvcmVVbml4EjgKC2tpbmRfZmlsdGVyGAMgASgOMhcucGFzdGVmZXJyeS52'- 'MS5DbGlwS2luZFIKa2luZEZpbHRlchIUCgVxdWVyeRgEIAEoCVIFcXVlcnk=');+ 'MS5DbGlwS2luZFIKa2luZEZpbHRlchIUCgVxdWVyeRgEIAEoCVIFcXVlcnkSHAoJZmF2b3JpdG'+ 'VzGAUgASgIUglmYXZvcml0ZXMSHQoKbGlua3Nfb25seRgGIAEoCFIJbGlua3NPbmx5');@$core.Deprecated('Use listHistoryResponseDescriptor instead')const ListHistoryResponse$json = {@@ -506,13 +543,97 @@ const ApplyToClipboardRequest$json = {'1': 'ApplyToClipboardRequest','2': [{'1': 'clip_id', '3': 1, '4': 1, '5': 9, '10': 'clipId'},+ {'1': 'plain_text', '3': 2, '4': 1, '5': 8, '10': 'plainText'},],};/// Descriptor for `ApplyToClipboardRequest`. Decode as a `google.protobuf.DescriptorProto`.final $typed_data.Uint8List applyToClipboardRequestDescriptor =$convert.base64Decode(- 'ChdBcHBseVRvQ2xpcGJvYXJkUmVxdWVzdBIXCgdjbGlwX2lkGAEgASgJUgZjbGlwSWQ=');+ 'ChdBcHBseVRvQ2xpcGJvYXJkUmVxdWVzdBIXCgdjbGlwX2lkGAEgASgJUgZjbGlwSWQSHQoKcG'+ 'xhaW5fdGV4dBgCIAEoCFIJcGxhaW5UZXh0');++@$core.Deprecated('Use setFavoriteRequestDescriptor instead')+const SetFavoriteRequest$json = {+ '1': 'SetFavoriteRequest',+ '2': [+ {'1': 'clip_id', '3': 1, '4': 1, '5': 9, '10': 'clipId'},+ {'1': 'favorite', '3': 2, '4': 1, '5': 8, '10': 'favorite'},+ ],+};++/// Descriptor for `SetFavoriteRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List setFavoriteRequestDescriptor = $convert.base64Decode(+ 'ChJTZXRGYXZvcml0ZVJlcXVlc3QSFwoHY2xpcF9pZBgBIAEoCVIGY2xpcElkEhoKCGZhdm9yaX'+ 'RlGAIgASgIUghmYXZvcml0ZQ==');++@$core.Deprecated('Use getClipDetailRequestDescriptor instead')+const GetClipDetailRequest$json = {+ '1': 'GetClipDetailRequest',+ '2': [+ {'1': 'clip_id', '3': 1, '4': 1, '5': 9, '10': 'clipId'},+ ],+};++/// Descriptor for `GetClipDetailRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List getClipDetailRequestDescriptor =+ $convert.base64Decode(+ 'ChRHZXRDbGlwRGV0YWlsUmVxdWVzdBIXCgdjbGlwX2lkGAEgASgJUgZjbGlwSWQ=');++@$core.Deprecated('Use clipDetailDescriptor instead')+const ClipDetail$json = {+ '1': 'ClipDetail',+ '2': [+ {'1': 'text', '3': 1, '4': 1, '5': 9, '10': 'text'},+ {'1': 'text_length', '3': 2, '4': 1, '5': 5, '10': 'textLength'},+ {'1': 'source_paths', '3': 3, '4': 3, '5': 9, '10': 'sourcePaths'},+ ],+};++/// Descriptor for `ClipDetail`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List clipDetailDescriptor = $convert.base64Decode(+ 'CgpDbGlwRGV0YWlsEhIKBHRleHQYASABKAlSBHRleHQSHwoLdGV4dF9sZW5ndGgYAiABKAVSCn'+ 'RleHRMZW5ndGgSIQoMc291cmNlX3BhdGhzGAMgAygJUgtzb3VyY2VQYXRocw==');++@$core.Deprecated('Use quickPasteStatusDescriptor instead')+const QuickPasteStatus$json = {+ '1': 'QuickPasteStatus',+ '2': [+ {'1': 'running', '3': 1, '4': 1, '5': 8, '10': 'running'},+ {'1': 'hotkey_error', '3': 2, '4': 1, '5': 9, '10': 'hotkeyError'},+ {'1': 'hotkey', '3': 3, '4': 1, '5': 9, '10': 'hotkey'},+ {'1': 'paste_available', '3': 4, '4': 1, '5': 8, '10': 'pasteAvailable'},+ {+ '1': 'paste_unavailable_reason',+ '3': 5,+ '4': 1,+ '5': 9,+ '10': 'pasteUnavailableReason'+ },+ {'1': 'hotkey_source', '3': 6, '4': 1, '5': 9, '10': 'hotkeySource'},+ {'1': 'version', '3': 7, '4': 1, '5': 9, '10': 'version'},+ ],+};++/// Descriptor for `QuickPasteStatus`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List quickPasteStatusDescriptor = $convert.base64Decode(+ 'ChBRdWlja1Bhc3RlU3RhdHVzEhgKB3J1bm5pbmcYASABKAhSB3J1bm5pbmcSIQoMaG90a2V5X2'+ 'Vycm9yGAIgASgJUgtob3RrZXlFcnJvchIWCgZob3RrZXkYAyABKAlSBmhvdGtleRInCg9wYXN0'+ 'ZV9hdmFpbGFibGUYBCABKAhSDnBhc3RlQXZhaWxhYmxlEjgKGHBhc3RlX3VuYXZhaWxhYmxlX3'+ 'JlYXNvbhgFIAEoCVIWcGFzdGVVbmF2YWlsYWJsZVJlYXNvbhIjCg1ob3RrZXlfc291cmNlGAYg'+ 'ASgJUgxob3RrZXlTb3VyY2USGAoHdmVyc2lvbhgHIAEoCVIHdmVyc2lvbg==');++@$core.Deprecated('Use quickPasteCommandDescriptor instead')+const QuickPasteCommand$json = {+ '1': 'QuickPasteCommand',+ '2': [+ {'1': 'command', '3': 1, '4': 1, '5': 9, '10': 'command'},+ ],+};++/// Descriptor for `QuickPasteCommand`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List quickPasteCommandDescriptor = $convert.base64Decode(+ 'ChFRdWlja1Bhc3RlQ29tbWFuZBIYCgdjb21tYW5kGAEgASgJUgdjb21tYW5k');@$core.Deprecated('Use listDevicesResponseDescriptor instead')const ListDevicesResponse$json = {@@ -755,6 +876,27 @@ const Config$json = {'5': 9,'10': 'updateSkipVersion'},+ {+ '1': 'quick_paste_disabled',+ '3': 20,+ '4': 1,+ '5': 8,+ '10': 'quickPasteDisabled'+ },+ {+ '1': 'quick_paste_hotkey',+ '3': 21,+ '4': 1,+ '5': 9,+ '10': 'quickPasteHotkey'+ },+ {+ '1': 'quick_paste_copy_only',+ '3': 22,+ '4': 1,+ '5': 8,+ '10': 'quickPasteCopyOnly'+ },],};@@ -774,7 +916,10 @@ final $typed_data.Uint8List configDescriptor = $convert.base64Decode('N0b21fc2lnbmFsaW5nX3VybBgQIAEoCVISY3VzdG9tU2lnbmFsaW5nVXJsEi4KE29mZmljaWFs''X25vdGljZV9hY2sYESABKAlSEW9mZmljaWFsTm90aWNlQWNrEjIKFXVwZGF0ZV9jaGVja19kaX''NhYmxlZBgSIAEoCFITdXBkYXRlQ2hlY2tEaXNhYmxlZBIuChN1cGRhdGVfc2tpcF92ZXJzaW9u'- 'GBMgASgJUhF1cGRhdGVTa2lwVmVyc2lvbg==');+ 'GBMgASgJUhF1cGRhdGVTa2lwVmVyc2lvbhIwChRxdWlja19wYXN0ZV9kaXNhYmxlZBgUIAEoCF'+ 'IScXVpY2tQYXN0ZURpc2FibGVkEiwKEnF1aWNrX3Bhc3RlX2hvdGtleRgVIAEoCVIQcXVpY2tQ'+ 'YXN0ZUhvdGtleRIxChVxdWlja19wYXN0ZV9jb3B5X29ubHkYFiABKAhSEnF1aWNrUGFzdGVDb3'+ 'B5T25seQ==');@$core.Deprecated('Use officialUsageDescriptor instead')const OfficialUsage$json = {