-
Notifications
You must be signed in to change notification settings - Fork 33
[Extending API] /clipboard #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[Extending API] /clipboard #55
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Performed full review of fe02e69...a6f392e
11 files reviewed | 0 comments | Review on Mesa | Edit Reviewer Settings
| // Initialize clipboard manager if not already done | ||
| if s.clipboardManager == nil { | ||
| s.clipboardManager = newClipboardManager() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Clipboard Manager Initialization Race Condition
A race condition exists in the lazy initialization of clipboardManager. Multiple concurrent requests to GetClipboard, SetClipboard, or StreamClipboard can cause several clipboardManager instances to be created. This leads to lost state and inconsistent behavior, potentially dropping clipboard events for watchers.
|
Neat idea! Any thoughts about supporting clearing the clipboard? |
| log := logger.FromContext(ctx) | ||
| display := getDisplay() | ||
|
|
||
| // Create a temporary file to store the content (more reliable than piping for large content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly this is an outdated comment?
/clipboardroutesTL;DR
Introduced new
/clipboardAPI endpoints to get, set, and stream system clipboard content, extending server capabilities for external application interaction.Why we made these changes
To enhance server functionality by providing programmatic access to the system clipboard, enabling external applications to interact with clipboard data.
What changed?
clipboard.go, leveragingxclip.openapi.yamland regenerated OpenAPI files (oapi.go,clipboard_types.go,server_handlers.go).ApiServicewas enhanced with aclipboardManager, andmain.goexplicitly registers the new handlers.go.modandgo.sumwere updated to reflect new direct and indirect Go dependencies, includingoapi-codegen.clipboard_test.gofor the clipboard API functionalities.README.mdwas updated withcurlexamples for the new routes.Description generated by Mesa. Update settings