mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 12:01:13 +00:00
* fix(#3488): automated AI fix * fix: address Codex review on PR #3491 * fix: address Codex review on PR #3491 * fix: address Codex review on PR #3491 * fix: address Codex review on PR #3491 * fix: address Codex review on PR #3491 * fix: address Codex review on PR #3491 * fix: address Codex review on PR #3491 * fix: address Codex review on PR #3491 * fix: address Codex review on PR #3491 * fix: address Codex review on PR #3491 * fix: address Codex review on PR #3491 * fix: address Codex review on PR #3491 * test: verify broadcast password prompts on Windows desktop * test: run desktop SSH check only in Windows job * fix: preserve sensitive peer input across compose wake * fix: retain compose history when sensitive peer receives nothing * fix: protect compose history during sensitive fallback writes --------- Co-authored-by: netcatty-bot <308658023+netcatty-bot@users.noreply.github.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
21 lines
771 B
TypeScript
21 lines
771 B
TypeScript
import { useCallback } from "react";
|
|
import { netcattyBridge } from "../../infrastructure/services/netcattyBridge";
|
|
|
|
export const useClipboardBackend = () => {
|
|
const readClipboardText = useCallback(async (): Promise<string> => {
|
|
const bridge = netcattyBridge.get();
|
|
if (!bridge?.readClipboardText) throw new Error("clipboard bridge unavailable");
|
|
|
|
const text = await bridge.readClipboardText();
|
|
return typeof text === "string" ? text : "";
|
|
}, []);
|
|
|
|
const writeClipboardText = useCallback(async (text: string): Promise<boolean> => {
|
|
const bridge = netcattyBridge.get();
|
|
if (!bridge?.writeClipboardText) return false;
|
|
return await bridge.writeClipboardText(text) === true;
|
|
}, []);
|
|
|
|
return { readClipboardText, writeClipboardText };
|
|
};
|