fix alerts reconnect backoff and clipboard availability checks
This commit is contained in:
4 files changed
+11
No files matched your search
@@ -2,6 +2,7 @@
|
|||||||
# schema on each build, so the .sqlx cache is only needed for DB-less builds.
|
# schema on each build, so the .sqlx cache is only needed for DB-less builds.
|
||||||
# Run scripts/prepare_sqlx_sqlite.sh once first — it creates and migrates the DB.
|
# Run scripts/prepare_sqlx_sqlite.sh once first — it creates and migrates the DB.
|
||||||
# Use an absolute path so builds work from any working directory.
|
# Use an absolute path so builds work from any working directory.
|
||||||
|
# Replace the placeholder below with the DATABASE_URL printed by the script.
|
||||||
DATABASE_URL=sqlite:///absolute/path/to/wakey-prepare.sqlite3
|
DATABASE_URL=sqlite:///absolute/path/to/wakey-prepare.sqlite3
|
||||||
|
|
||||||
# Offline mode (CI / packaging): force the committed .sqlx cache.
|
# Offline mode (CI / packaging): force the committed .sqlx cache.
|
||||||
|
|||||||
@@ -24,3 +24,4 @@ cp .sqlx/*.json wakey-control-plane/.sqlx/
|
|||||||
echo "SQLx metadata prepared in $ROOT/.sqlx"
|
echo "SQLx metadata prepared in $ROOT/.sqlx"
|
||||||
echo "SQLx package metadata mirrored in $ROOT/wakey-control-plane/.sqlx"
|
echo "SQLx package metadata mirrored in $ROOT/wakey-control-plane/.sqlx"
|
||||||
echo "Prepare DB (referenced by .env for live compile-time checking): $DB"
|
echo "Prepare DB (referenced by .env for live compile-time checking): $DB"
|
||||||
|
echo "DATABASE_URL=$DATABASE_URL"
|
||||||
@@ -207,6 +207,7 @@ export function App() {
|
|||||||
// Only a connection that stayed up proves the stream is healthy; an
|
// 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.
|
// accept-then-close server must not pin us to the first backoff step.
|
||||||
if (openedAt && Date.now() - openedAt > 10_000) attempt = 0;
|
if (openedAt && Date.now() - openedAt > 10_000) attempt = 0;
|
||||||
|
openedAt = 0;
|
||||||
// Browsers never reconnect a WebSocket on their own.
|
// Browsers never reconnect a WebSocket on their own.
|
||||||
const delay =
|
const delay =
|
||||||
Math.min(30_000, 1000 * 2 ** attempt) + Math.random() * 1000;
|
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");
|
toast.info("Nothing to copy");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!navigator.clipboard) {
|
||||||
|
toast.error("Clipboard access requires HTTPS or localhost");
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(text);
|
await navigator.clipboard.writeText(text);
|
||||||
toast.success(
|
toast.success(
|
||||||
@@ -184,6 +188,10 @@ export function useXterm({ pageRef, hostRef }: Options) {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
const paste = useCallback(async (writeData: (data: string) => void) => {
|
const paste = useCallback(async (writeData: (data: string) => void) => {
|
||||||
|
if (!navigator.clipboard) {
|
||||||
|
toast.error("Clipboard access requires HTTPS or localhost");
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const text = await navigator.clipboard.readText();
|
const text = await navigator.clipboard.readText();
|
||||||
if (text) writeData(text);
|
if (text) writeData(text);
|
||||||
|
|||||||
Reference in new issue
Block a user