fix alerts reconnect backoff and clipboard availability checks
release / build (push) Successful in 1m12s
release / build (push) Successful in 1m12s
This commit is contained in:
4 files changed
+11
No files matched your search
@@ -207,6 +207,7 @@ export function App() {
|
||||
// Only a connection that stayed up proves the stream is healthy; an
|
||||
// accept-then-close server must not pin us to the first backoff step.
|
||||
if (openedAt && Date.now() - openedAt > 10_000) attempt = 0;
|
||||
openedAt = 0;
|
||||
// Browsers never reconnect a WebSocket on their own.
|
||||
const delay =
|
||||
Math.min(30_000, 1000 * 2 ** attempt) + Math.random() * 1000;
|
||||
|
||||
@@ -172,6 +172,10 @@ export function useXterm({ pageRef, hostRef }: Options) {
|
||||
toast.info("Nothing to copy");
|
||||
return;
|
||||
}
|
||||
if (!navigator.clipboard) {
|
||||
toast.error("Clipboard access requires HTTPS or localhost");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
toast.success(
|
||||
@@ -184,6 +188,10 @@ export function useXterm({ pageRef, hostRef }: Options) {
|
||||
}
|
||||
}, []);
|
||||
const paste = useCallback(async (writeData: (data: string) => void) => {
|
||||
if (!navigator.clipboard) {
|
||||
toast.error("Clipboard access requires HTTPS or localhost");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const text = await navigator.clipboard.readText();
|
||||
if (text) writeData(text);
|
||||
|
||||
Reference in new issue
Block a user