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): store themes and serve them to AI apps over MCP
baiyuze85757caaa202
diff --git a/client-core/cmd/pasteferry-cli/main.go b/client-core/cmd/pasteferry-cli/main.goindex fbe4f5e..c562710 100644--- a/client-core/cmd/pasteferry-cli/main.go+++ b/client-core/cmd/pasteferry-cli/main.go@@ -17,6 +17,7 @@// pasteferry-cli transfers [-v] 最近收到和发出的文件(-v 带上 ID)// pasteferry-cli cancel ID 取消一批传输// pasteferry-cli web [on|off|invite [ADDR]|remove ID] 手机网页传输+// pasteferry-cli mcp MCP 服务(stdio):让 AI 读、改、应用主题,见 design/mcp.mdpackage mainimport (@@ -79,7 +80,7 @@ func main() {reportError(errors.New("缺少命令:version、status、devices、history 或 config get"), 2)}fmt.Fprintln(os.Stderr,- "用法: pasteferry-cli [-json] [-data-dir DIR] <version|status|watch|history|config [get]|devices|nat|pair|join CODE [ADDRESS]|nearby [NAME]|address DEVICE ADDR|send [-relay] [-note TEXT] DEVICE PATH...|transfers [-v]|cancel ID|friends|friend code|add|remove|auto|accept [ID] [always]|decline [ID]|name NAME|avatar PATH|reset|receive-from [off|friends|everyone]|web [on|off|invite [ADDR]|remove ID]>")+ "用法: pasteferry-cli [-json] [-data-dir DIR] <version|status|watch|history|config [get]|devices|nat|pair|join CODE [ADDRESS]|nearby [NAME]|address DEVICE ADDR|send [-relay] [-note TEXT] DEVICE PATH...|transfers [-v]|cancel ID|friends|friend code|add|remove|auto|accept [ID] [always]|decline [ID]|name NAME|avatar PATH|reset|receive-from [off|friends|everyone]|web [on|off|invite [ADDR]|remove ID]|mcp>")os.Exit(2)}@@ -111,6 +112,13 @@ func run(cmd, dataDir string) error {if err != nil {return err}+ // MCP 服务不要求后台服务已经在跑:每次调用工具时才去连+ if cmd == "mcp" {+ if flag.NArg() != 1 {+ return errors.New("用法: pasteferry-cli mcp")+ }+ return serveMCP(os.Stdin, os.Stdout, os.Stderr, daemonDialer(paths))+ }ep, err := rpc.ReadEndpoint(paths.Endpoint)if err != nil {diff --git a/client-core/cmd/pasteferry-cli/mcp.go b/client-core/cmd/pasteferry-cli/mcp.gonew file mode 100644index 0000000..cd56387--- /dev/null+++ b/client-core/cmd/pasteferry-cli/mcp.go@@ -0,0 +1,710 @@+package main++import (+ "bufio"+ "bytes"+ "context"+ "encoding/base64"+ "encoding/json"+ "errors"+ "fmt"+ "io"+ "os"+ "path/filepath"+ "strings"+ "sync"+ "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"++ "github.com/baiyuze/pasteferry/client-core/internal/config"+ "github.com/baiyuze/pasteferry/client-core/internal/rpc"+ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++// pasteferry-cli mcp:stdio 上的 MCP 服务,让 AI 读、校验、保存、应用主题(design/mcp.md)。+//+// 一行一条 JSON-RPC 2.0 消息。stdout 只写协议消息,日志写 stderr。只提供主题与背景图,+// 不碰复制记录、设备、好友。每次调用工具时才连后台服务:AI 客户端常常比后台服务先启动,+// 后台服务重启后也不用重开会话。++// 支持的协议版本,新的在前。客户端要的版本在这里面就照它回,否则回最新的+var mcpVersions = []string{"2025-06-18", "2025-03-26"}++const mcpInstructions = `PasteFerry themes. A theme is a JSON document (call theme_schema for the format and what every color role is used for). ` ++ `Typical flow: theme_list → theme_get a built-in theme with resolved=true as a starting point → write a new theme with your own id and "base" set to that theme, overriding only what you change → theme_validate → fix any contrast warnings → theme_save → theme_apply. ` ++ `Built-in themes ("default", "pixel") cannot be overwritten. Background images must be imported first with background_import, then referenced as "user:<sha256>".`++// themeClient 是 MCP 用到的那几个 RPC;测试里换成假的+type themeClient interface {+ GetConfig(ctx context.Context, in *pb.Empty, opts ...grpc.CallOption) (*pb.Config, error)+ UpdateConfig(ctx context.Context, in *pb.Config, opts ...grpc.CallOption) (*pb.Config, error)+ ListThemes(ctx context.Context, in *pb.Empty, opts ...grpc.CallOption) (*pb.ListThemesResponse, error)+ GetTheme(ctx context.Context, in *pb.GetThemeRequest, opts ...grpc.CallOption) (*pb.ThemeJson, error)+ PutTheme(ctx context.Context, in *pb.PutThemeRequest, opts ...grpc.CallOption) (*pb.PutThemeResponse, error)+ DeleteTheme(ctx context.Context, in *pb.ThemeRef, opts ...grpc.CallOption) (*pb.Empty, error)+ ImportBackground(ctx context.Context, in *pb.ImportBackgroundRequest, opts ...grpc.CallOption) (*pb.BackgroundInfo, error)+ AnalyzeBackground(ctx context.Context, in *pb.BackgroundRef, opts ...grpc.CallOption) (*pb.BackgroundInfo, error)+}++// dialer 连上后台服务,返回带认证 token 的 context 与关闭连接的函数+type dialer func() (themeClient, context.Context, func(), error)++func daemonDialer(paths config.Paths) dialer {+ return func() (themeClient, context.Context, func(), error) {+ ep, err := rpc.ReadEndpoint(paths.Endpoint)+ if err != nil {+ if os.IsNotExist(err) {+ return nil, nil, nil, errors.New("PasteFerry's background service is not running. Open the PasteFerry app (or start the service) and try again")+ }+ return nil, nil, nil, err+ }+ conn, err := grpc.NewClient(fmt.Sprintf("127.0.0.1:%d", ep.Port), grpc.WithTransportCredentials(insecure.NewCredentials()))+ if err != nil {+ return nil, nil, nil, fmt.Errorf("connect to the background service: %w", err)+ }+ ctx := metadata.AppendToOutgoingContext(context.Background(), "x-pasteferry-token", ep.Token)+ return pb.NewDaemonServiceClient(conn), ctx, func() { conn.Close() }, nil+ }+}++type mcpServer struct {+ dial dialer+ out io.Writer+ log io.Writer+ mu sync.Mutex // 写 stdout+ protocol string+}++type rpcRequest struct {+ JSONRPC string `json:"jsonrpc"`+ ID json.RawMessage `json:"id,omitempty"`+ Method string `json:"method"`+ Params json.RawMessage `json:"params,omitempty"`+}++type rpcError struct {+ Code int `json:"code"`+ Message string `json:"message"`+}++type rpcResponse struct {+ JSONRPC string `json:"jsonrpc"`+ ID json.RawMessage `json:"id"`+ Result any `json:"result,omitempty"`+ Error *rpcError `json:"error,omitempty"`+}++const (+ errParse = -32700+ errInvalidRequest = -32600+ errMethodNotFound = -32601+ errInvalidParams = -32602+)++func serveMCP(in io.Reader, out, log io.Writer, dial dialer) error {+ s := &mcpServer{dial: dial, out: out, log: log, protocol: mcpVersions[0]}+ sc := bufio.NewScanner(in)+ // 背景图可以 base64 直接给,一行可能很长+ sc.Buffer(make([]byte, 64<<10), 96<<20)+ for sc.Scan() {+ line := bytes.TrimSpace(sc.Bytes())+ if len(line) == 0 {+ continue+ }+ if line[0] == '[' {+ // 2025-03-26 允许批量;2025-06-18 去掉了,照样处理不报错+ var batch []json.RawMessage+ if err := json.Unmarshal(line, &batch); err != nil || len(batch) == 0 {+ s.write(rpcResponse{JSONRPC: "2.0", ID: json.RawMessage("null"), Error: &rpcError{errParse, "parse error"}})+ continue+ }+ var replies []rpcResponse+ for _, m := range batch {+ if r, ok := s.handle(m); ok {+ replies = append(replies, r)+ }+ }+ if len(replies) > 0 {+ s.write(replies)+ }+ continue+ }+ if r, ok := s.handle(line); ok {+ s.write(r)+ }+ }+ return sc.Err()+}++func (s *mcpServer) write(v any) {+ data, err := json.Marshal(v)+ if err != nil {+ fmt.Fprintln(s.log, "mcp: encode:", err)+ return+ }+ s.mu.Lock()+ defer s.mu.Unlock()+ s.out.Write(append(data, '\n'))+}++// handle 处理一条消息。通知(没有 id)不回复,第二个返回值为 false+func (s *mcpServer) handle(raw []byte) (rpcResponse, bool) {+ var req rpcRequest+ if err := json.Unmarshal(raw, &req); err != nil {+ return rpcResponse{JSONRPC: "2.0", ID: json.RawMessage("null"), Error: &rpcError{errParse, "parse error"}}, true+ }+ notification := len(req.ID) == 0+ if req.JSONRPC != "2.0" || req.Method == "" {+ if notification {+ return rpcResponse{}, false+ }+ return rpcResponse{JSONRPC: "2.0", ID: req.ID, Error: &rpcError{errInvalidRequest, "invalid request"}}, true+ }+ if notification {+ // notifications/initialized、notifications/cancelled 等:不需要做什么+ return rpcResponse{}, false+ }+ result, rerr := s.dispatch(req.Method, req.Params)+ resp := rpcResponse{JSONRPC: "2.0", ID: req.ID}+ if rerr != nil {+ resp.Error = rerr+ } else {+ resp.Result = result+ }+ return resp, true+}++func (s *mcpServer) dispatch(method string, params json.RawMessage) (any, *rpcError) {+ switch method {+ case "initialize":+ var p struct {+ ProtocolVersion string `json:"protocolVersion"`+ }+ _ = json.Unmarshal(params, &p)+ s.protocol = mcpVersions[0]+ for _, v := range mcpVersions {+ if v == p.ProtocolVersion {+ s.protocol = v+ }+ }+ return map[string]any{+ "protocolVersion": s.protocol,+ "capabilities": map[string]any{+ "tools": map[string]any{"listChanged": false},+ "resources": map[string]any{"listChanged": false, "subscribe": false},+ },+ "serverInfo": map[string]any{"name": "pasteferry", "title": "PasteFerry", "version": version},+ "instructions": mcpInstructions,+ }, nil+ case "ping":+ return map[string]any{}, nil+ case "tools/list":+ return map[string]any{"tools": mcpTools()}, nil+ case "tools/call":+ var p struct {+ Name string `json:"name"`+ Arguments json.RawMessage `json:"arguments"`+ }+ if err := json.Unmarshal(params, &p); err != nil || p.Name == "" {+ return nil, &rpcError{errInvalidParams, "tools/call needs a tool name"}+ }+ tool, ok := toolHandlers[p.Name]+ if !ok {+ return nil, &rpcError{errInvalidParams, fmt.Sprintf("unknown tool %q", p.Name)}+ }+ args := map[string]any{}+ if len(p.Arguments) > 0 && string(p.Arguments) != "null" {+ if err := json.Unmarshal(p.Arguments, &args); err != nil {+ return nil, &rpcError{errInvalidParams, "arguments must be a JSON object"}+ }+ }+ data, err := tool(s, args)+ return s.toolResult(data, err), nil+ case "resources/list":+ return s.listResources(), nil+ case "resources/templates/list":+ return map[string]any{"resourceTemplates": []any{map[string]any{+ "uriTemplate": "pasteferry://themes/{id}",+ "name": "theme",+ "title": "PasteFerry theme",+ "description": "A theme as saved (base not merged in). Use theme_get with resolved=true for the complete theme.",+ "mimeType": "application/json",+ }}}, nil+ case "resources/read":+ var p struct {+ URI string `json:"uri"`+ }+ if err := json.Unmarshal(params, &p); err != nil || p.URI == "" {+ return nil, &rpcError{errInvalidParams, "resources/read needs a uri"}+ }+ return s.readResource(p.URI)+ }+ return nil, &rpcError{errMethodNotFound, fmt.Sprintf("method %q not found", method)}+}++// toolResult 把工具的结果包成 MCP 的 CallToolResult。工具出错不算协议错误:isError 加一句人能读的话+func (s *mcpServer) toolResult(data any, err error) map[string]any {+ if err != nil {+ return map[string]any{+ "content": []any{map[string]any{"type": "text", "text": describeRPCError(err)}},+ "isError": true,+ }+ }+ text, _ := json.MarshalIndent(data, "", " ")+ out := map[string]any{"content": []any{map[string]any{"type": "text", "text": string(text)}}, "isError": false}+ // 2025-06-18 起有结构化结果;它必须是对象+ if s.protocol >= "2025-06-18" {+ if _, ok := data.(map[string]any); ok {+ out["structuredContent"] = data+ }+ }+ return out+}++// describeRPCError 把 gRPC 错误换成给 AI 看的话:后台服务的消息本来就是给人看的,去掉状态码前缀+func describeRPCError(err error) string {+ st, ok := status.FromError(err)+ if !ok {+ return err.Error()+ }+ switch st.Code() {+ case codes.Unavailable:+ return "Cannot reach PasteFerry's background service. Make sure PasteFerry is running, then try again."+ case codes.Unauthenticated:+ return "The background service rejected the connection. Restart PasteFerry and try again."+ case codes.Unimplemented:+ return "This version of PasteFerry does not support themes. Update PasteFerry and try again."+ case codes.DeadlineExceeded:+ return "The background service did not answer in time. Try again."+ }+ return st.Message()+}++// call 连上后台服务、执行 f、断开。每次调用都重新连:后台服务重启后照样能用+func (s *mcpServer) call(timeout time.Duration, f func(context.Context, themeClient) (any, error)) (any, error) {+ client, ctx, closeConn, err := s.dial()+ if err != nil {+ return nil, err+ }+ defer closeConn()+ ctx, cancel := context.WithTimeout(ctx, timeout)+ defer cancel()+ return f(ctx, client)+}++// ───────────────────────────── 资源 ─────────────────────────────++const schemaURI = "pasteferry://themes/schema"++func (s *mcpServer) listResources() map[string]any {+ resources := []any{map[string]any{+ "uri": schemaURI,+ "name": "theme-schema",+ "title": "PasteFerry theme format",+ "description": "JSON Schema of a PasteFerry theme, with what every color role is used for and which contrast it must reach.",+ "mimeType": "application/schema+json",+ }}+ // 后台服务没开时只列格式说明+ list, err := s.call(5*time.Second, func(ctx context.Context, c themeClient) (any, error) {+ return c.ListThemes(ctx, &pb.Empty{})+ })+ if err == nil {+ for _, t := range list.(*pb.ListThemesResponse).GetThemes() {+ resources = append(resources, map[string]any{+ "uri": "pasteferry://themes/" + t.GetId(),+ "name": t.GetId(),+ "title": themeTitle(t),+ "description": themeDescription(t),+ "mimeType": "application/json",+ })+ }+ } else {+ fmt.Fprintln(s.log, "mcp: list themes:", describeRPCError(err))+ }+ return map[string]any{"resources": resources}+}++func themeTitle(t *pb.ThemeInfo) string {+ if n := t.GetName()["en"]; n != "" {+ return n+ }+ return t.GetId()+}++func themeDescription(t *pb.ThemeInfo) string {+ if t.GetBuiltin() {+ return "Built-in theme (read-only)."+ }+ base := t.GetBase()+ if base == "" {+ base = "default"+ }+ return "Custom theme based on " + base + "."+}++func (s *mcpServer) readResource(uri string) (any, *rpcError) {+ contents := func(mime, text string) map[string]any {+ return map[string]any{"contents": []any{map[string]any{"uri": uri, "mimeType": mime, "text": text}}}+ }+ if uri == schemaURI {+ data, _ := json.MarshalIndent(themeSchema(), "", " ")+ return contents("application/schema+json", string(data)), nil+ }+ id, ok := strings.CutPrefix(uri, "pasteferry://themes/")+ if !ok || id == "" || strings.Contains(id, "/") {+ return nil, &rpcError{-32002, "resource not found: " + uri}+ }+ got, err := s.call(5*time.Second, func(ctx context.Context, c themeClient) (any, error) {+ return c.GetTheme(ctx, &pb.GetThemeRequest{Id: id})+ })+ if err != nil {+ if status.Code(err) == codes.NotFound {+ return nil, &rpcError{-32002, "resource not found: " + uri}+ }+ return nil, &rpcError{-32603, describeRPCError(err)}+ }+ return contents("application/json", got.(*pb.ThemeJson).GetJson()), nil+}++// ───────────────────────────── 工具 ─────────────────────────────++type toolHandler func(s *mcpServer, args map[string]any) (any, error)++var toolHandlers = map[string]toolHandler{+ "theme_list": toolThemeList,+ "theme_get": toolThemeGet,+ "theme_schema": func(*mcpServer, map[string]any) (any, error) { return themeSchema(), nil },+ "theme_validate": func(s *mcpServer, args map[string]any) (any, error) { return putTheme(s, args, true) },+ "theme_save": func(s *mcpServer, args map[string]any) (any, error) { return putTheme(s, args, false) },+ "theme_apply": toolThemeApply,+ "theme_delete": toolThemeDelete,+ "background_import": toolBackgroundImport,+ "background_analyze": toolBackgroundAnalyze,+}++func obj(props map[string]any, required ...string) map[string]any {+ o := map[string]any{"type": "object", "properties": props, "additionalProperties": false}+ if len(required) > 0 {+ o["required"] = required+ }+ return o+}++func mcpTools() []any {+ themeArg := map[string]any{+ "type": []string{"object", "string"},+ "description": "The theme document (a JSON object, or the same as a JSON string). Format: theme_schema. It needs schema=1 and your own id; set base to the theme you start from and include only what you change.",+ }+ readOnly := map[string]any{"readOnlyHint": true, "openWorldHint": false}+ return []any{+ map[string]any{+ "name": "theme_list",+ "title": "List themes",+ "description": "List the built-in and custom themes, plus which theme is in use, the light/dark mode setting and whether the CRT scanline effect is on.",+ "inputSchema": obj(map[string]any{}),+ "annotations": readOnly,+ },+ map[string]any{+ "name": "theme_get",+ "title": "Get a theme",+ "description": "Get one theme as JSON. With resolved=true (default) its base is merged in, so every color role and option is present — use this to see a built-in theme's exact values before deriving your own.",+ "inputSchema": obj(map[string]any{+ "id": map[string]any{"type": "string", "description": "Theme id from theme_list, e.g. \"default\" or \"pixel\"."},+ "resolved": map[string]any{"type": "boolean", "description": "Merge the base theme in (default true). false returns the theme exactly as saved.", "default": true},+ }, "id"),+ "annotations": readOnly,+ },+ map[string]any{+ "name": "theme_schema",+ "title": "Theme format",+ "description": "JSON Schema of a theme. Explains every color role (where it appears and which contrast it must reach), shapes, fonts, motion and background options. Read this before writing a theme.",+ "inputSchema": obj(map[string]any{}),+ "annotations": readOnly,+ },+ map[string]any{+ "name": "theme_validate",+ "title": "Check a theme",+ "description": "Check a theme without saving it: format errors come back as an error; contrast problems come back as warnings (foreground/background role, actual ratio, required minimum). Fix warnings before saving.",+ "inputSchema": obj(map[string]any{"theme": themeArg}, "theme"),+ "annotations": readOnly,+ },+ map[string]any{+ "name": "theme_save",+ "title": "Save a theme",+ "description": "Save a custom theme (creates it or replaces the custom theme with the same id). Returns its id and any contrast warnings. Built-in theme ids cannot be used. Saving does not switch to it; call theme_apply.",+ "inputSchema": obj(map[string]any{"theme": themeArg}, "theme"),+ "annotations": map[string]any{"readOnlyHint": false, "destructiveHint": false, "idempotentHint": true, "openWorldHint": false},+ },+ map[string]any{+ "name": "theme_apply",+ "title": "Use a theme",+ "description": "Switch PasteFerry to a theme on this device. The main window, Quick Paste and the phone app update immediately. Optionally also set light/dark mode.",+ "inputSchema": obj(map[string]any{+ "id": map[string]any{"type": "string", "description": "Theme id from theme_list."},+ "mode": map[string]any{"type": "string", "enum": []string{"system", "light", "dark"}, "description": "Light/dark mode. Omit to keep the current setting."},+ }, "id"),+ "annotations": map[string]any{"readOnlyHint": false, "destructiveHint": false, "idempotentHint": true, "openWorldHint": false},+ },+ map[string]any{+ "name": "theme_delete",+ "title": "Delete a theme",+ "description": "Delete a custom theme. If it is in use, PasteFerry switches back to the default theme. Fails for built-in themes and for themes other themes use as their base.",+ "inputSchema": obj(map[string]any{"id": map[string]any{"type": "string", "description": "Custom theme id."}}, "id"),+ "annotations": map[string]any{"readOnlyHint": false, "destructiveHint": true, "idempotentHint": true, "openWorldHint": false},+ },+ map[string]any{+ "name": "background_import",+ "title": "Import a background image",+ "description": "Import a background image from a file on this computer or from base64 data (no URLs). The image is re-encoded without metadata (EXIF/GPS removed) and analyzed. Reference it in a theme as background.image = \"user:<sha256>\". The analysis gives average luminance, how busy it is, its main colors (good accent candidates) and the minimum scrim opacity that keeps text readable.",+ "inputSchema": obj(map[string]any{+ "path": map[string]any{"type": "string", "description": "Path of a PNG, JPEG or GIF file on this computer."},+ "base64": map[string]any{"type": "string", "description": "Image bytes as base64 (a data: URI prefix is allowed). Use instead of path."},+ }),+ "annotations": map[string]any{"readOnlyHint": false, "destructiveHint": false, "idempotentHint": true, "openWorldHint": false},+ },+ map[string]any{+ "name": "background_analyze",+ "title": "Analyze a background image",+ "description": "Analysis of an already imported background image: luminance, how busy it is, main colors and the minimum scrim opacity for readable text.",+ "inputSchema": obj(map[string]any{"sha256": map[string]any{"type": "string", "description": "The sha256 returned by background_import (the part after \"user:\")."}}, "sha256"),+ "annotations": readOnly,+ },+ }+}++func str(args map[string]any, key string) string {+ v, _ := args[key].(string)+ return strings.TrimSpace(v)+}++var modeNames = map[pb.ThemeMode]string{+ pb.ThemeMode_THEME_MODE_UNSPECIFIED: "system",+ pb.ThemeMode_THEME_MODE_LIGHT: "light",+ pb.ThemeMode_THEME_MODE_DARK: "dark",+}++func currentThemeID(c *pb.Config) string {+ if c.GetThemeId() == "" {+ return "default"+ }+ return c.GetThemeId()+}++func toolThemeList(s *mcpServer, _ map[string]any) (any, error) {+ return s.call(5*time.Second, func(ctx context.Context, c themeClient) (any, error) {+ cfg, err := c.GetConfig(ctx, &pb.Empty{})+ if err != nil {+ return nil, err+ }+ list, err := c.ListThemes(ctx, &pb.Empty{})+ if err != nil {+ return nil, err+ }+ themes := []any{}+ for _, t := range list.GetThemes() {+ base := t.GetBase()+ if base == "" && !t.GetBuiltin() {+ base = "default"+ }+ themes = append(themes, map[string]any{"id": t.GetId(), "name": t.GetName(), "builtin": t.GetBuiltin(), "base": base})+ }+ return map[string]any{+ "current": currentThemeID(cfg),+ "mode": modeNames[cfg.GetThemeMode()],+ "scanlines": cfg.GetThemeScanlines(),+ "themes": themes,+ }, nil+ })+}++func toolThemeGet(s *mcpServer, args map[string]any) (any, error) {+ id := str(args, "id")+ if id == "" {+ return nil, errors.New("id is required")+ }+ resolved := true+ if v, ok := args["resolved"].(bool); ok {+ resolved = v+ }+ return s.call(5*time.Second, func(ctx context.Context, c themeClient) (any, error) {+ got, err := c.GetTheme(ctx, &pb.GetThemeRequest{Id: id, Resolved: resolved})+ if err != nil {+ return nil, err+ }+ var doc map[string]any+ if err := json.Unmarshal([]byte(got.GetJson()), &doc); err != nil {+ return nil, fmt.Errorf("the saved theme is not valid JSON: %w", err)+ }+ return doc, nil+ })+}++// themeJSON 取工具参数里的主题:对象或 JSON 字符串都行+func themeJSON(args map[string]any) (string, error) {+ switch v := args["theme"].(type) {+ case string:+ if !json.Valid([]byte(v)) {+ return "", errors.New("theme is not valid JSON")+ }+ return v, nil+ case map[string]any:+ data, err := json.Marshal(v)+ return string(data), err+ }+ return "", errors.New("theme is required: pass the theme document as a JSON object")+}++func putTheme(s *mcpServer, args map[string]any, dryRun bool) (any, error) {+ doc, err := themeJSON(args)+ if err != nil {+ return nil, err+ }+ return s.call(10*time.Second, func(ctx context.Context, c themeClient) (any, error) {+ resp, err := c.PutTheme(ctx, &pb.PutThemeRequest{Json: doc, DryRun: dryRun})+ if err != nil {+ return nil, err+ }+ warnings := []any{}+ for _, w := range resp.GetWarnings() {+ warnings = append(warnings, map[string]any{+ "mode": w.GetMode(), "foreground": w.GetForeground(), "background": w.GetBackground(),+ "ratio": w.GetRatio(), "minimum": w.GetMinimum(),+ })+ }+ out := map[string]any{"id": resp.GetId(), "warnings": warnings}+ if dryRun {+ out["valid"] = true+ } else {+ out["saved"] = true+ }+ return out, nil+ })+}++func toolThemeApply(s *mcpServer, args map[string]any) (any, error) {+ id := str(args, "id")+ if id == "" {+ return nil, errors.New("id is required")+ }+ mode, hasMode := args["mode"].(string)+ var want pb.ThemeMode+ if hasMode {+ found := false+ for m, name := range modeNames {+ if name == mode {+ want, found = m, true+ }+ }+ if !found {+ return nil, fmt.Errorf("mode must be system, light or dark, not %q", mode)+ }+ }+ return s.call(5*time.Second, func(ctx context.Context, c themeClient) (any, error) {+ cfg, err := c.GetConfig(ctx, &pb.Empty{})+ if err != nil {+ return nil, err+ }+ if id == "default" {+ cfg.ThemeId = ""+ } else {+ cfg.ThemeId = id+ }+ if hasMode {+ cfg.ThemeMode = want+ }+ next, err := c.UpdateConfig(ctx, cfg)+ if err != nil {+ return nil, err+ }+ return map[string]any{"current": currentThemeID(next), "mode": modeNames[next.GetThemeMode()]}, nil+ })+}++func toolThemeDelete(s *mcpServer, args map[string]any) (any, error) {+ id := str(args, "id")+ if id == "" {+ return nil, errors.New("id is required")+ }+ return s.call(5*time.Second, func(ctx context.Context, c themeClient) (any, error) {+ if _, err := c.DeleteTheme(ctx, &pb.ThemeRef{Id: id}); err != nil {+ return nil, err+ }+ return map[string]any{"deleted": id}, nil+ })+}++func backgroundResult(info *pb.BackgroundInfo) map[string]any {+ colors := info.GetColors()+ if colors == nil {+ colors = []string{}+ }+ return map[string]any{+ "sha256": info.GetSha256(),+ "reference": "user:" + info.GetSha256(),+ "width": info.GetWidth(),+ "height": info.GetHeight(),+ "format": info.GetFormat(),+ "luminance": info.GetLuminance(),+ "luminance_spread": info.GetLuminanceSpread(),+ "colors": colors,+ "min_scrim_dark": info.GetMinScrimDark(),+ "min_scrim_light": info.GetMinScrimLight(),+ }+}++func toolBackgroundImport(s *mcpServer, args map[string]any) (any, error) {+ path, data := str(args, "path"), str(args, "base64")+ if (path == "") == (data == "") {+ return nil, errors.New("give exactly one of path or base64")+ }+ req := &pb.ImportBackgroundRequest{}+ if path != "" {+ if strings.Contains(path, "://") {+ return nil, errors.New("URLs are not accepted: download the image to a file first, then pass its path")+ }+ abs, err := filepath.Abs(path)+ if err != nil {+ return nil, err+ }+ req.Path = abs+ } else {+ if strings.HasPrefix(data, "data:") {+ if _, after, ok := strings.Cut(data, ","); ok {+ data = after+ }+ }+ raw, err := base64.StdEncoding.DecodeString(data)+ if err != nil {+ if raw, err = base64.RawStdEncoding.DecodeString(data); err != nil {+ return nil, errors.New("base64 is not valid base64 data")+ }+ }+ req.Image = raw+ }+ return s.call(60*time.Second, func(ctx context.Context, c themeClient) (any, error) {+ info, err := c.ImportBackground(ctx, req)+ if err != nil {+ return nil, err+ }+ return backgroundResult(info), nil+ })+}++func toolBackgroundAnalyze(s *mcpServer, args map[string]any) (any, error) {+ sha := strings.TrimPrefix(str(args, "sha256"), "user:")+ if sha == "" {+ return nil, errors.New("sha256 is required")+ }+ return s.call(30*time.Second, func(ctx context.Context, c themeClient) (any, error) {+ info, err := c.AnalyzeBackground(ctx, &pb.BackgroundRef{Sha256: sha})+ if err != nil {+ return nil, err+ }+ return backgroundResult(info), nil+ })+}diff --git a/client-core/cmd/pasteferry-cli/mcp_schema.go b/client-core/cmd/pasteferry-cli/mcp_schema.gonew file mode 100644index 0000000..2f41bfd--- /dev/null+++ b/client-core/cmd/pasteferry-cli/mcp_schema.go@@ -0,0 +1,126 @@+package main++import "github.com/baiyuze/pasteferry/client-core/internal/theme"++// themeSchema 是主题格式的 JSON Schema(design/themes.md 第 3 节),给 AI 看:+// 每个颜色角色写清楚用在界面哪里、要和谁达到多少对比度。取值范围与后台服务的校验一致+// (client-core/internal/theme/theme.go 的 validate)。++// roleDocs 与 theme.Roles 一一对应;测试会检查没有漏+var roleDocs = map[string]string{+ "accent": "Brand/accent color. Filled primary buttons, the selected-item bar, links, progress, focus outlines, small highlights. Use sparingly. onAccent must reach 4.5:1 on it.",+ "background": "Main content area behind every page (the largest area). text and textDim need 4.5:1 on it, textFaint 3:1.",+ "sidebar": "Left navigation column. Usually one step darker than background in dark mode, or a slightly tinted/darker tone in light mode.",+ "surface": "Panels, grouped lists, cards, dialogs, menus — sits on background. text and textDim need 4.5:1 on it, textFaint 3:1.",+ "border": "Low-contrast outline of panels and cards. Should be subtle: a little different from surface/background.",+ "borderStrong": "Outline of interactive controls (buttons, inputs, segmented controls, switches) and floating layers (dialogs, menus, previews). More visible than border. If omitted it equals border.",+ "separator": "Lines between rows inside a panel; subtler than border.",+ "text": "Primary text and titles.",+ "textDim": "Secondary text: descriptions, metadata (time, size, source device), inactive icons.",+ "textFaint": "Least important text: placeholders, hints, counters, disabled labels.",+ "selection": "Background of the selected sidebar item; in the pixel corner style also the face of raised buttons and the selected segment.",+ "hover": "Overlay drawn on hovered rows and buttons. Use a translucent color in #AARRGGBB, e.g. #0A000000 on light themes or #0FFFFFFF on dark ones.",+ "fill": "Recessed areas: segmented-control track, input fields (pixel style), progress-bar track, code blocks.",+ "online": "Status color for connected/success; shown as a small dot and as text on background.",+ "warning": "Status color for warnings; shown as a dot and as text on background.",+ "danger": "Errors and destructive actions; shown as text, dots and icons on background.",+ "onAccent": "Text and icons drawn on accent (primary buttons, badges). Must reach 4.5:1 against accent — dark text for light accents, white for dark accents.",+ "inverse": "Background of toasts and tooltips (inverted from the theme, e.g. near-black on a light theme).",+ "onInverse": "Text on inverse.",+ "bevelLight": "Pixel corner style only: 2px highlight on the top/left inner edge of raised controls (bottom/right of sunken ones). Translucent white, e.g. #14FFFFFF. Fully transparent disables it.",+ "bevelDark": "Pixel corner style only: 2px shade on the bottom/right inner edge of raised controls (top/left of sunken ones). Translucent black, e.g. #59000000.",+ "shadow": "Color of the hard offset shadow under floating layers when shape.shadow is \"hard\". Usually translucent black.",+}++func themeSchema() map[string]any {+ color := func(desc string) map[string]any {+ return map[string]any{+ "type": "string",+ "pattern": "^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$",+ "description": desc + " Format #RRGGBB, or #AARRGGBB with alpha first.",+ }+ }+ roles := map[string]any{}+ for _, r := range theme.Roles {+ roles[r] = color(roleDocs[r])+ }+ palette := map[string]any{+ "type": "object",+ "description": "Colors for one mode. Every role is optional: omitted roles are taken from the base theme.",+ "properties": roles,+ "additionalProperties": false,+ }+ num := func(lo, hi float64, desc string) map[string]any {+ return map[string]any{"type": "number", "minimum": lo, "maximum": hi, "description": desc}+ }+ enum := func(desc string, values ...string) map[string]any {+ return map[string]any{"type": "string", "enum": values, "description": desc}+ }+ strictObj := func(desc string, props map[string]any) map[string]any {+ return map[string]any{"type": "object", "description": desc, "properties": props, "additionalProperties": false}+ }+ return map[string]any{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "$id": schemaURI,+ "title": "PasteFerry theme",+ "description": "A PasteFerry theme. Only schema and id are required; everything else falls back to the base theme, so a theme can be as small as one accent color. Contrast rules checked on save: text and textDim ≥ 4.5:1 on background and surface, textFaint ≥ 3:1, onAccent ≥ 4.5:1 on accent. Built-in themes: \"default\" (quiet macOS-like, rounded, soft shadows) and \"pixel\" (pixel font, cut corners with 2px borders, bevels, hard shadows, stepped motion).",+ "type": "object",+ "required": []string{"schema", "id"},+ "additionalProperties": false,+ "properties": map[string]any{+ "schema": map[string]any{"const": theme.Schema, "description": "Format version. Always 1."},+ "id": map[string]any{+ "type": "string", "pattern": "^[a-z0-9-]{1,40}$",+ "description": "Unique id: lowercase letters, digits and hyphens, at most 40. Cannot be \"default\" or \"pixel\". Saving with an existing custom id replaces that theme.",+ },+ "name": map[string]any{+ "type": "object",+ "description": "Display name per UI language, 1–40 characters each. Keys: zh-Hans, zh-Hant-TW, zh-Hant-HK, en, ja.",+ "additionalProperties": map[string]any{"type": "string", "minLength": 1, "maxLength": 40},+ },+ "base": map[string]any{+ "type": "string",+ "description": "Theme to inherit from: \"default\", \"pixel\" or a custom theme id (at most 2 levels of custom themes). Default \"default\". Pick the base whose shapes and fonts you want, then override colors.",+ },+ "modes": strictObj("Colors for light and dark mode. The user picks light, dark or follow-system, so provide both when you change colors.", map[string]any{+ "light": palette,+ "dark": palette,+ }),+ "typography": strictObj("Fonts. Only fonts bundled with PasteFerry are allowed.", map[string]any{+ "family": enum("Body font: system (the platform UI font) or FusionPixel (12px bitmap pixel font with Chinese and Japanese).", "system", "FusionPixel"),+ "mono": enum("Monospace font for codes and fingerprints: system or FusionPixelMono.", "system", "FusionPixelMono"),+ "sizes": map[string]any{+ "type": "array", "maxItems": 6, "items": num(8, 48, "Font size in logical pixels."),+ "description": "Allowed font sizes; every text snaps to the nearest one. Use [12, 24] with FusionPixel so the pixels stay crisp; [] means any size.",+ },+ }),+ "shape": strictObj("Corners, borders and shadows.", map[string]any{+ "radius": strictObj("Corner radii for round corners.", map[string]any{+ "sm": num(0, 32, "Controls (buttons, inputs). Default theme: 6."),+ "md": num(0, 32, "Panels and cards. Default theme: 10."),+ "lg": num(0, 32, "Dialogs and large panels. Default theme: 14."),+ }),+ "corner": enum("round: rounded corners. pixel: square corners with one notched pixel, 2px borders, bevels on controls.", "round", "pixel"),+ "borderWidth": num(0, 4, "Border width of panels, buttons and inputs. Default 1, pixel 2."),+ "unit": num(1, 8, "Size of one pixel step for the pixel corner style (notch, bevel, hard shadow offset). Default 2."),+ "shadow": enum("soft: blurred shadows. hard: solid offset shadows under floating layers only (pixel look). none: flat.", "soft", "hard", "none"),+ }),+ "motion": enum("Animation style: smooth transitions, stepped (frame-by-frame, pixel look) or reduced (no animation).", "smooth", "stepped", "reduced"),+ "icons": enum("Icon set: system (macOS/Fluent style) or pixel (Pixelarticons).", "system", "pixel"),+ "background": strictObj("Optional background image behind the pages. Import images with background_import first.", map[string]any{+ "image": map[string]any{"type": "string", "pattern": "^(asset:[a-z0-9-]{1,40}|user:[0-9a-f]{64})$", "description": "\"user:<sha256>\" from background_import, or \"asset:<name>\" for a bundled image."},+ "imageDark": map[string]any{"type": "string", "pattern": "^(asset:[a-z0-9-]{1,40}|user:[0-9a-f]{64})$", "description": "Different image for dark mode; omit to use image in both modes."},+ "fit": enum("How the image fills the window. tile repeats it (for small pixel-art patterns).", "cover", "contain", "tile"),+ "align": enum("Which part stays visible when cropped.", "center", "top", "bottom", "left", "right", "topLeft", "topRight", "bottomLeft", "bottomRight"),+ "blur": num(0, 40, "Blur radius; higher keeps text more readable over busy photos."),+ "scrim": strictObj("Color laid over the image so text stays readable. Use at least the min_scrim value from the image analysis.", map[string]any{+ "color": color("Scrim color: usually black for dark themes and white for light ones."),+ "opacity": num(0, 1, "Scrim opacity."),+ }),+ "surfaceOpacity": num(0.6, 1, "Opacity of panels over the image; lower shows more of the image. Raise it when the image is busy (high luminance_spread)."),+ "scope": map[string]any{"type": "array", "items": enum("Where to show the image.", "main", "picker", "mobile"), "description": "Windows that show the image; default main and mobile."},+ "accentFromImage": map[string]any{"type": "boolean", "description": "Use the image's main color as accent."},+ }),+ },+ }+}diff --git a/client-core/cmd/pasteferry-cli/mcp_test.go b/client-core/cmd/pasteferry-cli/mcp_test.gonew file mode 100644index 0000000..88dd9d1--- /dev/null+++ b/client-core/cmd/pasteferry-cli/mcp_test.go@@ -0,0 +1,326 @@+package main++import (+ "bytes"+ "context"+ "encoding/base64"+ "encoding/json"+ "fmt"+ "image"+ "image/color"+ "image/png"+ "strings"+ "testing"++ "github.com/baiyuze/pasteferry/client-core/internal/config"+ "github.com/baiyuze/pasteferry/client-core/internal/rpc"+ "github.com/baiyuze/pasteferry/client-core/internal/theme"+)++// startThemeDaemon 起一个真实的后台服务(只有配置与主题),返回它的数据目录+func startThemeDaemon(t *testing.T) (string, *config.Config) {+ t.Helper()+ dir := t.TempDir()+ paths := config.PathsUnder(dir)+ cfg := config.Default()+ s := rpc.NewServer(rpc.Deps{+ LoadConfig: func() config.Config { return cfg },+ SaveConfig: func(c config.Config) error { cfg = c; return nil },+ Themes: theme.NewStore(paths),+ }, rpc.NewHub(), "mcp-test-token")+ ctx, cancel := context.WithCancel(context.Background())+ t.Cleanup(cancel)+ port, _, err := s.Serve(ctx)+ if err != nil {+ t.Fatal(err)+ }+ if err := rpc.WriteEndpoint(paths.Endpoint, rpc.Endpoint{Port: port, Token: "mcp-test-token", PID: 1}); err != nil {+ t.Fatal(err)+ }+ return dir, &cfg+}++// mcpSession 把几条请求按行喂给 MCP 服务,返回按 id 索引的回复。stdout 上每一行都必须是 JSON-RPC 消息+func mcpSession(t *testing.T, dir string, messages ...any) map[float64]map[string]any {+ t.Helper()+ var in bytes.Buffer+ for _, m := range messages {+ line, err := json.Marshal(m)+ if err != nil {+ t.Fatal(err)+ }+ in.Write(append(line, '\n'))+ }+ var out, log bytes.Buffer+ if err := serveMCP(&in, &out, &log, daemonDialer(config.PathsUnder(dir))); err != nil {+ t.Fatal(err)+ }+ replies := map[float64]map[string]any{}+ for _, line := range strings.Split(strings.TrimSpace(out.String()), "\n") {+ if line == "" {+ continue+ }+ var r map[string]any+ if err := json.Unmarshal([]byte(line), &r); err != nil {+ t.Fatalf("stdout 上有不是 JSON 的内容:%q", line)+ }+ if r["jsonrpc"] != "2.0" {+ t.Fatalf("不是 JSON-RPC 2.0:%v", r)+ }+ id, _ := r["id"].(float64)+ replies[id] = r+ }+ return replies+}++func req(id int, method string, params any) map[string]any {+ m := map[string]any{"jsonrpc": "2.0", "id": id, "method": method}+ if params != nil {+ m["params"] = params+ }+ return m+}++func call(id int, tool string, args any) map[string]any {+ return req(id, "tools/call", map[string]any{"name": tool, "arguments": args})+}++func initialize(version string) []any {+ return []any{+ req(1, "initialize", map[string]any{"protocolVersion": version, "capabilities": map[string]any{}, "clientInfo": map[string]any{"name": "test", "version": "1"}}),+ map[string]any{"jsonrpc": "2.0", "method": "notifications/initialized"},+ }+}++// toolData 取工具结果的 JSON 内容;isError 不对时失败+func toolData(t *testing.T, reply map[string]any, wantError bool) map[string]any {+ t.Helper()+ result, ok := reply["result"].(map[string]any)+ if !ok {+ t.Fatalf("没有 result:%v", reply)+ }+ if result["isError"] != wantError {+ t.Fatalf("isError=%v,想要 %v:%v", result["isError"], wantError, result)+ }+ text := result["content"].([]any)[0].(map[string]any)["text"].(string)+ if wantError {+ return map[string]any{"text": text}+ }+ var data map[string]any+ if err := json.Unmarshal([]byte(text), &data); err != nil {+ t.Fatalf("工具的文字结果不是 JSON:%q", text)+ }+ return data+}++func TestMCPInitializeAndList(t *testing.T) {+ dir, _ := startThemeDaemon(t)+ for _, version := range []string{"2025-06-18", "2025-03-26", "2099-01-01"} {+ replies := mcpSession(t, dir, append(initialize(version),+ req(2, "tools/list", nil),+ req(3, "resources/list", nil),+ req(4, "ping", nil),+ req(5, "nope", nil),+ )...)+ if len(replies) != 5 {+ t.Fatalf("通知不该有回复,其余每条一条:%v", replies)+ }+ got := replies[1]["result"].(map[string]any)["protocolVersion"]+ want := version+ if version == "2099-01-01" {+ want = "2025-06-18"+ }+ if got != want {+ t.Errorf("协议版本:要 %s 回了 %v", version, got)+ }+ tools := replies[2]["result"].(map[string]any)["tools"].([]any)+ names := map[string]bool{}+ for _, tool := range tools {+ m := tool.(map[string]any)+ names[m["name"].(string)] = true+ if m["description"] == "" || m["inputSchema"].(map[string]any)["type"] != "object" {+ t.Errorf("工具要有说明与对象类型的参数:%v", m)+ }+ }+ for _, n := range []string{"theme_list", "theme_get", "theme_schema", "theme_validate", "theme_save", "theme_apply", "theme_delete", "background_import", "background_analyze"} {+ if !names[n] {+ t.Errorf("少了工具 %s", n)+ }+ }+ for n := range names {+ if !strings.HasPrefix(n, "theme_") && !strings.HasPrefix(n, "background_") {+ t.Errorf("只能提供主题与背景图的工具,不该有 %s", n)+ }+ }+ uris := map[string]bool{}+ for _, r := range replies[3]["result"].(map[string]any)["resources"].([]any) {+ uris[r.(map[string]any)["uri"].(string)] = true+ }+ if !uris[schemaURI] || !uris["pasteferry://themes/default"] || !uris["pasteferry://themes/pixel"] {+ t.Errorf("资源里要有格式说明与内置主题:%v", uris)+ }+ if replies[5]["error"].(map[string]any)["code"] != float64(errMethodNotFound) {+ t.Errorf("不认识的方法:%v", replies[5])+ }+ }+}++func TestMCPThemeWorkflow(t *testing.T) {+ dir, cfg := startThemeDaemon(t)+ mint := map[string]any{+ "schema": 1, "id": "mint", "base": "pixel",+ "name": map[string]any{"en": "Mint"},+ "modes": map[string]any{"dark": map[string]any{"accent": "#7CF5C4"}},+ }+ bad := map[string]any{"schema": 1, "id": "faint", "modes": map[string]any{"dark": map[string]any{"textDim": "#2A2A2C"}}}+ replies := mcpSession(t, dir, append(initialize("2025-06-18"),+ call(2, "theme_validate", map[string]any{"theme": mint}),+ call(3, "theme_list", map[string]any{}),+ call(4, "theme_validate", map[string]any{"theme": bad}),+ call(5, "theme_save", map[string]any{"theme": mint}),+ call(6, "theme_apply", map[string]any{"id": "mint", "mode": "dark"}),+ call(7, "theme_list", nil),+ call(8, "theme_get", map[string]any{"id": "mint"}),+ call(9, "theme_save", map[string]any{"theme": map[string]any{"schema": 1, "id": "pixel"}}),+ call(10, "theme_validate", map[string]any{"theme": `{"schema":1,"id":"x","shape":{"corner":"star"}}`}),+ req(11, "resources/read", map[string]any{"uri": "pasteferry://themes/mint"}),+ req(12, "resources/read", map[string]any{"uri": schemaURI}),+ call(13, "theme_schema", nil),+ call(14, "theme_delete", map[string]any{"id": "mint"}),+ )...)++ if v := toolData(t, replies[2], false); v["valid"] != true || v["id"] != "mint" {+ t.Errorf("校验:%v", v)+ }+ if list := toolData(t, replies[3], false); len(list["themes"].([]any)) != 2 {+ t.Errorf("只校验不该保存:%v", list)+ }+ if w := toolData(t, replies[4], false)["warnings"].([]any); len(w) == 0 || w[0].(map[string]any)["foreground"] != "textDim" {+ t.Errorf("对比度不够要有警告:%v", w)+ }+ if v := toolData(t, replies[5], false); v["saved"] != true {+ t.Errorf("保存:%v", v)+ }+ if v := toolData(t, replies[6], false); v["current"] != "mint" || v["mode"] != "dark" {+ t.Errorf("应用:%v", v)+ }+ if list := toolData(t, replies[7], false); list["current"] != "mint" || list["mode"] != "dark" || len(list["themes"].([]any)) != 3 {+ t.Errorf("列表:%v", list)+ }+ if structured := replies[7]["result"].(map[string]any)["structuredContent"]; structured == nil {+ t.Error("2025-06-18 应当带 structuredContent")+ }+ got := toolData(t, replies[8], false)+ dark := got["modes"].(map[string]any)["dark"].(map[string]any)+ if dark["accent"] != "#7CF5C4" || dark["background"] == nil || got["typography"] == nil {+ t.Errorf("resolved 的主题应当补齐 base:%v", got)+ }+ if e := toolData(t, replies[9], true)["text"].(string); !strings.Contains(e, "内置") {+ t.Errorf("内置主题不能覆盖:%q", e)+ }+ if e := toolData(t, replies[10], true)["text"].(string); !strings.Contains(e, "corner") {+ t.Errorf("格式错误要说清楚:%q", e)+ }+ content := replies[11]["result"].(map[string]any)["contents"].([]any)[0].(map[string]any)+ if !strings.Contains(content["text"].(string), `"mint"`) || content["mimeType"] != "application/json" {+ t.Errorf("读主题资源:%v", content)+ }+ schema := replies[12]["result"].(map[string]any)["contents"].([]any)[0].(map[string]any)["text"].(string)+ if !strings.Contains(schema, "onAccent") || !strings.Contains(schema, "4.5") {+ t.Error("格式说明里要讲清颜色角色与对比度")+ }+ if toolData(t, replies[13], false)["properties"] == nil {+ t.Error("theme_schema 要返回 JSON Schema")+ }+ if v := toolData(t, replies[14], false); v["deleted"] != "mint" {+ t.Errorf("删除:%v", v)+ }+ if cfg.ThemeID != "" {+ t.Errorf("删掉正在用的主题后应当换回默认:%q", cfg.ThemeID)+ }+}++func TestMCPBackground(t *testing.T) {+ dir, _ := startThemeDaemon(t)+ img := image.NewRGBA(image.Rect(0, 0, 8, 8))+ for i := range img.Pix {+ img.Pix[i] = 255+ }+ img.Set(0, 0, color.RGBA{255, 0, 0, 255})+ var buf bytes.Buffer+ png.Encode(&buf, img)+ encoded := "data:image/png;base64," + base64.StdEncoding.EncodeToString(buf.Bytes())++ replies := mcpSession(t, dir, append(initialize("2025-03-26"),+ call(2, "background_import", map[string]any{"base64": encoded}),+ call(3, "background_import", map[string]any{"path": "https://example.com/a.png"}),+ call(4, "background_import", map[string]any{}),+ )...)+ info := toolData(t, replies[2], false)+ sha := info["sha256"].(string)+ if len(sha) != 64 || info["reference"] != "user:"+sha || info["luminance"].(float64) < 0.8 {+ t.Fatalf("导入:%v", info)+ }+ if _, ok := replies[2]["result"].(map[string]any)["structuredContent"]; ok {+ t.Error("2025-03-26 没有 structuredContent")+ }+ if e := toolData(t, replies[3], true)["text"].(string); !strings.Contains(e, "URL") {+ t.Errorf("不接受网址:%q", e)+ }+ toolData(t, replies[4], true)++ replies = mcpSession(t, dir, append(initialize("2025-06-18"),+ call(2, "background_analyze", map[string]any{"sha256": "user:" + sha}),+ call(3, "theme_save", map[string]any{"theme": map[string]any{"schema": 1, "id": "photo", "background": map[string]any{"image": "user:" + sha, "fit": "tile"}}}),+ )...)+ if again := toolData(t, replies[2], false); again["sha256"] != sha || again["format"] != "png" {+ t.Errorf("重新分析:%v", again)+ }+ toolData(t, replies[3], false)+}++func TestMCPWithoutDaemon(t *testing.T) {+ dir := t.TempDir()+ replies := mcpSession(t, dir, append(initialize("2025-06-18"),+ call(2, "theme_list", nil),+ call(3, "theme_schema", nil),+ req(4, "resources/list", nil),+ )...)+ if e := toolData(t, replies[2], true)["text"].(string); !strings.Contains(e, "not running") {+ t.Errorf("后台服务没开要说清楚:%q", e)+ }+ toolData(t, replies[3], false)+ if r := replies[4]["result"].(map[string]any)["resources"].([]any); len(r) != 1 {+ t.Errorf("后台服务没开时只列格式说明:%v", r)+ }+}++func TestMCPMalformedInput(t *testing.T) {+ var out, log bytes.Buffer+ in := strings.NewReader("not json\n" + `{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"nope"}}` + "\n" ++ `[{"jsonrpc":"2.0","id":8,"method":"ping"},{"jsonrpc":"2.0","method":"notifications/initialized"}]` + "\n")+ if err := serveMCP(in, &out, &log, func() (themeClient, context.Context, func(), error) {+ return nil, nil, nil, fmt.Errorf("unused")+ }); err != nil {+ t.Fatal(err)+ }+ lines := strings.Split(strings.TrimSpace(out.String()), "\n")+ if len(lines) != 3 {+ t.Fatalf("三行输入、三条回复:%q", out.String())+ }+ if !strings.Contains(lines[0], `"code":-32700`) || !strings.Contains(lines[1], `"code":-32602`) || !strings.HasPrefix(lines[2], "[") {+ t.Errorf("错误码不对:%q", lines)+ }+}++// 每个颜色角色都要有给 AI 看的说明+func TestRoleDocsComplete(t *testing.T) {+ for _, r := range theme.Roles {+ if roleDocs[r] == "" {+ t.Errorf("颜色角色 %s 缺说明", r)+ }+ }+ if len(roleDocs) != len(theme.Roles) {+ t.Error("roleDocs 里有多余的角色")+ }+}diff --git a/client-core/cmd/pasteferryd/main.go b/client-core/cmd/pasteferryd/main.goindex a3983e8..a7e26e0 100644--- a/client-core/cmd/pasteferryd/main.go+++ b/client-core/cmd/pasteferryd/main.go@@ -35,6 +35,7 @@ import ("github.com/baiyuze/pasteferry/client-core/internal/sendpeer""github.com/baiyuze/pasteferry/client-core/internal/store"syncengine "github.com/baiyuze/pasteferry/client-core/internal/sync"+ "github.com/baiyuze/pasteferry/client-core/internal/theme""github.com/baiyuze/pasteferry/client-core/internal/transport/lan""github.com/baiyuze/pasteferry/client-core/internal/transport/p2p""github.com/baiyuze/pasteferry/client-core/internal/update"@@ -600,6 +601,7 @@ func run(dataDir string) error {})deps := rpc.Deps{Store: db,+ Themes: theme.NewStore(paths),Paths: paths,Version: version,DeviceID: id.DeviceID,diff --git a/client-core/internal/config/config.go b/client-core/internal/config/config.goindex a567d4e..92ddfdf 100644--- a/client-core/internal/config/config.go+++ b/client-core/internal/config/config.go@@ -99,6 +99,13 @@ type Config struct {EveryoneUntil int64 `json:"everyone_until,omitempty"`// DisplayName 是好友看到的名字,空字符串表示系统的用户全名DisplayName string `json:"display_name,omitempty"`++ // ThemeID 是界面用的主题(design/themes.md):空字符串表示默认主题,否则是内置或自定义主题的 id+ ThemeID string `json:"theme_id,omitempty"`+ // ThemeMode 是浅色还是深色:"light"、"dark";空字符串表示跟随系统+ ThemeMode string `json:"theme_mode,omitempty"`+ // ThemeScanlines 打开像素主题的 CRT 扫描线效果,默认关+ ThemeScanlines bool `json:"theme_scanlines,omitempty"`}// 谁可以给我发文件@@ -236,6 +243,27 @@ func (c *Config) Validate() {if len(c.DisplayName) > 64 {c.DisplayName = c.DisplayName[:64]}+ if !ValidThemeID(c.ThemeID) || c.ThemeID == "default" {+ c.ThemeID = ""+ }+ switch c.ThemeMode {+ case "", "light", "dark":+ default:+ c.ThemeMode = ""+ }+}++// ValidThemeID 报告 id 能不能当主题的 id 用:小写字母、数字和连字符,最长 40 个字符。空字符串也算(默认主题)+func ValidThemeID(id string) bool {+ if len(id) > 40 {+ return false+ }+ for _, r := range id {+ if !(r >= 'a' && r <= 'z' || r >= '0' && r <= '9' || r == '-') {+ return false+ }+ }+ return true}// ─────────────────────────── 目录布局 ───────────────────────────@@ -250,6 +278,9 @@ type Paths struct {DB string// daemon 启动后把 gRPC 端口和一次性 token 写在这里,供 UI 发现Endpoint string+ // 自定义主题(<id>.json)与导入的背景图,见 design/themes.md+ Themes string+ Backgrounds string}func DefaultPaths() (Paths, error) {@@ -294,6 +325,9 @@ func pathsUnder(root string) Paths {Config: filepath.Join(root, "config.json"),DB: filepath.Join(root, "pasteferry.db"),Endpoint: filepath.Join(root, "daemon.json"),++ Themes: filepath.Join(root, "themes"),+ Backgrounds: filepath.Join(root, "backgrounds"),}}diff --git a/client-core/internal/rpc/convert.go b/client-core/internal/rpc/convert.goindex a963217..b3358cb 100644--- a/client-core/internal/rpc/convert.go+++ b/client-core/internal/rpc/convert.go@@ -98,9 +98,32 @@ func configToProto(c config.Config) *pb.Config {ReceiveFrom: receiveFromToProto(c),EveryoneUntilUnix: c.EveryoneUntil,DisplayName: c.DisplayName,+ ThemeId: c.ThemeID,+ ThemeMode: themeModeToProto(c.ThemeMode),+ ThemeScanlines: c.ThemeScanlines,}}+func themeModeToProto(m string) pb.ThemeMode {+ switch m {+ case "light":+ return pb.ThemeMode_THEME_MODE_LIGHT+ case "dark":+ return pb.ThemeMode_THEME_MODE_DARK+ }+ return pb.ThemeMode_THEME_MODE_UNSPECIFIED+}++func themeModeFromProto(m pb.ThemeMode) string {+ switch m {+ case pb.ThemeMode_THEME_MODE_LIGHT:+ return "light"+ case pb.ThemeMode_THEME_MODE_DARK:+ return "dark"+ }+ return ""+}+// receiveFromToProto 报告此刻实际的接收范围:「所有人」到时间了就是「仅限好友」func receiveFromToProto(c config.Config) string {return c.EffectiveReceiveFrom(time.Now())@@ -183,6 +206,10 @@ func configFromProto(in *pb.Config, base config.Config) config.Config {if d := in.GetSentRetentionDays(); d > 0 {c.SentRetentionDays = int(d)}+ // 空字符串就是默认主题、跟随系统,与「没设置」同义,直接覆盖+ c.ThemeID = in.GetThemeId()+ c.ThemeMode = themeModeFromProto(in.GetThemeMode())+ c.ThemeScanlines = in.GetThemeScanlines()// 空字符串就是系统的「下载」文件夹c.ReceiveDir = in.GetReceiveDir()c.ReceiveDisabled = in.GetReceiveDisabled()diff --git a/client-core/internal/rpc/server.go b/client-core/internal/rpc/server.goindex 64e7d20..9099805 100644--- a/client-core/internal/rpc/server.go+++ b/client-core/internal/rpc/server.go@@ -22,6 +22,7 @@ import ("github.com/baiyuze/pasteferry/client-core/internal/diag""github.com/baiyuze/pasteferry/client-core/internal/peers""github.com/baiyuze/pasteferry/client-core/internal/store"+ "github.com/baiyuze/pasteferry/client-core/internal/theme""github.com/baiyuze/pasteferry/client-core/internal/transport/lan"pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1")@@ -106,6 +107,8 @@ type Deps struct {SubmitText func(ctx context.Context, text string) (store.Clip, error)// SubmitFiles 把发送页里选的照片和文件当成本机复制;为 nil 时返回 UnimplementedSubmitFiles func(ctx context.Context, paths []string) (store.Clip, error)+ // Themes 保存自定义主题与背景图(design/themes.md);为空时主题相关的调用报 Unimplemented+ Themes *theme.Store}func (s *Server) GetNotificationStatus(ctx context.Context, _ *pb.Empty) (*pb.NotificationStatus, error) {@@ -407,6 +410,9 @@ func (s *Server) GetConfig(context.Context, *pb.Empty) (*pb.Config, error) {func (s *Server) UpdateConfig(_ context.Context, in *pb.Config) (*pb.Config, error) {c := configFromProto(in, s.deps.LoadConfig())c.Validate()+ if c.ThemeID != "" && s.deps.Themes != nil && !s.deps.Themes.Exists(c.ThemeID) {+ return nil, status.Errorf(codes.InvalidArgument, "没有主题 %q", c.ThemeID)+ }if err := s.deps.SaveConfig(c); err != nil {return nil, status.Errorf(codes.Internal, "保存配置: %v", err)}diff --git a/client-core/internal/rpc/themes.go b/client-core/internal/rpc/themes.gonew file mode 100644index 0000000..9f80e48--- /dev/null+++ b/client-core/internal/rpc/themes.go@@ -0,0 +1,178 @@+package rpc++import (+ "context"+ "errors"++ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/status"++ "github.com/baiyuze/pasteferry/client-core/internal/theme"+ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++// 主题与背景图,见 design/themes.md。正在用哪一套主题存在配置里(theme_id、theme_mode),+// 改了走 UpdateConfig 与 config_changed 事件;这里管主题与背景图本身。++func EventThemesChanged(ids ...string) *pb.Event {+ return &pb.Event{Payload: &pb.Event_ThemesChanged{ThemesChanged: &pb.ThemesChanged{Ids: ids}}}+}++func (s *Server) themes() (*theme.Store, error) {+ if s.deps.Themes == nil {+ return nil, status.Error(codes.Unimplemented, "这个版本的后台服务不支持主题")+ }+ return s.deps.Themes, nil+}++// themeError 把主题包的错误换成 gRPC 状态码,消息直接给界面显示+func themeError(err error) error {+ var inv *theme.InvalidError+ switch {+ case errors.As(err, &inv):+ return status.Error(codes.InvalidArgument, inv.Msg)+ case errors.Is(err, theme.ErrNotFound):+ return status.Error(codes.NotFound, err.Error())+ case errors.Is(err, theme.ErrBuiltin):+ return status.Error(codes.PermissionDenied, err.Error())+ case errors.Is(err, theme.ErrIsBase), errors.Is(err, theme.ErrInUse):+ return status.Error(codes.FailedPrecondition, err.Error())+ case errors.Is(err, theme.ErrNotImage):+ return status.Error(codes.InvalidArgument, err.Error())+ }+ return status.Errorf(codes.Internal, "%v", err)+}++func (s *Server) ListThemes(context.Context, *pb.Empty) (*pb.ListThemesResponse, error) {+ store, err := s.themes()+ if err != nil {+ return nil, err+ }+ infos, err := store.List()+ if err != nil {+ return nil, themeError(err)+ }+ out := &pb.ListThemesResponse{}+ for _, i := range infos {+ out.Themes = append(out.Themes, &pb.ThemeInfo{Id: i.ID, Name: i.Name, Builtin: i.Builtin, Base: i.Base})+ }+ return out, nil+}++func (s *Server) GetTheme(_ context.Context, req *pb.GetThemeRequest) (*pb.ThemeJson, error) {+ store, err := s.themes()+ if err != nil {+ return nil, err+ }+ data, err := store.Get(req.GetId(), req.GetResolved())+ if err != nil {+ return nil, themeError(err)+ }+ return &pb.ThemeJson{Json: string(data)}, nil+}++func (s *Server) PutTheme(_ context.Context, req *pb.PutThemeRequest) (*pb.PutThemeResponse, error) {+ store, err := s.themes()+ if err != nil {+ return nil, err+ }+ put := store.Put+ if req.GetDryRun() {+ put = store.Check+ }+ id, warnings, err := put([]byte(req.GetJson()))+ if err != nil {+ return nil, themeError(err)+ }+ out := &pb.PutThemeResponse{Id: id}+ for _, w := range warnings {+ out.Warnings = append(out.Warnings, &pb.ThemeWarning{+ Mode: w.Mode, Foreground: w.Foreground, Background: w.Background, Ratio: w.Ratio, Minimum: w.Minimum,+ })+ }+ if !req.GetDryRun() {+ s.hub.Publish(EventThemesChanged(id))+ }+ return out, nil+}++func (s *Server) DeleteTheme(_ context.Context, req *pb.ThemeRef) (*pb.Empty, error) {+ store, err := s.themes()+ if err != nil {+ return nil, err+ }+ id := req.GetId()+ if err := store.Delete(id); err != nil {+ return nil, themeError(err)+ }+ // 正在用的主题没了:换回默认主题(保存配置时会推 config_changed)+ if c := s.deps.LoadConfig(); c.ThemeID == id {+ c.ThemeID = ""+ if err := s.deps.SaveConfig(c); err != nil {+ return nil, status.Errorf(codes.Internal, "保存配置: %v", err)+ }+ }+ s.hub.Publish(EventThemesChanged(id))+ return &pb.Empty{}, nil+}++func (s *Server) ImportBackground(_ context.Context, req *pb.ImportBackgroundRequest) (*pb.BackgroundInfo, error) {+ store, err := s.themes()+ if err != nil {+ return nil, err+ }+ info, err := store.ImportBackground(req.GetImage(), req.GetPath())+ if err != nil {+ return nil, themeError(err)+ }+ return backgroundInfo(info), nil+}++func (s *Server) AnalyzeBackground(_ context.Context, req *pb.BackgroundRef) (*pb.BackgroundInfo, error) {+ store, err := s.themes()+ if err != nil {+ return nil, err+ }+ info, err := store.AnalyzeBackground(req.GetSha256())+ if err != nil {+ return nil, themeError(err)+ }+ return backgroundInfo(info), nil+}++func backgroundInfo(info theme.BackgroundInfo) *pb.BackgroundInfo {+ return &pb.BackgroundInfo{+ Sha256: info.SHA256,+ Width: int32(info.Width),+ Height: int32(info.Height),+ Format: info.Format,+ Luminance: info.Luminance,+ LuminanceSpread: info.LuminanceSpread,+ Colors: info.Colors,+ MinScrimDark: info.MinScrimDark,+ MinScrimLight: info.MinScrimLight,+ }+}++func (s *Server) GetBackground(_ context.Context, req *pb.GetBackgroundRequest) (*pb.BackgroundImage, error) {+ store, err := s.themes()+ if err != nil {+ return nil, err+ }+ data, format, err := store.Background(req.GetSha256(), req.GetBlurred())+ if err != nil {+ return nil, themeError(err)+ }+ return &pb.BackgroundImage{Data: data, Format: format}, nil+}++func (s *Server) DeleteBackground(_ context.Context, req *pb.BackgroundRef) (*pb.Empty, error) {+ store, err := s.themes()+ if err != nil {+ return nil, err+ }+ if err := store.DeleteBackground(req.GetSha256()); err != nil {+ return nil, themeError(err)+ }+ return &pb.Empty{}, nil+}diff --git a/client-core/internal/rpc/themes_test.go b/client-core/internal/rpc/themes_test.gonew file mode 100644index 0000000..34c2ce3--- /dev/null+++ b/client-core/internal/rpc/themes_test.go@@ -0,0 +1,110 @@+package rpc++import (+ "context"+ "testing"++ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/status"++ "github.com/baiyuze/pasteferry/client-core/internal/config"+ "github.com/baiyuze/pasteferry/client-core/internal/theme"+ pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1"+)++func themeServer(t *testing.T) (*Server, *config.Config, <-chan *pb.Event) {+ t.Helper()+ cfg := config.Default()+ hub := NewHub()+ events, cancel := hub.Subscribe()+ t.Cleanup(cancel)+ s := NewServer(Deps{+ LoadConfig: func() config.Config { return cfg },+ SaveConfig: func(c config.Config) error { cfg = c; return nil },+ Themes: theme.NewStore(config.PathsUnder(t.TempDir())),+ }, hub, "")+ return s, &cfg, events+}++func TestThemeModeRoundTrip(t *testing.T) {+ c := config.Default()+ c.ThemeID, c.ThemeMode, c.ThemeScanlines = "pixel", "dark", true+ got := configFromProto(configToProto(c), config.Default())+ if got.ThemeID != "pixel" || got.ThemeMode != "dark" || !got.ThemeScanlines {+ t.Fatalf("主题设置没有原样往返:%+v", got)+ }+ if configToProto(config.Default()).GetThemeMode() != pb.ThemeMode_THEME_MODE_UNSPECIFIED {+ t.Fatal("默认应当跟随系统")+ }+}++func TestUpdateConfigRejectsUnknownTheme(t *testing.T) {+ s, cfg, _ := themeServer(t)+ in := configToProto(*cfg)+ in.ThemeId = "nope"+ if _, err := s.UpdateConfig(context.Background(), in); status.Code(err) != codes.InvalidArgument {+ t.Fatalf("不存在的主题应当拒绝:%v", err)+ }+ in.ThemeId = "pixel"+ in.ThemeMode = pb.ThemeMode_THEME_MODE_LIGHT+ out, err := s.UpdateConfig(context.Background(), in)+ if err != nil || out.GetThemeId() != "pixel" || cfg.ThemeMode != "light" {+ t.Fatalf("换成 pixel:%v %+v", err, cfg)+ }+}++func TestDeleteCurrentThemeFallsBack(t *testing.T) {+ s, cfg, events := themeServer(t)+ ctx := context.Background()+ res, err := s.PutTheme(ctx, &pb.PutThemeRequest{Json: `{"schema":1,"id":"mine","base":"pixel"}`})+ if err != nil || res.GetId() != "mine" {+ t.Fatal(err)+ }+ if e := <-events; e.GetThemesChanged().GetIds()[0] != "mine" {+ t.Fatalf("保存后应当推 themes_changed:%v", e)+ }+ cfg.ThemeID = "mine"+ if _, err := s.DeleteTheme(ctx, &pb.ThemeRef{Id: "mine"}); err != nil {+ t.Fatal(err)+ }+ if cfg.ThemeID != "" {+ t.Fatalf("删掉正在用的主题后应当换回默认主题:%q", cfg.ThemeID)+ }+ if _, err := s.DeleteTheme(ctx, &pb.ThemeRef{Id: "default"}); status.Code(err) != codes.PermissionDenied {+ t.Fatalf("内置主题不能删:%v", err)+ }+ if _, err := s.PutTheme(ctx, &pb.PutThemeRequest{Json: `{"schema":1,"id":"x","modes":{"light":{"text":"#EEEEEE"}}}`}); err != nil {+ t.Fatal(err)+ }+ r, err := s.PutTheme(ctx, &pb.PutThemeRequest{Json: `{"schema":1,"id":"x","modes":{"light":{"text":"#EEEEEE"}}}`})+ if err != nil || len(r.GetWarnings()) == 0 {+ t.Fatalf("浅色上的浅字应当有对比度警告:%v %v", err, r)+ }+ if _, err := s.PutTheme(ctx, &pb.PutThemeRequest{Json: `{"id":"x"}`}); status.Code(err) != codes.InvalidArgument {+ t.Fatalf("格式不对应当是 InvalidArgument:%v", err)+ }+ list, err := s.ListThemes(ctx, &pb.Empty{})+ if err != nil || len(list.GetThemes()) != 3 || !list.GetThemes()[0].GetBuiltin() {+ t.Fatalf("列表不对:%v %v", err, list)+ }+}++func TestPutThemeDryRun(t *testing.T) {+ s, _, events := themeServer(t)+ ctx := context.Background()+ res, err := s.PutTheme(ctx, &pb.PutThemeRequest{Json: `{"schema":1,"id":"try","base":"pixel"}`, DryRun: true})+ if err != nil || res.GetId() != "try" {+ t.Fatal(res, err)+ }+ if _, err := s.GetTheme(ctx, &pb.GetThemeRequest{Id: "try"}); status.Code(err) != codes.NotFound {+ t.Fatalf("只校验时不该保存:%v", err)+ }+ select {+ case ev := <-events:+ t.Fatalf("只校验时不该推送事件:%v", ev)+ default:+ }+ if _, err := s.PutTheme(ctx, &pb.PutThemeRequest{Json: `{"schema":1}`, DryRun: true}); status.Code(err) != codes.InvalidArgument {+ t.Fatalf("格式不对:%v", err)+ }+}diff --git a/client-core/internal/theme/background.go b/client-core/internal/theme/background.gonew file mode 100644index 0000000..9c27e0d--- /dev/null+++ b/client-core/internal/theme/background.go@@ -0,0 +1,581 @@+package theme++import (+ "bytes"+ "crypto/sha256"+ "encoding/binary"+ "encoding/hex"+ "errors"+ "image"+ "image/color"+ "image/draw"+ _ "image/gif" // 注册 GIF 解码器:动图只取第一帧+ "image/jpeg"+ "image/png"+ "io"+ "math"+ "os"+ "path/filepath"+ "regexp"+ "sort"+ "strings"++ "github.com/baiyuze/pasteferry/client-core/internal/imagepreview"+)++// 背景图(design/themes.md 第 7 节)。只用 Go 自带的解码器(内存安全):PNG、JPEG、GIF;+// HEIC、TIFF 在 Mac 上先由系统转成 PNG。重新编码时 EXIF 等元数据都不写回去——照片里常有 GPS 坐标,+// 分享主题时不能把位置带出去;拍摄方向先按 EXIF 转正。++const (+ maxBackgroundSource = 20 << 20 // 输入最大 20 MB+ maxBackgroundPixels = 64 << 20 // 愿意解码的最大像素数+ maxBackgroundSide = 3840 // 存下来的长边上限+ blurredSide = 960 // 模糊版的长边+ tileSide = 512 // 不超过这么大的 PNG 当作平铺小图(像素画),原样保留 PNG+)++var ErrNotImage = errors.New("不是能处理的图片(支持 PNG、JPEG、GIF)")++var shaRef = regexp.MustCompile(`^[0-9a-f]{64}$`)++// BackgroundInfo 是导入后的背景图与它的分析结果+type BackgroundInfo struct {+ SHA256 string+ Width, Height int+ Format string // jpeg、png+ Luminance float64+ LuminanceSpread float64+ Colors []string+ MinScrimDark float64+ MinScrimLight float64+}++// ImportBackground 导入一张背景图:data 为空时读 path。同一张图导入两次得到同一个 sha256+func (s *Store) ImportBackground(data []byte, path string) (BackgroundInfo, error) {+ if len(data) == 0 {+ var err error+ if data, err = readImageFile(path); err != nil {+ return BackgroundInfo{}, err+ }+ }+ if len(data) > maxBackgroundSource {+ return BackgroundInfo{}, ErrNotImage+ }+ cfg, format, err := image.DecodeConfig(bytes.NewReader(data))+ if err != nil || cfg.Width <= 0 || cfg.Height <= 0 || int64(cfg.Width)*int64(cfg.Height) > maxBackgroundPixels {+ return BackgroundInfo{}, ErrNotImage+ }+ src, _, err := image.Decode(bytes.NewReader(data))+ if err != nil {+ return BackgroundInfo{}, ErrNotImage+ }+ img := toRGBA(src)+ if format == "jpeg" {+ img = orient(img, jpegOrientation(data))+ }++ var main []byte+ outFormat := "jpeg"+ w, h := img.Rect.Dx(), img.Rect.Dy()+ if format == "png" && w <= tileSide && h <= tileSide {+ outFormat = "png"+ if main, err = encodePNG(img); err != nil {+ return BackgroundInfo{}, err+ }+ } else {+ if w, h = fitInside(w, h, maxBackgroundSide); w != img.Rect.Dx() || h != img.Rect.Dy() {+ img = scale(img, w, h)+ }+ if main, err = encodeJPEG(onWhite(img), 88); err != nil {+ return BackgroundInfo{}, err+ }+ }+ sum := sha256.Sum256(main)+ sha := hex.EncodeToString(sum[:])++ bw, bh := fitInside(w, h, blurredSide)+ blurred := blur(onWhite(scale(img, bw, bh)), max(2, bw/80))+ blurData, err := encodeJPEG(blurred, 80)+ if err != nil {+ return BackgroundInfo{}, err+ }++ s.mu.Lock()+ defer s.mu.Unlock()+ if err := os.MkdirAll(s.backgrounds, 0o700); err != nil {+ return BackgroundInfo{}, err+ }+ if err := writeAtomic(s.backgroundPath(sha, outFormat, false), main); err != nil {+ return BackgroundInfo{}, err+ }+ if err := writeAtomic(s.backgroundPath(sha, "jpeg", true), blurData); err != nil {+ return BackgroundInfo{}, err+ }+ info := analyze(img)+ info.SHA256, info.Width, info.Height, info.Format = sha, w, h, outFormat+ return info, nil+}++func (s *Store) backgroundPath(sha, format string, blurred bool) string {+ switch {+ case blurred:+ return filepath.Join(s.backgrounds, sha+".blur.jpg")+ case format == "png":+ return filepath.Join(s.backgrounds, sha+".png")+ default:+ return filepath.Join(s.backgrounds, sha+".jpg")+ }+}++// Background 返回背景图的字节与格式+func (s *Store) Background(sha string, blurred bool) ([]byte, string, error) {+ if !shaRef.MatchString(sha) {+ return nil, "", ErrNotFound+ }+ if blurred {+ data, err := os.ReadFile(s.backgroundPath(sha, "jpeg", true))+ if errors.Is(err, os.ErrNotExist) {+ return nil, "", ErrNotFound+ }+ return data, "jpeg", err+ }+ for _, f := range []string{"jpeg", "png"} {+ data, err := os.ReadFile(s.backgroundPath(sha, f, false))+ if err == nil {+ return data, f, nil+ }+ if !errors.Is(err, os.ErrNotExist) {+ return nil, "", err+ }+ }+ return nil, "", ErrNotFound+}++// AnalyzeBackground 重新分析一张已导入的背景图。分析的是保存下来的文件(重新编码过),+// 结果与导入时的可能差一点点+func (s *Store) AnalyzeBackground(sha string) (BackgroundInfo, error) {+ data, format, err := s.Background(sha, false)+ if err != nil {+ return BackgroundInfo{}, err+ }+ src, _, err := image.Decode(bytes.NewReader(data))+ if err != nil {+ return BackgroundInfo{}, ErrNotImage+ }+ img := toRGBA(src)+ info := analyze(img)+ info.SHA256, info.Width, info.Height, info.Format = sha, img.Rect.Dx(), img.Rect.Dy(), format+ return info, nil+}++func (s *Store) hasBackground(sha string) bool {+ for _, f := range []string{"jpeg", "png"} {+ if _, err := os.Stat(s.backgroundPath(sha, f, false)); err == nil {+ return true+ }+ }+ return false+}++// DeleteBackground 删掉一张背景图;还有自定义主题引用它时返回 ErrInUse+func (s *Store) DeleteBackground(sha string) error {+ if !shaRef.MatchString(sha) {+ return ErrNotFound+ }+ s.mu.Lock()+ defer s.mu.Unlock()+ if !s.hasBackground(sha) {+ return ErrNotFound+ }+ infos, err := s.List()+ if err != nil {+ return err+ }+ for _, info := range infos {+ if info.Builtin {+ continue+ }+ t, _, err := s.load(info.ID)+ if err != nil {+ continue+ }+ for _, img := range s.userImages(t) {+ if img == sha {+ return ErrInUse+ }+ }+ }+ for _, p := range []string{s.backgroundPath(sha, "jpeg", false), s.backgroundPath(sha, "png", false), s.backgroundPath(sha, "jpeg", true)} {+ if err := os.Remove(p); err != nil && !errors.Is(err, os.ErrNotExist) {+ return err+ }+ }+ return nil+}++// ─────────────────────────── 图片处理 ───────────────────────────++func readImageFile(path string) ([]byte, error) {+ if path == "" || !imagepreview.Previewable(path) {+ return nil, ErrNotImage+ }+ src, err := imagepreview.Prepare(path)+ if err != nil {+ return nil, ErrNotImage+ }+ switch strings.ToLower(filepath.Ext(src)) {+ case ".png", ".jpg", ".jpeg", ".gif":+ default:+ return nil, ErrNotImage+ }+ f, err := os.Open(src)+ if err != nil {+ return nil, err+ }+ defer f.Close()+ data, err := io.ReadAll(io.LimitReader(f, maxBackgroundSource+1))+ if err != nil {+ return nil, err+ }+ if len(data) > maxBackgroundSource {+ return nil, ErrNotImage+ }+ return data, nil+}++func toRGBA(src image.Image) *image.RGBA {+ b := src.Bounds()+ dst := image.NewRGBA(image.Rect(0, 0, b.Dx(), b.Dy()))+ draw.Draw(dst, dst.Rect, src, b.Min, draw.Src)+ return dst+}++// jpegOrientation 读 JPEG 里 EXIF 的拍摄方向(1 到 8),读不到时是 1+func jpegOrientation(data []byte) int {+ if len(data) < 4 || data[0] != 0xFF || data[1] != 0xD8 {+ return 1+ }+ i := 2+ for i+4 <= len(data) {+ if data[i] != 0xFF {+ return 1+ }+ marker := data[i+1]+ if marker == 0xDA || marker == 0xD9 { // 图像数据开始了,后面不会再有 EXIF+ return 1+ }+ size := int(binary.BigEndian.Uint16(data[i+2:]))+ if size < 2 || i+2+size > len(data) {+ return 1+ }+ seg := data[i+4 : i+2+size]+ if marker == 0xE1 && len(seg) > 14 && string(seg[:6]) == "Exif\x00\x00" {+ return tiffOrientation(seg[6:])+ }+ i += 2 + size+ }+ return 1+}++func tiffOrientation(t []byte) int {+ if len(t) < 8 {+ return 1+ }+ var bo binary.ByteOrder+ switch string(t[:2]) {+ case "II":+ bo = binary.LittleEndian+ case "MM":+ bo = binary.BigEndian+ default:+ return 1+ }+ off := int(bo.Uint32(t[4:]))+ if off+2 > len(t) {+ return 1+ }+ n := int(bo.Uint16(t[off:]))+ for k := 0; k < n; k++ {+ e := off + 2 + k*12+ if e+12 > len(t) {+ return 1+ }+ if bo.Uint16(t[e:]) == 0x0112 {+ if v := int(bo.Uint16(t[e+8:])); v >= 1 && v <= 8 {+ return v+ }+ return 1+ }+ }+ return 1+}++// orient 按 EXIF 方向把图转正+func orient(src *image.RGBA, o int) *image.RGBA {+ if o <= 1 || o > 8 {+ return src+ }+ w, h := src.Rect.Dx(), src.Rect.Dy()+ dw, dh := w, h+ if o >= 5 {+ dw, dh = h, w+ }+ dst := image.NewRGBA(image.Rect(0, 0, dw, dh))+ for y := 0; y < h; y++ {+ for x := 0; x < w; x++ {+ var dx, dy int+ switch o {+ case 2:+ dx, dy = w-1-x, y+ case 3:+ dx, dy = w-1-x, h-1-y+ case 4:+ dx, dy = x, h-1-y+ case 5:+ dx, dy = y, x+ case 6:+ dx, dy = h-1-y, x+ case 7:+ dx, dy = h-1-y, w-1-x+ case 8:+ dx, dy = y, w-1-x+ }+ dst.SetRGBA(dx, dy, src.RGBAAt(x, y))+ }+ }+ return dst+}++// fitInside 是把 w×h 缩到长边不超过 limit 后的尺寸(不放大)+func fitInside(w, h, limit int) (int, int) {+ if w <= limit && h <= limit {+ return w, h+ }+ if w >= h {+ return limit, max(1, h*limit/w)+ }+ return max(1, w*limit/h), limit+}++// scale 缩放到 w×h:缩小时按区域取平均(盒式滤波),放大时取最近的像素+func scale(src *image.RGBA, w, h int) *image.RGBA {+ r := src.Rect+ dst := image.NewRGBA(image.Rect(0, 0, w, h))+ sw, sh := r.Dx(), r.Dy()+ for dy := 0; dy < h; dy++ {+ y0, y1 := dy*sh/h, (dy+1)*sh/h+ if y1 <= y0 {+ y1 = y0 + 1+ }+ for dx := 0; dx < w; dx++ {+ x0, x1 := dx*sw/w, (dx+1)*sw/w+ if x1 <= x0 {+ x1 = x0 + 1+ }+ var rs, gs, bs, as, n uint32+ for yy := y0; yy < y1; yy++ {+ for xx := x0; xx < x1; xx++ {+ c := src.RGBAAt(xx, yy)+ rs, gs, bs, as = rs+uint32(c.R), gs+uint32(c.G), bs+uint32(c.B), as+uint32(c.A)+ n+++ }+ }+ dst.SetRGBA(dx, dy, color.RGBA{uint8(rs / n), uint8(gs / n), uint8(bs / n), uint8(as / n)})+ }+ }+ return dst+}++// blur 三遍盒式模糊,接近高斯模糊+func blur(img *image.RGBA, radius int) *image.RGBA {+ for range 3 {+ img = boxBlur(img, radius, true)+ img = boxBlur(img, radius, false)+ }+ return img+}++func boxBlur(src *image.RGBA, r int, horizontal bool) *image.RGBA {+ w, h := src.Rect.Dx(), src.Rect.Dy()+ dst := image.NewRGBA(src.Rect)+ lines, length := h, w+ if !horizontal {+ lines, length = w, h+ }+ at := func(line, i int) color.RGBA {+ i = min(max(i, 0), length-1)+ if horizontal {+ return src.RGBAAt(i, line)+ }+ return src.RGBAAt(line, i)+ }+ n := uint32(2*r + 1)+ for line := 0; line < lines; line++ {+ var rs, gs, bs, as uint32+ for i := -r; i <= r; i++ {+ c := at(line, i)+ rs, gs, bs, as = rs+uint32(c.R), gs+uint32(c.G), bs+uint32(c.B), as+uint32(c.A)+ }+ for i := 0; i < length; i++ {+ out := color.RGBA{uint8(rs / n), uint8(gs / n), uint8(bs / n), uint8(as / n)}+ if horizontal {+ dst.SetRGBA(i, line, out)+ } else {+ dst.SetRGBA(line, i, out)+ }+ in, gone := at(line, i+r+1), at(line, i-r)+ rs += uint32(in.R) - uint32(gone.R)+ gs += uint32(in.G) - uint32(gone.G)+ bs += uint32(in.B) - uint32(gone.B)+ as += uint32(in.A) - uint32(gone.A)+ }+ }+ return dst+}++// onWhite 把透明的部分垫上白色(JPEG 没有透明)+func onWhite(img *image.RGBA) *image.RGBA {+ for i := 0; i+3 < len(img.Pix); i += 4 {+ a := uint32(img.Pix[i+3])+ if a == 255 {+ continue+ }+ for c := 0; c < 3; c++ {+ img.Pix[i+c] = uint8((uint32(img.Pix[i+c])*a + 255*(255-a)) / 255)+ }+ img.Pix[i+3] = 255+ }+ return img+}++func encodeJPEG(img image.Image, quality int) ([]byte, error) {+ var buf bytes.Buffer+ if err := jpeg.Encode(&buf, img, &jpeg.Options{Quality: quality}); err != nil {+ return nil, err+ }+ return buf.Bytes(), nil+}++func encodePNG(img image.Image) ([]byte, error) {+ var buf bytes.Buffer+ if err := png.Encode(&buf, img); err != nil {+ return nil, err+ }+ return buf.Bytes(), nil+}++// ─────────────────────────── 分析 ───────────────────────────++// analyze 在缩成长边 64 的小图上算亮度与主色+func analyze(img *image.RGBA) BackgroundInfo {+ w, h := fitInside(img.Rect.Dx(), img.Rect.Dy(), 64)+ small := onWhite(scale(img, w, h))+ lums := make([]float64, 0, w*h)+ var sum float64+ type bucket struct {+ r, g, b, n int+ }+ buckets := map[int]*bucket{}+ for y := 0; y < h; y++ {+ for x := 0; x < w; x++ {+ c := small.RGBAAt(x, y)+ l := RGBA{c.R, c.G, c.B, 255}.Luminance()+ lums = append(lums, l)+ sum += l+ // 每个通道分 8 档,同一档的颜色算一种+ key := int(c.R>>5)<<6 | int(c.G>>5)<<3 | int(c.B>>5)+ bk := buckets[key]+ if bk == nil {+ bk = &bucket{}+ buckets[key] = bk+ }+ bk.r, bk.g, bk.b, bk.n = bk.r+int(c.R), bk.g+int(c.G), bk.b+int(c.B), bk.n+1+ }+ }+ n := float64(len(lums))+ mean := sum / n+ var variance float64+ for _, l := range lums {+ variance += (l - mean) * (l - mean)+ }+ sort.Float64s(lums)+ p10, p90 := lums[int(0.1*(n-1))], lums[int(0.9*(n-1))]++ list := make([]*bucket, 0, len(buckets))+ for _, b := range buckets {+ list = append(list, b)+ }+ sort.Slice(list, func(i, j int) bool { return list[i].n > list[j].n })+ var colors []string+ var picked []RGBA+ for _, b := range list {+ c := RGBA{uint8(b.r / b.n), uint8(b.g / b.n), uint8(b.b / b.n), 255}+ close := false+ for _, p := range picked {+ if colorDistance(c, p) < 48 {+ close = true+ break+ }+ }+ if close {+ continue+ }+ picked = append(picked, c)+ colors = append(colors, c.Hex())+ if len(colors) == 5 {+ break+ }+ }+ // 相近的颜色合并后不到 3 种:图本来就很单一,按占比补齐+ for _, b := range list {+ if len(colors) >= 3 {+ break+ }+ hex := RGBA{uint8(b.r / b.n), uint8(b.g / b.n), uint8(b.b / b.n), 255}.Hex()+ if !contains(colors, hex) {+ colors = append(colors, hex)+ }+ }+ return BackgroundInfo{+ Luminance: round3(mean),+ LuminanceSpread: round3(math.Sqrt(variance / n)),+ Colors: colors,+ MinScrimDark: round3(scrimForWhiteText(p90)),+ MinScrimLight: round3(scrimForBlackText(p10)),+ }+}++// scrimForWhiteText:黑色遮罩浓度 a 让亮度 l 降到 l·(1−a),白字要达到 4.5:1,即 l·(1−a) ≤ 1.05/4.5 − 0.05+func scrimForWhiteText(l float64) float64 {+ limit := 1.05/4.5 - 0.05+ if l <= limit {+ return 0+ }+ return 1 - limit/l+}++// scrimForBlackText:白色遮罩浓度 a 让亮度变成 l + (1−l)·a,黑字要达到 4.5:1,即至少 4.5·0.05 − 0.05+func scrimForBlackText(l float64) float64 {+ limit := 4.5*0.05 - 0.05+ if l >= limit {+ return 0+ }+ return (limit - l) / (1 - l)+}++func colorDistance(a, b RGBA) float64 {+ dr, dg, db := float64(a.R)-float64(b.R), float64(a.G)-float64(b.G), float64(a.B)-float64(b.B)+ return math.Sqrt(dr*dr + dg*dg + db*db)+}++func contains(list []string, v string) bool {+ for _, s := range list {+ if s == v {+ return true+ }+ }+ return false+}++func round3(v float64) float64 { return math.Round(v*1000) / 1000 }diff --git a/client-core/internal/theme/builtin/default.json b/client-core/internal/theme/builtin/default.jsonnew file mode 100644index 0000000..f8ebca6--- /dev/null+++ b/client-core/internal/theme/builtin/default.json@@ -0,0 +1,29 @@+{+ "schema": 1,+ "id": "default",+ "name": { "zh-Hans": "默认", "zh-Hant-TW": "預設", "zh-Hant-HK": "預設", "en": "Default", "ja": "デフォルト" },+ "modes": {+ "light": {+ "accent": "#0A66D8", "background": "#F5F5F4", "sidebar": "#EBEBE9", "surface": "#FFFFFF",+ "border": "#E0E0DD", "borderStrong": "#E0E0DD", "separator": "#ECECEA",+ "text": "#1D1D1F", "textDim": "#6E6E73", "textFaint": "#A1A1A6",+ "selection": "#DCDCD9", "hover": "#0A000000", "fill": "#EEEEEC",+ "online": "#248A3D", "warning": "#B25000", "danger": "#D70015",+ "onAccent": "#FFFFFF", "inverse": "#2C2C2E", "onInverse": "#FFFFFF",+ "bevelLight": "#00000000", "bevelDark": "#00000000", "shadow": "#40000000"+ },+ "dark": {+ "accent": "#3B8BEB", "background": "#1C1C1E", "sidebar": "#232325", "surface": "#2A2A2C",+ "border": "#3A3A3C", "borderStrong": "#3A3A3C", "separator": "#333335",+ "text": "#F5F5F7", "textDim": "#98989D", "textFaint": "#636366",+ "selection": "#3A3A3C", "hover": "#0FFFFFFF", "fill": "#323234",+ "online": "#32D74B", "warning": "#FF9F0A", "danger": "#FF453A",+ "onAccent": "#FFFFFF", "inverse": "#3A3A3C", "onInverse": "#FFFFFF",+ "bevelLight": "#00000000", "bevelDark": "#00000000", "shadow": "#40000000"+ }+ },+ "typography": { "family": "system", "mono": "system", "sizes": [] },+ "shape": { "radius": { "sm": 6, "md": 10, "lg": 14 }, "corner": "round", "borderWidth": 1, "unit": 2, "shadow": "soft" },+ "motion": "smooth",+ "icons": "system"+}diff --git a/client-core/internal/theme/builtin/pixel.json b/client-core/internal/theme/builtin/pixel.jsonnew file mode 100644index 0000000..fcc29df--- /dev/null+++ b/client-core/internal/theme/builtin/pixel.json@@ -0,0 +1,29 @@+{+ "schema": 1,+ "id": "pixel",+ "name": { "zh-Hans": "像素", "zh-Hant-TW": "像素", "zh-Hant-HK": "像素", "en": "Pixel", "ja": "ピクセル" },+ "modes": {+ "light": {+ "accent": "#08875B", "background": "#F5F5F2", "sidebar": "#ECECE7", "surface": "#FFFFFF",+ "border": "#DCDCD5", "borderStrong": "#1C1D20", "separator": "#E2E2DC",+ "text": "#1C1D20", "textDim": "#5E626A", "textFaint": "#9A9DA4",+ "selection": "#FAFAF8", "hover": "#0A1C1D20", "fill": "#EFEFEA",+ "online": "#15803D", "warning": "#B45309", "danger": "#DC2626",+ "onAccent": "#FFFFFF", "inverse": "#1C1D20", "onInverse": "#F5F5F2",+ "bevelLight": "#B3FFFFFF", "bevelDark": "#2E000000", "shadow": "#E61C1D20"+ },+ "dark": {+ "accent": "#3DDC97", "background": "#111215", "sidebar": "#0C0D0F", "surface": "#17191D",+ "border": "#2A2D34", "borderStrong": "#3C414B", "separator": "#25282E",+ "text": "#E6E8EB", "textDim": "#9AA0AA", "textFaint": "#5F6570",+ "selection": "#1F2227", "hover": "#0AFFFFFF", "fill": "#0D0E11",+ "online": "#4ADE80", "warning": "#FBBF24", "danger": "#F87171",+ "onAccent": "#0C0D0F", "inverse": "#E6E8EB", "onInverse": "#111215",+ "bevelLight": "#14FFFFFF", "bevelDark": "#59000000", "shadow": "#80000000"+ }+ },+ "typography": { "family": "FusionPixel", "mono": "FusionPixelMono", "sizes": [12, 24] },+ "shape": { "radius": { "sm": 0, "md": 0, "lg": 0 }, "corner": "pixel", "borderWidth": 2, "unit": 2, "shadow": "hard" },+ "motion": "stepped",+ "icons": "pixel"+}diff --git a/client-core/internal/theme/store.go b/client-core/internal/theme/store.gonew file mode 100644index 0000000..a55f5bd--- /dev/null+++ b/client-core/internal/theme/store.go@@ -0,0 +1,308 @@+package theme++import (+ "encoding/json"+ "errors"+ "fmt"+ "os"+ "path/filepath"+ "sort"+ "strings"+ "sync"++ "github.com/baiyuze/pasteferry/client-core/internal/config"+)++var (+ ErrNotFound = errors.New("没有这个主题")+ ErrBuiltin = errors.New("内置主题不能修改或删除")+ // ErrIsBase 是要删的主题还被别的主题当作 base+ ErrIsBase = errors.New("还有主题继承它,先删掉或改掉那些主题")+ // ErrInUse 是要删的背景图还有主题在用+ ErrInUse = errors.New("还有主题在用这张背景图")+)++// maxDepth 是自定义主题最多往上继承几层自定义主题(再往上就是内置主题)+const maxDepth = 2++// Info 是主题列表里的一项+type Info struct {+ ID string+ Name map[string]string+ Builtin bool+ Base string+}++// Store 读写数据目录里的自定义主题与背景图+type Store struct {+ mu sync.Mutex+ dir string+ backgrounds string+}++func NewStore(p config.Paths) *Store {+ return &Store{dir: p.Themes, backgrounds: p.Backgrounds}+}++func (s *Store) path(id string) string { return filepath.Join(s.dir, id+".json") }++// load 读一套主题的原样(未合并 base)+func (s *Store) load(id string) (Theme, []byte, error) {+ if id == "" {+ id = DefaultID+ }+ if IsBuiltin(id) {+ return builtin(id)+ }+ if !validID(id) {+ return Theme{}, nil, ErrNotFound+ }+ data, err := os.ReadFile(s.path(id))+ if errors.Is(err, os.ErrNotExist) {+ return Theme{}, nil, ErrNotFound+ }+ if err != nil {+ return Theme{}, nil, err+ }+ t, err := Parse(data)+ if err != nil {+ return Theme{}, nil, fmt.Errorf("主题 %s 的文件坏了:%w", id, err)+ }+ t.ID = id+ return t, data, nil+}++// resolve 合并 base,返回完整的主题。seen 防止继承成环+func (s *Store) resolve(t Theme, depth int, seen map[string]bool) (Theme, error) {+ if IsBuiltin(t.ID) {+ return t, nil+ }+ if depth > maxDepth {+ return Theme{}, invalid("继承太深:自定义主题最多往上继承 %d 层自定义主题", maxDepth)+ }+ if seen[t.ID] {+ return Theme{}, invalid("主题的继承关系成了环:%s", t.ID)+ }+ seen[t.ID] = true+ baseID := t.Base+ if baseID == "" {+ baseID = DefaultID+ }+ base, _, err := s.load(baseID)+ if errors.Is(err, ErrNotFound) {+ return Theme{}, invalid("base 主题 %q 不存在", baseID)+ }+ if err != nil {+ return Theme{}, err+ }+ resolved, err := s.resolve(base, depth+1, seen)+ if err != nil {+ return Theme{}, err+ }+ return merge(resolved, t), nil+}++// Exists 报告有没有这套主题(空字符串是默认主题)+func (s *Store) Exists(id string) bool {+ _, _, err := s.load(id)+ return err == nil+}++// List 返回内置主题与自定义主题,内置的在前+func (s *Store) List() ([]Info, error) {+ var out []Info+ for _, id := range builtinIDs {+ t, _, err := builtin(id)+ if err != nil {+ return nil, err+ }+ out = append(out, Info{ID: id, Name: t.Name, Builtin: true})+ }+ entries, err := os.ReadDir(s.dir)+ if err != nil && !errors.Is(err, os.ErrNotExist) {+ return nil, err+ }+ var custom []Info+ for _, e := range entries {+ id, ok := strings.CutSuffix(e.Name(), ".json")+ if !ok || e.IsDir() || !validID(id) || IsBuiltin(id) {+ continue+ }+ t, _, err := s.load(id)+ if err != nil {+ continue // 坏掉的文件不列出来,免得界面拿到一套用不了的主题+ }+ base := t.Base+ if base == "" {+ base = DefaultID+ }+ custom = append(custom, Info{ID: id, Name: t.Name, Base: base})+ }+ sort.Slice(custom, func(i, j int) bool { return custom[i].ID < custom[j].ID })+ return append(out, custom...), nil+}++// Get 返回一套主题的 JSON。resolved 时合并了 base,各项齐全;否则是保存时的样子+func (s *Store) Get(id string, resolved bool) ([]byte, error) {+ t, raw, err := s.load(id)+ if err != nil {+ return nil, err+ }+ if !resolved || IsBuiltin(t.ID) {+ return raw, nil+ }+ r, err := s.resolve(t, 0, map[string]bool{})+ if err != nil {+ return nil, err+ }+ return json.MarshalIndent(r, "", " ")+}++// Put 校验并保存一套自定义主题,返回它的 id 与对比度警告。格式不对时返回 *InvalidError+func (s *Store) Put(data []byte) (string, []Warning, error) { return s.put(data, false) }++// Check 与 Put 做同样的校验、算同样的警告,但不保存(AI 改主题前先试一遍)+func (s *Store) Check(data []byte) (string, []Warning, error) { return s.put(data, true) }++func (s *Store) put(data []byte, dryRun bool) (string, []Warning, error) {+ t, err := Parse(data)+ if err != nil {+ return "", nil, err+ }+ if err := validate(t); err != nil {+ return "", nil, err+ }+ s.mu.Lock()+ defer s.mu.Unlock()+ for _, img := range s.userImages(t) {+ if !s.hasBackground(img) {+ return "", nil, invalid("背景图 user:%s 不存在,先导入", img)+ }+ }+ resolved, err := s.resolve(t, 0, map[string]bool{})+ if err != nil {+ return "", nil, err+ }+ // 改一套已有主题时,继承它的主题也要还能合并(不成环、不超深度)+ if err := s.checkChildren(t); err != nil {+ return "", nil, err+ }+ baseID := t.Base+ if baseID == "" {+ baseID = DefaultID+ }+ baseRaw, _, _ := s.load(baseID)+ base, err := s.resolve(baseRaw, 1, map[string]bool{t.ID: true})+ if err != nil {+ return "", nil, err+ }+ if dryRun {+ return t.ID, checkContrast(resolved, base), nil+ }+ out, err := json.MarshalIndent(t, "", " ")+ if err != nil {+ return "", nil, err+ }+ if err := os.MkdirAll(s.dir, 0o700); err != nil {+ return "", nil, err+ }+ if err := writeAtomic(s.path(t.ID), out); err != nil {+ return "", nil, err+ }+ return t.ID, checkContrast(resolved, base), nil+}++// checkChildren 假设 t 已经保存,检查所有自定义主题还能合并+func (s *Store) checkChildren(t Theme) error {+ entries, err := os.ReadDir(s.dir)+ if err != nil {+ return nil+ }+ for _, e := range entries {+ id, ok := strings.CutSuffix(e.Name(), ".json")+ if !ok || id == t.ID || !validID(id) {+ continue+ }+ other, _, err := s.load(id)+ if err != nil {+ continue+ }+ if err := s.resolveWith(other, t); err != nil {+ return invalid("这样改后,继承它的主题 %s 用不了了:%v", id, err)+ }+ }+ return nil+}++// resolveWith 合并 other,其中 id 为 replaced.ID 的那一层用 replaced 代替磁盘上的版本+func (s *Store) resolveWith(other, replaced Theme) error {+ seen := map[string]bool{}+ cur := other+ for depth := 0; !IsBuiltin(cur.ID); depth++ {+ if depth > maxDepth {+ return invalid("继承太深")+ }+ if seen[cur.ID] {+ return invalid("继承成了环")+ }+ seen[cur.ID] = true+ next := cur.Base+ if next == "" {+ next = DefaultID+ }+ if next == replaced.ID {+ cur = replaced+ continue+ }+ t, _, err := s.load(next)+ if err != nil {+ return err+ }+ cur = t+ }+ return nil+}++// Delete 删一套自定义主题+func (s *Store) Delete(id string) error {+ if IsBuiltin(id) || id == "" {+ return ErrBuiltin+ }+ s.mu.Lock()+ defer s.mu.Unlock()+ if _, _, err := s.load(id); err != nil {+ return err+ }+ infos, err := s.List()+ if err != nil {+ return err+ }+ for _, info := range infos {+ if !info.Builtin && info.ID != id && info.Base == id {+ return ErrIsBase+ }+ }+ return os.Remove(s.path(id))+}++// userImages 是主题 t 自己引用的导入背景图的 sha256+func (s *Store) userImages(t Theme) []string {+ if t.Background == nil {+ return nil+ }+ var out []string+ for _, img := range []string{t.Background.Image, t.Background.ImageDark} {+ if sha, ok := strings.CutPrefix(img, "user:"); ok {+ out = append(out, sha)+ }+ }+ return out+}++func writeAtomic(path string, data []byte) error {+ tmp := path + ".tmp"+ if err := os.WriteFile(tmp, data, 0o600); err != nil {+ return err+ }+ return os.Rename(tmp, path)+}diff --git a/client-core/internal/theme/theme.go b/client-core/internal/theme/theme.gonew file mode 100644index 0000000..2c2c59c--- /dev/null+++ b/client-core/internal/theme/theme.go@@ -0,0 +1,552 @@+// Package theme 保存界面的主题与背景图,见 design/themes.md。+//+// 主题是一份 JSON:内置的 default、pixel 嵌在程序里(builtin/),自定义的存在数据目录的+// themes/<id>.json。自定义主题用 base 继承另一套主题,只写想改的字段。+// 界面、CLI、MCP 都经后台服务读写主题,校验统一在这里做。+package theme++import (+ "embed"+ "encoding/json"+ "fmt"+ "math"+ "regexp"+ "sort"+ "strconv"+ "strings"+)++// Schema 是这个版本认识的主题格式版本+const Schema = 1++// 内置主题的 id。界面里的配色常量(ui/lib/theme.dart、ui/lib/pixel_theme.dart)要与 builtin/ 里的一致+const (+ DefaultID = "default"+ PixelID = "pixel"+)++var builtinIDs = []string{DefaultID, PixelID}++//go:embed builtin/*.json+var builtinFS embed.FS++// Roles 是一种模式(浅色或深色)里的颜色角色,与界面 AppPalette 的字段同名+var Roles = []string{+ "accent", "background", "sidebar", "surface", "border", "borderStrong", "separator",+ "text", "textDim", "textFaint", "selection", "hover", "fill",+ "online", "warning", "danger", "onAccent", "inverse", "onInverse",+ "bevelLight", "bevelDark", "shadow",+}++var roleSet = func() map[string]bool {+ m := map[string]bool{}+ for _, r := range Roles {+ m[r] = true+ }+ return m+}()++// Modes 是浅色与深色+var Modes = []string{"light", "dark"}++// Theme 是一套主题。指针字段为空表示不覆盖 base 的值+type Theme struct {+ Schema int `json:"schema"`+ ID string `json:"id"`+ Name map[string]string `json:"name,omitempty"`+ Base string `json:"base,omitempty"`+ Modes map[string]map[string]string `json:"modes,omitempty"`+ Typography *Typography `json:"typography,omitempty"`+ Shape *Shape `json:"shape,omitempty"`+ Motion string `json:"motion,omitempty"` // smooth、stepped、reduced+ Icons string `json:"icons,omitempty"` // system、pixel+ Background *Background `json:"background,omitempty"`+}++type Typography struct {+ Family *string `json:"family,omitempty"` // system,或 App 自带的 FusionPixel+ Mono *string `json:"mono,omitempty"` // system,或 FusionPixelMono+ // 允许的字号;空数组表示不限(点阵字体要吸附到设计字号的整数倍)+ Sizes *[]float64 `json:"sizes,omitempty"`+}++type Radius struct {+ Sm *float64 `json:"sm,omitempty"`+ Md *float64 `json:"md,omitempty"`+ Lg *float64 `json:"lg,omitempty"`+}++type Shape struct {+ Radius *Radius `json:"radius,omitempty"`+ Corner string `json:"corner,omitempty"` // round、pixel+ BorderWidth *float64 `json:"borderWidth,omitempty"`+ Unit *float64 `json:"unit,omitempty"` // 像素角的一格+ Shadow string `json:"shadow,omitempty"` // soft、hard、none+}++type Scrim struct {+ Color string `json:"color,omitempty"`+ Opacity *float64 `json:"opacity,omitempty"`+}++// Background 是背景图,见 design/themes.md 第 7 节+type Background struct {+ // "asset:<名字>" 是 App 自带的图,"user:<sha256>" 是 ImportBackground 导入的图+ Image string `json:"image,omitempty"`+ // 深色模式另用的一张;空时两种模式用同一张+ ImageDark string `json:"imageDark,omitempty"`+ Fit string `json:"fit,omitempty"` // cover、contain、tile+ Align string `json:"align,omitempty"` // center、top、bottom、left、right、topLeft……+ Blur *float64 `json:"blur,omitempty"` // 0 到 40+ Scrim *Scrim `json:"scrim,omitempty"`+ SurfaceOpacity *float64 `json:"surfaceOpacity,omitempty"` // 0.6 到 1+ Scope []string `json:"scope,omitempty"` // main、picker、mobile+ AccentFromImage *bool `json:"accentFromImage,omitempty"`+}++// InvalidError 是主题写得不对:界面直接把它显示给用户+type InvalidError struct{ Msg string }++func (e *InvalidError) Error() string { return e.Msg }++func invalid(format string, a ...any) error { return &InvalidError{Msg: fmt.Sprintf(format, a...)} }++// IsBuiltin 报告 id 是不是内置主题+func IsBuiltin(id string) bool {+ for _, b := range builtinIDs {+ if id == b {+ return true+ }+ }+ return false+}++func builtin(id string) (Theme, []byte, error) {+ data, err := builtinFS.ReadFile("builtin/" + id + ".json")+ if err != nil {+ return Theme{}, nil, err+ }+ var t Theme+ if err := json.Unmarshal(data, &t); err != nil {+ return Theme{}, nil, err+ }+ return t, data, nil+}++// Parse 读一份主题 JSON。不认识的字段忽略;schema 比本机新时拒绝,提示升级+func Parse(data []byte) (Theme, error) {+ if len(data) > maxThemeBytes {+ return Theme{}, invalid("主题文件太大(超过 %d KB)", maxThemeBytes>>10)+ }+ var t Theme+ if err := json.Unmarshal(data, &t); err != nil {+ return Theme{}, invalid("主题不是有效的 JSON:%v", err)+ }+ switch {+ case t.Schema == 0:+ return Theme{}, invalid("缺少 schema(主题格式版本)")+ case t.Schema > Schema:+ return Theme{}, invalid("主题格式版本 %d 比这个版本的隔空贴新,请先升级", t.Schema)+ case t.Schema < 0:+ return Theme{}, invalid("schema 不对:%d", t.Schema)+ }+ return t, nil+}++const maxThemeBytes = 64 << 10++var (+ assetRef = regexp.MustCompile(`^asset:[a-z0-9-]{1,40}$`)+ userRef = regexp.MustCompile(`^user:[0-9a-f]{64}$`)+)++// validate 检查自定义主题 t 本身的格式;base 是否存在、继承深度由 Store 检查+func validate(t Theme) error {+ if t.ID == "" {+ return invalid("缺少 id")+ }+ if !validID(t.ID) {+ return invalid("id 只能用小写字母、数字和连字符,最长 40 个字符:%q", t.ID)+ }+ if IsBuiltin(t.ID) {+ return invalid("%q 是内置主题,不能覆盖;换一个 id", t.ID)+ }+ if t.Base == t.ID {+ return invalid("主题不能继承自己")+ }+ if t.Base != "" && !validID(t.Base) {+ return invalid("base 不对:%q", t.Base)+ }+ for lang, name := range t.Name {+ if lang == "" || len(lang) > 20 {+ return invalid("名字的语言代码不对:%q", lang)+ }+ if n := len([]rune(name)); n == 0 || n > 40 {+ return invalid("名字要有 1 到 40 个字:%q", name)+ }+ }+ for mode, colors := range t.Modes {+ if mode != "light" && mode != "dark" {+ return invalid("modes 里只能有 light 与 dark,没有 %q", mode)+ }+ for role, c := range colors {+ if !roleSet[role] {+ return invalid("%s 里没有 %q 这个颜色角色", mode, role)+ }+ if _, err := ParseColor(c); err != nil {+ return invalid("%s.%s:%v", mode, role, err)+ }+ }+ }+ if ty := t.Typography; ty != nil {+ if ty.Family != nil && !oneOf(*ty.Family, "system", "FusionPixel") {+ return invalid("typography.family 只能是 system 或 FusionPixel,不能是 %q", *ty.Family)+ }+ if ty.Mono != nil && !oneOf(*ty.Mono, "system", "FusionPixelMono") {+ return invalid("typography.mono 只能是 system 或 FusionPixelMono,不能是 %q", *ty.Mono)+ }+ if ty.Sizes != nil {+ if len(*ty.Sizes) > 6 {+ return invalid("typography.sizes 最多 6 档")+ }+ for _, s := range *ty.Sizes {+ if err := inRange("typography.sizes", s, 8, 48); err != nil {+ return err+ }+ }+ }+ }+ if sh := t.Shape; sh != nil {+ if r := sh.Radius; r != nil {+ for name, v := range map[string]*float64{"sm": r.Sm, "md": r.Md, "lg": r.Lg} {+ if v != nil {+ if err := inRange("shape.radius."+name, *v, 0, 32); err != nil {+ return err+ }+ }+ }+ }+ if sh.Corner != "" && !oneOf(sh.Corner, "round", "pixel") {+ return invalid("shape.corner 只能是 round 或 pixel,不能是 %q", sh.Corner)+ }+ if sh.BorderWidth != nil {+ if err := inRange("shape.borderWidth", *sh.BorderWidth, 0, 4); err != nil {+ return err+ }+ }+ if sh.Unit != nil {+ if err := inRange("shape.unit", *sh.Unit, 1, 8); err != nil {+ return err+ }+ }+ if sh.Shadow != "" && !oneOf(sh.Shadow, "soft", "hard", "none") {+ return invalid("shape.shadow 只能是 soft、hard 或 none,不能是 %q", sh.Shadow)+ }+ }+ if t.Motion != "" && !oneOf(t.Motion, "smooth", "stepped", "reduced") {+ return invalid("motion 只能是 smooth、stepped 或 reduced,不能是 %q", t.Motion)+ }+ if t.Icons != "" && !oneOf(t.Icons, "system", "pixel") {+ return invalid("icons 只能是 system 或 pixel,不能是 %q", t.Icons)+ }+ if b := t.Background; b != nil {+ for _, img := range []string{b.Image, b.ImageDark} {+ if img != "" && !assetRef.MatchString(img) && !userRef.MatchString(img) {+ return invalid("background 的图片要写成 asset:<名字> 或 user:<sha256>,不能是 %q", img)+ }+ }+ if b.Fit != "" && !oneOf(b.Fit, "cover", "contain", "tile") {+ return invalid("background.fit 只能是 cover、contain 或 tile,不能是 %q", b.Fit)+ }+ if b.Align != "" && !oneOf(b.Align, "center", "top", "bottom", "left", "right",+ "topLeft", "topRight", "bottomLeft", "bottomRight") {+ return invalid("background.align 不对:%q", b.Align)+ }+ if b.Blur != nil {+ if err := inRange("background.blur", *b.Blur, 0, 40); err != nil {+ return err+ }+ }+ if s := b.Scrim; s != nil {+ if s.Color != "" {+ if _, err := ParseColor(s.Color); err != nil {+ return invalid("background.scrim.color:%v", err)+ }+ }+ if s.Opacity != nil {+ if err := inRange("background.scrim.opacity", *s.Opacity, 0, 1); err != nil {+ return err+ }+ }+ }+ if b.SurfaceOpacity != nil {+ if err := inRange("background.surfaceOpacity", *b.SurfaceOpacity, 0.6, 1); err != nil {+ return err+ }+ }+ for _, s := range b.Scope {+ if !oneOf(s, "main", "picker", "mobile") {+ return invalid("background.scope 里只能有 main、picker、mobile,不能是 %q", s)+ }+ }+ }+ return nil+}++func validID(id string) bool {+ if id == "" || len(id) > 40 {+ return false+ }+ for _, r := range id {+ if !(r >= 'a' && r <= 'z' || r >= '0' && r <= '9' || r == '-') {+ return false+ }+ }+ return true+}++func oneOf(v string, allowed ...string) bool {+ for _, a := range allowed {+ if v == a {+ return true+ }+ }+ return false+}++func inRange(name string, v, lo, hi float64) error {+ if math.IsNaN(v) || v < lo || v > hi {+ return invalid("%s 要在 %g 到 %g 之间,不能是 %g", name, lo, hi, v)+ }+ return nil+}++// merge 把 child 叠在已经合并好的 base 上:child 写了的字段覆盖,没写的沿用 base+func merge(base, child Theme) Theme {+ out := base+ out.Schema = Schema+ out.ID = child.ID+ out.Base = child.Base+ if out.Base == "" {+ out.Base = DefaultID+ }+ if len(child.Name) > 0 {+ out.Name = child.Name+ }+ out.Modes = map[string]map[string]string{}+ for _, m := range Modes {+ colors := map[string]string{}+ for k, v := range base.Modes[m] {+ colors[k] = v+ }+ for k, v := range child.Modes[m] {+ colors[k] = v+ }+ out.Modes[m] = colors+ }+ if c := child.Typography; c != nil {+ t := Typography{}+ if base.Typography != nil {+ t = *base.Typography+ }+ if c.Family != nil {+ t.Family = c.Family+ }+ if c.Mono != nil {+ t.Mono = c.Mono+ }+ if c.Sizes != nil {+ t.Sizes = c.Sizes+ }+ out.Typography = &t+ }+ if c := child.Shape; c != nil {+ s := Shape{}+ if base.Shape != nil {+ s = *base.Shape+ }+ if c.Radius != nil {+ r := Radius{}+ if s.Radius != nil {+ r = *s.Radius+ }+ if c.Radius.Sm != nil {+ r.Sm = c.Radius.Sm+ }+ if c.Radius.Md != nil {+ r.Md = c.Radius.Md+ }+ if c.Radius.Lg != nil {+ r.Lg = c.Radius.Lg+ }+ s.Radius = &r+ }+ if c.Corner != "" {+ s.Corner = c.Corner+ }+ if c.BorderWidth != nil {+ s.BorderWidth = c.BorderWidth+ }+ if c.Unit != nil {+ s.Unit = c.Unit+ }+ if c.Shadow != "" {+ s.Shadow = c.Shadow+ }+ out.Shape = &s+ }+ if child.Motion != "" {+ out.Motion = child.Motion+ }+ if child.Icons != "" {+ out.Icons = child.Icons+ }+ if c := child.Background; c != nil {+ b := Background{}+ if base.Background != nil {+ b = *base.Background+ }+ if c.Image != "" {+ b.Image = c.Image+ }+ if c.ImageDark != "" {+ b.ImageDark = c.ImageDark+ }+ if c.Fit != "" {+ b.Fit = c.Fit+ }+ if c.Align != "" {+ b.Align = c.Align+ }+ if c.Blur != nil {+ b.Blur = c.Blur+ }+ if c.Scrim != nil {+ b.Scrim = c.Scrim+ }+ if c.SurfaceOpacity != nil {+ b.SurfaceOpacity = c.SurfaceOpacity+ }+ if c.Scope != nil {+ b.Scope = c.Scope+ }+ if c.AccentFromImage != nil {+ b.AccentFromImage = c.AccentFromImage+ }+ out.Background = &b+ }+ return out+}++// ─────────────────────────── 颜色与对比度 ───────────────────────────++// RGBA 是 0 到 255 的颜色分量+type RGBA struct{ R, G, B, A uint8 }++// ParseColor 读 "#RRGGBB" 或 "#AARRGGBB"(与界面的 Color(0xAARRGGBB) 同序)+func ParseColor(s string) (RGBA, error) {+ if !strings.HasPrefix(s, "#") || (len(s) != 7 && len(s) != 9) {+ return RGBA{}, fmt.Errorf("颜色要写成 #RRGGBB 或 #AARRGGBB,不能是 %q", s)+ }+ v, err := strconv.ParseUint(s[1:], 16, 32)+ if err != nil {+ return RGBA{}, fmt.Errorf("颜色要写成 #RRGGBB 或 #AARRGGBB,不能是 %q", s)+ }+ if len(s) == 7 {+ v |= 0xFF000000+ }+ return RGBA{R: uint8(v >> 16), G: uint8(v >> 8), B: uint8(v), A: uint8(v >> 24)}, nil+}++// Hex 写成 "#RRGGBB"(不透明)或 "#AARRGGBB"+func (c RGBA) Hex() string {+ if c.A == 255 {+ return fmt.Sprintf("#%02X%02X%02X", c.R, c.G, c.B)+ }+ return fmt.Sprintf("#%02X%02X%02X%02X", c.A, c.R, c.G, c.B)+}++// over 把半透明的 c 叠在不透明的 bg 上+func (c RGBA) over(bg RGBA) RGBA {+ a := float64(c.A) / 255+ mix := func(f, b uint8) uint8 { return uint8(math.Round(float64(f)*a + float64(b)*(1-a))) }+ return RGBA{R: mix(c.R, bg.R), G: mix(c.G, bg.G), B: mix(c.B, bg.B), A: 255}+}++func channel(v uint8) float64 {+ c := float64(v) / 255+ if c <= 0.03928 {+ return c / 12.92+ }+ return math.Pow((c+0.055)/1.055, 2.4)+}++// Luminance 是 WCAG 的相对亮度,0 到 1+func (c RGBA) Luminance() float64 {+ return 0.2126*channel(c.R) + 0.7152*channel(c.G) + 0.0722*channel(c.B)+}++// Contrast 是 WCAG 对比度,1 到 21。半透明的前景先叠在背景上+func Contrast(fg, bg RGBA) float64 {+ bg.A = 255+ if fg.A < 255 {+ fg = fg.over(bg)+ }+ l1, l2 := fg.Luminance(), bg.Luminance()+ if l1 < l2 {+ l1, l2 = l2, l1+ }+ return (l1 + 0.05) / (l2 + 0.05)+}++// Warning 是一对颜色的对比度不够+type Warning struct {+ Mode string+ Foreground string+ Background string+ Ratio float64+ Minimum float64+}++// contrastPairs 是 design/themes.md 第 8 节要求的几对颜色+var contrastPairs = []struct {+ fg, bg string+ min float64+}{+ {"text", "background", 4.5},+ {"text", "surface", 4.5},+ {"textDim", "background", 4.5},+ {"textDim", "surface", 4.5},+ {"textFaint", "background", 3},+ {"textFaint", "surface", 3},+ {"onAccent", "accent", 4.5},+}++// checkContrast 检查合并好的主题 t。base 是合并好的 base 主题:两种颜色都和 base 一样的那一对不报,+// 免得只改了强调色的主题也因为 base 本来的配色收到一堆警告+func checkContrast(t, base Theme) []Warning {+ var out []Warning+ for _, mode := range Modes {+ colors, baseColors := t.Modes[mode], base.Modes[mode]+ for _, p := range contrastPairs {+ fgHex, bgHex := colors[p.fg], colors[p.bg]+ if fgHex == "" || bgHex == "" {+ continue+ }+ if strings.EqualFold(fgHex, baseColors[p.fg]) && strings.EqualFold(bgHex, baseColors[p.bg]) {+ continue+ }+ fg, err1 := ParseColor(fgHex)+ bg, err2 := ParseColor(bgHex)+ if err1 != nil || err2 != nil {+ continue+ }+ if r := Contrast(fg, bg); r < p.min {+ out = append(out, Warning{Mode: mode, Foreground: p.fg, Background: p.bg,+ Ratio: math.Round(r*100) / 100, Minimum: p.min})+ }+ }+ }+ sort.SliceStable(out, func(i, j int) bool { return out[i].Mode > out[j].Mode })+ return out+}diff --git a/client-core/internal/theme/theme_test.go b/client-core/internal/theme/theme_test.gonew file mode 100644index 0000000..c55cc4a--- /dev/null+++ b/client-core/internal/theme/theme_test.go@@ -0,0 +1,356 @@+package theme++import (+ "bytes"+ "encoding/binary"+ "encoding/json"+ "errors"+ "image"+ "image/color"+ "image/jpeg"+ "image/png"+ "os"+ "strings"+ "testing"++ "github.com/baiyuze/pasteferry/client-core/internal/config"+)++func newStore(t *testing.T) *Store {+ t.Helper()+ return NewStore(config.PathsUnder(t.TempDir()))+}++func put(t *testing.T, s *Store, js string) []Warning {+ t.Helper()+ _, w, err := s.Put([]byte(js))+ if err != nil {+ t.Fatalf("Put(%s): %v", js, err)+ }+ return w+}++func isInvalid(err error) bool {+ var inv *InvalidError+ return errors.As(err, &inv)+}++func TestBuiltinsParse(t *testing.T) {+ for _, id := range builtinIDs {+ th, _, err := builtin(id)+ if err != nil {+ t.Fatal(id, err)+ }+ for _, m := range Modes {+ for _, r := range Roles {+ if _, err := ParseColor(th.Modes[m][r]); err != nil {+ t.Errorf("%s.%s.%s: %v", id, m, r, err)+ }+ }+ }+ }+}++func TestParseRejectsBadFormat(t *testing.T) {+ for name, js := range map[string]string{+ "不是 JSON": `{`,+ "缺 schema": `{"id":"a"}`,+ "schema 太新": `{"schema":2,"id":"a"}`,+ } {+ if _, err := Parse([]byte(js)); !isInvalid(err) {+ t.Errorf("%s: 应当报格式错误,得到 %v", name, err)+ }+ }+}++func TestValidate(t *testing.T) {+ s := newStore(t)+ for name, js := range map[string]string{+ "id 有大写": `{"schema":1,"id":"Mine"}`,+ "覆盖内置主题": `{"schema":1,"id":"pixel"}`,+ "颜色写错": `{"schema":1,"id":"a","modes":{"light":{"accent":"red"}}}`,+ "没有这个角色": `{"schema":1,"id":"a","modes":{"light":{"glow":"#FFFFFF"}}}`,+ "多出一种模式": `{"schema":1,"id":"a","modes":{"sepia":{"accent":"#FFFFFF"}}}`,+ "角的样式不认识": `{"schema":1,"id":"a","shape":{"corner":"notch"}}`,+ "字体不是自带的": `{"schema":1,"id":"a","typography":{"family":"Comic Sans"}}`,+ "base 不存在": `{"schema":1,"id":"a","base":"nope"}`,+ "继承自己": `{"schema":1,"id":"a","base":"a"}`,+ "背景图没导入": `{"schema":1,"id":"a","background":{"image":"user:` + strings.Repeat("a", 64) + `"}}`,+ "遮罩超出范围": `{"schema":1,"id":"a","background":{"surfaceOpacity":0.2}}`,+ } {+ if _, _, err := s.Put([]byte(js)); !isInvalid(err) {+ t.Errorf("%s: 应当报格式错误,得到 %v", name, err)+ }+ }+}++func TestMergeWithBase(t *testing.T) {+ s := newStore(t)+ put(t, s, `{"schema":1,"id":"mint","name":{"zh-Hans":"薄荷"},"base":"pixel","modes":{"dark":{"accent":"#7CF2C2"}}}`)++ raw, err := s.Get("mint", false)+ if err != nil {+ t.Fatal(err)+ }+ if strings.Contains(string(raw), "borderStrong") {+ t.Errorf("未合并的主题不该带上 base 的颜色:%s", raw)+ }++ data, err := s.Get("mint", true)+ if err != nil {+ t.Fatal(err)+ }+ var r Theme+ if err := json.Unmarshal(data, &r); err != nil {+ t.Fatal(err)+ }+ if got := r.Modes["dark"]["accent"]; got != "#7CF2C2" {+ t.Errorf("强调色没有覆盖:%s", got)+ }+ if got := r.Modes["dark"]["background"]; got != "#111215" {+ t.Errorf("没写的颜色应当沿用 pixel:%s", got)+ }+ if r.Shape == nil || r.Shape.Corner != "pixel" || *r.Typography.Family != "FusionPixel" || r.Icons != "pixel" {+ t.Errorf("形状、字体、图标应当沿用 pixel:%+v", r)+ }+ if r.Name["zh-Hans"] != "薄荷" || r.Base != "pixel" {+ t.Errorf("名字、base 不对:%v %s", r.Name, r.Base)+ }++ infos, err := s.List()+ if err != nil {+ t.Fatal(err)+ }+ if len(infos) != 3 || infos[0].ID != DefaultID || infos[1].ID != PixelID || infos[2].ID != "mint" || infos[2].Base != "pixel" {+ t.Errorf("列表不对:%+v", infos)+ }+}++func TestInheritanceDepthAndCycle(t *testing.T) {+ s := newStore(t)+ put(t, s, `{"schema":1,"id":"a"}`)+ put(t, s, `{"schema":1,"id":"b","base":"a"}`)+ put(t, s, `{"schema":1,"id":"c","base":"b"}`)+ if _, _, err := s.Put([]byte(`{"schema":1,"id":"d","base":"c"}`)); !isInvalid(err) {+ t.Errorf("往上三层自定义主题应当拒绝,得到 %v", err)+ }+ if _, _, err := s.Put([]byte(`{"schema":1,"id":"a","base":"b"}`)); !isInvalid(err) {+ t.Errorf("继承成环应当拒绝,得到 %v", err)+ }+ // a 改成继承 pixel 没问题,b、c 跟着变+ put(t, s, `{"schema":1,"id":"a","base":"pixel"}`)+ data, _ := s.Get("c", true)+ if !strings.Contains(string(data), `"corner": "pixel"`) {+ t.Errorf("c 应当经 b、a 继承到 pixel 的形状:%s", data)+ }+}++func TestContrastWarnings(t *testing.T) {+ if r := Contrast(RGBA{0, 0, 0, 255}, RGBA{255, 255, 255, 255}); r < 20.9 || r > 21.1 {+ t.Errorf("黑白对比度应当是 21,得到 %v", r)+ }+ s := newStore(t)+ // 只改了强调色:base 本来的配色(默认主题浅色的 textFaint 只有 2.4)不报+ if w := put(t, s, `{"schema":1,"id":"blue","modes":{"light":{"accent":"#2255CC"}}}`); len(w) != 0 {+ t.Errorf("只改强调色不该有警告:%+v", w)+ }+ w := put(t, s, `{"schema":1,"id":"low","modes":{"light":{"text":"#BBBBBB","accent":"#FFE066"}}}`)+ got := map[string]bool{}+ for _, x := range w {+ got[x.Mode+":"+x.Foreground+"/"+x.Background] = true+ if x.Ratio >= x.Minimum {+ t.Errorf("警告的比值应当低于要求:%+v", x)+ }+ }+ for _, want := range []string{"light:text/background", "light:text/surface", "light:onAccent/accent"} {+ if !got[want] {+ t.Errorf("缺少警告 %s,得到 %+v", want, w)+ }+ }+ if got["dark:text/background"] {+ t.Errorf("深色没改,不该报")+ }+}++func TestDelete(t *testing.T) {+ s := newStore(t)+ if err := s.Delete("pixel"); !errors.Is(err, ErrBuiltin) {+ t.Errorf("内置主题不能删:%v", err)+ }+ put(t, s, `{"schema":1,"id":"a"}`)+ put(t, s, `{"schema":1,"id":"b","base":"a"}`)+ if err := s.Delete("a"); !errors.Is(err, ErrIsBase) {+ t.Errorf("被继承的主题不能删:%v", err)+ }+ if err := s.Delete("b"); err != nil {+ t.Fatal(err)+ }+ if err := s.Delete("a"); err != nil {+ t.Fatal(err)+ }+ if s.Exists("a") || !s.Exists("") || !s.Exists("pixel") {+ t.Errorf("删除后存在与否不对")+ }+ if err := s.Delete("a"); !errors.Is(err, ErrNotFound) {+ t.Errorf("删不存在的主题:%v", err)+ }+}++// withOrientation 在 JPEG 的开头插一段只有拍摄方向的 EXIF+func withOrientation(t *testing.T, jpg []byte, o uint16) []byte {+ t.Helper()+ var tiff bytes.Buffer+ tiff.WriteString("MM\x00\x2a")+ binary.Write(&tiff, binary.BigEndian, uint32(8))+ binary.Write(&tiff, binary.BigEndian, uint16(1))+ binary.Write(&tiff, binary.BigEndian, []uint16{0x0112, 3})+ binary.Write(&tiff, binary.BigEndian, uint32(1))+ binary.Write(&tiff, binary.BigEndian, []uint16{o, 0})+ binary.Write(&tiff, binary.BigEndian, uint32(0))+ // 再塞一段假的 GPS 信息,检查重新编码后没有留下来+ tiff.WriteString("GPS-SECRET")+ seg := append([]byte("Exif\x00\x00"), tiff.Bytes()...)+ var out bytes.Buffer+ out.Write(jpg[:2])+ out.Write([]byte{0xFF, 0xE1})+ binary.Write(&out, binary.BigEndian, uint16(len(seg)+2))+ out.Write(seg)+ out.Write(jpg[2:])+ return out.Bytes()+}++func solid(w, h int, c color.RGBA) *image.RGBA {+ img := image.NewRGBA(image.Rect(0, 0, w, h))+ for i := 0; i < len(img.Pix); i += 4 {+ img.Pix[i], img.Pix[i+1], img.Pix[i+2], img.Pix[i+3] = c.R, c.G, c.B, c.A+ }+ return img+}++func TestImportBackgroundStripsExifAndRotates(t *testing.T) {+ s := newStore(t)+ var buf bytes.Buffer+ if err := jpeg.Encode(&buf, solid(40, 20, color.RGBA{250, 250, 250, 255}), nil); err != nil {+ t.Fatal(err)+ }+ src := withOrientation(t, buf.Bytes(), 6)+ if jpegOrientation(src) != 6 {+ t.Fatal("测试数据里的方向没写对")+ }+ info, err := s.ImportBackground(src, "")+ if err != nil {+ t.Fatal(err)+ }+ if info.Width != 20 || info.Height != 40 || info.Format != "jpeg" {+ t.Errorf("方向 6 应当转成竖图:%+v", info)+ }+ data, format, err := s.Background(info.SHA256, false)+ if err != nil || format != "jpeg" {+ t.Fatal(err, format)+ }+ if bytes.Contains(data, []byte("Exif")) || bytes.Contains(data, []byte("GPS-SECRET")) {+ t.Error("重新编码后不该留下 EXIF")+ }+ if blurred, _, err := s.Background(info.SHA256, true); err != nil || len(blurred) == 0 {+ t.Errorf("应当有模糊版:%v", err)+ }+ if info.Luminance < 0.9 || info.MinScrimDark < 0.7 || info.MinScrimLight != 0 {+ t.Errorf("近白的图:亮度高,白字要很浓的黑遮罩,黑字不用遮罩:%+v", info)+ }+ if len(info.Colors) < 1 || len(info.Colors) > 5 {+ t.Errorf("主色数量不对:%v", info.Colors)+ }+}++func TestImportBackgroundScalesAndKeepsTiles(t *testing.T) {+ s := newStore(t)+ var big bytes.Buffer+ jpeg.Encode(&big, solid(5000, 50, color.RGBA{20, 30, 40, 255}), nil)+ info, err := s.ImportBackground(big.Bytes(), "")+ if err != nil {+ t.Fatal(err)+ }+ if info.Width != maxBackgroundSide || info.Height != 38 {+ t.Errorf("长边应当缩到 %d:%dx%d", maxBackgroundSide, info.Width, info.Height)+ }+ if info.MinScrimDark != 0 || info.MinScrimLight < 0.1 {+ t.Errorf("很暗的图:白字不用遮罩,黑字要白遮罩:%+v", info)+ }++ var tile bytes.Buffer+ png.Encode(&tile, solid(16, 16, color.RGBA{61, 220, 151, 255}))+ info, err = s.ImportBackground(tile.Bytes(), "")+ if err != nil {+ t.Fatal(err)+ }+ if info.Format != "png" || info.Width != 16 {+ t.Errorf("小 PNG 应当原样保留成 PNG:%+v", info)+ }+ if _, err := s.ImportBackground([]byte("not an image"), ""); !errors.Is(err, ErrNotImage) {+ t.Errorf("不是图片:%v", err)+ }+}++func TestDeleteBackgroundInUse(t *testing.T) {+ s := newStore(t)+ var buf bytes.Buffer+ png.Encode(&buf, solid(8, 8, color.RGBA{0, 0, 0, 255}))+ info, err := s.ImportBackground(buf.Bytes(), "")+ if err != nil {+ t.Fatal(err)+ }+ put(t, s, `{"schema":1,"id":"bg","background":{"image":"user:`+info.SHA256+`","fit":"tile"}}`)+ if err := s.DeleteBackground(info.SHA256); !errors.Is(err, ErrInUse) {+ t.Errorf("还在用的背景图不能删:%v", err)+ }+ if err := s.Delete("bg"); err != nil {+ t.Fatal(err)+ }+ if err := s.DeleteBackground(info.SHA256); err != nil {+ t.Fatal(err)+ }+ if _, _, err := s.Background(info.SHA256, false); !errors.Is(err, ErrNotFound) {+ t.Errorf("删掉后不该还读得到:%v", err)+ }+ entries, _ := os.ReadDir(s.backgrounds)+ if len(entries) != 0 {+ t.Errorf("模糊版也要删掉,还剩 %d 个文件", len(entries))+ }+}++func TestCheckDoesNotSave(t *testing.T) {+ s := newStore(t)+ id, warnings, err := s.Check([]byte(`{"schema":1,"id":"dim","modes":{"dark":{"textDim":"#3A3A3C"}}}`))+ if err != nil || id != "dim" {+ t.Fatal(id, err)+ }+ if len(warnings) == 0 {+ t.Error("textDim 和背景几乎一样,应当有对比度警告")+ }+ if s.Exists("dim") {+ t.Error("只校验时不该保存")+ }+ if _, _, err := s.Check([]byte(`{"schema":1,"id":"pixel"}`)); !isInvalid(err) {+ t.Errorf("内置主题的 id 校验时也要拒绝:%v", err)+ }+}++func TestAnalyzeBackground(t *testing.T) {+ s := newStore(t)+ var buf bytes.Buffer+ png.Encode(&buf, solid(16, 16, color.RGBA{10, 10, 10, 255}))+ info, err := s.ImportBackground(buf.Bytes(), "")+ if err != nil {+ t.Fatal(err)+ }+ again, err := s.AnalyzeBackground(info.SHA256)+ if err != nil {+ t.Fatal(err)+ }+ if again.SHA256 != info.SHA256 || again.Width != 16 || again.Format != "png" || again.Luminance != info.Luminance {+ t.Errorf("重新分析应当与导入时一致:%+v vs %+v", again, info)+ }+ if _, err := s.AnalyzeBackground(strings.Repeat("0", 64)); !errors.Is(err, ErrNotFound) {+ t.Errorf("没有这张图:%v", err)+ }+}diff --git a/client-core/mobile/mobile.go b/client-core/mobile/mobile.goindex 9855807..c0e30ff 100644--- a/client-core/mobile/mobile.go+++ b/client-core/mobile/mobile.go@@ -39,6 +39,7 @@ import ("github.com/baiyuze/pasteferry/client-core/internal/sendpeer""github.com/baiyuze/pasteferry/client-core/internal/store"syncengine "github.com/baiyuze/pasteferry/client-core/internal/sync"+ "github.com/baiyuze/pasteferry/client-core/internal/theme""github.com/baiyuze/pasteferry/client-core/internal/transport/p2p"pb "github.com/baiyuze/pasteferry/proto/gen/pasteferry/v1")@@ -392,6 +393,7 @@ func start(dataDir, deviceName, version string, host Host) (_ *core, err error)}srv := rpc.NewServer(rpc.Deps{Store: db,+ Themes: theme.NewStore(paths),Paths: paths,Version: version,DeviceID: id.DeviceID,diff --git a/design/mcp.md b/design/mcp.mdnew file mode 100644index 0000000..a89ce24--- /dev/null+++ b/design/mcp.md@@ -0,0 +1,80 @@+# 隔空贴:让 AI 改主题(MCP)++> 方案稿 · 2026-11-06 · 已实现+>+> - 主题的格式与校验见 `design/themes.md`(第 3、8、9 节);本文只讲 MCP 这一层。+> - 面向用户的说明见 `guide/ai-themes.zh-CN.md`。++## 1. 概览++`pasteferry-cli mcp` 是一个按 [Model Context Protocol](https://modelcontextprotocol.io/) 工作的本机服务,让 Claude Desktop、Claude Code、Cursor 这类 AI 客户端读、校验、保存、应用隔空贴的主题,导入背景图。++- **传输**:stdio。一行一条 JSON-RPC 2.0 消息;stdout 只写协议消息,日志写 stderr。+- **协议版本**:2025-06-18 与 2025-03-26。客户端要的版本在这两个里就照它回,否则回 2025-06-18。2025-06-18 下工具结果另带 `structuredContent`;2025-03-26 的批量请求照样处理。+- **不引入新依赖**:协议部分手写,在 `client-core/cmd/pasteferry-cli/mcp.go`;主题格式说明在 `mcp_schema.go`。+- **连接**:走 CLI 已有的本机 RPC 认证(`daemon.json` 里的端口与 token),与 `design/cli-json.md` 相同。每次调用工具时才连后台服务:AI 客户端常常比隔空贴先启动,后台服务重启后也不用重开会话。+- **设备之间的协议不变,服务器不变。**++## 2. 能做什么、不能做什么++只提供主题与背景图。复制记录、设备、好友、配置里的其他项一律不经 MCP 提供:AI 客户端会把工具结果发给模型服务商,剪贴板内容不能这样流出去。以后若要提供,需要在设置里单独开关,默认关闭。++修改类的工具只有:保存与删除自定义主题、切换当前主题与深浅模式、导入背景图。内置主题(`default`、`pixel`)不能覆盖也不能删除。是否让 AI 调用由客户端自己的授权流程把关(Claude Desktop 等每次调用前会问用户)。++## 3. 工具++| 工具 | 参数 | 结果 |+|---|---|---|+| `theme_list` | 无 | `current`(当前主题 id,默认主题是 `default`)、`mode`(system、light、dark)、`scanlines`、`themes[]`(`id`、`name`、`builtin`、`base`) |+| `theme_get` | `id`,`resolved`(默认 true) | 主题 JSON。`resolved` 时合并了 base,22 个颜色角色与各项设置齐全 |+| `theme_schema` | 无 | 主题格式的 JSON Schema:每个颜色角色用在界面哪里、要和谁达到多少对比度,各项的取值范围 |+| `theme_validate` | `theme`(对象或 JSON 字符串) | 只校验不保存:`valid`、`id`、`warnings[]`(`mode`、`foreground`、`background`、`ratio`、`minimum`)。格式错误以 `isError` 返回 |+| `theme_save` | `theme` | 保存:`saved`、`id`、`warnings[]` |+| `theme_apply` | `id`,`mode`(可选:system、light、dark) | `current`、`mode`。主窗口、快捷粘贴窗口、手机 App 立即换 |+| `theme_delete` | `id` | `deleted`。删的是正在用的主题时换回默认主题 |+| `background_import` | `path` 或 `base64`(二选一) | `sha256`、`reference`(`user:<sha256>`,写进主题的 `background.image`)、宽高、格式、`luminance`、`luminance_spread`、`colors[]`、`min_scrim_dark`、`min_scrim_light` |+| `background_analyze` | `sha256`(可带 `user:` 前缀) | 与上面相同的分析结果 |++- 工具的说明与参数说明都用英文写,写清每个字段的用途,模型照着就能用。+- `background_import` 不接受网址(含 `://` 的路径直接拒绝),要 AI 先下载到本机文件;`base64` 可以带 `data:` 前缀。+- 工具出错不算协议错误:结果里 `isError: true`,文字是人能读的原因。后台服务的校验消息本来就是给用户看的(中文),原样转过去;连不上后台服务等情况给英文说明。++`initialize` 的 `instructions` 给出建议的流程:`theme_list` → `theme_get` 一套内置主题作起点 → 写一套自己 id、`base` 指向它、只覆盖改动的主题 → `theme_validate` → 处理对比度警告 → `theme_save` → `theme_apply`。++## 4. 资源++| URI | 内容 |+|---|---|+| `pasteferry://themes/schema` | 与 `theme_schema` 相同的 JSON Schema(`application/schema+json`) |+| `pasteferry://themes/{id}` | 主题保存时的原样(不合并 base;要完整内容用 `theme_get`) |++`resources/list` 列出格式说明与现有的每套主题;后台服务没开时只列格式说明。另有 `resources/templates/list` 给出 `pasteferry://themes/{id}`。不支持订阅。++## 5. 后台服务的改动++- `PutThemeRequest.dry_run`:只校验、算对比度,不保存也不推送 `themes_changed`。`theme_validate` 用它,校验规则与保存时完全一致。+- `AnalyzeBackground(BackgroundRef) → BackgroundInfo`:重新分析一张已导入的背景图。分析的是保存下来的文件(重新编码过),结果与导入时可能差一点点。++## 6. 错误处理++| 情况 | 回复 |+|---|---|+| 一行不是 JSON | JSON-RPC 错误 -32700 |+| 没有 `jsonrpc: "2.0"` 或没有 `method` | -32600 |+| 不认识的方法 | -32601 |+| `tools/call` 缺工具名、工具不存在、参数不是对象 | -32602 |+| 资源不存在 | -32002 |+| 后台服务没运行、连不上、token 不对、版本太旧 | 工具结果 `isError`,说明怎么办 |++通知(没有 `id` 的消息,如 `notifications/initialized`)不回复。++## 7. 测试++`client-core/cmd/pasteferry-cli/mcp_test.go` 起一个真实的后台服务(只有配置与主题存储),用内存里的输入输出驱动整段 MCP 会话:++- 两个协议版本的 `initialize`、`tools/list`、`resources/list`、`ping`、不认识的方法;+- 校验、保存、应用、列表、合并后的读取、读资源、删除(删掉正在用的主题后换回默认);+- 内置主题不能覆盖、格式错误说清楚、对比度警告;+- 背景图用 base64 导入、拒绝网址、重新分析、主题引用导入的图;+- 后台服务没开、坏输入、批量请求;+- 每个颜色角色都有说明。diff --git a/guide/ai-themes.md b/guide/ai-themes.mdnew file mode 100644index 0000000..2c71c61--- /dev/null+++ b/guide/ai-themes.md@@ -0,0 +1,84 @@+# Let AI design your theme++[简体中文](ai-themes.zh-CN.md) · [Back to README](../README.md)++PasteFerry themes can be made by AI. Ask for "a cyberpunk theme" or "use this photo as the background and match the colors", and the AI reads the theme format, picks the colors, checks that text stays readable, saves the theme and switches to it. It connects through `pasteferry-cli mcp`, which ships with the desktop app, and works with Claude Desktop, Claude Code, Cursor and other MCP clients.++**Themes only**: the AI can read, change and delete themes and background images, nothing else. It cannot see your clipboard history, devices or friends. Your AI client asks you before it saves, applies or deletes a theme.++## Before you start++1. Install the PasteFerry desktop app and open it (the background service must be running).+2. Find `pasteferry-cli`:++| System | Path |+|---|---|+| Mac | `/Applications/PasteFerry.app/Contents/Helpers/pasteferry-cli` (with Homebrew you can write just `pasteferry-cli`) |+| Windows | `%LOCALAPPDATA%\Programs\PasteFerry\pasteferry-cli.exe`; write the full path in configuration files, for example `C:\Users\you\AppData\Local\Programs\PasteFerry\pasteferry-cli.exe` |+| Linux | `/usr/bin/pasteferry-cli` from the deb package; `PasteFerry/pasteferry-cli` inside the extracted tar.gz |++The examples below use the Mac path; replace it with yours.++## Claude Desktop++Open Settings → Developer → Edit Config and add this to `claude_desktop_config.json`:++```json+{+ "mcpServers": {+ "pasteferry": {+ "command": "/Applications/PasteFerry.app/Contents/Helpers/pasteferry-cli",+ "args": ["mcp"]+ }+ }+}+```++On Windows, double the backslashes: `"C:\\Users\\you\\AppData\\Local\\Programs\\PasteFerry\\pasteferry-cli.exe"`. Restart Claude Desktop afterwards.++## Claude Code++```bash+claude mcp add pasteferry -- /Applications/PasteFerry.app/Contents/Helpers/pasteferry-cli mcp+```++## Cursor++Add this to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` in a project:++```json+{+ "mcpServers": {+ "pasteferry": {+ "command": "/Applications/PasteFerry.app/Contents/Helpers/pasteferry-cli",+ "args": ["mcp"]+ }+ }+}+```++## Things to ask++- "Which PasteFerry themes do I have? Switch to the pixel theme in dark mode."+- "Make a matcha green theme based on the default one, light and dark, with readable text."+- "Change the pixel theme's accent to coral, save it as a new theme and use it."+- "Use ~/Pictures/beach.jpg as the background and match the colors to the photo."+- "Delete the theme you just made."++Themes made by AI appear in Settings → Appearance next to the built-in ones, so you can switch back at any time.++## Questions++**The AI says it cannot reach PasteFerry**+Open PasteFerry (or check in Settings that the background service is running), then ask the AI to try again. You don't need to restart the AI client.++**The AI reports low contrast**+PasteFerry checks that body and secondary text reach 4.5:1 against the background, hint text 3:1, and button text 4.5:1 against the button. Ask the AI to adjust those colors. The theme saves anyway, but that text may be hard to read.++**Can I use an image from the web?**+Not by URL. Download the image first, then give the AI the file. The image is re-encoded on import, so location data from photos is not kept.++**Several computers**+Themes are stored on this computer only and are not synced. Set up the AI client on the other computer too, or have the AI save the theme there again.++Technical details: [MCP design](../design/mcp.md) and [theme format](../design/themes.md).diff --git a/guide/ai-themes.zh-CN.md b/guide/ai-themes.zh-CN.mdnew file mode 100644index 0000000..746d912--- /dev/null+++ b/guide/ai-themes.zh-CN.md@@ -0,0 +1,84 @@+# 让 AI 帮你做主题++[English](ai-themes.md) · [回到 README](../README.zh-CN.md)++隔空贴的主题可以交给 AI 来做:说一句「给我做一个赛博朋克风的主题」或者「用这张照片当背景,配一套颜色」,AI 会读主题格式、写好配色、检查文字是否看得清、保存并换上。它通过桌面版自带的 `pasteferry-cli mcp` 连接隔空贴,支持 Claude Desktop、Claude Code、Cursor 等支持 MCP 的 AI 客户端。++**只给主题**:AI 能读、改、删的只有主题与背景图,看不到你的复制记录、设备和好友。保存、应用、删除主题前,AI 客户端会先问你。++## 准备++1. 装好隔空贴桌面版并打开(后台服务要在运行)。+2. 找到 `pasteferry-cli`:++| 系统 | 路径 |+|---|---|+| Mac | `/Applications/PasteFerry.app/Contents/Helpers/pasteferry-cli`(用 Homebrew 装的可以直接写 `pasteferry-cli`) |+| Windows | `%LOCALAPPDATA%\Programs\PasteFerry\pasteferry-cli.exe`,写进配置时要展开成完整路径,如 `C:\Users\你的用户名\AppData\Local\Programs\PasteFerry\pasteferry-cli.exe` |+| Linux | deb 包是 `/usr/bin/pasteferry-cli`;tar.gz 是解压目录里的 `PasteFerry/pasteferry-cli` |++下面的例子用 Mac 的路径,其他系统换成上表里的。++## Claude Desktop++打开「设置 → 开发者 → 编辑配置」,在 `claude_desktop_config.json` 里加上:++```json+{+ "mcpServers": {+ "pasteferry": {+ "command": "/Applications/PasteFerry.app/Contents/Helpers/pasteferry-cli",+ "args": ["mcp"]+ }+ }+}+```++Windows 上路径里的反斜杠要写两遍:`"C:\\Users\\你的用户名\\AppData\\Local\\Programs\\PasteFerry\\pasteferry-cli.exe"`。保存后重启 Claude Desktop。++## Claude Code++```bash+claude mcp add pasteferry -- /Applications/PasteFerry.app/Contents/Helpers/pasteferry-cli mcp+```++## Cursor++在 `~/.cursor/mcp.json`(所有项目)或项目里的 `.cursor/mcp.json` 加上:++```json+{+ "mcpServers": {+ "pasteferry": {+ "command": "/Applications/PasteFerry.app/Contents/Helpers/pasteferry-cli",+ "args": ["mcp"]+ }+ }+}+```++## 可以这样说++- 「看看隔空贴现在有哪些主题,换成像素主题,深色。」+- 「基于默认主题做一套抹茶绿的主题,浅色和深色都要,文字要看得清。」+- 「把像素主题的强调色换成珊瑚橙,存成一套新主题并用上。」+- 「用 ~/Pictures/海边.jpg 当背景,按照片的颜色配一套主题。」+- 「删掉刚才那套主题。」++AI 做好的主题会出现在「设置 → 外观」里,和内置主题放在一起,随时可以换回来。++## 常见问题++**AI 说连不上隔空贴**+打开隔空贴(或者在「设置」里确认后台服务在运行),再让 AI 重试,不用重启 AI 客户端。++**AI 说某些颜色对比度不够**+这是隔空贴的检查:正文和说明文字与背景的对比度要达到 4.5:1,提示文字 3:1,按钮上的字与按钮 4.5:1。让 AI 按警告调深或调浅那几个颜色即可;不改也能保存,只是那几处字可能看不清。++**能不能用网上的图片当背景**+不能直接给网址。先把图片下载到电脑上,再让 AI 用这个文件。导入时会重新编码,照片里的拍摄位置等信息不会保留。++**同时有好几台电脑**+主题只保存在本机,不会同步到其他设备。在另一台电脑上同样配置一遍,或者让 AI 把主题再存一次。++技术细节见 [MCP 方案](../design/mcp.md) 与 [主题格式](../design/themes.md)。diff --git a/proto/gen/pasteferry/v1/daemon.pb.go b/proto/gen/pasteferry/v1/daemon.pb.goindex 77039f7..d716e00 100644--- a/proto/gen/pasteferry/v1/daemon.pb.go+++ b/proto/gen/pasteferry/v1/daemon.pb.go@@ -303,6 +303,56 @@ func (ClipboardWriteOutcome) EnumDescriptor() ([]byte, []int) {return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{4}}+// 浅色还是深色+type ThemeMode int32++const (+ ThemeMode_THEME_MODE_UNSPECIFIED ThemeMode = 0 // 跟随系统+ ThemeMode_THEME_MODE_LIGHT ThemeMode = 1+ ThemeMode_THEME_MODE_DARK ThemeMode = 2+)++// Enum value maps for ThemeMode.+var (+ ThemeMode_name = map[int32]string{+ 0: "THEME_MODE_UNSPECIFIED",+ 1: "THEME_MODE_LIGHT",+ 2: "THEME_MODE_DARK",+ }+ ThemeMode_value = map[string]int32{+ "THEME_MODE_UNSPECIFIED": 0,+ "THEME_MODE_LIGHT": 1,+ "THEME_MODE_DARK": 2,+ }+)++func (x ThemeMode) Enum() *ThemeMode {+ p := new(ThemeMode)+ *p = x+ return p+}++func (x ThemeMode) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (ThemeMode) Descriptor() protoreflect.EnumDescriptor {+ return file_pasteferry_v1_daemon_proto_enumTypes[5].Descriptor()+}++func (ThemeMode) Type() protoreflect.EnumType {+ return &file_pasteferry_v1_daemon_proto_enumTypes[5]+}++func (x ThemeMode) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use ThemeMode.Descriptor instead.+func (ThemeMode) EnumDescriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{5}+}+type ServiceMode int32const (@@ -339,11 +389,11 @@ func (x ServiceMode) String() string {}func (ServiceMode) Descriptor() protoreflect.EnumDescriptor {- return file_pasteferry_v1_daemon_proto_enumTypes[5].Descriptor()+ return file_pasteferry_v1_daemon_proto_enumTypes[6].Descriptor()}func (ServiceMode) Type() protoreflect.EnumType {- return &file_pasteferry_v1_daemon_proto_enumTypes[5]+ return &file_pasteferry_v1_daemon_proto_enumTypes[6]}func (x ServiceMode) Number() protoreflect.EnumNumber {@@ -352,7 +402,7 @@ func (x ServiceMode) Number() protoreflect.EnumNumber {// Deprecated: Use ServiceMode.Descriptor instead.func (ServiceMode) EnumDescriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{5}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{6}}type TransferDirection int32@@ -388,11 +438,11 @@ func (x TransferDirection) String() string {}func (TransferDirection) Descriptor() protoreflect.EnumDescriptor {- return file_pasteferry_v1_daemon_proto_enumTypes[6].Descriptor()+ return file_pasteferry_v1_daemon_proto_enumTypes[7].Descriptor()}func (TransferDirection) Type() protoreflect.EnumType {- return &file_pasteferry_v1_daemon_proto_enumTypes[6]+ return &file_pasteferry_v1_daemon_proto_enumTypes[7]}func (x TransferDirection) Number() protoreflect.EnumNumber {@@ -401,7 +451,7 @@ func (x TransferDirection) Number() protoreflect.EnumNumber {// Deprecated: Use TransferDirection.Descriptor instead.func (TransferDirection) EnumDescriptor() ([]byte, []int) {- return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{6}+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{7}}type Empty struct {@@ -989,6 +1039,7 @@ type Event struct {// *Event_ProfileChanged// *Event_WebShareChanged// *Event_Notice+ // *Event_ThemesChangedPayload isEvent_Payload `protobuf_oneof:"payload"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -1202,6 +1253,15 @@ func (x *Event) GetNotice() *AppNotice {return nil}+func (x *Event) GetThemesChanged() *ThemesChanged {+ if x != nil {+ if x, ok := x.Payload.(*Event_ThemesChanged); ok {+ return x.ThemesChanged+ }+ }+ return nil+}+type isEvent_Payload interface {isEvent_Payload()}@@ -1291,6 +1351,11 @@ type Event_Notice struct {Notice *AppNotice `protobuf:"bytes,19,opt,name=notice,proto3,oneof"`}+type Event_ThemesChanged struct {+ // 自定义主题保存或删除了(正在用哪一套的变化走 config_changed)+ ThemesChanged *ThemesChanged `protobuf:"bytes,20,opt,name=themes_changed,json=themesChanged,proto3,oneof"`+}+func (*Event_ClipAdded) isEvent_Payload() {}func (*Event_ClipUpdated) isEvent_Payload() {}@@ -1329,6 +1394,8 @@ func (*Event_WebShareChanged) isEvent_Payload() {}func (*Event_Notice) isEvent_Payload() {}+func (*Event_ThemesChanged) isEvent_Payload() {}+// AppNotice 是一条给用户看的提示,只带一个固定代码,文案由界面翻译。// 不叫 Notice:界面里已经有一个叫 Notice 的组件type AppNotice struct {@@ -3774,8 +3841,13 @@ type Config struct {QuickPasteIndexModifier string `protobuf:"bytes,33,opt,name=quick_paste_index_modifier,json=quickPasteIndexModifier,proto3" json:"quick_paste_index_modifier,omitempty"`// 手机上「发送记录」显示最近几天的发出内容(2.7.2):0 或空表示默认 3 天SentRetentionDays int32 `protobuf:"varint,34,opt,name=sent_retention_days,json=sentRetentionDays,proto3" json:"sent_retention_days,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache+ // 用哪套主题(design/themes.md):空字符串表示默认主题,否则是 ListThemes 里的 id+ ThemeId string `protobuf:"bytes,35,opt,name=theme_id,json=themeId,proto3" json:"theme_id,omitempty"`+ ThemeMode ThemeMode `protobuf:"varint,36,opt,name=theme_mode,json=themeMode,proto3,enum=pasteferry.v1.ThemeMode" json:"theme_mode,omitempty"`+ // 像素主题的 CRT 扫描线效果,默认关+ ThemeScanlines bool `protobuf:"varint,37,opt,name=theme_scanlines,json=themeScanlines,proto3" json:"theme_scanlines,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}func (x *Config) Reset() {@@ -4046,6 +4118,27 @@ func (x *Config) GetSentRetentionDays() int32 {return 0}+func (x *Config) GetThemeId() string {+ if x != nil {+ return x.ThemeId+ }+ return ""+}++func (x *Config) GetThemeMode() ThemeMode {+ if x != nil {+ return x.ThemeMode+ }+ return ThemeMode_THEME_MODE_UNSPECIFIED+}++func (x *Config) GetThemeScanlines() bool {+ if x != nil {+ return x.ThemeScanlines+ }+ return false+}+type OfficialUsage struct {state protoimpl.MessageState `protogen:"open.v1"`Available bool `protobuf:"varint,1,opt,name=available,proto3" json:"available,omitempty"`@@ -6568,196 +6661,986 @@ func (x *WebSessionRef) GetId() string {return ""}-var File_pasteferry_v1_daemon_proto protoreflect.FileDescriptor+type ThemeInfo struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`+ // 界面语言("zh-Hans"、"en" 等)到名字;没有当前语言时界面取 "en",再没有就显示 id+ Name map[string]string `protobuf:"bytes,2,rep,name=name,proto3" json:"name,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`+ Builtin bool `protobuf:"varint,3,opt,name=builtin,proto3" json:"builtin,omitempty"` // 内置主题(default、pixel)不能修改、删除+ Base string `protobuf:"bytes,4,opt,name=base,proto3" json:"base,omitempty"` // 自定义主题继承的主题+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}-const file_pasteferry_v1_daemon_proto_rawDesc = "" +- "\n" +- "\x1apasteferry/v1/daemon.proto\x12\rpasteferry.v1\"\a\n" +- "\x05Empty\"l\n" +- "\bClipItem\x12\x12\n" +- "\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\"\x98\x05\n" +- "\n" +- "ClipRecord\x12\x0e\n" +- "\x02id\x18\x01 \x01(\tR\x02id\x12+\n" +- "\x04kind\x18\x02 \x01(\x0e2\x17.pasteferry.v1.ClipKindR\x04kind\x121\n" +- "\x06status\x18\x03 \x01(\x0e2\x19.pasteferry.v1.ClipStatusR\x06status\x12(\n" +- "\x10origin_device_id\x18\x04 \x01(\tR\x0eoriginDeviceId\x12,\n" +- "\x12origin_device_name\x18\x05 \x01(\tR\x10originDeviceName\x12\x1a\n" +- "\boutgoing\x18\x06 \x01(\bR\boutgoing\x12-\n" +- "\x05items\x18\a \x03(\v2\x17.pasteferry.v1.ClipItemR\x05items\x12\x1d\n" +- "\n" +- "total_size\x18\b \x01(\x03R\ttotalSize\x12!\n" +- "\ftext_preview\x18\t \x01(\tR\vtextPreview\x12&\n" +- "\x0fcreated_at_unix\x18\n" +- " \x01(\x03R\rcreatedAtUnix\x12&\n" +- "\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\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\x12\x14\n" +- "\x05alias\x18\x12 \x01(\tR\x05alias\x12\x19\n" +- "\bvia_name\x18\x13 \x01(\tR\aviaName\"1\n" +- "\x10SubscribeRequest\x12\x1d\n" +- "\n" +- "since_unix\x18\x01 \x01(\x03R\tsinceUnix\"\x8d\x01\n" +- "\x10TransferProgress\x12\x17\n" +- "\aclip_id\x18\x01 \x01(\tR\x06clipId\x12 \n" +- "\vtransferred\x18\x02 \x01(\x03R\vtransferred\x12\x14\n" +- "\x05total\x18\x03 \x01(\x03R\x05total\x12(\n" +- "\x10bytes_per_second\x18\x04 \x01(\x01R\x0ebytesPerSecond\"\xe3\x03\n" +- "\x06Device\x12\x0e\n" +- "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" +- "\x04name\x18\x02 \x01(\tR\x04name\x12\x1a\n" +- "\bplatform\x18\x03 \x01(\tR\bplatform\x12\x16\n" +- "\x06online\x18\x04 \x01(\bR\x06online\x12=\n" +- "\n" +- "connection\x18\x05 \x01(\x0e2\x1d.pasteferry.v1.ConnectionKindR\n" +- "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\x12%\n" +- "\x0ereceives_files\x18\t \x01(\bR\rreceivesFiles\x12)\n" +- "\x10receive_disabled\x18\n" +- " \x01(\bR\x0freceiveDisabled\x12#\n" +- "\rlan_reachable\x18\v \x01(\bR\flanReachable\x12%\n" +- "\x0efeatures_known\x18\f \x01(\bR\rfeaturesKnown\x12\x1f\n" +- "\vapp_version\x18\r \x01(\tR\n" +- "appVersion\"\xb3\t\n" +- "\x05Event\x12:\n" +- "\n" +- "clip_added\x18\x01 \x01(\v2\x19.pasteferry.v1.ClipRecordH\x00R\tclipAdded\x12>\n" +- "\fclip_updated\x18\x02 \x01(\v2\x19.pasteferry.v1.ClipRecordH\x00R\vclipUpdated\x12#\n" +- "\fclip_removed\x18\x03 \x01(\tH\x00R\vclipRemoved\x12=\n" +- "\bprogress\x18\x04 \x01(\v2\x1f.pasteferry.v1.TransferProgressH\x00R\bprogress\x12>\n" +- "\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\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\x11quickPasteChanged\x12D\n" +- "\x10transfer_changed\x18\v \x01(\v2\x17.pasteferry.v1.TransferH\x00R\x0ftransferChanged\x12+\n" +- "\x10transfer_removed\x18\f \x01(\tH\x00R\x0ftransferRemoved\x12\x1c\n" +- "\bnavigate\x18\r \x01(\tH\x00R\bnavigate\x12>\n" +- "\x0efriend_changed\x18\x0e \x01(\v2\x15.pasteferry.v1.FriendH\x00R\rfriendChanged\x12'\n" +- "\x0efriend_removed\x18\x0f \x01(\tH\x00R\rfriendRemoved\x12E\n" +- "\x0efriend_request\x18\x10 \x01(\v2\x1c.pasteferry.v1.FriendRequestH\x00R\rfriendRequest\x12A\n" +- "\x0fprofile_changed\x18\x11 \x01(\v2\x16.pasteferry.v1.ProfileH\x00R\x0eprofileChanged\x12K\n" +- "\x11web_share_changed\x18\x12 \x01(\v2\x1d.pasteferry.v1.WebShareStatusH\x00R\x0fwebShareChanged\x122\n" +- "\x06notice\x18\x13 \x01(\v2\x18.pasteferry.v1.AppNoticeH\x00R\x06noticeB\t\n" +- "\apayload\"\x1f\n" +- "\tAppNotice\x12\x12\n" +- "\x04kind\x18\x01 \x01(\tR\x04kind\"\x89\x01\n" +- "\aProfile\x12!\n" +- "\fdisplay_name\x18\x01 \x01(\tR\vdisplayName\x12\x1b\n" +- "\tdevice_id\x18\x02 \x01(\tR\bdeviceId\x12\x1d\n" +- "\n" +- "has_avatar\x18\x03 \x01(\bR\thasAvatar\x12\x1f\n" +- "\vavatar_hash\x18\x04 \x01(\fR\n" +- "avatarHash\"+\n" +- "\x15SetDisplayNameRequest\x12\x12\n" +- "\x04name\x18\x01 \x01(\tR\x04name\"\x87\x01\n" +- "\x10SetAvatarRequest\x12\x12\n" +- "\x04path\x18\x01 \x01(\tR\x04path\x12\x14\n" +- "\x05image\x18\x05 \x01(\fR\x05image\x12\x15\n" +- "\x06crop_x\x18\x02 \x01(\x01R\x05cropX\x12\x15\n" +- "\x06crop_y\x18\x03 \x01(\x01R\x05cropY\x12\x1b\n" +- "\tcrop_size\x18\x04 \x01(\x01R\bcropSize\"/\n" +- "\x10GetAvatarRequest\x12\x1b\n" +- "\tdevice_id\x18\x01 \x01(\tR\bdeviceId\"=\n" +- "\x06Avatar\x12\x12\n" +- "\x04jpeg\x18\x01 \x01(\fR\x04jpeg\x12\x1f\n" +- "\vavatar_hash\x18\x02 \x01(\fR\n" +- "avatarHash\"(\n" +- "\tFriendRef\x12\x1b\n" +- "\tdevice_id\x18\x01 \x01(\tR\bdeviceId\"Z\n" +- "\x1aSetFriendAutoAcceptRequest\x12\x1b\n" +- "\tdevice_id\x18\x01 \x01(\tR\bdeviceId\x12\x1f\n" +- "\vauto_accept\x18\x02 \x01(\bR\n" +- "autoAccept\"\x87\x05\n" +- "\x06Friend\x12\x0e\n" +- "\x02id\x18\x01 \x01(\tR\x02id\x12!\n" +- "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x1f\n" +- "\vdevice_name\x18\x03 \x01(\tR\n" +- "deviceName\x12\x1a\n" +- "\bplatform\x18\x04 \x01(\tR\bplatform\x12\x16\n" +- "\x06online\x18\x05 \x01(\bR\x06online\x12=\n" +- "\n" +- "connection\x18\x06 \x01(\x0e2\x1d.pasteferry.v1.ConnectionKindR\n" +- "connection\x12#\n" +- "\rlan_reachable\x18\a \x01(\bR\flanReachable\x12%\n" +- "\x0efeatures_known\x18\b \x01(\bR\rfeaturesKnown\x12%\n" +- "\x0ereceives_files\x18\t \x01(\bR\rreceivesFiles\x12)\n" +- "\x10receive_disabled\x18\n" +- " \x01(\bR\x0freceiveDisabled\x12\x1f\n" +- "\vapp_version\x18\v \x01(\tR\n" +- "appVersion\x12\x1f\n" +- "\vauto_accept\x18\f \x01(\bR\n" +- "autoAccept\x12\"\n" +- "\radded_at_unix\x18\r \x01(\x03R\vaddedAtUnix\x12,\n" +- "\x12last_activity_unix\x18\x0e \x01(\x03R\x10lastActivityUnix\x12\"\n" +- "\freachability\x18\x0f \x01(\tR\freachability\x12\x1d\n" +- "\n" +- "has_avatar\x18\x10 \x01(\bR\thasAvatar\x12\x1f\n" +- "\vavatar_hash\x18\x11 \x01(\fR\n" +- "avatarHash\x12 \n" +- "\vfingerprint\x18\x12 \x01(\tR\vfingerprint\"F\n" +- "\x13ListFriendsResponse\x12/\n" +- "\afriends\x18\x01 \x03(\v2\x15.pasteferry.v1.FriendR\afriends\"\xf3\x01\n" +- "\rFriendRequest\x12\x18\n" +- "\asession\x18\x01 \x01(\tR\asession\x12\x1b\n" +- "\tdevice_id\x18\x02 \x01(\tR\bdeviceId\x12!\n" +- "\fdisplay_name\x18\x03 \x01(\tR\vdisplayName\x12\x1f\n" +- "\vdevice_name\x18\x04 \x01(\tR\n" +- "deviceName\x12\x1a\n" +- "\bplatform\x18\x05 \x01(\tR\bplatform\x12 \n" +- "\vfingerprint\x18\x06 \x01(\tR\vfingerprint\x12)\n" +- "\x10self_fingerprint\x18\a \x01(\tR\x0fselfFingerprint\"\xa1\x01\n" +- "\bStranger\x12\x0e\n" +- "\x02id\x18\x01 \x01(\tR\x02id\x12!\n" +- "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x1f\n" +- "\vdevice_name\x18\x03 \x01(\tR\n" +- "deviceName\x12\x1a\n" +- "\bplatform\x18\x04 \x01(\tR\bplatform\x12%\n" +- "\x0ereceives_files\x18\x05 \x01(\bR\rreceivesFiles\"B\n" +- "\tStrangers\x125\n" +- "\tstrangers\x18\x01 \x03(\v2\x17.pasteferry.v1.StrangerR\tstrangers\"@\n" +- "\x12PasteFilesResponse\x12\x14\n" +- "\x05paths\x18\x01 \x03(\tR\x05paths\x12\x14\n" +- "\x05image\x18\x02 \x01(\bR\x05image\"\x7f\n" +- "\x12NotificationStatus\x12\x1c\n" +- "\tsupported\x18\x01 \x01(\bR\tsupported\x12+\n" +- "\x11actions_supported\x18\x02 \x01(\bR\x10actionsSupported\x12\x1e\n" +- "\n" +- "permission\x18\x03 \x01(\tR\n" +- "permission\"E\n" +- "\x12NotificationAction\x12\x17\n" +- "\aclip_id\x18\x01 \x01(\tR\x06clipId\x12\x16\n" +- "\x06action\x18\x02 \x01(\tR\x06action\"\x85\x01\n" +- "\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\"\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\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" +- "\x14DeleteHistoryRequest\x12\x10\n" ++func (x *ThemeInfo) Reset() {+ *x = ThemeInfo{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[84]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ThemeInfo) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ThemeInfo) ProtoMessage() {}++func (x *ThemeInfo) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[84]+ 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 ThemeInfo.ProtoReflect.Descriptor instead.+func (*ThemeInfo) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{84}+}++func (x *ThemeInfo) GetId() string {+ if x != nil {+ return x.Id+ }+ return ""+}++func (x *ThemeInfo) GetName() map[string]string {+ if x != nil {+ return x.Name+ }+ return nil+}++func (x *ThemeInfo) GetBuiltin() bool {+ if x != nil {+ return x.Builtin+ }+ return false+}++func (x *ThemeInfo) GetBase() string {+ if x != nil {+ return x.Base+ }+ return ""+}++type ListThemesResponse struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Themes []*ThemeInfo `protobuf:"bytes,1,rep,name=themes,proto3" json:"themes,omitempty"` // 内置的在前,自定义的按 id 排+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ListThemesResponse) Reset() {+ *x = ListThemesResponse{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[85]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ListThemesResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ListThemesResponse) ProtoMessage() {}++func (x *ListThemesResponse) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[85]+ 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 ListThemesResponse.ProtoReflect.Descriptor instead.+func (*ListThemesResponse) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{85}+}++func (x *ListThemesResponse) GetThemes() []*ThemeInfo {+ if x != nil {+ return x.Themes+ }+ return nil+}++type GetThemeRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 空字符串表示默认主题+ Resolved bool `protobuf:"varint,2,opt,name=resolved,proto3" json:"resolved,omitempty"` // 合并 base 之后的完整主题;否则是保存时的原样+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *GetThemeRequest) Reset() {+ *x = GetThemeRequest{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[86]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *GetThemeRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*GetThemeRequest) ProtoMessage() {}++func (x *GetThemeRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[86]+ 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 GetThemeRequest.ProtoReflect.Descriptor instead.+func (*GetThemeRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{86}+}++func (x *GetThemeRequest) GetId() string {+ if x != nil {+ return x.Id+ }+ return ""+}++func (x *GetThemeRequest) GetResolved() bool {+ if x != nil {+ return x.Resolved+ }+ return false+}++type ThemeJson struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Json string `protobuf:"bytes,1,opt,name=json,proto3" json:"json,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ThemeJson) Reset() {+ *x = ThemeJson{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[87]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ThemeJson) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ThemeJson) ProtoMessage() {}++func (x *ThemeJson) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[87]+ 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 ThemeJson.ProtoReflect.Descriptor instead.+func (*ThemeJson) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{87}+}++func (x *ThemeJson) GetJson() string {+ if x != nil {+ return x.Json+ }+ return ""+}++type PutThemeRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Json string `protobuf:"bytes,1,opt,name=json,proto3" json:"json,omitempty"` // 一套主题,id 不能是内置主题的+ DryRun bool `protobuf:"varint,2,opt,name=dry_run,json=dryRun,proto3" json:"dry_run,omitempty"` // 只校验、算对比度,不保存也不推送事件+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *PutThemeRequest) Reset() {+ *x = PutThemeRequest{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[88]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *PutThemeRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*PutThemeRequest) ProtoMessage() {}++func (x *PutThemeRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[88]+ 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 PutThemeRequest.ProtoReflect.Descriptor instead.+func (*PutThemeRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{88}+}++func (x *PutThemeRequest) GetJson() string {+ if x != nil {+ return x.Json+ }+ return ""+}++func (x *PutThemeRequest) GetDryRun() bool {+ if x != nil {+ return x.DryRun+ }+ return false+}++// 一对颜色的对比度不够(design/themes.md 第 8 节)+type ThemeWarning struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Mode string `protobuf:"bytes,1,opt,name=mode,proto3" json:"mode,omitempty"` // "light" 或 "dark"+ Foreground string `protobuf:"bytes,2,opt,name=foreground,proto3" json:"foreground,omitempty"` // 颜色角色名,如 "textDim"+ Background string `protobuf:"bytes,3,opt,name=background,proto3" json:"background,omitempty"` // 如 "surface"+ Ratio float64 `protobuf:"fixed64,4,opt,name=ratio,proto3" json:"ratio,omitempty"` // 实际的对比度+ Minimum float64 `protobuf:"fixed64,5,opt,name=minimum,proto3" json:"minimum,omitempty"` // 要求的最低对比度+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ThemeWarning) Reset() {+ *x = ThemeWarning{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[89]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ThemeWarning) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ThemeWarning) ProtoMessage() {}++func (x *ThemeWarning) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[89]+ 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 ThemeWarning.ProtoReflect.Descriptor instead.+func (*ThemeWarning) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{89}+}++func (x *ThemeWarning) GetMode() string {+ if x != nil {+ return x.Mode+ }+ return ""+}++func (x *ThemeWarning) GetForeground() string {+ if x != nil {+ return x.Foreground+ }+ return ""+}++func (x *ThemeWarning) GetBackground() string {+ if x != nil {+ return x.Background+ }+ return ""+}++func (x *ThemeWarning) GetRatio() float64 {+ if x != nil {+ return x.Ratio+ }+ return 0+}++func (x *ThemeWarning) GetMinimum() float64 {+ if x != nil {+ return x.Minimum+ }+ return 0+}++type PutThemeResponse struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`+ Warnings []*ThemeWarning `protobuf:"bytes,2,rep,name=warnings,proto3" json:"warnings,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *PutThemeResponse) Reset() {+ *x = PutThemeResponse{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[90]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *PutThemeResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*PutThemeResponse) ProtoMessage() {}++func (x *PutThemeResponse) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[90]+ 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 PutThemeResponse.ProtoReflect.Descriptor instead.+func (*PutThemeResponse) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{90}+}++func (x *PutThemeResponse) GetId() string {+ if x != nil {+ return x.Id+ }+ return ""+}++func (x *PutThemeResponse) GetWarnings() []*ThemeWarning {+ if x != nil {+ return x.Warnings+ }+ return nil+}++type ThemeRef struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ThemeRef) Reset() {+ *x = ThemeRef{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[91]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ThemeRef) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ThemeRef) ProtoMessage() {}++func (x *ThemeRef) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[91]+ 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 ThemeRef.ProtoReflect.Descriptor instead.+func (*ThemeRef) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{91}+}++func (x *ThemeRef) GetId() string {+ if x != nil {+ return x.Id+ }+ return ""+}++type ImportBackgroundRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` // 图片文件+ Image []byte `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"` // 或者直接给图片数据(拖入、粘贴时)+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ImportBackgroundRequest) Reset() {+ *x = ImportBackgroundRequest{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[92]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ImportBackgroundRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ImportBackgroundRequest) ProtoMessage() {}++func (x *ImportBackgroundRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[92]+ 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 ImportBackgroundRequest.ProtoReflect.Descriptor instead.+func (*ImportBackgroundRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{92}+}++func (x *ImportBackgroundRequest) GetPath() string {+ if x != nil {+ return x.Path+ }+ return ""+}++func (x *ImportBackgroundRequest) GetImage() []byte {+ if x != nil {+ return x.Image+ }+ return nil+}++// 导入后的背景图。主题里写成 "user:" 加上 sha256 引用它+type BackgroundInfo struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Sha256 string `protobuf:"bytes,1,opt,name=sha256,proto3" json:"sha256,omitempty"` // 重新编码后的文件内容的 SHA-256,十六进制+ Width int32 `protobuf:"varint,2,opt,name=width,proto3" json:"width,omitempty"`+ Height int32 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`+ Format string `protobuf:"bytes,4,opt,name=format,proto3" json:"format,omitempty"` // "jpeg";像素画这类小图保留 "png"+ Luminance float64 `protobuf:"fixed64,5,opt,name=luminance,proto3" json:"luminance,omitempty"` // 平均相对亮度,0 到 1+ LuminanceSpread float64 `protobuf:"fixed64,6,opt,name=luminance_spread,json=luminanceSpread,proto3" json:"luminance_spread,omitempty"` // 亮度的标准差:越大越花,面板要更不透明+ Colors []string `protobuf:"bytes,7,rep,name=colors,proto3" json:"colors,omitempty"` // 3 到 5 个主色,"#RRGGBB",占比大的在前+ // 让白字在最亮的区域也达到 4.5:1,黑色遮罩至少要多浓(0 到 1)+ MinScrimDark float64 `protobuf:"fixed64,8,opt,name=min_scrim_dark,json=minScrimDark,proto3" json:"min_scrim_dark,omitempty"`+ // 让黑字在最暗的区域也达到 4.5:1,白色遮罩至少要多浓(0 到 1)+ MinScrimLight float64 `protobuf:"fixed64,9,opt,name=min_scrim_light,json=minScrimLight,proto3" json:"min_scrim_light,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *BackgroundInfo) Reset() {+ *x = BackgroundInfo{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[93]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *BackgroundInfo) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*BackgroundInfo) ProtoMessage() {}++func (x *BackgroundInfo) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[93]+ 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 BackgroundInfo.ProtoReflect.Descriptor instead.+func (*BackgroundInfo) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{93}+}++func (x *BackgroundInfo) GetSha256() string {+ if x != nil {+ return x.Sha256+ }+ return ""+}++func (x *BackgroundInfo) GetWidth() int32 {+ if x != nil {+ return x.Width+ }+ return 0+}++func (x *BackgroundInfo) GetHeight() int32 {+ if x != nil {+ return x.Height+ }+ return 0+}++func (x *BackgroundInfo) GetFormat() string {+ if x != nil {+ return x.Format+ }+ return ""+}++func (x *BackgroundInfo) GetLuminance() float64 {+ if x != nil {+ return x.Luminance+ }+ return 0+}++func (x *BackgroundInfo) GetLuminanceSpread() float64 {+ if x != nil {+ return x.LuminanceSpread+ }+ return 0+}++func (x *BackgroundInfo) GetColors() []string {+ if x != nil {+ return x.Colors+ }+ return nil+}++func (x *BackgroundInfo) GetMinScrimDark() float64 {+ if x != nil {+ return x.MinScrimDark+ }+ return 0+}++func (x *BackgroundInfo) GetMinScrimLight() float64 {+ if x != nil {+ return x.MinScrimLight+ }+ return 0+}++type GetBackgroundRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Sha256 string `protobuf:"bytes,1,opt,name=sha256,proto3" json:"sha256,omitempty"`+ Blurred bool `protobuf:"varint,2,opt,name=blurred,proto3" json:"blurred,omitempty"` // 模糊版:长边 960,主题的 blur 大于 0 时用它放大铺满+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *GetBackgroundRequest) Reset() {+ *x = GetBackgroundRequest{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[94]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *GetBackgroundRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*GetBackgroundRequest) ProtoMessage() {}++func (x *GetBackgroundRequest) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[94]+ 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 GetBackgroundRequest.ProtoReflect.Descriptor instead.+func (*GetBackgroundRequest) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{94}+}++func (x *GetBackgroundRequest) GetSha256() string {+ if x != nil {+ return x.Sha256+ }+ return ""+}++func (x *GetBackgroundRequest) GetBlurred() bool {+ if x != nil {+ return x.Blurred+ }+ return false+}++type BackgroundImage struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`+ Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"` // "jpeg" 或 "png"+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *BackgroundImage) Reset() {+ *x = BackgroundImage{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[95]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *BackgroundImage) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*BackgroundImage) ProtoMessage() {}++func (x *BackgroundImage) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[95]+ 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 BackgroundImage.ProtoReflect.Descriptor instead.+func (*BackgroundImage) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{95}+}++func (x *BackgroundImage) GetData() []byte {+ if x != nil {+ return x.Data+ }+ return nil+}++func (x *BackgroundImage) GetFormat() string {+ if x != nil {+ return x.Format+ }+ return ""+}++type BackgroundRef struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Sha256 string `protobuf:"bytes,1,opt,name=sha256,proto3" json:"sha256,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *BackgroundRef) Reset() {+ *x = BackgroundRef{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[96]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *BackgroundRef) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*BackgroundRef) ProtoMessage() {}++func (x *BackgroundRef) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[96]+ 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 BackgroundRef.ProtoReflect.Descriptor instead.+func (*BackgroundRef) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{96}+}++func (x *BackgroundRef) GetSha256() string {+ if x != nil {+ return x.Sha256+ }+ return ""+}++type ThemesChanged struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` // 保存或删除了的主题+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ThemesChanged) Reset() {+ *x = ThemesChanged{}+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[97]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ThemesChanged) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ThemesChanged) ProtoMessage() {}++func (x *ThemesChanged) ProtoReflect() protoreflect.Message {+ mi := &file_pasteferry_v1_daemon_proto_msgTypes[97]+ 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 ThemesChanged.ProtoReflect.Descriptor instead.+func (*ThemesChanged) Descriptor() ([]byte, []int) {+ return file_pasteferry_v1_daemon_proto_rawDescGZIP(), []int{97}+}++func (x *ThemesChanged) GetIds() []string {+ if x != nil {+ return x.Ids+ }+ return nil+}++var File_pasteferry_v1_daemon_proto protoreflect.FileDescriptor++const file_pasteferry_v1_daemon_proto_rawDesc = "" ++ "\n" ++ "\x1apasteferry/v1/daemon.proto\x12\rpasteferry.v1\"\a\n" ++ "\x05Empty\"l\n" ++ "\bClipItem\x12\x12\n" ++ "\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\"\x98\x05\n" ++ "\n" ++ "ClipRecord\x12\x0e\n" ++ "\x02id\x18\x01 \x01(\tR\x02id\x12+\n" ++ "\x04kind\x18\x02 \x01(\x0e2\x17.pasteferry.v1.ClipKindR\x04kind\x121\n" ++ "\x06status\x18\x03 \x01(\x0e2\x19.pasteferry.v1.ClipStatusR\x06status\x12(\n" ++ "\x10origin_device_id\x18\x04 \x01(\tR\x0eoriginDeviceId\x12,\n" ++ "\x12origin_device_name\x18\x05 \x01(\tR\x10originDeviceName\x12\x1a\n" ++ "\boutgoing\x18\x06 \x01(\bR\boutgoing\x12-\n" ++ "\x05items\x18\a \x03(\v2\x17.pasteferry.v1.ClipItemR\x05items\x12\x1d\n" ++ "\n" ++ "total_size\x18\b \x01(\x03R\ttotalSize\x12!\n" ++ "\ftext_preview\x18\t \x01(\tR\vtextPreview\x12&\n" ++ "\x0fcreated_at_unix\x18\n" ++ " \x01(\x03R\rcreatedAtUnix\x12&\n" ++ "\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\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\x12\x14\n" ++ "\x05alias\x18\x12 \x01(\tR\x05alias\x12\x19\n" ++ "\bvia_name\x18\x13 \x01(\tR\aviaName\"1\n" ++ "\x10SubscribeRequest\x12\x1d\n" ++ "\n" ++ "since_unix\x18\x01 \x01(\x03R\tsinceUnix\"\x8d\x01\n" ++ "\x10TransferProgress\x12\x17\n" ++ "\aclip_id\x18\x01 \x01(\tR\x06clipId\x12 \n" ++ "\vtransferred\x18\x02 \x01(\x03R\vtransferred\x12\x14\n" ++ "\x05total\x18\x03 \x01(\x03R\x05total\x12(\n" ++ "\x10bytes_per_second\x18\x04 \x01(\x01R\x0ebytesPerSecond\"\xe3\x03\n" ++ "\x06Device\x12\x0e\n" ++ "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" ++ "\x04name\x18\x02 \x01(\tR\x04name\x12\x1a\n" ++ "\bplatform\x18\x03 \x01(\tR\bplatform\x12\x16\n" ++ "\x06online\x18\x04 \x01(\bR\x06online\x12=\n" ++ "\n" ++ "connection\x18\x05 \x01(\x0e2\x1d.pasteferry.v1.ConnectionKindR\n" ++ "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\x12%\n" ++ "\x0ereceives_files\x18\t \x01(\bR\rreceivesFiles\x12)\n" ++ "\x10receive_disabled\x18\n" ++ " \x01(\bR\x0freceiveDisabled\x12#\n" ++ "\rlan_reachable\x18\v \x01(\bR\flanReachable\x12%\n" ++ "\x0efeatures_known\x18\f \x01(\bR\rfeaturesKnown\x12\x1f\n" ++ "\vapp_version\x18\r \x01(\tR\n" ++ "appVersion\"\xfa\t\n" ++ "\x05Event\x12:\n" ++ "\n" ++ "clip_added\x18\x01 \x01(\v2\x19.pasteferry.v1.ClipRecordH\x00R\tclipAdded\x12>\n" ++ "\fclip_updated\x18\x02 \x01(\v2\x19.pasteferry.v1.ClipRecordH\x00R\vclipUpdated\x12#\n" ++ "\fclip_removed\x18\x03 \x01(\tH\x00R\vclipRemoved\x12=\n" ++ "\bprogress\x18\x04 \x01(\v2\x1f.pasteferry.v1.TransferProgressH\x00R\bprogress\x12>\n" ++ "\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\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\x11quickPasteChanged\x12D\n" ++ "\x10transfer_changed\x18\v \x01(\v2\x17.pasteferry.v1.TransferH\x00R\x0ftransferChanged\x12+\n" ++ "\x10transfer_removed\x18\f \x01(\tH\x00R\x0ftransferRemoved\x12\x1c\n" ++ "\bnavigate\x18\r \x01(\tH\x00R\bnavigate\x12>\n" ++ "\x0efriend_changed\x18\x0e \x01(\v2\x15.pasteferry.v1.FriendH\x00R\rfriendChanged\x12'\n" ++ "\x0efriend_removed\x18\x0f \x01(\tH\x00R\rfriendRemoved\x12E\n" ++ "\x0efriend_request\x18\x10 \x01(\v2\x1c.pasteferry.v1.FriendRequestH\x00R\rfriendRequest\x12A\n" ++ "\x0fprofile_changed\x18\x11 \x01(\v2\x16.pasteferry.v1.ProfileH\x00R\x0eprofileChanged\x12K\n" ++ "\x11web_share_changed\x18\x12 \x01(\v2\x1d.pasteferry.v1.WebShareStatusH\x00R\x0fwebShareChanged\x122\n" ++ "\x06notice\x18\x13 \x01(\v2\x18.pasteferry.v1.AppNoticeH\x00R\x06notice\x12E\n" ++ "\x0ethemes_changed\x18\x14 \x01(\v2\x1c.pasteferry.v1.ThemesChangedH\x00R\rthemesChangedB\t\n" ++ "\apayload\"\x1f\n" ++ "\tAppNotice\x12\x12\n" ++ "\x04kind\x18\x01 \x01(\tR\x04kind\"\x89\x01\n" ++ "\aProfile\x12!\n" ++ "\fdisplay_name\x18\x01 \x01(\tR\vdisplayName\x12\x1b\n" ++ "\tdevice_id\x18\x02 \x01(\tR\bdeviceId\x12\x1d\n" ++ "\n" ++ "has_avatar\x18\x03 \x01(\bR\thasAvatar\x12\x1f\n" ++ "\vavatar_hash\x18\x04 \x01(\fR\n" ++ "avatarHash\"+\n" ++ "\x15SetDisplayNameRequest\x12\x12\n" ++ "\x04name\x18\x01 \x01(\tR\x04name\"\x87\x01\n" ++ "\x10SetAvatarRequest\x12\x12\n" ++ "\x04path\x18\x01 \x01(\tR\x04path\x12\x14\n" ++ "\x05image\x18\x05 \x01(\fR\x05image\x12\x15\n" ++ "\x06crop_x\x18\x02 \x01(\x01R\x05cropX\x12\x15\n" ++ "\x06crop_y\x18\x03 \x01(\x01R\x05cropY\x12\x1b\n" ++ "\tcrop_size\x18\x04 \x01(\x01R\bcropSize\"/\n" ++ "\x10GetAvatarRequest\x12\x1b\n" ++ "\tdevice_id\x18\x01 \x01(\tR\bdeviceId\"=\n" ++ "\x06Avatar\x12\x12\n" ++ "\x04jpeg\x18\x01 \x01(\fR\x04jpeg\x12\x1f\n" ++ "\vavatar_hash\x18\x02 \x01(\fR\n" ++ "avatarHash\"(\n" ++ "\tFriendRef\x12\x1b\n" ++ "\tdevice_id\x18\x01 \x01(\tR\bdeviceId\"Z\n" ++ "\x1aSetFriendAutoAcceptRequest\x12\x1b\n" ++ "\tdevice_id\x18\x01 \x01(\tR\bdeviceId\x12\x1f\n" ++ "\vauto_accept\x18\x02 \x01(\bR\n" ++ "autoAccept\"\x87\x05\n" ++ "\x06Friend\x12\x0e\n" ++ "\x02id\x18\x01 \x01(\tR\x02id\x12!\n" ++ "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x1f\n" ++ "\vdevice_name\x18\x03 \x01(\tR\n" ++ "deviceName\x12\x1a\n" ++ "\bplatform\x18\x04 \x01(\tR\bplatform\x12\x16\n" ++ "\x06online\x18\x05 \x01(\bR\x06online\x12=\n" ++ "\n" ++ "connection\x18\x06 \x01(\x0e2\x1d.pasteferry.v1.ConnectionKindR\n" ++ "connection\x12#\n" ++ "\rlan_reachable\x18\a \x01(\bR\flanReachable\x12%\n" ++ "\x0efeatures_known\x18\b \x01(\bR\rfeaturesKnown\x12%\n" ++ "\x0ereceives_files\x18\t \x01(\bR\rreceivesFiles\x12)\n" ++ "\x10receive_disabled\x18\n" ++ " \x01(\bR\x0freceiveDisabled\x12\x1f\n" ++ "\vapp_version\x18\v \x01(\tR\n" ++ "appVersion\x12\x1f\n" ++ "\vauto_accept\x18\f \x01(\bR\n" ++ "autoAccept\x12\"\n" ++ "\radded_at_unix\x18\r \x01(\x03R\vaddedAtUnix\x12,\n" ++ "\x12last_activity_unix\x18\x0e \x01(\x03R\x10lastActivityUnix\x12\"\n" ++ "\freachability\x18\x0f \x01(\tR\freachability\x12\x1d\n" ++ "\n" ++ "has_avatar\x18\x10 \x01(\bR\thasAvatar\x12\x1f\n" ++ "\vavatar_hash\x18\x11 \x01(\fR\n" ++ "avatarHash\x12 \n" ++ "\vfingerprint\x18\x12 \x01(\tR\vfingerprint\"F\n" ++ "\x13ListFriendsResponse\x12/\n" ++ "\afriends\x18\x01 \x03(\v2\x15.pasteferry.v1.FriendR\afriends\"\xf3\x01\n" ++ "\rFriendRequest\x12\x18\n" ++ "\asession\x18\x01 \x01(\tR\asession\x12\x1b\n" ++ "\tdevice_id\x18\x02 \x01(\tR\bdeviceId\x12!\n" ++ "\fdisplay_name\x18\x03 \x01(\tR\vdisplayName\x12\x1f\n" ++ "\vdevice_name\x18\x04 \x01(\tR\n" ++ "deviceName\x12\x1a\n" ++ "\bplatform\x18\x05 \x01(\tR\bplatform\x12 \n" ++ "\vfingerprint\x18\x06 \x01(\tR\vfingerprint\x12)\n" ++ "\x10self_fingerprint\x18\a \x01(\tR\x0fselfFingerprint\"\xa1\x01\n" ++ "\bStranger\x12\x0e\n" ++ "\x02id\x18\x01 \x01(\tR\x02id\x12!\n" ++ "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x1f\n" ++ "\vdevice_name\x18\x03 \x01(\tR\n" ++ "deviceName\x12\x1a\n" ++ "\bplatform\x18\x04 \x01(\tR\bplatform\x12%\n" ++ "\x0ereceives_files\x18\x05 \x01(\bR\rreceivesFiles\"B\n" ++ "\tStrangers\x125\n" ++ "\tstrangers\x18\x01 \x03(\v2\x17.pasteferry.v1.StrangerR\tstrangers\"@\n" ++ "\x12PasteFilesResponse\x12\x14\n" ++ "\x05paths\x18\x01 \x03(\tR\x05paths\x12\x14\n" ++ "\x05image\x18\x02 \x01(\bR\x05image\"\x7f\n" ++ "\x12NotificationStatus\x12\x1c\n" ++ "\tsupported\x18\x01 \x01(\bR\tsupported\x12+\n" ++ "\x11actions_supported\x18\x02 \x01(\bR\x10actionsSupported\x12\x1e\n" ++ "\n" ++ "permission\x18\x03 \x01(\tR\n" ++ "permission\"E\n" ++ "\x12NotificationAction\x12\x17\n" ++ "\aclip_id\x18\x01 \x01(\tR\x06clipId\x12\x16\n" ++ "\x06action\x18\x02 \x01(\tR\x06action\"\x85\x01\n" ++ "\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\"\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\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" ++ "\x14DeleteHistoryRequest\x12\x10\n" +"\x03ids\x18\x01 \x03(\tR\x03ids\x12\x10\n" +"\x03all\x18\x02 \x01(\bR\x03all\"V\n" +"\fFetchRequest\x12\x17\n" +@@ -6826,7 +7709,7 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x04kind\x18\x01 \x01(\x0e2\x1d.pasteferry.v1.ConnectionKindR\x04kind\"P\n" +"\x17SetDeviceAddressRequest\x12\x1b\n" +"\tdevice_id\x18\x01 \x01(\tR\bdeviceId\x12\x18\n" +- "\aaddress\x18\x02 \x01(\tR\aaddress\"\xd5\v\n" ++ "\aaddress\x18\x02 \x01(\tR\aaddress\"\xd2\f\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" +@@ -6865,7 +7748,11 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x13everyone_until_unix\x18\x1f \x01(\x03R\x11everyoneUntilUnix\x12!\n" +"\fdisplay_name\x18 \x01(\tR\vdisplayName\x12;\n" +"\x1aquick_paste_index_modifier\x18! \x01(\tR\x17quickPasteIndexModifier\x12.\n" +- "\x13sent_retention_days\x18\" \x01(\x05R\x11sentRetentionDays\"\xd8\x02\n" ++ "\x13sent_retention_days\x18\" \x01(\x05R\x11sentRetentionDays\x12\x19\n" ++ "\btheme_id\x18# \x01(\tR\athemeId\x127\n" ++ "\n" ++ "theme_mode\x18$ \x01(\x0e2\x18.pasteferry.v1.ThemeModeR\tthemeMode\x12'\n" ++ "\x0ftheme_scanlines\x18% \x01(\bR\x0ethemeScanlines\"\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" +@@ -7078,7 +7965,63 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x11WebShareInviteRef\x12\x0e\n" +"\x02id\x18\x01 \x01(\tR\x02id\"\x1f\n" +"\rWebSessionRef\x12\x0e\n" +- "\x02id\x18\x01 \x01(\tR\x02id*v\n" ++ "\x02id\x18\x01 \x01(\tR\x02id\"\xba\x01\n" ++ "\tThemeInfo\x12\x0e\n" ++ "\x02id\x18\x01 \x01(\tR\x02id\x126\n" ++ "\x04name\x18\x02 \x03(\v2\".pasteferry.v1.ThemeInfo.NameEntryR\x04name\x12\x18\n" ++ "\abuiltin\x18\x03 \x01(\bR\abuiltin\x12\x12\n" ++ "\x04base\x18\x04 \x01(\tR\x04base\x1a7\n" ++ "\tNameEntry\x12\x10\n" ++ "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" ++ "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"F\n" ++ "\x12ListThemesResponse\x120\n" ++ "\x06themes\x18\x01 \x03(\v2\x18.pasteferry.v1.ThemeInfoR\x06themes\"=\n" ++ "\x0fGetThemeRequest\x12\x0e\n" ++ "\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n" ++ "\bresolved\x18\x02 \x01(\bR\bresolved\"\x1f\n" ++ "\tThemeJson\x12\x12\n" ++ "\x04json\x18\x01 \x01(\tR\x04json\">\n" ++ "\x0fPutThemeRequest\x12\x12\n" ++ "\x04json\x18\x01 \x01(\tR\x04json\x12\x17\n" ++ "\adry_run\x18\x02 \x01(\bR\x06dryRun\"\x92\x01\n" ++ "\fThemeWarning\x12\x12\n" ++ "\x04mode\x18\x01 \x01(\tR\x04mode\x12\x1e\n" ++ "\n" ++ "foreground\x18\x02 \x01(\tR\n" ++ "foreground\x12\x1e\n" ++ "\n" ++ "background\x18\x03 \x01(\tR\n" ++ "background\x12\x14\n" ++ "\x05ratio\x18\x04 \x01(\x01R\x05ratio\x12\x18\n" ++ "\aminimum\x18\x05 \x01(\x01R\aminimum\"[\n" ++ "\x10PutThemeResponse\x12\x0e\n" ++ "\x02id\x18\x01 \x01(\tR\x02id\x127\n" ++ "\bwarnings\x18\x02 \x03(\v2\x1b.pasteferry.v1.ThemeWarningR\bwarnings\"\x1a\n" ++ "\bThemeRef\x12\x0e\n" ++ "\x02id\x18\x01 \x01(\tR\x02id\"C\n" ++ "\x17ImportBackgroundRequest\x12\x12\n" ++ "\x04path\x18\x01 \x01(\tR\x04path\x12\x14\n" ++ "\x05image\x18\x02 \x01(\fR\x05image\"\x9d\x02\n" ++ "\x0eBackgroundInfo\x12\x16\n" ++ "\x06sha256\x18\x01 \x01(\tR\x06sha256\x12\x14\n" ++ "\x05width\x18\x02 \x01(\x05R\x05width\x12\x16\n" ++ "\x06height\x18\x03 \x01(\x05R\x06height\x12\x16\n" ++ "\x06format\x18\x04 \x01(\tR\x06format\x12\x1c\n" ++ "\tluminance\x18\x05 \x01(\x01R\tluminance\x12)\n" ++ "\x10luminance_spread\x18\x06 \x01(\x01R\x0fluminanceSpread\x12\x16\n" ++ "\x06colors\x18\a \x03(\tR\x06colors\x12$\n" ++ "\x0emin_scrim_dark\x18\b \x01(\x01R\fminScrimDark\x12&\n" ++ "\x0fmin_scrim_light\x18\t \x01(\x01R\rminScrimLight\"H\n" ++ "\x14GetBackgroundRequest\x12\x16\n" ++ "\x06sha256\x18\x01 \x01(\tR\x06sha256\x12\x18\n" ++ "\ablurred\x18\x02 \x01(\bR\ablurred\"=\n" ++ "\x0fBackgroundImage\x12\x12\n" ++ "\x04data\x18\x01 \x01(\fR\x04data\x12\x16\n" ++ "\x06format\x18\x02 \x01(\tR\x06format\"'\n" ++ "\rBackgroundRef\x12\x16\n" ++ "\x06sha256\x18\x01 \x01(\tR\x06sha256\"!\n" ++ "\rThemesChanged\x12\x10\n" ++ "\x03ids\x18\x01 \x03(\tR\x03ids*v\n" +"\bClipKind\x12\x19\n" +"\x15CLIP_KIND_UNSPECIFIED\x10\x00\x12\x12\n" +"\x0eCLIP_KIND_TEXT\x10\x01\x12\x12\n" +@@ -7109,7 +8052,11 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"#CLIPBOARD_WRITE_OUTCOME_UNSPECIFIED\x10\x00\x12#\n" +"\x1fCLIPBOARD_WRITE_OUTCOME_APPLIED\x10\x01\x12%\n" +"!CLIPBOARD_WRITE_OUTCOME_PRESERVED\x10\x02\x12\"\n" +- "\x1eCLIPBOARD_WRITE_OUTCOME_FAILED\x10\x03*u\n" ++ "\x1eCLIPBOARD_WRITE_OUTCOME_FAILED\x10\x03*R\n" ++ "\tThemeMode\x12\x1a\n" ++ "\x16THEME_MODE_UNSPECIFIED\x10\x00\x12\x14\n" ++ "\x10THEME_MODE_LIGHT\x10\x01\x12\x13\n" ++ "\x0fTHEME_MODE_DARK\x10\x02*u\n" +"\vServiceMode\x12\x1c\n" +"\x18SERVICE_MODE_UNSPECIFIED\x10\x00\x12\x14\n" +"\x10SERVICE_MODE_LAN\x10\x01\x12\x19\n" +@@ -7118,7 +8065,7 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x11TransferDirection\x12\"\n" +"\x1eTRANSFER_DIRECTION_UNSPECIFIED\x10\x00\x12\x1f\n" +"\x1bTRANSFER_DIRECTION_OUTGOING\x10\x01\x12\x1f\n" +- "\x1bTRANSFER_DIRECTION_INCOMING\x10\x022\xd1&\n" ++ "\x1bTRANSFER_DIRECTION_INCOMING\x10\x022\xb4+\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" +@@ -7188,7 +8135,16 @@ const file_pasteferry_v1_daemon_proto_rawDesc = "" +"\x10RemoveWebSession\x12\x1c.pasteferry.v1.WebSessionRef\x1a\x1d.pasteferry.v1.WebShareStatus\x12E\n" +"\n" +"PasteFiles\x12\x14.pasteferry.v1.Empty\x1a!.pasteferry.v1.PasteFilesResponse\x12B\n" +- "\x0eWatchStrangers\x12\x14.pasteferry.v1.Empty\x1a\x18.pasteferry.v1.Strangers0\x01BDZBgithub.com/baiyuze/pasteferry/proto/gen/pasteferry/v1;pasteferryv1b\x06proto3"+ "\x0eWatchStrangers\x12\x14.pasteferry.v1.Empty\x1a\x18.pasteferry.v1.Strangers0\x01\x12E\n" ++ "\n" ++ "ListThemes\x12\x14.pasteferry.v1.Empty\x1a!.pasteferry.v1.ListThemesResponse\x12D\n" ++ "\bGetTheme\x12\x1e.pasteferry.v1.GetThemeRequest\x1a\x18.pasteferry.v1.ThemeJson\x12K\n" ++ "\bPutTheme\x12\x1e.pasteferry.v1.PutThemeRequest\x1a\x1f.pasteferry.v1.PutThemeResponse\x12<\n" ++ "\vDeleteTheme\x12\x17.pasteferry.v1.ThemeRef\x1a\x14.pasteferry.v1.Empty\x12Y\n" ++ "\x10ImportBackground\x12&.pasteferry.v1.ImportBackgroundRequest\x1a\x1d.pasteferry.v1.BackgroundInfo\x12T\n" ++ "\rGetBackground\x12#.pasteferry.v1.GetBackgroundRequest\x1a\x1e.pasteferry.v1.BackgroundImage\x12F\n" ++ "\x10DeleteBackground\x12\x1c.pasteferry.v1.BackgroundRef\x1a\x14.pasteferry.v1.Empty\x12P\n" ++ "\x11AnalyzeBackground\x12\x1c.pasteferry.v1.BackgroundRef\x1a\x1d.pasteferry.v1.BackgroundInfoBDZBgithub.com/baiyuze/pasteferry/proto/gen/pasteferry/v1;pasteferryv1b\x06proto3"var (file_pasteferry_v1_daemon_proto_rawDescOnce sync.Once@@ -7202,279 +8158,316 @@ func file_pasteferry_v1_daemon_proto_rawDescGZIP() []byte {return file_pasteferry_v1_daemon_proto_rawDescData}-var file_pasteferry_v1_daemon_proto_enumTypes = make([]protoimpl.EnumInfo, 7)-var file_pasteferry_v1_daemon_proto_msgTypes = make([]protoimpl.MessageInfo, 84)+var file_pasteferry_v1_daemon_proto_enumTypes = make([]protoimpl.EnumInfo, 8)+var file_pasteferry_v1_daemon_proto_msgTypes = make([]protoimpl.MessageInfo, 99)var file_pasteferry_v1_daemon_proto_goTypes = []any{(ClipKind)(0), // 0: pasteferry.v1.ClipKind(ClipStatus)(0), // 1: pasteferry.v1.ClipStatus(ConnectionKind)(0), // 2: pasteferry.v1.ConnectionKind(ClipboardPermission)(0), // 3: pasteferry.v1.ClipboardPermission(ClipboardWriteOutcome)(0), // 4: pasteferry.v1.ClipboardWriteOutcome- (ServiceMode)(0), // 5: pasteferry.v1.ServiceMode- (TransferDirection)(0), // 6: pasteferry.v1.TransferDirection- (*Empty)(nil), // 7: pasteferry.v1.Empty- (*ClipItem)(nil), // 8: pasteferry.v1.ClipItem- (*ClipRecord)(nil), // 9: pasteferry.v1.ClipRecord- (*SubscribeRequest)(nil), // 10: pasteferry.v1.SubscribeRequest- (*TransferProgress)(nil), // 11: pasteferry.v1.TransferProgress- (*Device)(nil), // 12: pasteferry.v1.Device- (*Event)(nil), // 13: pasteferry.v1.Event- (*AppNotice)(nil), // 14: pasteferry.v1.AppNotice- (*Profile)(nil), // 15: pasteferry.v1.Profile- (*SetDisplayNameRequest)(nil), // 16: pasteferry.v1.SetDisplayNameRequest- (*SetAvatarRequest)(nil), // 17: pasteferry.v1.SetAvatarRequest- (*GetAvatarRequest)(nil), // 18: pasteferry.v1.GetAvatarRequest- (*Avatar)(nil), // 19: pasteferry.v1.Avatar- (*FriendRef)(nil), // 20: pasteferry.v1.FriendRef- (*SetFriendAutoAcceptRequest)(nil), // 21: pasteferry.v1.SetFriendAutoAcceptRequest- (*Friend)(nil), // 22: pasteferry.v1.Friend- (*ListFriendsResponse)(nil), // 23: pasteferry.v1.ListFriendsResponse- (*FriendRequest)(nil), // 24: pasteferry.v1.FriendRequest- (*Stranger)(nil), // 25: pasteferry.v1.Stranger- (*Strangers)(nil), // 26: pasteferry.v1.Strangers- (*PasteFilesResponse)(nil), // 27: pasteferry.v1.PasteFilesResponse- (*NotificationStatus)(nil), // 28: pasteferry.v1.NotificationStatus- (*NotificationAction)(nil), // 29: pasteferry.v1.NotificationAction- (*ClipboardWriteResult)(nil), // 30: pasteferry.v1.ClipboardWriteResult- (*ListHistoryRequest)(nil), // 31: pasteferry.v1.ListHistoryRequest- (*ListHistoryResponse)(nil), // 32: pasteferry.v1.ListHistoryResponse- (*DeleteHistoryRequest)(nil), // 33: pasteferry.v1.DeleteHistoryRequest- (*FetchRequest)(nil), // 34: pasteferry.v1.FetchRequest- (*ApplyToClipboardRequest)(nil), // 35: pasteferry.v1.ApplyToClipboardRequest- (*SetFavoriteRequest)(nil), // 36: pasteferry.v1.SetFavoriteRequest- (*SetAliasRequest)(nil), // 37: pasteferry.v1.SetAliasRequest- (*GetClipDetailRequest)(nil), // 38: pasteferry.v1.GetClipDetailRequest- (*ClipDetail)(nil), // 39: pasteferry.v1.ClipDetail- (*QuickPasteStatus)(nil), // 40: pasteferry.v1.QuickPasteStatus- (*QuickPasteCommand)(nil), // 41: pasteferry.v1.QuickPasteCommand- (*ListDevicesResponse)(nil), // 42: pasteferry.v1.ListDevicesResponse- (*CreatePairingCodeResponse)(nil), // 43: pasteferry.v1.CreatePairingCodeResponse- (*RedeemPairingCodeRequest)(nil), // 44: pasteferry.v1.RedeemPairingCodeRequest- (*RedeemPairingCodeResponse)(nil), // 45: pasteferry.v1.RedeemPairingCodeResponse- (*ConfirmPairingRequest)(nil), // 46: pasteferry.v1.ConfirmPairingRequest- (*NearbyDevice)(nil), // 47: pasteferry.v1.NearbyDevice- (*NearbyDevices)(nil), // 48: pasteferry.v1.NearbyDevices- (*PairNearbyRequest)(nil), // 49: pasteferry.v1.PairNearbyRequest- (*UnpairRequest)(nil), // 50: pasteferry.v1.UnpairRequest- (*ReconnectRequest)(nil), // 51: pasteferry.v1.ReconnectRequest- (*ReconnectResponse)(nil), // 52: pasteferry.v1.ReconnectResponse- (*SetDeviceAddressRequest)(nil), // 53: pasteferry.v1.SetDeviceAddressRequest- (*Config)(nil), // 54: pasteferry.v1.Config- (*OfficialUsage)(nil), // 55: pasteferry.v1.OfficialUsage- (*NetworkInfo)(nil), // 56: pasteferry.v1.NetworkInfo- (*LanInfo)(nil), // 57: pasteferry.v1.LanInfo- (*LanPeer)(nil), // 58: pasteferry.v1.LanPeer- (*NetworkEgress)(nil), // 59: pasteferry.v1.NetworkEgress- (*Status)(nil), // 60: pasteferry.v1.Status- (*CheckForUpdateRequest)(nil), // 61: pasteferry.v1.CheckForUpdateRequest- (*UpdateRelease)(nil), // 62: pasteferry.v1.UpdateRelease- (*UpdateInfo)(nil), // 63: pasteferry.v1.UpdateInfo- (*DownloadUpdateRequest)(nil), // 64: pasteferry.v1.DownloadUpdateRequest- (*UpdateProgress)(nil), // 65: pasteferry.v1.UpdateProgress- (*InstallUpdateRequest)(nil), // 66: pasteferry.v1.InstallUpdateRequest- (*UpdateResult)(nil), // 67: pasteferry.v1.UpdateResult- (*ExportDiagnosticsRequest)(nil), // 68: pasteferry.v1.ExportDiagnosticsRequest- (*Diagnostics)(nil), // 69: pasteferry.v1.Diagnostics- (*SetVerboseLogRequest)(nil), // 70: pasteferry.v1.SetVerboseLogRequest- (*GetImagePreviewRequest)(nil), // 71: pasteferry.v1.GetImagePreviewRequest- (*GetImagePreviewResponse)(nil), // 72: pasteferry.v1.GetImagePreviewResponse- (*SendFilesRequest)(nil), // 73: pasteferry.v1.SendFilesRequest- (*TransferRef)(nil), // 74: pasteferry.v1.TransferRef- (*Transfer)(nil), // 75: pasteferry.v1.Transfer- (*AnswerIncomingRequest)(nil), // 76: pasteferry.v1.AnswerIncomingRequest- (*ListTransfersRequest)(nil), // 77: pasteferry.v1.ListTransfersRequest- (*ListTransfersResponse)(nil), // 78: pasteferry.v1.ListTransfersResponse- (*DeleteTransfersRequest)(nil), // 79: pasteferry.v1.DeleteTransfersRequest- (*CheckReceiveDirRequest)(nil), // 80: pasteferry.v1.CheckReceiveDirRequest- (*CheckReceiveDirResponse)(nil), // 81: pasteferry.v1.CheckReceiveDirResponse- (*SubmitTextRequest)(nil), // 82: pasteferry.v1.SubmitTextRequest- (*SubmitFilesRequest)(nil), // 83: pasteferry.v1.SubmitFilesRequest- (*WebShareStatus)(nil), // 84: pasteferry.v1.WebShareStatus- (*WebSession)(nil), // 85: pasteferry.v1.WebSession- (*SetWebShareRequest)(nil), // 86: pasteferry.v1.SetWebShareRequest- (*NewWebShareInviteRequest)(nil), // 87: pasteferry.v1.NewWebShareInviteRequest- (*WebShareInvite)(nil), // 88: pasteferry.v1.WebShareInvite- (*WebShareInviteRef)(nil), // 89: pasteferry.v1.WebShareInviteRef- (*WebSessionRef)(nil), // 90: pasteferry.v1.WebSessionRef+ (ThemeMode)(0), // 5: pasteferry.v1.ThemeMode+ (ServiceMode)(0), // 6: pasteferry.v1.ServiceMode+ (TransferDirection)(0), // 7: pasteferry.v1.TransferDirection+ (*Empty)(nil), // 8: pasteferry.v1.Empty+ (*ClipItem)(nil), // 9: pasteferry.v1.ClipItem+ (*ClipRecord)(nil), // 10: pasteferry.v1.ClipRecord+ (*SubscribeRequest)(nil), // 11: pasteferry.v1.SubscribeRequest+ (*TransferProgress)(nil), // 12: pasteferry.v1.TransferProgress+ (*Device)(nil), // 13: pasteferry.v1.Device+ (*Event)(nil), // 14: pasteferry.v1.Event+ (*AppNotice)(nil), // 15: pasteferry.v1.AppNotice+ (*Profile)(nil), // 16: pasteferry.v1.Profile+ (*SetDisplayNameRequest)(nil), // 17: pasteferry.v1.SetDisplayNameRequest+ (*SetAvatarRequest)(nil), // 18: pasteferry.v1.SetAvatarRequest+ (*GetAvatarRequest)(nil), // 19: pasteferry.v1.GetAvatarRequest+ (*Avatar)(nil), // 20: pasteferry.v1.Avatar+ (*FriendRef)(nil), // 21: pasteferry.v1.FriendRef+ (*SetFriendAutoAcceptRequest)(nil), // 22: pasteferry.v1.SetFriendAutoAcceptRequest+ (*Friend)(nil), // 23: pasteferry.v1.Friend+ (*ListFriendsResponse)(nil), // 24: pasteferry.v1.ListFriendsResponse+ (*FriendRequest)(nil), // 25: pasteferry.v1.FriendRequest+ (*Stranger)(nil), // 26: pasteferry.v1.Stranger+ (*Strangers)(nil), // 27: pasteferry.v1.Strangers+ (*PasteFilesResponse)(nil), // 28: pasteferry.v1.PasteFilesResponse+ (*NotificationStatus)(nil), // 29: pasteferry.v1.NotificationStatus+ (*NotificationAction)(nil), // 30: pasteferry.v1.NotificationAction+ (*ClipboardWriteResult)(nil), // 31: pasteferry.v1.ClipboardWriteResult+ (*ListHistoryRequest)(nil), // 32: pasteferry.v1.ListHistoryRequest+ (*ListHistoryResponse)(nil), // 33: pasteferry.v1.ListHistoryResponse+ (*DeleteHistoryRequest)(nil), // 34: pasteferry.v1.DeleteHistoryRequest+ (*FetchRequest)(nil), // 35: pasteferry.v1.FetchRequest+ (*ApplyToClipboardRequest)(nil), // 36: pasteferry.v1.ApplyToClipboardRequest+ (*SetFavoriteRequest)(nil), // 37: pasteferry.v1.SetFavoriteRequest+ (*SetAliasRequest)(nil), // 38: pasteferry.v1.SetAliasRequest+ (*GetClipDetailRequest)(nil), // 39: pasteferry.v1.GetClipDetailRequest+ (*ClipDetail)(nil), // 40: pasteferry.v1.ClipDetail+ (*QuickPasteStatus)(nil), // 41: pasteferry.v1.QuickPasteStatus+ (*QuickPasteCommand)(nil), // 42: pasteferry.v1.QuickPasteCommand+ (*ListDevicesResponse)(nil), // 43: pasteferry.v1.ListDevicesResponse+ (*CreatePairingCodeResponse)(nil), // 44: pasteferry.v1.CreatePairingCodeResponse+ (*RedeemPairingCodeRequest)(nil), // 45: pasteferry.v1.RedeemPairingCodeRequest+ (*RedeemPairingCodeResponse)(nil), // 46: pasteferry.v1.RedeemPairingCodeResponse+ (*ConfirmPairingRequest)(nil), // 47: pasteferry.v1.ConfirmPairingRequest+ (*NearbyDevice)(nil), // 48: pasteferry.v1.NearbyDevice+ (*NearbyDevices)(nil), // 49: pasteferry.v1.NearbyDevices+ (*PairNearbyRequest)(nil), // 50: pasteferry.v1.PairNearbyRequest+ (*UnpairRequest)(nil), // 51: pasteferry.v1.UnpairRequest+ (*ReconnectRequest)(nil), // 52: pasteferry.v1.ReconnectRequest+ (*ReconnectResponse)(nil), // 53: pasteferry.v1.ReconnectResponse+ (*SetDeviceAddressRequest)(nil), // 54: pasteferry.v1.SetDeviceAddressRequest+ (*Config)(nil), // 55: pasteferry.v1.Config+ (*OfficialUsage)(nil), // 56: pasteferry.v1.OfficialUsage+ (*NetworkInfo)(nil), // 57: pasteferry.v1.NetworkInfo+ (*LanInfo)(nil), // 58: pasteferry.v1.LanInfo+ (*LanPeer)(nil), // 59: pasteferry.v1.LanPeer+ (*NetworkEgress)(nil), // 60: pasteferry.v1.NetworkEgress+ (*Status)(nil), // 61: pasteferry.v1.Status+ (*CheckForUpdateRequest)(nil), // 62: pasteferry.v1.CheckForUpdateRequest+ (*UpdateRelease)(nil), // 63: pasteferry.v1.UpdateRelease+ (*UpdateInfo)(nil), // 64: pasteferry.v1.UpdateInfo+ (*DownloadUpdateRequest)(nil), // 65: pasteferry.v1.DownloadUpdateRequest+ (*UpdateProgress)(nil), // 66: pasteferry.v1.UpdateProgress+ (*InstallUpdateRequest)(nil), // 67: pasteferry.v1.InstallUpdateRequest+ (*UpdateResult)(nil), // 68: pasteferry.v1.UpdateResult+ (*ExportDiagnosticsRequest)(nil), // 69: pasteferry.v1.ExportDiagnosticsRequest+ (*Diagnostics)(nil), // 70: pasteferry.v1.Diagnostics+ (*SetVerboseLogRequest)(nil), // 71: pasteferry.v1.SetVerboseLogRequest+ (*GetImagePreviewRequest)(nil), // 72: pasteferry.v1.GetImagePreviewRequest+ (*GetImagePreviewResponse)(nil), // 73: pasteferry.v1.GetImagePreviewResponse+ (*SendFilesRequest)(nil), // 74: pasteferry.v1.SendFilesRequest+ (*TransferRef)(nil), // 75: pasteferry.v1.TransferRef+ (*Transfer)(nil), // 76: pasteferry.v1.Transfer+ (*AnswerIncomingRequest)(nil), // 77: pasteferry.v1.AnswerIncomingRequest+ (*ListTransfersRequest)(nil), // 78: pasteferry.v1.ListTransfersRequest+ (*ListTransfersResponse)(nil), // 79: pasteferry.v1.ListTransfersResponse+ (*DeleteTransfersRequest)(nil), // 80: pasteferry.v1.DeleteTransfersRequest+ (*CheckReceiveDirRequest)(nil), // 81: pasteferry.v1.CheckReceiveDirRequest+ (*CheckReceiveDirResponse)(nil), // 82: pasteferry.v1.CheckReceiveDirResponse+ (*SubmitTextRequest)(nil), // 83: pasteferry.v1.SubmitTextRequest+ (*SubmitFilesRequest)(nil), // 84: pasteferry.v1.SubmitFilesRequest+ (*WebShareStatus)(nil), // 85: pasteferry.v1.WebShareStatus+ (*WebSession)(nil), // 86: pasteferry.v1.WebSession+ (*SetWebShareRequest)(nil), // 87: pasteferry.v1.SetWebShareRequest+ (*NewWebShareInviteRequest)(nil), // 88: pasteferry.v1.NewWebShareInviteRequest+ (*WebShareInvite)(nil), // 89: pasteferry.v1.WebShareInvite+ (*WebShareInviteRef)(nil), // 90: pasteferry.v1.WebShareInviteRef+ (*WebSessionRef)(nil), // 91: pasteferry.v1.WebSessionRef+ (*ThemeInfo)(nil), // 92: pasteferry.v1.ThemeInfo+ (*ListThemesResponse)(nil), // 93: pasteferry.v1.ListThemesResponse+ (*GetThemeRequest)(nil), // 94: pasteferry.v1.GetThemeRequest+ (*ThemeJson)(nil), // 95: pasteferry.v1.ThemeJson+ (*PutThemeRequest)(nil), // 96: pasteferry.v1.PutThemeRequest+ (*ThemeWarning)(nil), // 97: pasteferry.v1.ThemeWarning+ (*PutThemeResponse)(nil), // 98: pasteferry.v1.PutThemeResponse+ (*ThemeRef)(nil), // 99: pasteferry.v1.ThemeRef+ (*ImportBackgroundRequest)(nil), // 100: pasteferry.v1.ImportBackgroundRequest+ (*BackgroundInfo)(nil), // 101: pasteferry.v1.BackgroundInfo+ (*GetBackgroundRequest)(nil), // 102: pasteferry.v1.GetBackgroundRequest+ (*BackgroundImage)(nil), // 103: pasteferry.v1.BackgroundImage+ (*BackgroundRef)(nil), // 104: pasteferry.v1.BackgroundRef+ (*ThemesChanged)(nil), // 105: pasteferry.v1.ThemesChanged+ nil, // 106: pasteferry.v1.ThemeInfo.NameEntry}var file_pasteferry_v1_daemon_proto_depIdxs = []int32{0, // 0: pasteferry.v1.ClipRecord.kind:type_name -> pasteferry.v1.ClipKind1, // 1: pasteferry.v1.ClipRecord.status:type_name -> pasteferry.v1.ClipStatus- 8, // 2: pasteferry.v1.ClipRecord.items:type_name -> pasteferry.v1.ClipItem+ 9, // 2: pasteferry.v1.ClipRecord.items:type_name -> pasteferry.v1.ClipItem2, // 3: pasteferry.v1.Device.connection:type_name -> pasteferry.v1.ConnectionKind- 9, // 4: pasteferry.v1.Event.clip_added:type_name -> pasteferry.v1.ClipRecord- 9, // 5: pasteferry.v1.Event.clip_updated:type_name -> pasteferry.v1.ClipRecord- 11, // 6: pasteferry.v1.Event.progress:type_name -> pasteferry.v1.TransferProgress- 12, // 7: pasteferry.v1.Event.device_changed:type_name -> pasteferry.v1.Device+ 10, // 4: pasteferry.v1.Event.clip_added:type_name -> pasteferry.v1.ClipRecord+ 10, // 5: pasteferry.v1.Event.clip_updated:type_name -> pasteferry.v1.ClipRecord+ 12, // 6: pasteferry.v1.Event.progress:type_name -> pasteferry.v1.TransferProgress+ 13, // 7: pasteferry.v1.Event.device_changed:type_name -> pasteferry.v1.Device3, // 8: pasteferry.v1.Event.permission_changed:type_name -> pasteferry.v1.ClipboardPermission- 60, // 9: pasteferry.v1.Event.status_changed:type_name -> pasteferry.v1.Status- 30, // 10: pasteferry.v1.Event.clipboard_written:type_name -> pasteferry.v1.ClipboardWriteResult- 54, // 11: pasteferry.v1.Event.config_changed:type_name -> pasteferry.v1.Config- 40, // 12: pasteferry.v1.Event.quick_paste_changed:type_name -> pasteferry.v1.QuickPasteStatus- 75, // 13: pasteferry.v1.Event.transfer_changed:type_name -> pasteferry.v1.Transfer- 22, // 14: pasteferry.v1.Event.friend_changed:type_name -> pasteferry.v1.Friend- 24, // 15: pasteferry.v1.Event.friend_request:type_name -> pasteferry.v1.FriendRequest- 15, // 16: pasteferry.v1.Event.profile_changed:type_name -> pasteferry.v1.Profile- 84, // 17: pasteferry.v1.Event.web_share_changed:type_name -> pasteferry.v1.WebShareStatus- 14, // 18: pasteferry.v1.Event.notice:type_name -> pasteferry.v1.AppNotice- 2, // 19: pasteferry.v1.Friend.connection:type_name -> pasteferry.v1.ConnectionKind- 22, // 20: pasteferry.v1.ListFriendsResponse.friends:type_name -> pasteferry.v1.Friend- 25, // 21: pasteferry.v1.Strangers.strangers:type_name -> pasteferry.v1.Stranger- 4, // 22: pasteferry.v1.ClipboardWriteResult.outcome:type_name -> pasteferry.v1.ClipboardWriteOutcome- 0, // 23: pasteferry.v1.ListHistoryRequest.kind_filter:type_name -> pasteferry.v1.ClipKind- 9, // 24: pasteferry.v1.ListHistoryResponse.records:type_name -> pasteferry.v1.ClipRecord- 12, // 25: pasteferry.v1.ListDevicesResponse.self:type_name -> pasteferry.v1.Device- 12, // 26: pasteferry.v1.ListDevicesResponse.peers:type_name -> pasteferry.v1.Device- 12, // 27: pasteferry.v1.RedeemPairingCodeResponse.peer:type_name -> pasteferry.v1.Device- 47, // 28: pasteferry.v1.NearbyDevices.devices:type_name -> pasteferry.v1.NearbyDevice- 2, // 29: pasteferry.v1.ReconnectResponse.kind:type_name -> pasteferry.v1.ConnectionKind- 5, // 30: pasteferry.v1.Config.service_mode:type_name -> pasteferry.v1.ServiceMode- 59, // 31: pasteferry.v1.NetworkInfo.egresses:type_name -> pasteferry.v1.NetworkEgress- 57, // 32: pasteferry.v1.NetworkInfo.lan:type_name -> pasteferry.v1.LanInfo- 58, // 33: pasteferry.v1.LanInfo.peers:type_name -> pasteferry.v1.LanPeer- 3, // 34: pasteferry.v1.Status.clipboard_permission:type_name -> pasteferry.v1.ClipboardPermission- 55, // 35: pasteferry.v1.Status.official_usage:type_name -> pasteferry.v1.OfficialUsage- 67, // 36: pasteferry.v1.Status.last_update:type_name -> pasteferry.v1.UpdateResult- 62, // 37: pasteferry.v1.UpdateInfo.releases:type_name -> pasteferry.v1.UpdateRelease- 6, // 38: pasteferry.v1.Transfer.direction:type_name -> pasteferry.v1.TransferDirection- 8, // 39: pasteferry.v1.Transfer.items:type_name -> pasteferry.v1.ClipItem- 6, // 40: pasteferry.v1.ListTransfersRequest.direction:type_name -> pasteferry.v1.TransferDirection- 75, // 41: pasteferry.v1.ListTransfersResponse.transfers:type_name -> pasteferry.v1.Transfer- 6, // 42: pasteferry.v1.DeleteTransfersRequest.direction:type_name -> pasteferry.v1.TransferDirection- 85, // 43: pasteferry.v1.WebShareStatus.sessions:type_name -> pasteferry.v1.WebSession- 10, // 44: pasteferry.v1.DaemonService.Subscribe:input_type -> pasteferry.v1.SubscribeRequest- 31, // 45: pasteferry.v1.DaemonService.ListHistory:input_type -> pasteferry.v1.ListHistoryRequest- 33, // 46: pasteferry.v1.DaemonService.DeleteHistory:input_type -> pasteferry.v1.DeleteHistoryRequest- 34, // 47: pasteferry.v1.DaemonService.Fetch:input_type -> pasteferry.v1.FetchRequest- 35, // 48: pasteferry.v1.DaemonService.ApplyToClipboard:input_type -> pasteferry.v1.ApplyToClipboardRequest- 71, // 49: pasteferry.v1.DaemonService.GetImagePreview:input_type -> pasteferry.v1.GetImagePreviewRequest- 7, // 50: pasteferry.v1.DaemonService.ListDevices:input_type -> pasteferry.v1.Empty- 7, // 51: pasteferry.v1.DaemonService.CreatePairingCode:input_type -> pasteferry.v1.Empty- 44, // 52: pasteferry.v1.DaemonService.RedeemPairingCode:input_type -> pasteferry.v1.RedeemPairingCodeRequest- 46, // 53: pasteferry.v1.DaemonService.ConfirmPairing:input_type -> pasteferry.v1.ConfirmPairingRequest- 50, // 54: pasteferry.v1.DaemonService.Unpair:input_type -> pasteferry.v1.UnpairRequest- 51, // 55: pasteferry.v1.DaemonService.Reconnect:input_type -> pasteferry.v1.ReconnectRequest- 53, // 56: pasteferry.v1.DaemonService.SetDeviceAddress:input_type -> pasteferry.v1.SetDeviceAddressRequest- 7, // 57: pasteferry.v1.DaemonService.WatchNearby:input_type -> pasteferry.v1.Empty- 49, // 58: pasteferry.v1.DaemonService.PairNearby:input_type -> pasteferry.v1.PairNearbyRequest- 7, // 59: pasteferry.v1.DaemonService.GetConfig:input_type -> pasteferry.v1.Empty- 54, // 60: pasteferry.v1.DaemonService.UpdateConfig:input_type -> pasteferry.v1.Config- 7, // 61: pasteferry.v1.DaemonService.GetStatus:input_type -> pasteferry.v1.Empty- 7, // 62: pasteferry.v1.DaemonService.RequestClipboardPermission:input_type -> pasteferry.v1.Empty- 7, // 63: pasteferry.v1.DaemonService.RequestLocalNetworkPermission:input_type -> pasteferry.v1.Empty- 7, // 64: pasteferry.v1.DaemonService.GetNotificationStatus:input_type -> pasteferry.v1.Empty- 7, // 65: pasteferry.v1.DaemonService.RequestNotificationPermission:input_type -> pasteferry.v1.Empty- 29, // 66: pasteferry.v1.DaemonService.ActivateNotification:input_type -> pasteferry.v1.NotificationAction- 7, // 67: pasteferry.v1.DaemonService.GetNetwork:input_type -> pasteferry.v1.Empty- 68, // 68: pasteferry.v1.DaemonService.ExportDiagnostics:input_type -> pasteferry.v1.ExportDiagnosticsRequest- 70, // 69: pasteferry.v1.DaemonService.SetVerboseLog:input_type -> pasteferry.v1.SetVerboseLogRequest- 61, // 70: pasteferry.v1.DaemonService.CheckForUpdate:input_type -> pasteferry.v1.CheckForUpdateRequest- 64, // 71: pasteferry.v1.DaemonService.DownloadUpdate:input_type -> pasteferry.v1.DownloadUpdateRequest- 66, // 72: pasteferry.v1.DaemonService.InstallUpdate:input_type -> pasteferry.v1.InstallUpdateRequest- 36, // 73: pasteferry.v1.DaemonService.SetFavorite:input_type -> pasteferry.v1.SetFavoriteRequest- 38, // 74: pasteferry.v1.DaemonService.GetClipDetail:input_type -> pasteferry.v1.GetClipDetailRequest- 37, // 75: pasteferry.v1.DaemonService.SetAlias:input_type -> pasteferry.v1.SetAliasRequest- 40, // 76: pasteferry.v1.DaemonService.QuickPasteSession:input_type -> pasteferry.v1.QuickPasteStatus- 7, // 77: pasteferry.v1.DaemonService.GetQuickPasteStatus:input_type -> pasteferry.v1.Empty- 41, // 78: pasteferry.v1.DaemonService.SendQuickPasteCommand:input_type -> pasteferry.v1.QuickPasteCommand- 73, // 79: pasteferry.v1.DaemonService.SendFiles:input_type -> pasteferry.v1.SendFilesRequest- 74, // 80: pasteferry.v1.DaemonService.CancelTransfer:input_type -> pasteferry.v1.TransferRef- 74, // 81: pasteferry.v1.DaemonService.ResumeTransfer:input_type -> pasteferry.v1.TransferRef- 77, // 82: pasteferry.v1.DaemonService.ListTransfers:input_type -> pasteferry.v1.ListTransfersRequest- 79, // 83: pasteferry.v1.DaemonService.DeleteTransfers:input_type -> pasteferry.v1.DeleteTransfersRequest- 7, // 84: pasteferry.v1.DaemonService.MarkTransfersSeen:input_type -> pasteferry.v1.Empty- 80, // 85: pasteferry.v1.DaemonService.CheckReceiveDir:input_type -> pasteferry.v1.CheckReceiveDirRequest- 76, // 86: pasteferry.v1.DaemonService.AnswerIncoming:input_type -> pasteferry.v1.AnswerIncomingRequest- 7, // 87: pasteferry.v1.DaemonService.GetProfile:input_type -> pasteferry.v1.Empty- 16, // 88: pasteferry.v1.DaemonService.SetDisplayName:input_type -> pasteferry.v1.SetDisplayNameRequest- 17, // 89: pasteferry.v1.DaemonService.SetAvatar:input_type -> pasteferry.v1.SetAvatarRequest- 7, // 90: pasteferry.v1.DaemonService.ResetAvatar:input_type -> pasteferry.v1.Empty- 18, // 91: pasteferry.v1.DaemonService.GetAvatar:input_type -> pasteferry.v1.GetAvatarRequest- 7, // 92: pasteferry.v1.DaemonService.CreateFriendCode:input_type -> pasteferry.v1.Empty- 44, // 93: pasteferry.v1.DaemonService.RedeemFriendCode:input_type -> pasteferry.v1.RedeemPairingCodeRequest- 46, // 94: pasteferry.v1.DaemonService.ConfirmFriend:input_type -> pasteferry.v1.ConfirmPairingRequest- 7, // 95: pasteferry.v1.DaemonService.ListFriends:input_type -> pasteferry.v1.Empty- 20, // 96: pasteferry.v1.DaemonService.RemoveFriend:input_type -> pasteferry.v1.FriendRef- 21, // 97: pasteferry.v1.DaemonService.SetFriendAutoAccept:input_type -> pasteferry.v1.SetFriendAutoAcceptRequest- 20, // 98: pasteferry.v1.DaemonService.BlockDevice:input_type -> pasteferry.v1.FriendRef- 82, // 99: pasteferry.v1.DaemonService.SubmitText:input_type -> pasteferry.v1.SubmitTextRequest- 83, // 100: pasteferry.v1.DaemonService.SubmitFiles:input_type -> pasteferry.v1.SubmitFilesRequest- 7, // 101: pasteferry.v1.DaemonService.GetWebShare:input_type -> pasteferry.v1.Empty- 86, // 102: pasteferry.v1.DaemonService.SetWebShare:input_type -> pasteferry.v1.SetWebShareRequest- 87, // 103: pasteferry.v1.DaemonService.NewWebShareInvite:input_type -> pasteferry.v1.NewWebShareInviteRequest- 89, // 104: pasteferry.v1.DaemonService.CloseWebShareInvite:input_type -> pasteferry.v1.WebShareInviteRef- 90, // 105: pasteferry.v1.DaemonService.RemoveWebSession:input_type -> pasteferry.v1.WebSessionRef- 7, // 106: pasteferry.v1.DaemonService.PasteFiles:input_type -> pasteferry.v1.Empty- 7, // 107: pasteferry.v1.DaemonService.WatchStrangers:input_type -> pasteferry.v1.Empty- 13, // 108: pasteferry.v1.DaemonService.Subscribe:output_type -> pasteferry.v1.Event- 32, // 109: pasteferry.v1.DaemonService.ListHistory:output_type -> pasteferry.v1.ListHistoryResponse- 7, // 110: pasteferry.v1.DaemonService.DeleteHistory:output_type -> pasteferry.v1.Empty- 7, // 111: pasteferry.v1.DaemonService.Fetch:output_type -> pasteferry.v1.Empty- 7, // 112: pasteferry.v1.DaemonService.ApplyToClipboard:output_type -> pasteferry.v1.Empty- 72, // 113: pasteferry.v1.DaemonService.GetImagePreview:output_type -> pasteferry.v1.GetImagePreviewResponse- 42, // 114: pasteferry.v1.DaemonService.ListDevices:output_type -> pasteferry.v1.ListDevicesResponse- 43, // 115: pasteferry.v1.DaemonService.CreatePairingCode:output_type -> pasteferry.v1.CreatePairingCodeResponse- 45, // 116: pasteferry.v1.DaemonService.RedeemPairingCode:output_type -> pasteferry.v1.RedeemPairingCodeResponse- 7, // 117: pasteferry.v1.DaemonService.ConfirmPairing:output_type -> pasteferry.v1.Empty- 7, // 118: pasteferry.v1.DaemonService.Unpair:output_type -> pasteferry.v1.Empty- 52, // 119: pasteferry.v1.DaemonService.Reconnect:output_type -> pasteferry.v1.ReconnectResponse- 7, // 120: pasteferry.v1.DaemonService.SetDeviceAddress:output_type -> pasteferry.v1.Empty- 48, // 121: pasteferry.v1.DaemonService.WatchNearby:output_type -> pasteferry.v1.NearbyDevices- 45, // 122: pasteferry.v1.DaemonService.PairNearby:output_type -> pasteferry.v1.RedeemPairingCodeResponse- 54, // 123: pasteferry.v1.DaemonService.GetConfig:output_type -> pasteferry.v1.Config- 54, // 124: pasteferry.v1.DaemonService.UpdateConfig:output_type -> pasteferry.v1.Config- 60, // 125: pasteferry.v1.DaemonService.GetStatus:output_type -> pasteferry.v1.Status- 7, // 126: pasteferry.v1.DaemonService.RequestClipboardPermission:output_type -> pasteferry.v1.Empty- 7, // 127: pasteferry.v1.DaemonService.RequestLocalNetworkPermission:output_type -> pasteferry.v1.Empty- 28, // 128: pasteferry.v1.DaemonService.GetNotificationStatus:output_type -> pasteferry.v1.NotificationStatus- 28, // 129: pasteferry.v1.DaemonService.RequestNotificationPermission:output_type -> pasteferry.v1.NotificationStatus- 7, // 130: pasteferry.v1.DaemonService.ActivateNotification:output_type -> pasteferry.v1.Empty- 56, // 131: pasteferry.v1.DaemonService.GetNetwork:output_type -> pasteferry.v1.NetworkInfo- 69, // 132: pasteferry.v1.DaemonService.ExportDiagnostics:output_type -> pasteferry.v1.Diagnostics- 60, // 133: pasteferry.v1.DaemonService.SetVerboseLog:output_type -> pasteferry.v1.Status- 63, // 134: pasteferry.v1.DaemonService.CheckForUpdate:output_type -> pasteferry.v1.UpdateInfo- 65, // 135: pasteferry.v1.DaemonService.DownloadUpdate:output_type -> pasteferry.v1.UpdateProgress- 7, // 136: pasteferry.v1.DaemonService.InstallUpdate:output_type -> pasteferry.v1.Empty- 9, // 137: pasteferry.v1.DaemonService.SetFavorite:output_type -> pasteferry.v1.ClipRecord- 39, // 138: pasteferry.v1.DaemonService.GetClipDetail:output_type -> pasteferry.v1.ClipDetail- 9, // 139: pasteferry.v1.DaemonService.SetAlias:output_type -> pasteferry.v1.ClipRecord- 41, // 140: pasteferry.v1.DaemonService.QuickPasteSession:output_type -> pasteferry.v1.QuickPasteCommand- 40, // 141: pasteferry.v1.DaemonService.GetQuickPasteStatus:output_type -> pasteferry.v1.QuickPasteStatus- 7, // 142: pasteferry.v1.DaemonService.SendQuickPasteCommand:output_type -> pasteferry.v1.Empty- 75, // 143: pasteferry.v1.DaemonService.SendFiles:output_type -> pasteferry.v1.Transfer- 7, // 144: pasteferry.v1.DaemonService.CancelTransfer:output_type -> pasteferry.v1.Empty- 7, // 145: pasteferry.v1.DaemonService.ResumeTransfer:output_type -> pasteferry.v1.Empty- 78, // 146: pasteferry.v1.DaemonService.ListTransfers:output_type -> pasteferry.v1.ListTransfersResponse- 7, // 147: pasteferry.v1.DaemonService.DeleteTransfers:output_type -> pasteferry.v1.Empty- 7, // 148: pasteferry.v1.DaemonService.MarkTransfersSeen:output_type -> pasteferry.v1.Empty- 81, // 149: pasteferry.v1.DaemonService.CheckReceiveDir:output_type -> pasteferry.v1.CheckReceiveDirResponse- 7, // 150: pasteferry.v1.DaemonService.AnswerIncoming:output_type -> pasteferry.v1.Empty- 15, // 151: pasteferry.v1.DaemonService.GetProfile:output_type -> pasteferry.v1.Profile- 15, // 152: pasteferry.v1.DaemonService.SetDisplayName:output_type -> pasteferry.v1.Profile- 15, // 153: pasteferry.v1.DaemonService.SetAvatar:output_type -> pasteferry.v1.Profile- 15, // 154: pasteferry.v1.DaemonService.ResetAvatar:output_type -> pasteferry.v1.Profile- 19, // 155: pasteferry.v1.DaemonService.GetAvatar:output_type -> pasteferry.v1.Avatar- 43, // 156: pasteferry.v1.DaemonService.CreateFriendCode:output_type -> pasteferry.v1.CreatePairingCodeResponse- 24, // 157: pasteferry.v1.DaemonService.RedeemFriendCode:output_type -> pasteferry.v1.FriendRequest- 7, // 158: pasteferry.v1.DaemonService.ConfirmFriend:output_type -> pasteferry.v1.Empty- 23, // 159: pasteferry.v1.DaemonService.ListFriends:output_type -> pasteferry.v1.ListFriendsResponse- 7, // 160: pasteferry.v1.DaemonService.RemoveFriend:output_type -> pasteferry.v1.Empty- 22, // 161: pasteferry.v1.DaemonService.SetFriendAutoAccept:output_type -> pasteferry.v1.Friend- 7, // 162: pasteferry.v1.DaemonService.BlockDevice:output_type -> pasteferry.v1.Empty- 9, // 163: pasteferry.v1.DaemonService.SubmitText:output_type -> pasteferry.v1.ClipRecord- 9, // 164: pasteferry.v1.DaemonService.SubmitFiles:output_type -> pasteferry.v1.ClipRecord- 84, // 165: pasteferry.v1.DaemonService.GetWebShare:output_type -> pasteferry.v1.WebShareStatus- 84, // 166: pasteferry.v1.DaemonService.SetWebShare:output_type -> pasteferry.v1.WebShareStatus- 88, // 167: pasteferry.v1.DaemonService.NewWebShareInvite:output_type -> pasteferry.v1.WebShareInvite- 7, // 168: pasteferry.v1.DaemonService.CloseWebShareInvite:output_type -> pasteferry.v1.Empty- 84, // 169: pasteferry.v1.DaemonService.RemoveWebSession:output_type -> pasteferry.v1.WebShareStatus- 27, // 170: pasteferry.v1.DaemonService.PasteFiles:output_type -> pasteferry.v1.PasteFilesResponse- 26, // 171: pasteferry.v1.DaemonService.WatchStrangers:output_type -> pasteferry.v1.Strangers- 108, // [108:172] is the sub-list for method output_type- 44, // [44:108] is the sub-list for method input_type- 44, // [44:44] is the sub-list for extension type_name- 44, // [44:44] is the sub-list for extension extendee- 0, // [0:44] is the sub-list for field type_name+ 61, // 9: pasteferry.v1.Event.status_changed:type_name -> pasteferry.v1.Status+ 31, // 10: pasteferry.v1.Event.clipboard_written:type_name -> pasteferry.v1.ClipboardWriteResult+ 55, // 11: pasteferry.v1.Event.config_changed:type_name -> pasteferry.v1.Config+ 41, // 12: pasteferry.v1.Event.quick_paste_changed:type_name -> pasteferry.v1.QuickPasteStatus+ 76, // 13: pasteferry.v1.Event.transfer_changed:type_name -> pasteferry.v1.Transfer+ 23, // 14: pasteferry.v1.Event.friend_changed:type_name -> pasteferry.v1.Friend+ 25, // 15: pasteferry.v1.Event.friend_request:type_name -> pasteferry.v1.FriendRequest+ 16, // 16: pasteferry.v1.Event.profile_changed:type_name -> pasteferry.v1.Profile+ 85, // 17: pasteferry.v1.Event.web_share_changed:type_name -> pasteferry.v1.WebShareStatus+ 15, // 18: pasteferry.v1.Event.notice:type_name -> pasteferry.v1.AppNotice+ 105, // 19: pasteferry.v1.Event.themes_changed:type_name -> pasteferry.v1.ThemesChanged+ 2, // 20: pasteferry.v1.Friend.connection:type_name -> pasteferry.v1.ConnectionKind+ 23, // 21: pasteferry.v1.ListFriendsResponse.friends:type_name -> pasteferry.v1.Friend+ 26, // 22: pasteferry.v1.Strangers.strangers:type_name -> pasteferry.v1.Stranger+ 4, // 23: pasteferry.v1.ClipboardWriteResult.outcome:type_name -> pasteferry.v1.ClipboardWriteOutcome+ 0, // 24: pasteferry.v1.ListHistoryRequest.kind_filter:type_name -> pasteferry.v1.ClipKind+ 10, // 25: pasteferry.v1.ListHistoryResponse.records:type_name -> pasteferry.v1.ClipRecord+ 13, // 26: pasteferry.v1.ListDevicesResponse.self:type_name -> pasteferry.v1.Device+ 13, // 27: pasteferry.v1.ListDevicesResponse.peers:type_name -> pasteferry.v1.Device+ 13, // 28: pasteferry.v1.RedeemPairingCodeResponse.peer:type_name -> pasteferry.v1.Device+ 48, // 29: pasteferry.v1.NearbyDevices.devices:type_name -> pasteferry.v1.NearbyDevice+ 2, // 30: pasteferry.v1.ReconnectResponse.kind:type_name -> pasteferry.v1.ConnectionKind+ 6, // 31: pasteferry.v1.Config.service_mode:type_name -> pasteferry.v1.ServiceMode+ 5, // 32: pasteferry.v1.Config.theme_mode:type_name -> pasteferry.v1.ThemeMode+ 60, // 33: pasteferry.v1.NetworkInfo.egresses:type_name -> pasteferry.v1.NetworkEgress+ 58, // 34: pasteferry.v1.NetworkInfo.lan:type_name -> pasteferry.v1.LanInfo+ 59, // 35: pasteferry.v1.LanInfo.peers:type_name -> pasteferry.v1.LanPeer+ 3, // 36: pasteferry.v1.Status.clipboard_permission:type_name -> pasteferry.v1.ClipboardPermission+ 56, // 37: pasteferry.v1.Status.official_usage:type_name -> pasteferry.v1.OfficialUsage+ 68, // 38: pasteferry.v1.Status.last_update:type_name -> pasteferry.v1.UpdateResult+ 63, // 39: pasteferry.v1.UpdateInfo.releases:type_name -> pasteferry.v1.UpdateRelease+ 7, // 40: pasteferry.v1.Transfer.direction:type_name -> pasteferry.v1.TransferDirection+ 9, // 41: pasteferry.v1.Transfer.items:type_name -> pasteferry.v1.ClipItem+ 7, // 42: pasteferry.v1.ListTransfersRequest.direction:type_name -> pasteferry.v1.TransferDirection+ 76, // 43: pasteferry.v1.ListTransfersResponse.transfers:type_name -> pasteferry.v1.Transfer+ 7, // 44: pasteferry.v1.DeleteTransfersRequest.direction:type_name -> pasteferry.v1.TransferDirection+ 86, // 45: pasteferry.v1.WebShareStatus.sessions:type_name -> pasteferry.v1.WebSession+ 106, // 46: pasteferry.v1.ThemeInfo.name:type_name -> pasteferry.v1.ThemeInfo.NameEntry+ 92, // 47: pasteferry.v1.ListThemesResponse.themes:type_name -> pasteferry.v1.ThemeInfo+ 97, // 48: pasteferry.v1.PutThemeResponse.warnings:type_name -> pasteferry.v1.ThemeWarning+ 11, // 49: pasteferry.v1.DaemonService.Subscribe:input_type -> pasteferry.v1.SubscribeRequest+ 32, // 50: pasteferry.v1.DaemonService.ListHistory:input_type -> pasteferry.v1.ListHistoryRequest+ 34, // 51: pasteferry.v1.DaemonService.DeleteHistory:input_type -> pasteferry.v1.DeleteHistoryRequest+ 35, // 52: pasteferry.v1.DaemonService.Fetch:input_type -> pasteferry.v1.FetchRequest+ 36, // 53: pasteferry.v1.DaemonService.ApplyToClipboard:input_type -> pasteferry.v1.ApplyToClipboardRequest+ 72, // 54: pasteferry.v1.DaemonService.GetImagePreview:input_type -> pasteferry.v1.GetImagePreviewRequest+ 8, // 55: pasteferry.v1.DaemonService.ListDevices:input_type -> pasteferry.v1.Empty+ 8, // 56: pasteferry.v1.DaemonService.CreatePairingCode:input_type -> pasteferry.v1.Empty+ 45, // 57: pasteferry.v1.DaemonService.RedeemPairingCode:input_type -> pasteferry.v1.RedeemPairingCodeRequest+ 47, // 58: pasteferry.v1.DaemonService.ConfirmPairing:input_type -> pasteferry.v1.ConfirmPairingRequest+ 51, // 59: pasteferry.v1.DaemonService.Unpair:input_type -> pasteferry.v1.UnpairRequest+ 52, // 60: pasteferry.v1.DaemonService.Reconnect:input_type -> pasteferry.v1.ReconnectRequest+ 54, // 61: pasteferry.v1.DaemonService.SetDeviceAddress:input_type -> pasteferry.v1.SetDeviceAddressRequest+ 8, // 62: pasteferry.v1.DaemonService.WatchNearby:input_type -> pasteferry.v1.Empty+ 50, // 63: pasteferry.v1.DaemonService.PairNearby:input_type -> pasteferry.v1.PairNearbyRequest+ 8, // 64: pasteferry.v1.DaemonService.GetConfig:input_type -> pasteferry.v1.Empty+ 55, // 65: pasteferry.v1.DaemonService.UpdateConfig:input_type -> pasteferry.v1.Config+ 8, // 66: pasteferry.v1.DaemonService.GetStatus:input_type -> pasteferry.v1.Empty+ 8, // 67: pasteferry.v1.DaemonService.RequestClipboardPermission:input_type -> pasteferry.v1.Empty+ 8, // 68: pasteferry.v1.DaemonService.RequestLocalNetworkPermission:input_type -> pasteferry.v1.Empty+ 8, // 69: pasteferry.v1.DaemonService.GetNotificationStatus:input_type -> pasteferry.v1.Empty+ 8, // 70: pasteferry.v1.DaemonService.RequestNotificationPermission:input_type -> pasteferry.v1.Empty+ 30, // 71: pasteferry.v1.DaemonService.ActivateNotification:input_type -> pasteferry.v1.NotificationAction+ 8, // 72: pasteferry.v1.DaemonService.GetNetwork:input_type -> pasteferry.v1.Empty+ 69, // 73: pasteferry.v1.DaemonService.ExportDiagnostics:input_type -> pasteferry.v1.ExportDiagnosticsRequest+ 71, // 74: pasteferry.v1.DaemonService.SetVerboseLog:input_type -> pasteferry.v1.SetVerboseLogRequest+ 62, // 75: pasteferry.v1.DaemonService.CheckForUpdate:input_type -> pasteferry.v1.CheckForUpdateRequest+ 65, // 76: pasteferry.v1.DaemonService.DownloadUpdate:input_type -> pasteferry.v1.DownloadUpdateRequest+ 67, // 77: pasteferry.v1.DaemonService.InstallUpdate:input_type -> pasteferry.v1.InstallUpdateRequest+ 37, // 78: pasteferry.v1.DaemonService.SetFavorite:input_type -> pasteferry.v1.SetFavoriteRequest+ 39, // 79: pasteferry.v1.DaemonService.GetClipDetail:input_type -> pasteferry.v1.GetClipDetailRequest+ 38, // 80: pasteferry.v1.DaemonService.SetAlias:input_type -> pasteferry.v1.SetAliasRequest+ 41, // 81: pasteferry.v1.DaemonService.QuickPasteSession:input_type -> pasteferry.v1.QuickPasteStatus+ 8, // 82: pasteferry.v1.DaemonService.GetQuickPasteStatus:input_type -> pasteferry.v1.Empty+ 42, // 83: pasteferry.v1.DaemonService.SendQuickPasteCommand:input_type -> pasteferry.v1.QuickPasteCommand+ 74, // 84: pasteferry.v1.DaemonService.SendFiles:input_type -> pasteferry.v1.SendFilesRequest+ 75, // 85: pasteferry.v1.DaemonService.CancelTransfer:input_type -> pasteferry.v1.TransferRef+ 75, // 86: pasteferry.v1.DaemonService.ResumeTransfer:input_type -> pasteferry.v1.TransferRef+ 78, // 87: pasteferry.v1.DaemonService.ListTransfers:input_type -> pasteferry.v1.ListTransfersRequest+ 80, // 88: pasteferry.v1.DaemonService.DeleteTransfers:input_type -> pasteferry.v1.DeleteTransfersRequest+ 8, // 89: pasteferry.v1.DaemonService.MarkTransfersSeen:input_type -> pasteferry.v1.Empty+ 81, // 90: pasteferry.v1.DaemonService.CheckReceiveDir:input_type -> pasteferry.v1.CheckReceiveDirRequest+ 77, // 91: pasteferry.v1.DaemonService.AnswerIncoming:input_type -> pasteferry.v1.AnswerIncomingRequest+ 8, // 92: pasteferry.v1.DaemonService.GetProfile:input_type -> pasteferry.v1.Empty+ 17, // 93: pasteferry.v1.DaemonService.SetDisplayName:input_type -> pasteferry.v1.SetDisplayNameRequest+ 18, // 94: pasteferry.v1.DaemonService.SetAvatar:input_type -> pasteferry.v1.SetAvatarRequest+ 8, // 95: pasteferry.v1.DaemonService.ResetAvatar:input_type -> pasteferry.v1.Empty+ 19, // 96: pasteferry.v1.DaemonService.GetAvatar:input_type -> pasteferry.v1.GetAvatarRequest+ 8, // 97: pasteferry.v1.DaemonService.CreateFriendCode:input_type -> pasteferry.v1.Empty+ 45, // 98: pasteferry.v1.DaemonService.RedeemFriendCode:input_type -> pasteferry.v1.RedeemPairingCodeRequest+ 47, // 99: pasteferry.v1.DaemonService.ConfirmFriend:input_type -> pasteferry.v1.ConfirmPairingRequest+ 8, // 100: pasteferry.v1.DaemonService.ListFriends:input_type -> pasteferry.v1.Empty+ 21, // 101: pasteferry.v1.DaemonService.RemoveFriend:input_type -> pasteferry.v1.FriendRef+ 22, // 102: pasteferry.v1.DaemonService.SetFriendAutoAccept:input_type -> pasteferry.v1.SetFriendAutoAcceptRequest+ 21, // 103: pasteferry.v1.DaemonService.BlockDevice:input_type -> pasteferry.v1.FriendRef+ 83, // 104: pasteferry.v1.DaemonService.SubmitText:input_type -> pasteferry.v1.SubmitTextRequest+ 84, // 105: pasteferry.v1.DaemonService.SubmitFiles:input_type -> pasteferry.v1.SubmitFilesRequest+ 8, // 106: pasteferry.v1.DaemonService.GetWebShare:input_type -> pasteferry.v1.Empty+ 87, // 107: pasteferry.v1.DaemonService.SetWebShare:input_type -> pasteferry.v1.SetWebShareRequest+ 88, // 108: pasteferry.v1.DaemonService.NewWebShareInvite:input_type -> pasteferry.v1.NewWebShareInviteRequest+ 90, // 109: pasteferry.v1.DaemonService.CloseWebShareInvite:input_type -> pasteferry.v1.WebShareInviteRef+ 91, // 110: pasteferry.v1.DaemonService.RemoveWebSession:input_type -> pasteferry.v1.WebSessionRef+ 8, // 111: pasteferry.v1.DaemonService.PasteFiles:input_type -> pasteferry.v1.Empty+ 8, // 112: pasteferry.v1.DaemonService.WatchStrangers:input_type -> pasteferry.v1.Empty+ 8, // 113: pasteferry.v1.DaemonService.ListThemes:input_type -> pasteferry.v1.Empty+ 94, // 114: pasteferry.v1.DaemonService.GetTheme:input_type -> pasteferry.v1.GetThemeRequest+ 96, // 115: pasteferry.v1.DaemonService.PutTheme:input_type -> pasteferry.v1.PutThemeRequest+ 99, // 116: pasteferry.v1.DaemonService.DeleteTheme:input_type -> pasteferry.v1.ThemeRef+ 100, // 117: pasteferry.v1.DaemonService.ImportBackground:input_type -> pasteferry.v1.ImportBackgroundRequest+ 102, // 118: pasteferry.v1.DaemonService.GetBackground:input_type -> pasteferry.v1.GetBackgroundRequest+ 104, // 119: pasteferry.v1.DaemonService.DeleteBackground:input_type -> pasteferry.v1.BackgroundRef+ 104, // 120: pasteferry.v1.DaemonService.AnalyzeBackground:input_type -> pasteferry.v1.BackgroundRef+ 14, // 121: pasteferry.v1.DaemonService.Subscribe:output_type -> pasteferry.v1.Event+ 33, // 122: pasteferry.v1.DaemonService.ListHistory:output_type -> pasteferry.v1.ListHistoryResponse+ 8, // 123: pasteferry.v1.DaemonService.DeleteHistory:output_type -> pasteferry.v1.Empty+ 8, // 124: pasteferry.v1.DaemonService.Fetch:output_type -> pasteferry.v1.Empty+ 8, // 125: pasteferry.v1.DaemonService.ApplyToClipboard:output_type -> pasteferry.v1.Empty+ 73, // 126: pasteferry.v1.DaemonService.GetImagePreview:output_type -> pasteferry.v1.GetImagePreviewResponse+ 43, // 127: pasteferry.v1.DaemonService.ListDevices:output_type -> pasteferry.v1.ListDevicesResponse+ 44, // 128: pasteferry.v1.DaemonService.CreatePairingCode:output_type -> pasteferry.v1.CreatePairingCodeResponse+ 46, // 129: pasteferry.v1.DaemonService.RedeemPairingCode:output_type -> pasteferry.v1.RedeemPairingCodeResponse+ 8, // 130: pasteferry.v1.DaemonService.ConfirmPairing:output_type -> pasteferry.v1.Empty+ 8, // 131: pasteferry.v1.DaemonService.Unpair:output_type -> pasteferry.v1.Empty+ 53, // 132: pasteferry.v1.DaemonService.Reconnect:output_type -> pasteferry.v1.ReconnectResponse+ 8, // 133: pasteferry.v1.DaemonService.SetDeviceAddress:output_type -> pasteferry.v1.Empty+ 49, // 134: pasteferry.v1.DaemonService.WatchNearby:output_type -> pasteferry.v1.NearbyDevices+ 46, // 135: pasteferry.v1.DaemonService.PairNearby:output_type -> pasteferry.v1.RedeemPairingCodeResponse+ 55, // 136: pasteferry.v1.DaemonService.GetConfig:output_type -> pasteferry.v1.Config+ 55, // 137: pasteferry.v1.DaemonService.UpdateConfig:output_type -> pasteferry.v1.Config+ 61, // 138: pasteferry.v1.DaemonService.GetStatus:output_type -> pasteferry.v1.Status+ 8, // 139: pasteferry.v1.DaemonService.RequestClipboardPermission:output_type -> pasteferry.v1.Empty+ 8, // 140: pasteferry.v1.DaemonService.RequestLocalNetworkPermission:output_type -> pasteferry.v1.Empty+ 29, // 141: pasteferry.v1.DaemonService.GetNotificationStatus:output_type -> pasteferry.v1.NotificationStatus+ 29, // 142: pasteferry.v1.DaemonService.RequestNotificationPermission:output_type -> pasteferry.v1.NotificationStatus+ 8, // 143: pasteferry.v1.DaemonService.ActivateNotification:output_type -> pasteferry.v1.Empty+ 57, // 144: pasteferry.v1.DaemonService.GetNetwork:output_type -> pasteferry.v1.NetworkInfo+ 70, // 145: pasteferry.v1.DaemonService.ExportDiagnostics:output_type -> pasteferry.v1.Diagnostics+ 61, // 146: pasteferry.v1.DaemonService.SetVerboseLog:output_type -> pasteferry.v1.Status+ 64, // 147: pasteferry.v1.DaemonService.CheckForUpdate:output_type -> pasteferry.v1.UpdateInfo+ 66, // 148: pasteferry.v1.DaemonService.DownloadUpdate:output_type -> pasteferry.v1.UpdateProgress+ 8, // 149: pasteferry.v1.DaemonService.InstallUpdate:output_type -> pasteferry.v1.Empty+ 10, // 150: pasteferry.v1.DaemonService.SetFavorite:output_type -> pasteferry.v1.ClipRecord+ 40, // 151: pasteferry.v1.DaemonService.GetClipDetail:output_type -> pasteferry.v1.ClipDetail+ 10, // 152: pasteferry.v1.DaemonService.SetAlias:output_type -> pasteferry.v1.ClipRecord+ 42, // 153: pasteferry.v1.DaemonService.QuickPasteSession:output_type -> pasteferry.v1.QuickPasteCommand+ 41, // 154: pasteferry.v1.DaemonService.GetQuickPasteStatus:output_type -> pasteferry.v1.QuickPasteStatus+ 8, // 155: pasteferry.v1.DaemonService.SendQuickPasteCommand:output_type -> pasteferry.v1.Empty+ 76, // 156: pasteferry.v1.DaemonService.SendFiles:output_type -> pasteferry.v1.Transfer+ 8, // 157: pasteferry.v1.DaemonService.CancelTransfer:output_type -> pasteferry.v1.Empty+ 8, // 158: pasteferry.v1.DaemonService.ResumeTransfer:output_type -> pasteferry.v1.Empty+ 79, // 159: pasteferry.v1.DaemonService.ListTransfers:output_type -> pasteferry.v1.ListTransfersResponse+ 8, // 160: pasteferry.v1.DaemonService.DeleteTransfers:output_type -> pasteferry.v1.Empty+ 8, // 161: pasteferry.v1.DaemonService.MarkTransfersSeen:output_type -> pasteferry.v1.Empty+ 82, // 162: pasteferry.v1.DaemonService.CheckReceiveDir:output_type -> pasteferry.v1.CheckReceiveDirResponse+ 8, // 163: pasteferry.v1.DaemonService.AnswerIncoming:output_type -> pasteferry.v1.Empty+ 16, // 164: pasteferry.v1.DaemonService.GetProfile:output_type -> pasteferry.v1.Profile+ 16, // 165: pasteferry.v1.DaemonService.SetDisplayName:output_type -> pasteferry.v1.Profile+ 16, // 166: pasteferry.v1.DaemonService.SetAvatar:output_type -> pasteferry.v1.Profile+ 16, // 167: pasteferry.v1.DaemonService.ResetAvatar:output_type -> pasteferry.v1.Profile+ 20, // 168: pasteferry.v1.DaemonService.GetAvatar:output_type -> pasteferry.v1.Avatar+ 44, // 169: pasteferry.v1.DaemonService.CreateFriendCode:output_type -> pasteferry.v1.CreatePairingCodeResponse+ 25, // 170: pasteferry.v1.DaemonService.RedeemFriendCode:output_type -> pasteferry.v1.FriendRequest+ 8, // 171: pasteferry.v1.DaemonService.ConfirmFriend:output_type -> pasteferry.v1.Empty+ 24, // 172: pasteferry.v1.DaemonService.ListFriends:output_type -> pasteferry.v1.ListFriendsResponse+ 8, // 173: pasteferry.v1.DaemonService.RemoveFriend:output_type -> pasteferry.v1.Empty+ 23, // 174: pasteferry.v1.DaemonService.SetFriendAutoAccept:output_type -> pasteferry.v1.Friend+ 8, // 175: pasteferry.v1.DaemonService.BlockDevice:output_type -> pasteferry.v1.Empty+ 10, // 176: pasteferry.v1.DaemonService.SubmitText:output_type -> pasteferry.v1.ClipRecord+ 10, // 177: pasteferry.v1.DaemonService.SubmitFiles:output_type -> pasteferry.v1.ClipRecord+ 85, // 178: pasteferry.v1.DaemonService.GetWebShare:output_type -> pasteferry.v1.WebShareStatus+ 85, // 179: pasteferry.v1.DaemonService.SetWebShare:output_type -> pasteferry.v1.WebShareStatus+ 89, // 180: pasteferry.v1.DaemonService.NewWebShareInvite:output_type -> pasteferry.v1.WebShareInvite+ 8, // 181: pasteferry.v1.DaemonService.CloseWebShareInvite:output_type -> pasteferry.v1.Empty+ 85, // 182: pasteferry.v1.DaemonService.RemoveWebSession:output_type -> pasteferry.v1.WebShareStatus+ 28, // 183: pasteferry.v1.DaemonService.PasteFiles:output_type -> pasteferry.v1.PasteFilesResponse+ 27, // 184: pasteferry.v1.DaemonService.WatchStrangers:output_type -> pasteferry.v1.Strangers+ 93, // 185: pasteferry.v1.DaemonService.ListThemes:output_type -> pasteferry.v1.ListThemesResponse+ 95, // 186: pasteferry.v1.DaemonService.GetTheme:output_type -> pasteferry.v1.ThemeJson+ 98, // 187: pasteferry.v1.DaemonService.PutTheme:output_type -> pasteferry.v1.PutThemeResponse+ 8, // 188: pasteferry.v1.DaemonService.DeleteTheme:output_type -> pasteferry.v1.Empty+ 101, // 189: pasteferry.v1.DaemonService.ImportBackground:output_type -> pasteferry.v1.BackgroundInfo+ 103, // 190: pasteferry.v1.DaemonService.GetBackground:output_type -> pasteferry.v1.BackgroundImage+ 8, // 191: pasteferry.v1.DaemonService.DeleteBackground:output_type -> pasteferry.v1.Empty+ 101, // 192: pasteferry.v1.DaemonService.AnalyzeBackground:output_type -> pasteferry.v1.BackgroundInfo+ 121, // [121:193] is the sub-list for method output_type+ 49, // [49:121] is the sub-list for method input_type+ 49, // [49:49] is the sub-list for extension type_name+ 49, // [49:49] is the sub-list for extension extendee+ 0, // [0:49] is the sub-list for field type_name}func init() { file_pasteferry_v1_daemon_proto_init() }@@ -7502,14 +8495,15 @@ func file_pasteferry_v1_daemon_proto_init() {(*Event_ProfileChanged)(nil),(*Event_WebShareChanged)(nil),(*Event_Notice)(nil),+ (*Event_ThemesChanged)(nil),}type x struct{}out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_pasteferry_v1_daemon_proto_rawDesc), len(file_pasteferry_v1_daemon_proto_rawDesc)),- NumEnums: 7,- NumMessages: 84,+ NumEnums: 8,+ NumMessages: 99,NumExtensions: 0,NumServices: 1,},diff --git a/proto/gen/pasteferry/v1/daemon_grpc.pb.go b/proto/gen/pasteferry/v1/daemon_grpc.pb.goindex 8e35ac6..c29e7e8 100644--- a/proto/gen/pasteferry/v1/daemon_grpc.pb.go+++ b/proto/gen/pasteferry/v1/daemon_grpc.pb.go@@ -88,6 +88,14 @@ const (DaemonService_RemoveWebSession_FullMethodName = "/pasteferry.v1.DaemonService/RemoveWebSession"DaemonService_PasteFiles_FullMethodName = "/pasteferry.v1.DaemonService/PasteFiles"DaemonService_WatchStrangers_FullMethodName = "/pasteferry.v1.DaemonService/WatchStrangers"+ DaemonService_ListThemes_FullMethodName = "/pasteferry.v1.DaemonService/ListThemes"+ DaemonService_GetTheme_FullMethodName = "/pasteferry.v1.DaemonService/GetTheme"+ DaemonService_PutTheme_FullMethodName = "/pasteferry.v1.DaemonService/PutTheme"+ DaemonService_DeleteTheme_FullMethodName = "/pasteferry.v1.DaemonService/DeleteTheme"+ DaemonService_ImportBackground_FullMethodName = "/pasteferry.v1.DaemonService/ImportBackground"+ DaemonService_GetBackground_FullMethodName = "/pasteferry.v1.DaemonService/GetBackground"+ DaemonService_DeleteBackground_FullMethodName = "/pasteferry.v1.DaemonService/DeleteBackground"+ DaemonService_AnalyzeBackground_FullMethodName = "/pasteferry.v1.DaemonService/AnalyzeBackground")// DaemonServiceClient is the client API for DaemonService service.@@ -215,6 +223,24 @@ type DaemonServiceClient interface {PasteFiles(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PasteFilesResponse, error)// 隔空传送页打开期间保持这个调用:推送附近开着「所有人」的陌生设备(只在局域网里)WatchStrangers(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Strangers], error)+ // 主题与背景图(design/themes.md)。现在用哪一套在 Config.theme_id、theme_mode 里+ // 内置主题与本机的自定义主题+ ListThemes(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListThemesResponse, error)+ // 一套主题的 JSON(格式见 design/themes.md 第 3 节);resolved 时已合并 base,各项齐全+ GetTheme(ctx context.Context, in *GetThemeRequest, opts ...grpc.CallOption) (*ThemeJson, error)+ // 校验并保存一套自定义主题。格式不对报 InvalidArgument;对比度不够照样保存,返回警告。+ // dry_run 时只校验、不保存(AI 经 MCP 改主题前先试一遍,见 design/mcp.md)+ PutTheme(ctx context.Context, in *PutThemeRequest, opts ...grpc.CallOption) (*PutThemeResponse, error)+ // 删掉一套自定义主题。正在用它时换回默认主题;被别的主题当作 base 时报 FailedPrecondition+ DeleteTheme(ctx context.Context, in *ThemeRef, opts ...grpc.CallOption) (*Empty, error)+ // 导入一张背景图:重新编码(去掉 EXIF)、缩到长边 3840 以内、另存一份模糊版,并分析亮度与主色+ ImportBackground(ctx context.Context, in *ImportBackgroundRequest, opts ...grpc.CallOption) (*BackgroundInfo, error)+ // 背景图的字节,界面显示用+ GetBackground(ctx context.Context, in *GetBackgroundRequest, opts ...grpc.CallOption) (*BackgroundImage, error)+ // 删掉一张背景图;还有主题在用时报 FailedPrecondition+ DeleteBackground(ctx context.Context, in *BackgroundRef, opts ...grpc.CallOption) (*Empty, error)+ // 已导入的背景图的分析结果(亮度、主色、建议的遮罩浓度),与 ImportBackground 返回的相同+ AnalyzeBackground(ctx context.Context, in *BackgroundRef, opts ...grpc.CallOption) (*BackgroundInfo, error)}type daemonServiceClient struct {@@ -904,6 +930,86 @@ func (c *daemonServiceClient) WatchStrangers(ctx context.Context, in *Empty, opt// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.type DaemonService_WatchStrangersClient = grpc.ServerStreamingClient[Strangers]+func (c *daemonServiceClient) ListThemes(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListThemesResponse, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(ListThemesResponse)+ err := c.cc.Invoke(ctx, DaemonService_ListThemes_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) GetTheme(ctx context.Context, in *GetThemeRequest, opts ...grpc.CallOption) (*ThemeJson, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(ThemeJson)+ err := c.cc.Invoke(ctx, DaemonService_GetTheme_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) PutTheme(ctx context.Context, in *PutThemeRequest, opts ...grpc.CallOption) (*PutThemeResponse, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(PutThemeResponse)+ err := c.cc.Invoke(ctx, DaemonService_PutTheme_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) DeleteTheme(ctx context.Context, in *ThemeRef, opts ...grpc.CallOption) (*Empty, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Empty)+ err := c.cc.Invoke(ctx, DaemonService_DeleteTheme_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) ImportBackground(ctx context.Context, in *ImportBackgroundRequest, opts ...grpc.CallOption) (*BackgroundInfo, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(BackgroundInfo)+ err := c.cc.Invoke(ctx, DaemonService_ImportBackground_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) GetBackground(ctx context.Context, in *GetBackgroundRequest, opts ...grpc.CallOption) (*BackgroundImage, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(BackgroundImage)+ err := c.cc.Invoke(ctx, DaemonService_GetBackground_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) DeleteBackground(ctx context.Context, in *BackgroundRef, opts ...grpc.CallOption) (*Empty, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(Empty)+ err := c.cc.Invoke(ctx, DaemonService_DeleteBackground_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *daemonServiceClient) AnalyzeBackground(ctx context.Context, in *BackgroundRef, opts ...grpc.CallOption) (*BackgroundInfo, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(BackgroundInfo)+ err := c.cc.Invoke(ctx, DaemonService_AnalyzeBackground_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.@@ -1029,6 +1135,24 @@ type DaemonServiceServer interface {PasteFiles(context.Context, *Empty) (*PasteFilesResponse, error)// 隔空传送页打开期间保持这个调用:推送附近开着「所有人」的陌生设备(只在局域网里)WatchStrangers(*Empty, grpc.ServerStreamingServer[Strangers]) error+ // 主题与背景图(design/themes.md)。现在用哪一套在 Config.theme_id、theme_mode 里+ // 内置主题与本机的自定义主题+ ListThemes(context.Context, *Empty) (*ListThemesResponse, error)+ // 一套主题的 JSON(格式见 design/themes.md 第 3 节);resolved 时已合并 base,各项齐全+ GetTheme(context.Context, *GetThemeRequest) (*ThemeJson, error)+ // 校验并保存一套自定义主题。格式不对报 InvalidArgument;对比度不够照样保存,返回警告。+ // dry_run 时只校验、不保存(AI 经 MCP 改主题前先试一遍,见 design/mcp.md)+ PutTheme(context.Context, *PutThemeRequest) (*PutThemeResponse, error)+ // 删掉一套自定义主题。正在用它时换回默认主题;被别的主题当作 base 时报 FailedPrecondition+ DeleteTheme(context.Context, *ThemeRef) (*Empty, error)+ // 导入一张背景图:重新编码(去掉 EXIF)、缩到长边 3840 以内、另存一份模糊版,并分析亮度与主色+ ImportBackground(context.Context, *ImportBackgroundRequest) (*BackgroundInfo, error)+ // 背景图的字节,界面显示用+ GetBackground(context.Context, *GetBackgroundRequest) (*BackgroundImage, error)+ // 删掉一张背景图;还有主题在用时报 FailedPrecondition+ DeleteBackground(context.Context, *BackgroundRef) (*Empty, error)+ // 已导入的背景图的分析结果(亮度、主色、建议的遮罩浓度),与 ImportBackground 返回的相同+ AnalyzeBackground(context.Context, *BackgroundRef) (*BackgroundInfo, error)mustEmbedUnimplementedDaemonServiceServer()}@@ -1231,6 +1355,30 @@ func (UnimplementedDaemonServiceServer) PasteFiles(context.Context, *Empty) (*Pafunc (UnimplementedDaemonServiceServer) WatchStrangers(*Empty, grpc.ServerStreamingServer[Strangers]) error {return status.Error(codes.Unimplemented, "method WatchStrangers not implemented")}+func (UnimplementedDaemonServiceServer) ListThemes(context.Context, *Empty) (*ListThemesResponse, error) {+ return nil, status.Error(codes.Unimplemented, "method ListThemes not implemented")+}+func (UnimplementedDaemonServiceServer) GetTheme(context.Context, *GetThemeRequest) (*ThemeJson, error) {+ return nil, status.Error(codes.Unimplemented, "method GetTheme not implemented")+}+func (UnimplementedDaemonServiceServer) PutTheme(context.Context, *PutThemeRequest) (*PutThemeResponse, error) {+ return nil, status.Error(codes.Unimplemented, "method PutTheme not implemented")+}+func (UnimplementedDaemonServiceServer) DeleteTheme(context.Context, *ThemeRef) (*Empty, error) {+ return nil, status.Error(codes.Unimplemented, "method DeleteTheme not implemented")+}+func (UnimplementedDaemonServiceServer) ImportBackground(context.Context, *ImportBackgroundRequest) (*BackgroundInfo, error) {+ return nil, status.Error(codes.Unimplemented, "method ImportBackground not implemented")+}+func (UnimplementedDaemonServiceServer) GetBackground(context.Context, *GetBackgroundRequest) (*BackgroundImage, error) {+ return nil, status.Error(codes.Unimplemented, "method GetBackground not implemented")+}+func (UnimplementedDaemonServiceServer) DeleteBackground(context.Context, *BackgroundRef) (*Empty, error) {+ return nil, status.Error(codes.Unimplemented, "method DeleteBackground not implemented")+}+func (UnimplementedDaemonServiceServer) AnalyzeBackground(context.Context, *BackgroundRef) (*BackgroundInfo, error) {+ return nil, status.Error(codes.Unimplemented, "method AnalyzeBackground not implemented")+}func (UnimplementedDaemonServiceServer) mustEmbedUnimplementedDaemonServiceServer() {}func (UnimplementedDaemonServiceServer) testEmbeddedByValue() {}@@ -2365,6 +2513,150 @@ func _DaemonService_WatchStrangers_Handler(srv interface{}, stream grpc.ServerSt// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.type DaemonService_WatchStrangersServer = grpc.ServerStreamingServer[Strangers]+func _DaemonService_ListThemes_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).ListThemes(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_ListThemes_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).ListThemes(ctx, req.(*Empty))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_GetTheme_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(GetThemeRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).GetTheme(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_GetTheme_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).GetTheme(ctx, req.(*GetThemeRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_PutTheme_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(PutThemeRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).PutTheme(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_PutTheme_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).PutTheme(ctx, req.(*PutThemeRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_DeleteTheme_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(ThemeRef)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).DeleteTheme(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_DeleteTheme_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).DeleteTheme(ctx, req.(*ThemeRef))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_ImportBackground_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(ImportBackgroundRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).ImportBackground(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_ImportBackground_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).ImportBackground(ctx, req.(*ImportBackgroundRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_GetBackground_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(GetBackgroundRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).GetBackground(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_GetBackground_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).GetBackground(ctx, req.(*GetBackgroundRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_DeleteBackground_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(BackgroundRef)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).DeleteBackground(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_DeleteBackground_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).DeleteBackground(ctx, req.(*BackgroundRef))+ }+ return interceptor(ctx, in, info, handler)+}++func _DaemonService_AnalyzeBackground_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(BackgroundRef)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(DaemonServiceServer).AnalyzeBackground(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: DaemonService_AnalyzeBackground_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(DaemonServiceServer).AnalyzeBackground(ctx, req.(*BackgroundRef))+ }+ 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)@@ -2608,6 +2900,38 @@ var DaemonService_ServiceDesc = grpc.ServiceDesc{MethodName: "PasteFiles",Handler: _DaemonService_PasteFiles_Handler,},+ {+ MethodName: "ListThemes",+ Handler: _DaemonService_ListThemes_Handler,+ },+ {+ MethodName: "GetTheme",+ Handler: _DaemonService_GetTheme_Handler,+ },+ {+ MethodName: "PutTheme",+ Handler: _DaemonService_PutTheme_Handler,+ },+ {+ MethodName: "DeleteTheme",+ Handler: _DaemonService_DeleteTheme_Handler,+ },+ {+ MethodName: "ImportBackground",+ Handler: _DaemonService_ImportBackground_Handler,+ },+ {+ MethodName: "GetBackground",+ Handler: _DaemonService_GetBackground_Handler,+ },+ {+ MethodName: "DeleteBackground",+ Handler: _DaemonService_DeleteBackground_Handler,+ },+ {+ MethodName: "AnalyzeBackground",+ Handler: _DaemonService_AnalyzeBackground_Handler,+ },},Streams: []grpc.StreamDesc{{diff --git a/proto/pasteferry/v1/daemon.proto b/proto/pasteferry/v1/daemon.protoindex 12903b5..55ddfae 100644--- a/proto/pasteferry/v1/daemon.proto+++ b/proto/pasteferry/v1/daemon.proto@@ -147,6 +147,25 @@ service DaemonService {rpc PasteFiles(Empty) returns (PasteFilesResponse);// 隔空传送页打开期间保持这个调用:推送附近开着「所有人」的陌生设备(只在局域网里)rpc WatchStrangers(Empty) returns (stream Strangers);++ // 主题与背景图(design/themes.md)。现在用哪一套在 Config.theme_id、theme_mode 里+ // 内置主题与本机的自定义主题+ rpc ListThemes(Empty) returns (ListThemesResponse);+ // 一套主题的 JSON(格式见 design/themes.md 第 3 节);resolved 时已合并 base,各项齐全+ rpc GetTheme(GetThemeRequest) returns (ThemeJson);+ // 校验并保存一套自定义主题。格式不对报 InvalidArgument;对比度不够照样保存,返回警告。+ // dry_run 时只校验、不保存(AI 经 MCP 改主题前先试一遍,见 design/mcp.md)+ rpc PutTheme(PutThemeRequest) returns (PutThemeResponse);+ // 删掉一套自定义主题。正在用它时换回默认主题;被别的主题当作 base 时报 FailedPrecondition+ rpc DeleteTheme(ThemeRef) returns (Empty);+ // 导入一张背景图:重新编码(去掉 EXIF)、缩到长边 3840 以内、另存一份模糊版,并分析亮度与主色+ rpc ImportBackground(ImportBackgroundRequest) returns (BackgroundInfo);+ // 背景图的字节,界面显示用+ rpc GetBackground(GetBackgroundRequest) returns (BackgroundImage);+ // 删掉一张背景图;还有主题在用时报 FailedPrecondition+ rpc DeleteBackground(BackgroundRef) returns (Empty);+ // 已导入的背景图的分析结果(亮度、主色、建议的遮罩浓度),与 ImportBackground 返回的相同+ rpc AnalyzeBackground(BackgroundRef) returns (BackgroundInfo);}message Empty {}@@ -300,6 +319,8 @@ message Event {// 需要让用户知道、但和某条记录无关的一件小事(比如刚才复制的文件读不到,没有同步)。// kind 是固定代码,界面按它显示文案AppNotice notice = 19;+ // 自定义主题保存或删除了(正在用哪一套的变化走 config_changed)+ ThemesChanged themes_changed = 20;}}@@ -672,6 +693,18 @@ message Config {string quick_paste_index_modifier = 33;// 手机上「发送记录」显示最近几天的发出内容(2.7.2):0 或空表示默认 3 天int32 sent_retention_days = 34;+ // 用哪套主题(design/themes.md):空字符串表示默认主题,否则是 ListThemes 里的 id+ string theme_id = 35;+ ThemeMode theme_mode = 36;+ // 像素主题的 CRT 扫描线效果,默认关+ bool theme_scanlines = 37;+}++// 浅色还是深色+enum ThemeMode {+ THEME_MODE_UNSPECIFIED = 0; // 跟随系统+ THEME_MODE_LIGHT = 1;+ THEME_MODE_DARK = 2;}enum ServiceMode {@@ -988,3 +1021,87 @@ message WebShareInviteRef {message WebSessionRef {string id = 1;}++// ─────────────────────────── 主题与背景图 ───────────────────────────++message ThemeInfo {+ string id = 1;+ // 界面语言("zh-Hans"、"en" 等)到名字;没有当前语言时界面取 "en",再没有就显示 id+ map<string, string> name = 2;+ bool builtin = 3; // 内置主题(default、pixel)不能修改、删除+ string base = 4; // 自定义主题继承的主题+}++message ListThemesResponse {+ repeated ThemeInfo themes = 1; // 内置的在前,自定义的按 id 排+}++message GetThemeRequest {+ string id = 1; // 空字符串表示默认主题+ bool resolved = 2; // 合并 base 之后的完整主题;否则是保存时的原样+}++message ThemeJson {+ string json = 1;+}++message PutThemeRequest {+ string json = 1; // 一套主题,id 不能是内置主题的+ bool dry_run = 2; // 只校验、算对比度,不保存也不推送事件+}++// 一对颜色的对比度不够(design/themes.md 第 8 节)+message ThemeWarning {+ string mode = 1; // "light" 或 "dark"+ string foreground = 2; // 颜色角色名,如 "textDim"+ string background = 3; // 如 "surface"+ double ratio = 4; // 实际的对比度+ double minimum = 5; // 要求的最低对比度+}++message PutThemeResponse {+ string id = 1;+ repeated ThemeWarning warnings = 2;+}++message ThemeRef {+ string id = 1;+}++message ImportBackgroundRequest {+ string path = 1; // 图片文件+ bytes image = 2; // 或者直接给图片数据(拖入、粘贴时)+}++// 导入后的背景图。主题里写成 "user:" 加上 sha256 引用它+message BackgroundInfo {+ string sha256 = 1; // 重新编码后的文件内容的 SHA-256,十六进制+ int32 width = 2;+ int32 height = 3;+ string format = 4; // "jpeg";像素画这类小图保留 "png"+ double luminance = 5; // 平均相对亮度,0 到 1+ double luminance_spread = 6; // 亮度的标准差:越大越花,面板要更不透明+ repeated string colors = 7; // 3 到 5 个主色,"#RRGGBB",占比大的在前+ // 让白字在最亮的区域也达到 4.5:1,黑色遮罩至少要多浓(0 到 1)+ double min_scrim_dark = 8;+ // 让黑字在最暗的区域也达到 4.5:1,白色遮罩至少要多浓(0 到 1)+ double min_scrim_light = 9;+}++message GetBackgroundRequest {+ string sha256 = 1;+ bool blurred = 2; // 模糊版:长边 960,主题的 blur 大于 0 时用它放大铺满+}++message BackgroundImage {+ bytes data = 1;+ string format = 2; // "jpeg" 或 "png"+}++message BackgroundRef {+ string sha256 = 1;+}++message ThemesChanged {+ repeated string ids = 1; // 保存或删除了的主题+}diff --git a/ui/lib/gen/pasteferry/v1/daemon.pb.dart b/ui/lib/gen/pasteferry/v1/daemon.pb.dartindex 6529c69..05731c9 100644--- a/ui/lib/gen/pasteferry/v1/daemon.pb.dart+++ b/ui/lib/gen/pasteferry/v1/daemon.pb.dart@@ -808,6 +808,7 @@ enum Event_Payload {profileChanged,webShareChanged,notice,+ themesChanged,notSet}@@ -832,6 +833,7 @@ class Event extends $pb.GeneratedMessage {Profile? profileChanged,WebShareStatus? webShareChanged,AppNotice? notice,+ ThemesChanged? themesChanged,}) {final result = Event._();if (clipAdded != null) result.clipAdded = clipAdded;@@ -853,6 +855,7 @@ class Event extends $pb.GeneratedMessage {if (profileChanged != null) result.profileChanged = profileChanged;if (webShareChanged != null) result.webShareChanged = webShareChanged;if (notice != null) result.notice = notice;+ if (themesChanged != null) result.themesChanged = themesChanged;return result;}@@ -885,13 +888,15 @@ class Event extends $pb.GeneratedMessage {17: Event_Payload.profileChanged,18: Event_Payload.webShareChanged,19: Event_Payload.notice,+ 20: Event_Payload.themesChanged,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, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19])+ ..oo(0,+ [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])..aOM<ClipRecord>(1, _omitFieldNames ? '' : 'clipAdded',subBuilder: ClipRecord.$_createMessage)..aOM<ClipRecord>(2, _omitFieldNames ? '' : 'clipUpdated',@@ -926,6 +931,8 @@ class Event extends $pb.GeneratedMessage {subBuilder: WebShareStatus.$_createMessage)..aOM<AppNotice>(19, _omitFieldNames ? '' : 'notice',subBuilder: AppNotice.$_createMessage)+ ..aOM<ThemesChanged>(20, _omitFieldNames ? '' : 'themesChanged',+ subBuilder: ThemesChanged.$_createMessage)..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -967,6 +974,7 @@ class Event extends $pb.GeneratedMessage {@$pb.TagNumber(17)@$pb.TagNumber(18)@$pb.TagNumber(19)+ @$pb.TagNumber(20)Event_Payload whichPayload() => _Event_PayloadByTag[$_whichOneof(0)]!;@$pb.TagNumber(1)@$pb.TagNumber(2)@@ -987,6 +995,7 @@ class Event extends $pb.GeneratedMessage {@$pb.TagNumber(17)@$pb.TagNumber(18)@$pb.TagNumber(19)+ @$pb.TagNumber(20)void clearPayload() => $_clearField($_whichOneof(0));@$pb.TagNumber(1)@@ -1196,6 +1205,18 @@ class Event extends $pb.GeneratedMessage {void clearNotice() => $_clearField(19);@$pb.TagNumber(19)AppNotice ensureNotice() => $_ensure(18);++ /// 自定义主题保存或删除了(正在用哪一套的变化走 config_changed)+ @$pb.TagNumber(20)+ ThemesChanged get themesChanged => $_getN(19);+ @$pb.TagNumber(20)+ set themesChanged(ThemesChanged value) => $_setField(20, value);+ @$pb.TagNumber(20)+ $core.bool hasThemesChanged() => $_has(19);+ @$pb.TagNumber(20)+ void clearThemesChanged() => $_clearField(20);+ @$pb.TagNumber(20)+ ThemesChanged ensureThemesChanged() => $_ensure(19);}/// AppNotice 是一条给用户看的提示,只带一个固定代码,文案由界面翻译。@@ -4400,6 +4421,9 @@ class Config extends $pb.GeneratedMessage {$core.String? displayName,$core.String? quickPasteIndexModifier,$core.int? sentRetentionDays,+ $core.String? themeId,+ ThemeMode? themeMode,+ $core.bool? themeScanlines,}) {final result = Config._();if (autoSyncThresholdBytes != null)@@ -4446,6 +4470,9 @@ class Config extends $pb.GeneratedMessage {if (quickPasteIndexModifier != null)result.quickPasteIndexModifier = quickPasteIndexModifier;if (sentRetentionDays != null) result.sentRetentionDays = sentRetentionDays;+ if (themeId != null) result.themeId = themeId;+ if (themeMode != null) result.themeMode = themeMode;+ if (themeScanlines != null) result.themeScanlines = themeScanlines;return result;}@@ -4497,6 +4524,10 @@ class Config extends $pb.GeneratedMessage {..aOS(32, _omitFieldNames ? '' : 'displayName')..aOS(33, _omitFieldNames ? '' : 'quickPasteIndexModifier')..aI(34, _omitFieldNames ? '' : 'sentRetentionDays')+ ..aOS(35, _omitFieldNames ? '' : 'themeId')+ ..aE<ThemeMode>(36, _omitFieldNames ? '' : 'themeMode',+ enumValues: ThemeMode.values)+ ..aOB(37, _omitFieldNames ? '' : 'themeScanlines')..hasRequiredFields = false;@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')@@ -4844,6 +4875,35 @@ class Config extends $pb.GeneratedMessage {$core.bool hasSentRetentionDays() => $_has(33);@$pb.TagNumber(34)void clearSentRetentionDays() => $_clearField(34);++ /// 用哪套主题(design/themes.md):空字符串表示默认主题,否则是 ListThemes 里的 id+ @$pb.TagNumber(35)+ $core.String get themeId => $_getSZ(34);+ @$pb.TagNumber(35)+ set themeId($core.String value) => $_setString(34, value);+ @$pb.TagNumber(35)+ $core.bool hasThemeId() => $_has(34);+ @$pb.TagNumber(35)+ void clearThemeId() => $_clearField(35);++ @$pb.TagNumber(36)+ ThemeMode get themeMode => $_getN(35);+ @$pb.TagNumber(36)+ set themeMode(ThemeMode value) => $_setField(36, value);+ @$pb.TagNumber(36)+ $core.bool hasThemeMode() => $_has(35);+ @$pb.TagNumber(36)+ void clearThemeMode() => $_clearField(36);++ /// 像素主题的 CRT 扫描线效果,默认关+ @$pb.TagNumber(37)+ $core.bool get themeScanlines => $_getBF(36);+ @$pb.TagNumber(37)+ set themeScanlines($core.bool value) => $_setBool(36, value);+ @$pb.TagNumber(37)+ $core.bool hasThemeScanlines() => $_has(36);+ @$pb.TagNumber(37)+ void clearThemeScanlines() => $_clearField(37);}class OfficialUsage extends $pb.GeneratedMessage {@@ -8214,6 +8274,1036 @@ class WebSessionRef extends $pb.GeneratedMessage {void clearId() => $_clearField(1);}+class ThemeInfo extends $pb.GeneratedMessage {+ factory ThemeInfo({+ $core.String? id,+ $core.Iterable<$core.MapEntry<$core.String, $core.String>>? name,+ $core.bool? builtin,+ $core.String? base,+ }) {+ final result = ThemeInfo._();+ if (id != null) result.id = id;+ if (name != null) result.name.addEntries(name);+ if (builtin != null) result.builtin = builtin;+ if (base != null) result.base = base;+ return result;+ }++ ThemeInfo._();++ factory ThemeInfo.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ThemeInfo()..mergeFromBuffer(data, registry);+ factory ThemeInfo.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ThemeInfo()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'ThemeInfo',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: ThemeInfo.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'id')+ ..m<$core.String, $core.String>(2, _omitFieldNames ? '' : 'name',+ entryClassName: 'ThemeInfo.NameEntry',+ keyFieldType: $pb.PbFieldType.OS,+ valueFieldType: $pb.PbFieldType.OS,+ packageName: const $pb.PackageName('pasteferry.v1'))+ ..aOB(3, _omitFieldNames ? '' : 'builtin')+ ..aOS(4, _omitFieldNames ? '' : 'base')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ThemeInfo clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ThemeInfo copyWith(void Function(ThemeInfo) updates) =>+ super.copyWith((message) => updates(message as ThemeInfo)) as ThemeInfo;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use ThemeInfo() / ThemeInfo.new instead')+ static ThemeInfo create() => ThemeInfo._();+ static $pb.GeneratedMessage $_createMessage() => ThemeInfo._();+ @$core.override+ ThemeInfo createEmptyInstance() => ThemeInfo._();+ @$core.pragma('dart2js:noInline')+ static ThemeInfo getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<ThemeInfo>(ThemeInfo.$_createMessage);+ static ThemeInfo? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get id => $_getSZ(0);+ @$pb.TagNumber(1)+ set id($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasId() => $_has(0);+ @$pb.TagNumber(1)+ void clearId() => $_clearField(1);++ /// 界面语言("zh-Hans"、"en" 等)到名字;没有当前语言时界面取 "en",再没有就显示 id+ @$pb.TagNumber(2)+ $pb.PbMap<$core.String, $core.String> get name => $_getMap(1);++ @$pb.TagNumber(3)+ $core.bool get builtin => $_getBF(2);+ @$pb.TagNumber(3)+ set builtin($core.bool value) => $_setBool(2, value);+ @$pb.TagNumber(3)+ $core.bool hasBuiltin() => $_has(2);+ @$pb.TagNumber(3)+ void clearBuiltin() => $_clearField(3);++ @$pb.TagNumber(4)+ $core.String get base => $_getSZ(3);+ @$pb.TagNumber(4)+ set base($core.String value) => $_setString(3, value);+ @$pb.TagNumber(4)+ $core.bool hasBase() => $_has(3);+ @$pb.TagNumber(4)+ void clearBase() => $_clearField(4);+}++class ListThemesResponse extends $pb.GeneratedMessage {+ factory ListThemesResponse({+ $core.Iterable<ThemeInfo>? themes,+ }) {+ final result = ListThemesResponse._();+ if (themes != null) result.themes.addAll(themes);+ return result;+ }++ ListThemesResponse._();++ factory ListThemesResponse.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ListThemesResponse()..mergeFromBuffer(data, registry);+ factory ListThemesResponse.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ListThemesResponse()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'ListThemesResponse',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: ListThemesResponse.$_createMessage)+ ..pPM<ThemeInfo>(1, _omitFieldNames ? '' : 'themes',+ subBuilder: ThemeInfo.$_createMessage)+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ListThemesResponse clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ListThemesResponse copyWith(void Function(ListThemesResponse) updates) =>+ super.copyWith((message) => updates(message as ListThemesResponse))+ as ListThemesResponse;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use ListThemesResponse() / ListThemesResponse.new instead')+ static ListThemesResponse create() => ListThemesResponse._();+ static $pb.GeneratedMessage $_createMessage() => ListThemesResponse._();+ @$core.override+ ListThemesResponse createEmptyInstance() => ListThemesResponse._();+ @$core.pragma('dart2js:noInline')+ static ListThemesResponse getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<ListThemesResponse>(+ ListThemesResponse.$_createMessage);+ static ListThemesResponse? _defaultInstance;++ @$pb.TagNumber(1)+ $pb.PbList<ThemeInfo> get themes => $_getList(0);+}++class GetThemeRequest extends $pb.GeneratedMessage {+ factory GetThemeRequest({+ $core.String? id,+ $core.bool? resolved,+ }) {+ final result = GetThemeRequest._();+ if (id != null) result.id = id;+ if (resolved != null) result.resolved = resolved;+ return result;+ }++ GetThemeRequest._();++ factory GetThemeRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ GetThemeRequest()..mergeFromBuffer(data, registry);+ factory GetThemeRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ GetThemeRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'GetThemeRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: GetThemeRequest.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'id')+ ..aOB(2, _omitFieldNames ? '' : 'resolved')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ GetThemeRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ GetThemeRequest copyWith(void Function(GetThemeRequest) updates) =>+ super.copyWith((message) => updates(message as GetThemeRequest))+ as GetThemeRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use GetThemeRequest() / GetThemeRequest.new instead')+ static GetThemeRequest create() => GetThemeRequest._();+ static $pb.GeneratedMessage $_createMessage() => GetThemeRequest._();+ @$core.override+ GetThemeRequest createEmptyInstance() => GetThemeRequest._();+ @$core.pragma('dart2js:noInline')+ static GetThemeRequest getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<GetThemeRequest>(+ GetThemeRequest.$_createMessage);+ static GetThemeRequest? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get id => $_getSZ(0);+ @$pb.TagNumber(1)+ set id($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasId() => $_has(0);+ @$pb.TagNumber(1)+ void clearId() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.bool get resolved => $_getBF(1);+ @$pb.TagNumber(2)+ set resolved($core.bool value) => $_setBool(1, value);+ @$pb.TagNumber(2)+ $core.bool hasResolved() => $_has(1);+ @$pb.TagNumber(2)+ void clearResolved() => $_clearField(2);+}++class ThemeJson extends $pb.GeneratedMessage {+ factory ThemeJson({+ $core.String? json,+ }) {+ final result = ThemeJson._();+ if (json != null) result.json = json;+ return result;+ }++ ThemeJson._();++ factory ThemeJson.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ThemeJson()..mergeFromBuffer(data, registry);+ factory ThemeJson.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ThemeJson()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'ThemeJson',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: ThemeJson.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'json')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ThemeJson clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ThemeJson copyWith(void Function(ThemeJson) updates) =>+ super.copyWith((message) => updates(message as ThemeJson)) as ThemeJson;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use ThemeJson() / ThemeJson.new instead')+ static ThemeJson create() => ThemeJson._();+ static $pb.GeneratedMessage $_createMessage() => ThemeJson._();+ @$core.override+ ThemeJson createEmptyInstance() => ThemeJson._();+ @$core.pragma('dart2js:noInline')+ static ThemeJson getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<ThemeJson>(ThemeJson.$_createMessage);+ static ThemeJson? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get json => $_getSZ(0);+ @$pb.TagNumber(1)+ set json($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasJson() => $_has(0);+ @$pb.TagNumber(1)+ void clearJson() => $_clearField(1);+}++class PutThemeRequest extends $pb.GeneratedMessage {+ factory PutThemeRequest({+ $core.String? json,+ $core.bool? dryRun,+ }) {+ final result = PutThemeRequest._();+ if (json != null) result.json = json;+ if (dryRun != null) result.dryRun = dryRun;+ return result;+ }++ PutThemeRequest._();++ factory PutThemeRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ PutThemeRequest()..mergeFromBuffer(data, registry);+ factory PutThemeRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ PutThemeRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'PutThemeRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: PutThemeRequest.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'json')+ ..aOB(2, _omitFieldNames ? '' : 'dryRun')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ PutThemeRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ PutThemeRequest copyWith(void Function(PutThemeRequest) updates) =>+ super.copyWith((message) => updates(message as PutThemeRequest))+ as PutThemeRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use PutThemeRequest() / PutThemeRequest.new instead')+ static PutThemeRequest create() => PutThemeRequest._();+ static $pb.GeneratedMessage $_createMessage() => PutThemeRequest._();+ @$core.override+ PutThemeRequest createEmptyInstance() => PutThemeRequest._();+ @$core.pragma('dart2js:noInline')+ static PutThemeRequest getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<PutThemeRequest>(+ PutThemeRequest.$_createMessage);+ static PutThemeRequest? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get json => $_getSZ(0);+ @$pb.TagNumber(1)+ set json($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasJson() => $_has(0);+ @$pb.TagNumber(1)+ void clearJson() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.bool get dryRun => $_getBF(1);+ @$pb.TagNumber(2)+ set dryRun($core.bool value) => $_setBool(1, value);+ @$pb.TagNumber(2)+ $core.bool hasDryRun() => $_has(1);+ @$pb.TagNumber(2)+ void clearDryRun() => $_clearField(2);+}++/// 一对颜色的对比度不够(design/themes.md 第 8 节)+class ThemeWarning extends $pb.GeneratedMessage {+ factory ThemeWarning({+ $core.String? mode,+ $core.String? foreground,+ $core.String? background,+ $core.double? ratio,+ $core.double? minimum,+ }) {+ final result = ThemeWarning._();+ if (mode != null) result.mode = mode;+ if (foreground != null) result.foreground = foreground;+ if (background != null) result.background = background;+ if (ratio != null) result.ratio = ratio;+ if (minimum != null) result.minimum = minimum;+ return result;+ }++ ThemeWarning._();++ factory ThemeWarning.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ThemeWarning()..mergeFromBuffer(data, registry);+ factory ThemeWarning.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ThemeWarning()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'ThemeWarning',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: ThemeWarning.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'mode')+ ..aOS(2, _omitFieldNames ? '' : 'foreground')+ ..aOS(3, _omitFieldNames ? '' : 'background')+ ..aD(4, _omitFieldNames ? '' : 'ratio')+ ..aD(5, _omitFieldNames ? '' : 'minimum')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ThemeWarning clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ThemeWarning copyWith(void Function(ThemeWarning) updates) =>+ super.copyWith((message) => updates(message as ThemeWarning))+ as ThemeWarning;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use ThemeWarning() / ThemeWarning.new instead')+ static ThemeWarning create() => ThemeWarning._();+ static $pb.GeneratedMessage $_createMessage() => ThemeWarning._();+ @$core.override+ ThemeWarning createEmptyInstance() => ThemeWarning._();+ @$core.pragma('dart2js:noInline')+ static ThemeWarning getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ThemeWarning>(+ ThemeWarning.$_createMessage);+ static ThemeWarning? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get mode => $_getSZ(0);+ @$pb.TagNumber(1)+ set mode($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasMode() => $_has(0);+ @$pb.TagNumber(1)+ void clearMode() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.String get foreground => $_getSZ(1);+ @$pb.TagNumber(2)+ set foreground($core.String value) => $_setString(1, value);+ @$pb.TagNumber(2)+ $core.bool hasForeground() => $_has(1);+ @$pb.TagNumber(2)+ void clearForeground() => $_clearField(2);++ @$pb.TagNumber(3)+ $core.String get background => $_getSZ(2);+ @$pb.TagNumber(3)+ set background($core.String value) => $_setString(2, value);+ @$pb.TagNumber(3)+ $core.bool hasBackground() => $_has(2);+ @$pb.TagNumber(3)+ void clearBackground() => $_clearField(3);++ @$pb.TagNumber(4)+ $core.double get ratio => $_getN(3);+ @$pb.TagNumber(4)+ set ratio($core.double value) => $_setDouble(3, value);+ @$pb.TagNumber(4)+ $core.bool hasRatio() => $_has(3);+ @$pb.TagNumber(4)+ void clearRatio() => $_clearField(4);++ @$pb.TagNumber(5)+ $core.double get minimum => $_getN(4);+ @$pb.TagNumber(5)+ set minimum($core.double value) => $_setDouble(4, value);+ @$pb.TagNumber(5)+ $core.bool hasMinimum() => $_has(4);+ @$pb.TagNumber(5)+ void clearMinimum() => $_clearField(5);+}++class PutThemeResponse extends $pb.GeneratedMessage {+ factory PutThemeResponse({+ $core.String? id,+ $core.Iterable<ThemeWarning>? warnings,+ }) {+ final result = PutThemeResponse._();+ if (id != null) result.id = id;+ if (warnings != null) result.warnings.addAll(warnings);+ return result;+ }++ PutThemeResponse._();++ factory PutThemeResponse.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ PutThemeResponse()..mergeFromBuffer(data, registry);+ factory PutThemeResponse.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ PutThemeResponse()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'PutThemeResponse',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: PutThemeResponse.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'id')+ ..pPM<ThemeWarning>(2, _omitFieldNames ? '' : 'warnings',+ subBuilder: ThemeWarning.$_createMessage)+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ PutThemeResponse clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ PutThemeResponse copyWith(void Function(PutThemeResponse) updates) =>+ super.copyWith((message) => updates(message as PutThemeResponse))+ as PutThemeResponse;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use PutThemeResponse() / PutThemeResponse.new instead')+ static PutThemeResponse create() => PutThemeResponse._();+ static $pb.GeneratedMessage $_createMessage() => PutThemeResponse._();+ @$core.override+ PutThemeResponse createEmptyInstance() => PutThemeResponse._();+ @$core.pragma('dart2js:noInline')+ static PutThemeResponse getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<PutThemeResponse>(+ PutThemeResponse.$_createMessage);+ static PutThemeResponse? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get id => $_getSZ(0);+ @$pb.TagNumber(1)+ set id($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasId() => $_has(0);+ @$pb.TagNumber(1)+ void clearId() => $_clearField(1);++ @$pb.TagNumber(2)+ $pb.PbList<ThemeWarning> get warnings => $_getList(1);+}++class ThemeRef extends $pb.GeneratedMessage {+ factory ThemeRef({+ $core.String? id,+ }) {+ final result = ThemeRef._();+ if (id != null) result.id = id;+ return result;+ }++ ThemeRef._();++ factory ThemeRef.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ThemeRef()..mergeFromBuffer(data, registry);+ factory ThemeRef.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ThemeRef()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'ThemeRef',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: ThemeRef.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'id')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ThemeRef clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ThemeRef copyWith(void Function(ThemeRef) updates) =>+ super.copyWith((message) => updates(message as ThemeRef)) as ThemeRef;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use ThemeRef() / ThemeRef.new instead')+ static ThemeRef create() => ThemeRef._();+ static $pb.GeneratedMessage $_createMessage() => ThemeRef._();+ @$core.override+ ThemeRef createEmptyInstance() => ThemeRef._();+ @$core.pragma('dart2js:noInline')+ static ThemeRef getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<ThemeRef>(ThemeRef.$_createMessage);+ static ThemeRef? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get id => $_getSZ(0);+ @$pb.TagNumber(1)+ set id($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasId() => $_has(0);+ @$pb.TagNumber(1)+ void clearId() => $_clearField(1);+}++class ImportBackgroundRequest extends $pb.GeneratedMessage {+ factory ImportBackgroundRequest({+ $core.String? path,+ $core.List<$core.int>? image,+ }) {+ final result = ImportBackgroundRequest._();+ if (path != null) result.path = path;+ if (image != null) result.image = image;+ return result;+ }++ ImportBackgroundRequest._();++ factory ImportBackgroundRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ImportBackgroundRequest()..mergeFromBuffer(data, registry);+ factory ImportBackgroundRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ImportBackgroundRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'ImportBackgroundRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: ImportBackgroundRequest.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'path')+ ..a<$core.List<$core.int>>(+ 2, _omitFieldNames ? '' : 'image', $pb.PbFieldType.OY)+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ImportBackgroundRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ImportBackgroundRequest copyWith(+ void Function(ImportBackgroundRequest) updates) =>+ super.copyWith((message) => updates(message as ImportBackgroundRequest))+ as ImportBackgroundRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated(+ 'Use ImportBackgroundRequest() / ImportBackgroundRequest.new instead')+ static ImportBackgroundRequest create() => ImportBackgroundRequest._();+ static $pb.GeneratedMessage $_createMessage() => ImportBackgroundRequest._();+ @$core.override+ ImportBackgroundRequest createEmptyInstance() => ImportBackgroundRequest._();+ @$core.pragma('dart2js:noInline')+ static ImportBackgroundRequest getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<ImportBackgroundRequest>(+ ImportBackgroundRequest.$_createMessage);+ static ImportBackgroundRequest? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get path => $_getSZ(0);+ @$pb.TagNumber(1)+ set path($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasPath() => $_has(0);+ @$pb.TagNumber(1)+ void clearPath() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.List<$core.int> get image => $_getN(1);+ @$pb.TagNumber(2)+ set image($core.List<$core.int> value) => $_setBytes(1, value);+ @$pb.TagNumber(2)+ $core.bool hasImage() => $_has(1);+ @$pb.TagNumber(2)+ void clearImage() => $_clearField(2);+}++/// 导入后的背景图。主题里写成 "user:" 加上 sha256 引用它+class BackgroundInfo extends $pb.GeneratedMessage {+ factory BackgroundInfo({+ $core.String? sha256,+ $core.int? width,+ $core.int? height,+ $core.String? format,+ $core.double? luminance,+ $core.double? luminanceSpread,+ $core.Iterable<$core.String>? colors,+ $core.double? minScrimDark,+ $core.double? minScrimLight,+ }) {+ final result = BackgroundInfo._();+ if (sha256 != null) result.sha256 = sha256;+ if (width != null) result.width = width;+ if (height != null) result.height = height;+ if (format != null) result.format = format;+ if (luminance != null) result.luminance = luminance;+ if (luminanceSpread != null) result.luminanceSpread = luminanceSpread;+ if (colors != null) result.colors.addAll(colors);+ if (minScrimDark != null) result.minScrimDark = minScrimDark;+ if (minScrimLight != null) result.minScrimLight = minScrimLight;+ return result;+ }++ BackgroundInfo._();++ factory BackgroundInfo.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ BackgroundInfo()..mergeFromBuffer(data, registry);+ factory BackgroundInfo.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ BackgroundInfo()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'BackgroundInfo',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: BackgroundInfo.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'sha256')+ ..aI(2, _omitFieldNames ? '' : 'width')+ ..aI(3, _omitFieldNames ? '' : 'height')+ ..aOS(4, _omitFieldNames ? '' : 'format')+ ..aD(5, _omitFieldNames ? '' : 'luminance')+ ..aD(6, _omitFieldNames ? '' : 'luminanceSpread')+ ..pPS(7, _omitFieldNames ? '' : 'colors')+ ..aD(8, _omitFieldNames ? '' : 'minScrimDark')+ ..aD(9, _omitFieldNames ? '' : 'minScrimLight')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ BackgroundInfo clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ BackgroundInfo copyWith(void Function(BackgroundInfo) updates) =>+ super.copyWith((message) => updates(message as BackgroundInfo))+ as BackgroundInfo;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use BackgroundInfo() / BackgroundInfo.new instead')+ static BackgroundInfo create() => BackgroundInfo._();+ static $pb.GeneratedMessage $_createMessage() => BackgroundInfo._();+ @$core.override+ BackgroundInfo createEmptyInstance() => BackgroundInfo._();+ @$core.pragma('dart2js:noInline')+ static BackgroundInfo getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<BackgroundInfo>(+ BackgroundInfo.$_createMessage);+ static BackgroundInfo? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get sha256 => $_getSZ(0);+ @$pb.TagNumber(1)+ set sha256($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasSha256() => $_has(0);+ @$pb.TagNumber(1)+ void clearSha256() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.int get width => $_getIZ(1);+ @$pb.TagNumber(2)+ set width($core.int value) => $_setSignedInt32(1, value);+ @$pb.TagNumber(2)+ $core.bool hasWidth() => $_has(1);+ @$pb.TagNumber(2)+ void clearWidth() => $_clearField(2);++ @$pb.TagNumber(3)+ $core.int get height => $_getIZ(2);+ @$pb.TagNumber(3)+ set height($core.int value) => $_setSignedInt32(2, value);+ @$pb.TagNumber(3)+ $core.bool hasHeight() => $_has(2);+ @$pb.TagNumber(3)+ void clearHeight() => $_clearField(3);++ @$pb.TagNumber(4)+ $core.String get format => $_getSZ(3);+ @$pb.TagNumber(4)+ set format($core.String value) => $_setString(3, value);+ @$pb.TagNumber(4)+ $core.bool hasFormat() => $_has(3);+ @$pb.TagNumber(4)+ void clearFormat() => $_clearField(4);++ @$pb.TagNumber(5)+ $core.double get luminance => $_getN(4);+ @$pb.TagNumber(5)+ set luminance($core.double value) => $_setDouble(4, value);+ @$pb.TagNumber(5)+ $core.bool hasLuminance() => $_has(4);+ @$pb.TagNumber(5)+ void clearLuminance() => $_clearField(5);++ @$pb.TagNumber(6)+ $core.double get luminanceSpread => $_getN(5);+ @$pb.TagNumber(6)+ set luminanceSpread($core.double value) => $_setDouble(5, value);+ @$pb.TagNumber(6)+ $core.bool hasLuminanceSpread() => $_has(5);+ @$pb.TagNumber(6)+ void clearLuminanceSpread() => $_clearField(6);++ @$pb.TagNumber(7)+ $pb.PbList<$core.String> get colors => $_getList(6);++ /// 让白字在最亮的区域也达到 4.5:1,黑色遮罩至少要多浓(0 到 1)+ @$pb.TagNumber(8)+ $core.double get minScrimDark => $_getN(7);+ @$pb.TagNumber(8)+ set minScrimDark($core.double value) => $_setDouble(7, value);+ @$pb.TagNumber(8)+ $core.bool hasMinScrimDark() => $_has(7);+ @$pb.TagNumber(8)+ void clearMinScrimDark() => $_clearField(8);++ /// 让黑字在最暗的区域也达到 4.5:1,白色遮罩至少要多浓(0 到 1)+ @$pb.TagNumber(9)+ $core.double get minScrimLight => $_getN(8);+ @$pb.TagNumber(9)+ set minScrimLight($core.double value) => $_setDouble(8, value);+ @$pb.TagNumber(9)+ $core.bool hasMinScrimLight() => $_has(8);+ @$pb.TagNumber(9)+ void clearMinScrimLight() => $_clearField(9);+}++class GetBackgroundRequest extends $pb.GeneratedMessage {+ factory GetBackgroundRequest({+ $core.String? sha256,+ $core.bool? blurred,+ }) {+ final result = GetBackgroundRequest._();+ if (sha256 != null) result.sha256 = sha256;+ if (blurred != null) result.blurred = blurred;+ return result;+ }++ GetBackgroundRequest._();++ factory GetBackgroundRequest.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ GetBackgroundRequest()..mergeFromBuffer(data, registry);+ factory GetBackgroundRequest.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ GetBackgroundRequest()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'GetBackgroundRequest',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: GetBackgroundRequest.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'sha256')+ ..aOB(2, _omitFieldNames ? '' : 'blurred')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ GetBackgroundRequest clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ GetBackgroundRequest copyWith(void Function(GetBackgroundRequest) updates) =>+ super.copyWith((message) => updates(message as GetBackgroundRequest))+ as GetBackgroundRequest;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated(+ 'Use GetBackgroundRequest() / GetBackgroundRequest.new instead')+ static GetBackgroundRequest create() => GetBackgroundRequest._();+ static $pb.GeneratedMessage $_createMessage() => GetBackgroundRequest._();+ @$core.override+ GetBackgroundRequest createEmptyInstance() => GetBackgroundRequest._();+ @$core.pragma('dart2js:noInline')+ static GetBackgroundRequest getDefault() => _defaultInstance ??=+ $pb.GeneratedMessage.$_defaultFor<GetBackgroundRequest>(+ GetBackgroundRequest.$_createMessage);+ static GetBackgroundRequest? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get sha256 => $_getSZ(0);+ @$pb.TagNumber(1)+ set sha256($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasSha256() => $_has(0);+ @$pb.TagNumber(1)+ void clearSha256() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.bool get blurred => $_getBF(1);+ @$pb.TagNumber(2)+ set blurred($core.bool value) => $_setBool(1, value);+ @$pb.TagNumber(2)+ $core.bool hasBlurred() => $_has(1);+ @$pb.TagNumber(2)+ void clearBlurred() => $_clearField(2);+}++class BackgroundImage extends $pb.GeneratedMessage {+ factory BackgroundImage({+ $core.List<$core.int>? data,+ $core.String? format,+ }) {+ final result = BackgroundImage._();+ if (data != null) result.data = data;+ if (format != null) result.format = format;+ return result;+ }++ BackgroundImage._();++ factory BackgroundImage.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ BackgroundImage()..mergeFromBuffer(data, registry);+ factory BackgroundImage.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ BackgroundImage()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'BackgroundImage',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: BackgroundImage.$_createMessage)+ ..a<$core.List<$core.int>>(+ 1, _omitFieldNames ? '' : 'data', $pb.PbFieldType.OY)+ ..aOS(2, _omitFieldNames ? '' : 'format')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ BackgroundImage clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ BackgroundImage copyWith(void Function(BackgroundImage) updates) =>+ super.copyWith((message) => updates(message as BackgroundImage))+ as BackgroundImage;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use BackgroundImage() / BackgroundImage.new instead')+ static BackgroundImage create() => BackgroundImage._();+ static $pb.GeneratedMessage $_createMessage() => BackgroundImage._();+ @$core.override+ BackgroundImage createEmptyInstance() => BackgroundImage._();+ @$core.pragma('dart2js:noInline')+ static BackgroundImage getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<BackgroundImage>(+ BackgroundImage.$_createMessage);+ static BackgroundImage? _defaultInstance;++ @$pb.TagNumber(1)+ $core.List<$core.int> get data => $_getN(0);+ @$pb.TagNumber(1)+ set data($core.List<$core.int> value) => $_setBytes(0, value);+ @$pb.TagNumber(1)+ $core.bool hasData() => $_has(0);+ @$pb.TagNumber(1)+ void clearData() => $_clearField(1);++ @$pb.TagNumber(2)+ $core.String get format => $_getSZ(1);+ @$pb.TagNumber(2)+ set format($core.String value) => $_setString(1, value);+ @$pb.TagNumber(2)+ $core.bool hasFormat() => $_has(1);+ @$pb.TagNumber(2)+ void clearFormat() => $_clearField(2);+}++class BackgroundRef extends $pb.GeneratedMessage {+ factory BackgroundRef({+ $core.String? sha256,+ }) {+ final result = BackgroundRef._();+ if (sha256 != null) result.sha256 = sha256;+ return result;+ }++ BackgroundRef._();++ factory BackgroundRef.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ BackgroundRef()..mergeFromBuffer(data, registry);+ factory BackgroundRef.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ BackgroundRef()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'BackgroundRef',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: BackgroundRef.$_createMessage)+ ..aOS(1, _omitFieldNames ? '' : 'sha256')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ BackgroundRef clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ BackgroundRef copyWith(void Function(BackgroundRef) updates) =>+ super.copyWith((message) => updates(message as BackgroundRef))+ as BackgroundRef;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use BackgroundRef() / BackgroundRef.new instead')+ static BackgroundRef create() => BackgroundRef._();+ static $pb.GeneratedMessage $_createMessage() => BackgroundRef._();+ @$core.override+ BackgroundRef createEmptyInstance() => BackgroundRef._();+ @$core.pragma('dart2js:noInline')+ static BackgroundRef getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<BackgroundRef>(+ BackgroundRef.$_createMessage);+ static BackgroundRef? _defaultInstance;++ @$pb.TagNumber(1)+ $core.String get sha256 => $_getSZ(0);+ @$pb.TagNumber(1)+ set sha256($core.String value) => $_setString(0, value);+ @$pb.TagNumber(1)+ $core.bool hasSha256() => $_has(0);+ @$pb.TagNumber(1)+ void clearSha256() => $_clearField(1);+}++class ThemesChanged extends $pb.GeneratedMessage {+ factory ThemesChanged({+ $core.Iterable<$core.String>? ids,+ }) {+ final result = ThemesChanged._();+ if (ids != null) result.ids.addAll(ids);+ return result;+ }++ ThemesChanged._();++ factory ThemesChanged.fromBuffer($core.List<$core.int> data,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ThemesChanged()..mergeFromBuffer(data, registry);+ factory ThemesChanged.fromJson($core.String json,+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>+ ThemesChanged()..mergeFromJson(json, registry);++ static final $pb.BuilderInfo _i = $pb.BuilderInfo(+ _omitMessageNames ? '' : 'ThemesChanged',+ package: const $pb.PackageName(_omitMessageNames ? '' : 'pasteferry.v1'),+ createEmptyInstance: ThemesChanged.$_createMessage)+ ..pPS(1, _omitFieldNames ? '' : 'ids')+ ..hasRequiredFields = false;++ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ThemesChanged clone() => deepCopy();+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')+ ThemesChanged copyWith(void Function(ThemesChanged) updates) =>+ super.copyWith((message) => updates(message as ThemesChanged))+ as ThemesChanged;++ @$core.override+ $pb.BuilderInfo get info_ => _i;++ @$core.pragma('dart2js:noInline')+ @$core.Deprecated('Use ThemesChanged() / ThemesChanged.new instead')+ static ThemesChanged create() => ThemesChanged._();+ static $pb.GeneratedMessage $_createMessage() => ThemesChanged._();+ @$core.override+ ThemesChanged createEmptyInstance() => ThemesChanged._();+ @$core.pragma('dart2js:noInline')+ static ThemesChanged getDefault() =>+ _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ThemesChanged>(+ ThemesChanged.$_createMessage);+ static ThemesChanged? _defaultInstance;++ @$pb.TagNumber(1)+ $pb.PbList<$core.String> get ids => $_getList(0);+}+const $core.bool _omitFieldNames =$core.bool.fromEnvironment('protobuf.omit_field_names');const $core.bool _omitMessageNames =diff --git a/ui/lib/gen/pasteferry/v1/daemon.pbenum.dart b/ui/lib/gen/pasteferry/v1/daemon.pbenum.dartindex 1d0b4bc..6d99a61 100644--- a/ui/lib/gen/pasteferry/v1/daemon.pbenum.dart+++ b/ui/lib/gen/pasteferry/v1/daemon.pbenum.dart@@ -167,6 +167,29 @@ class ClipboardWriteOutcome extends $pb.ProtobufEnum {const ClipboardWriteOutcome._(super.value, super.name);}+/// 浅色还是深色+class ThemeMode extends $pb.ProtobufEnum {+ static const ThemeMode THEME_MODE_UNSPECIFIED =+ ThemeMode._(0, _omitEnumNames ? '' : 'THEME_MODE_UNSPECIFIED');+ static const ThemeMode THEME_MODE_LIGHT =+ ThemeMode._(1, _omitEnumNames ? '' : 'THEME_MODE_LIGHT');+ static const ThemeMode THEME_MODE_DARK =+ ThemeMode._(2, _omitEnumNames ? '' : 'THEME_MODE_DARK');++ static const $core.List<ThemeMode> values = <ThemeMode>[+ THEME_MODE_UNSPECIFIED,+ THEME_MODE_LIGHT,+ THEME_MODE_DARK,+ ];++ static final $core.List<ThemeMode?> _byValue =+ $pb.ProtobufEnum.$_initByValueList(values, 2);+ static ThemeMode? valueOf($core.int value) =>+ value < 0 || value >= _byValue.length ? null : _byValue[value];++ const ThemeMode._(super.value, super.name);+}+class ServiceMode extends $pb.ProtobufEnum {static const ServiceMode SERVICE_MODE_UNSPECIFIED =ServiceMode._(0, _omitEnumNames ? '' : 'SERVICE_MODE_UNSPECIFIED');diff --git a/ui/lib/gen/pasteferry/v1/daemon.pbgrpc.dart b/ui/lib/gen/pasteferry/v1/daemon.pbgrpc.dartindex 06d013a..c3909be 100644--- a/ui/lib/gen/pasteferry/v1/daemon.pbgrpc.dart+++ b/ui/lib/gen/pasteferry/v1/daemon.pbgrpc.dart@@ -548,6 +548,72 @@ class DaemonServiceClient extends $grpc.Client {options: options);}+ /// 主题与背景图(design/themes.md)。现在用哪一套在 Config.theme_id、theme_mode 里+ /// 内置主题与本机的自定义主题+ $grpc.ResponseFuture<$0.ListThemesResponse> listThemes(+ $0.Empty request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$listThemes, request, options: options);+ }++ /// 一套主题的 JSON(格式见 design/themes.md 第 3 节);resolved 时已合并 base,各项齐全+ $grpc.ResponseFuture<$0.ThemeJson> getTheme(+ $0.GetThemeRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$getTheme, request, options: options);+ }++ /// 校验并保存一套自定义主题。格式不对报 InvalidArgument;对比度不够照样保存,返回警告。+ /// dry_run 时只校验、不保存(AI 经 MCP 改主题前先试一遍,见 design/mcp.md)+ $grpc.ResponseFuture<$0.PutThemeResponse> putTheme(+ $0.PutThemeRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$putTheme, request, options: options);+ }++ /// 删掉一套自定义主题。正在用它时换回默认主题;被别的主题当作 base 时报 FailedPrecondition+ $grpc.ResponseFuture<$0.Empty> deleteTheme(+ $0.ThemeRef request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$deleteTheme, request, options: options);+ }++ /// 导入一张背景图:重新编码(去掉 EXIF)、缩到长边 3840 以内、另存一份模糊版,并分析亮度与主色+ $grpc.ResponseFuture<$0.BackgroundInfo> importBackground(+ $0.ImportBackgroundRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$importBackground, request, options: options);+ }++ /// 背景图的字节,界面显示用+ $grpc.ResponseFuture<$0.BackgroundImage> getBackground(+ $0.GetBackgroundRequest request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$getBackground, request, options: options);+ }++ /// 删掉一张背景图;还有主题在用时报 FailedPrecondition+ $grpc.ResponseFuture<$0.Empty> deleteBackground(+ $0.BackgroundRef request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$deleteBackground, request, options: options);+ }++ /// 已导入的背景图的分析结果(亮度、主色、建议的遮罩浓度),与 ImportBackground 返回的相同+ $grpc.ResponseFuture<$0.BackgroundInfo> analyzeBackground(+ $0.BackgroundRef request, {+ $grpc.CallOptions? options,+ }) {+ return $createUnaryCall(_$analyzeBackground, request, options: options);+ }+// method descriptorsstatic final _$subscribe = $grpc.ClientMethod<$0.SubscribeRequest, $0.Event>(@@ -852,6 +918,45 @@ class DaemonServiceClient extends $grpc.Client {'/pasteferry.v1.DaemonService/WatchStrangers',($0.Empty value) => value.writeToBuffer(),$0.Strangers.fromBuffer);+ static final _$listThemes =+ $grpc.ClientMethod<$0.Empty, $0.ListThemesResponse>(+ '/pasteferry.v1.DaemonService/ListThemes',+ ($0.Empty value) => value.writeToBuffer(),+ $0.ListThemesResponse.fromBuffer);+ static final _$getTheme =+ $grpc.ClientMethod<$0.GetThemeRequest, $0.ThemeJson>(+ '/pasteferry.v1.DaemonService/GetTheme',+ ($0.GetThemeRequest value) => value.writeToBuffer(),+ $0.ThemeJson.fromBuffer);+ static final _$putTheme =+ $grpc.ClientMethod<$0.PutThemeRequest, $0.PutThemeResponse>(+ '/pasteferry.v1.DaemonService/PutTheme',+ ($0.PutThemeRequest value) => value.writeToBuffer(),+ $0.PutThemeResponse.fromBuffer);+ static final _$deleteTheme = $grpc.ClientMethod<$0.ThemeRef, $0.Empty>(+ '/pasteferry.v1.DaemonService/DeleteTheme',+ ($0.ThemeRef value) => value.writeToBuffer(),+ $0.Empty.fromBuffer);+ static final _$importBackground =+ $grpc.ClientMethod<$0.ImportBackgroundRequest, $0.BackgroundInfo>(+ '/pasteferry.v1.DaemonService/ImportBackground',+ ($0.ImportBackgroundRequest value) => value.writeToBuffer(),+ $0.BackgroundInfo.fromBuffer);+ static final _$getBackground =+ $grpc.ClientMethod<$0.GetBackgroundRequest, $0.BackgroundImage>(+ '/pasteferry.v1.DaemonService/GetBackground',+ ($0.GetBackgroundRequest value) => value.writeToBuffer(),+ $0.BackgroundImage.fromBuffer);+ static final _$deleteBackground =+ $grpc.ClientMethod<$0.BackgroundRef, $0.Empty>(+ '/pasteferry.v1.DaemonService/DeleteBackground',+ ($0.BackgroundRef value) => value.writeToBuffer(),+ $0.Empty.fromBuffer);+ static final _$analyzeBackground =+ $grpc.ClientMethod<$0.BackgroundRef, $0.BackgroundInfo>(+ '/pasteferry.v1.DaemonService/AnalyzeBackground',+ ($0.BackgroundRef value) => value.writeToBuffer(),+ $0.BackgroundInfo.fromBuffer);}@$pb.GrpcServiceName('pasteferry.v1.DaemonService')@@ -1342,6 +1447,65 @@ abstract class DaemonServiceBase extends $grpc.Service {true,($core.List<$core.int> value) => $0.Empty.fromBuffer(value),($0.Strangers value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.Empty, $0.ListThemesResponse>(+ 'ListThemes',+ listThemes_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.Empty.fromBuffer(value),+ ($0.ListThemesResponse value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.GetThemeRequest, $0.ThemeJson>(+ 'GetTheme',+ getTheme_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.GetThemeRequest.fromBuffer(value),+ ($0.ThemeJson value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.PutThemeRequest, $0.PutThemeResponse>(+ 'PutTheme',+ putTheme_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.PutThemeRequest.fromBuffer(value),+ ($0.PutThemeResponse value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.ThemeRef, $0.Empty>(+ 'DeleteTheme',+ deleteTheme_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.ThemeRef.fromBuffer(value),+ ($0.Empty value) => value.writeToBuffer()));+ $addMethod(+ $grpc.ServiceMethod<$0.ImportBackgroundRequest, $0.BackgroundInfo>(+ 'ImportBackground',+ importBackground_Pre,+ false,+ false,+ ($core.List<$core.int> value) =>+ $0.ImportBackgroundRequest.fromBuffer(value),+ ($0.BackgroundInfo value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.GetBackgroundRequest, $0.BackgroundImage>(+ 'GetBackground',+ getBackground_Pre,+ false,+ false,+ ($core.List<$core.int> value) =>+ $0.GetBackgroundRequest.fromBuffer(value),+ ($0.BackgroundImage value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.BackgroundRef, $0.Empty>(+ 'DeleteBackground',+ deleteBackground_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.BackgroundRef.fromBuffer(value),+ ($0.Empty value) => value.writeToBuffer()));+ $addMethod($grpc.ServiceMethod<$0.BackgroundRef, $0.BackgroundInfo>(+ 'AnalyzeBackground',+ analyzeBackground_Pre,+ false,+ false,+ ($core.List<$core.int> value) => $0.BackgroundRef.fromBuffer(value),+ ($0.BackgroundInfo value) => value.writeToBuffer()));}$async.Stream<$0.Event> subscribe_Pre($grpc.ServiceCall $call,@@ -1854,4 +2018,68 @@ abstract class DaemonServiceBase extends $grpc.Service {$async.Stream<$0.Strangers> watchStrangers($grpc.ServiceCall call, $0.Empty request);++ $async.Future<$0.ListThemesResponse> listThemes_Pre(+ $grpc.ServiceCall $call, $async.Future<$0.Empty> $request) async {+ return listThemes($call, await $request);+ }++ $async.Future<$0.ListThemesResponse> listThemes(+ $grpc.ServiceCall call, $0.Empty request);++ $async.Future<$0.ThemeJson> getTheme_Pre($grpc.ServiceCall $call,+ $async.Future<$0.GetThemeRequest> $request) async {+ return getTheme($call, await $request);+ }++ $async.Future<$0.ThemeJson> getTheme(+ $grpc.ServiceCall call, $0.GetThemeRequest request);++ $async.Future<$0.PutThemeResponse> putTheme_Pre($grpc.ServiceCall $call,+ $async.Future<$0.PutThemeRequest> $request) async {+ return putTheme($call, await $request);+ }++ $async.Future<$0.PutThemeResponse> putTheme(+ $grpc.ServiceCall call, $0.PutThemeRequest request);++ $async.Future<$0.Empty> deleteTheme_Pre(+ $grpc.ServiceCall $call, $async.Future<$0.ThemeRef> $request) async {+ return deleteTheme($call, await $request);+ }++ $async.Future<$0.Empty> deleteTheme(+ $grpc.ServiceCall call, $0.ThemeRef request);++ $async.Future<$0.BackgroundInfo> importBackground_Pre($grpc.ServiceCall $call,+ $async.Future<$0.ImportBackgroundRequest> $request) async {+ return importBackground($call, await $request);+ }++ $async.Future<$0.BackgroundInfo> importBackground(+ $grpc.ServiceCall call, $0.ImportBackgroundRequest request);++ $async.Future<$0.BackgroundImage> getBackground_Pre($grpc.ServiceCall $call,+ $async.Future<$0.GetBackgroundRequest> $request) async {+ return getBackground($call, await $request);+ }++ $async.Future<$0.BackgroundImage> getBackground(+ $grpc.ServiceCall call, $0.GetBackgroundRequest request);++ $async.Future<$0.Empty> deleteBackground_Pre(+ $grpc.ServiceCall $call, $async.Future<$0.BackgroundRef> $request) async {+ return deleteBackground($call, await $request);+ }++ $async.Future<$0.Empty> deleteBackground(+ $grpc.ServiceCall call, $0.BackgroundRef request);++ $async.Future<$0.BackgroundInfo> analyzeBackground_Pre(+ $grpc.ServiceCall $call, $async.Future<$0.BackgroundRef> $request) async {+ return analyzeBackground($call, await $request);+ }++ $async.Future<$0.BackgroundInfo> analyzeBackground(+ $grpc.ServiceCall call, $0.BackgroundRef request);}diff --git a/ui/lib/gen/pasteferry/v1/daemon.pbjson.dart b/ui/lib/gen/pasteferry/v1/daemon.pbjson.dartindex 6171640..2aaf5ee 100644--- a/ui/lib/gen/pasteferry/v1/daemon.pbjson.dart+++ b/ui/lib/gen/pasteferry/v1/daemon.pbjson.dart@@ -109,6 +109,21 @@ final $typed_data.Uint8List clipboardWriteOutcomeDescriptor = $convert.base64Dec'QVJEX1dSSVRFX09VVENPTUVfUFJFU0VSVkVEEAISIgoeQ0xJUEJPQVJEX1dSSVRFX09VVENPTU''VfRkFJTEVEEAM=');+@$core.Deprecated('Use themeModeDescriptor instead')+const ThemeMode$json = {+ '1': 'ThemeMode',+ '2': [+ {'1': 'THEME_MODE_UNSPECIFIED', '2': 0},+ {'1': 'THEME_MODE_LIGHT', '2': 1},+ {'1': 'THEME_MODE_DARK', '2': 2},+ ],+};++/// Descriptor for `ThemeMode`. Decode as a `google.protobuf.EnumDescriptorProto`.+final $typed_data.Uint8List themeModeDescriptor = $convert.base64Decode(+ 'CglUaGVtZU1vZGUSGgoWVEhFTUVfTU9ERV9VTlNQRUNJRklFRBAAEhQKEFRIRU1FX01PREVfTE'+ 'lHSFQQARITCg9USEVNRV9NT0RFX0RBUksQAg==');+@$core.Deprecated('Use serviceModeDescriptor instead')const ServiceMode$json = {'1': 'ServiceMode',@@ -472,6 +487,15 @@ const Event$json = {'9': 0,'10': 'notice'},+ {+ '1': 'themes_changed',+ '3': 20,+ '4': 1,+ '5': 11,+ '6': '.pasteferry.v1.ThemesChanged',+ '9': 0,+ '10': 'themesChanged'+ },],'8': [{'1': 'payload'},@@ -501,7 +525,8 @@ final $typed_data.Uint8List eventDescriptor = $convert.base64Decode('D3Byb2ZpbGVfY2hhbmdlZBgRIAEoCzIWLnBhc3RlZmVycnkudjEuUHJvZmlsZUgAUg5wcm9maW''xlQ2hhbmdlZBJLChF3ZWJfc2hhcmVfY2hhbmdlZBgSIAEoCzIdLnBhc3RlZmVycnkudjEuV2Vi''U2hhcmVTdGF0dXNIAFIPd2ViU2hhcmVDaGFuZ2VkEjIKBm5vdGljZRgTIAEoCzIYLnBhc3RlZm'- 'VycnkudjEuQXBwTm90aWNlSABSBm5vdGljZUIJCgdwYXlsb2Fk');+ 'VycnkudjEuQXBwTm90aWNlSABSBm5vdGljZRJFCg50aGVtZXNfY2hhbmdlZBgUIAEoCzIcLnBh'+ 'c3RlZmVycnkudjEuVGhlbWVzQ2hhbmdlZEgAUg10aGVtZXNDaGFuZ2VkQgkKB3BheWxvYWQ=');@$core.Deprecated('Use appNoticeDescriptor instead')const AppNotice$json = {@@ -1365,6 +1390,16 @@ const Config$json = {'5': 5,'10': 'sentRetentionDays'},+ {'1': 'theme_id', '3': 35, '4': 1, '5': 9, '10': 'themeId'},+ {+ '1': 'theme_mode',+ '3': 36,+ '4': 1,+ '5': 14,+ '6': '.pasteferry.v1.ThemeMode',+ '10': 'themeMode'+ },+ {'1': 'theme_scanlines', '3': 37, '4': 1, '5': 8, '10': 'themeScanlines'},],};@@ -1396,7 +1431,10 @@ final $typed_data.Uint8List configDescriptor = $convert.base64Decode('VfZnJvbRgeIAEoCVILcmVjZWl2ZUZyb20SLgoTZXZlcnlvbmVfdW50aWxfdW5peBgfIAEoA1IR''ZXZlcnlvbmVVbnRpbFVuaXgSIQoMZGlzcGxheV9uYW1lGCAgASgJUgtkaXNwbGF5TmFtZRI7Ch''pxdWlja19wYXN0ZV9pbmRleF9tb2RpZmllchghIAEoCVIXcXVpY2tQYXN0ZUluZGV4TW9kaWZp'- 'ZXISLgoTc2VudF9yZXRlbnRpb25fZGF5cxgiIAEoBVIRc2VudFJldGVudGlvbkRheXM=');+ 'ZXISLgoTc2VudF9yZXRlbnRpb25fZGF5cxgiIAEoBVIRc2VudFJldGVudGlvbkRheXMSGQoIdG'+ 'hlbWVfaWQYIyABKAlSB3RoZW1lSWQSNwoKdGhlbWVfbW9kZRgkIAEoDjIYLnBhc3RlZmVycnku'+ 'djEuVGhlbWVNb2RlUgl0aGVtZU1vZGUSJwoPdGhlbWVfc2NhbmxpbmVzGCUgASgIUg50aGVtZV'+ 'NjYW5saW5lcw==');@$core.Deprecated('Use officialUsageDescriptor instead')const OfficialUsage$json = {@@ -2134,3 +2172,242 @@ const WebSessionRef$json = {/// Descriptor for `WebSessionRef`. Decode as a `google.protobuf.DescriptorProto`.final $typed_data.Uint8List webSessionRefDescriptor =$convert.base64Decode('Cg1XZWJTZXNzaW9uUmVmEg4KAmlkGAEgASgJUgJpZA==');++@$core.Deprecated('Use themeInfoDescriptor instead')+const ThemeInfo$json = {+ '1': 'ThemeInfo',+ '2': [+ {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},+ {+ '1': 'name',+ '3': 2,+ '4': 3,+ '5': 11,+ '6': '.pasteferry.v1.ThemeInfo.NameEntry',+ '10': 'name'+ },+ {'1': 'builtin', '3': 3, '4': 1, '5': 8, '10': 'builtin'},+ {'1': 'base', '3': 4, '4': 1, '5': 9, '10': 'base'},+ ],+ '3': [ThemeInfo_NameEntry$json],+};++@$core.Deprecated('Use themeInfoDescriptor instead')+const ThemeInfo_NameEntry$json = {+ '1': 'NameEntry',+ '2': [+ {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},+ {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'},+ ],+ '7': {'7': true},+};++/// Descriptor for `ThemeInfo`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List themeInfoDescriptor = $convert.base64Decode(+ 'CglUaGVtZUluZm8SDgoCaWQYASABKAlSAmlkEjYKBG5hbWUYAiADKAsyIi5wYXN0ZWZlcnJ5Ln'+ 'YxLlRoZW1lSW5mby5OYW1lRW50cnlSBG5hbWUSGAoHYnVpbHRpbhgDIAEoCFIHYnVpbHRpbhIS'+ 'CgRiYXNlGAQgASgJUgRiYXNlGjcKCU5hbWVFbnRyeRIQCgNrZXkYASABKAlSA2tleRIUCgV2YW'+ 'x1ZRgCIAEoCVIFdmFsdWU6AjgB');++@$core.Deprecated('Use listThemesResponseDescriptor instead')+const ListThemesResponse$json = {+ '1': 'ListThemesResponse',+ '2': [+ {+ '1': 'themes',+ '3': 1,+ '4': 3,+ '5': 11,+ '6': '.pasteferry.v1.ThemeInfo',+ '10': 'themes'+ },+ ],+};++/// Descriptor for `ListThemesResponse`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List listThemesResponseDescriptor = $convert.base64Decode(+ 'ChJMaXN0VGhlbWVzUmVzcG9uc2USMAoGdGhlbWVzGAEgAygLMhgucGFzdGVmZXJyeS52MS5UaG'+ 'VtZUluZm9SBnRoZW1lcw==');++@$core.Deprecated('Use getThemeRequestDescriptor instead')+const GetThemeRequest$json = {+ '1': 'GetThemeRequest',+ '2': [+ {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},+ {'1': 'resolved', '3': 2, '4': 1, '5': 8, '10': 'resolved'},+ ],+};++/// Descriptor for `GetThemeRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List getThemeRequestDescriptor = $convert.base64Decode(+ 'Cg9HZXRUaGVtZVJlcXVlc3QSDgoCaWQYASABKAlSAmlkEhoKCHJlc29sdmVkGAIgASgIUghyZX'+ 'NvbHZlZA==');++@$core.Deprecated('Use themeJsonDescriptor instead')+const ThemeJson$json = {+ '1': 'ThemeJson',+ '2': [+ {'1': 'json', '3': 1, '4': 1, '5': 9, '10': 'json'},+ ],+};++/// Descriptor for `ThemeJson`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List themeJsonDescriptor =+ $convert.base64Decode('CglUaGVtZUpzb24SEgoEanNvbhgBIAEoCVIEanNvbg==');++@$core.Deprecated('Use putThemeRequestDescriptor instead')+const PutThemeRequest$json = {+ '1': 'PutThemeRequest',+ '2': [+ {'1': 'json', '3': 1, '4': 1, '5': 9, '10': 'json'},+ {'1': 'dry_run', '3': 2, '4': 1, '5': 8, '10': 'dryRun'},+ ],+};++/// Descriptor for `PutThemeRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List putThemeRequestDescriptor = $convert.base64Decode(+ 'Cg9QdXRUaGVtZVJlcXVlc3QSEgoEanNvbhgBIAEoCVIEanNvbhIXCgdkcnlfcnVuGAIgASgIUg'+ 'ZkcnlSdW4=');++@$core.Deprecated('Use themeWarningDescriptor instead')+const ThemeWarning$json = {+ '1': 'ThemeWarning',+ '2': [+ {'1': 'mode', '3': 1, '4': 1, '5': 9, '10': 'mode'},+ {'1': 'foreground', '3': 2, '4': 1, '5': 9, '10': 'foreground'},+ {'1': 'background', '3': 3, '4': 1, '5': 9, '10': 'background'},+ {'1': 'ratio', '3': 4, '4': 1, '5': 1, '10': 'ratio'},+ {'1': 'minimum', '3': 5, '4': 1, '5': 1, '10': 'minimum'},+ ],+};++/// Descriptor for `ThemeWarning`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List themeWarningDescriptor = $convert.base64Decode(+ 'CgxUaGVtZVdhcm5pbmcSEgoEbW9kZRgBIAEoCVIEbW9kZRIeCgpmb3JlZ3JvdW5kGAIgASgJUg'+ 'pmb3JlZ3JvdW5kEh4KCmJhY2tncm91bmQYAyABKAlSCmJhY2tncm91bmQSFAoFcmF0aW8YBCAB'+ 'KAFSBXJhdGlvEhgKB21pbmltdW0YBSABKAFSB21pbmltdW0=');++@$core.Deprecated('Use putThemeResponseDescriptor instead')+const PutThemeResponse$json = {+ '1': 'PutThemeResponse',+ '2': [+ {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},+ {+ '1': 'warnings',+ '3': 2,+ '4': 3,+ '5': 11,+ '6': '.pasteferry.v1.ThemeWarning',+ '10': 'warnings'+ },+ ],+};++/// Descriptor for `PutThemeResponse`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List putThemeResponseDescriptor = $convert.base64Decode(+ 'ChBQdXRUaGVtZVJlc3BvbnNlEg4KAmlkGAEgASgJUgJpZBI3Cgh3YXJuaW5ncxgCIAMoCzIbLn'+ 'Bhc3RlZmVycnkudjEuVGhlbWVXYXJuaW5nUgh3YXJuaW5ncw==');++@$core.Deprecated('Use themeRefDescriptor instead')+const ThemeRef$json = {+ '1': 'ThemeRef',+ '2': [+ {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},+ ],+};++/// Descriptor for `ThemeRef`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List themeRefDescriptor =+ $convert.base64Decode('CghUaGVtZVJlZhIOCgJpZBgBIAEoCVICaWQ=');++@$core.Deprecated('Use importBackgroundRequestDescriptor instead')+const ImportBackgroundRequest$json = {+ '1': 'ImportBackgroundRequest',+ '2': [+ {'1': 'path', '3': 1, '4': 1, '5': 9, '10': 'path'},+ {'1': 'image', '3': 2, '4': 1, '5': 12, '10': 'image'},+ ],+};++/// Descriptor for `ImportBackgroundRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List importBackgroundRequestDescriptor =+ $convert.base64Decode(+ 'ChdJbXBvcnRCYWNrZ3JvdW5kUmVxdWVzdBISCgRwYXRoGAEgASgJUgRwYXRoEhQKBWltYWdlGA'+ 'IgASgMUgVpbWFnZQ==');++@$core.Deprecated('Use backgroundInfoDescriptor instead')+const BackgroundInfo$json = {+ '1': 'BackgroundInfo',+ '2': [+ {'1': 'sha256', '3': 1, '4': 1, '5': 9, '10': 'sha256'},+ {'1': 'width', '3': 2, '4': 1, '5': 5, '10': 'width'},+ {'1': 'height', '3': 3, '4': 1, '5': 5, '10': 'height'},+ {'1': 'format', '3': 4, '4': 1, '5': 9, '10': 'format'},+ {'1': 'luminance', '3': 5, '4': 1, '5': 1, '10': 'luminance'},+ {'1': 'luminance_spread', '3': 6, '4': 1, '5': 1, '10': 'luminanceSpread'},+ {'1': 'colors', '3': 7, '4': 3, '5': 9, '10': 'colors'},+ {'1': 'min_scrim_dark', '3': 8, '4': 1, '5': 1, '10': 'minScrimDark'},+ {'1': 'min_scrim_light', '3': 9, '4': 1, '5': 1, '10': 'minScrimLight'},+ ],+};++/// Descriptor for `BackgroundInfo`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List backgroundInfoDescriptor = $convert.base64Decode(+ 'Cg5CYWNrZ3JvdW5kSW5mbxIWCgZzaGEyNTYYASABKAlSBnNoYTI1NhIUCgV3aWR0aBgCIAEoBV'+ 'IFd2lkdGgSFgoGaGVpZ2h0GAMgASgFUgZoZWlnaHQSFgoGZm9ybWF0GAQgASgJUgZmb3JtYXQS'+ 'HAoJbHVtaW5hbmNlGAUgASgBUglsdW1pbmFuY2USKQoQbHVtaW5hbmNlX3NwcmVhZBgGIAEoAV'+ 'IPbHVtaW5hbmNlU3ByZWFkEhYKBmNvbG9ycxgHIAMoCVIGY29sb3JzEiQKDm1pbl9zY3JpbV9k'+ 'YXJrGAggASgBUgxtaW5TY3JpbURhcmsSJgoPbWluX3NjcmltX2xpZ2h0GAkgASgBUg1taW5TY3'+ 'JpbUxpZ2h0');++@$core.Deprecated('Use getBackgroundRequestDescriptor instead')+const GetBackgroundRequest$json = {+ '1': 'GetBackgroundRequest',+ '2': [+ {'1': 'sha256', '3': 1, '4': 1, '5': 9, '10': 'sha256'},+ {'1': 'blurred', '3': 2, '4': 1, '5': 8, '10': 'blurred'},+ ],+};++/// Descriptor for `GetBackgroundRequest`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List getBackgroundRequestDescriptor = $convert.base64Decode(+ 'ChRHZXRCYWNrZ3JvdW5kUmVxdWVzdBIWCgZzaGEyNTYYASABKAlSBnNoYTI1NhIYCgdibHVycm'+ 'VkGAIgASgIUgdibHVycmVk');++@$core.Deprecated('Use backgroundImageDescriptor instead')+const BackgroundImage$json = {+ '1': 'BackgroundImage',+ '2': [+ {'1': 'data', '3': 1, '4': 1, '5': 12, '10': 'data'},+ {'1': 'format', '3': 2, '4': 1, '5': 9, '10': 'format'},+ ],+};++/// Descriptor for `BackgroundImage`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List backgroundImageDescriptor = $convert.base64Decode(+ 'Cg9CYWNrZ3JvdW5kSW1hZ2USEgoEZGF0YRgBIAEoDFIEZGF0YRIWCgZmb3JtYXQYAiABKAlSBm'+ 'Zvcm1hdA==');++@$core.Deprecated('Use backgroundRefDescriptor instead')+const BackgroundRef$json = {+ '1': 'BackgroundRef',+ '2': [+ {'1': 'sha256', '3': 1, '4': 1, '5': 9, '10': 'sha256'},+ ],+};++/// Descriptor for `BackgroundRef`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List backgroundRefDescriptor = $convert+ .base64Decode('Cg1CYWNrZ3JvdW5kUmVmEhYKBnNoYTI1NhgBIAEoCVIGc2hhMjU2');++@$core.Deprecated('Use themesChangedDescriptor instead')+const ThemesChanged$json = {+ '1': 'ThemesChanged',+ '2': [+ {'1': 'ids', '3': 1, '4': 3, '5': 9, '10': 'ids'},+ ],+};++/// Descriptor for `ThemesChanged`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List themesChangedDescriptor =+ $convert.base64Decode('Cg1UaGVtZXNDaGFuZ2VkEhAKA2lkcxgBIAMoCVIDaWRz');