Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions src/components/menu/Connect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -164,25 +164,17 @@
{:else if connState === 'pending'}
<!-- pending: request out, waiting for their approval. Amber = reversible
abort (red stays reserved for Disconnect). -->
<div class="cx-connect inline-flex rounded-md shadow-sm">
<Input
type="text"
disabled
class="nob cx-input rounded-r-none border-0 opacity-70"
value={pendingOut[0]?.[0] ?? peerIdToConnect}
/>
<Button
color="yellow"
id="cancel-request-button"
class="nob shrink-0 rounded-l-none rounded-r-lg bg-amber-500 text-white hover:bg-amber-600 dark:bg-amber-600 dark:text-gray-900 dark:hover:bg-amber-500"
on:click={cancelPending}
title="Cancel the connection request">Cancel</Button
>
</div>
<span class="cx-status" aria-live="polite" data-testid="connect-pending">
<span class="cx-status" aria-live="polite" data-testid="connect-pending" title={'Waiting for ' + (pendingOut[0]?.[0] ?? peerIdToConnect) + ' to accept'}>
<span class="cx-dot cx-dot-wait"></span>
<span class="cx-status-label cx-muted">Waiting for approval…</span>
</span>
<Button
color="yellow"
id="cancel-request-button"
class="nob shrink-0 rounded-lg bg-amber-500 text-white hover:bg-amber-600 dark:bg-amber-600 dark:text-gray-900 dark:hover:bg-amber-500"
on:click={cancelPending}
title="Cancel the connection request">Cancel</Button
>
{:else}
<!-- idle: dial a peer — the input shrinks (down to cx-input min-width) so
the Connect button stays visible when the row is tight -->
Expand Down
30 changes: 3 additions & 27 deletions src/components/menu/Toasts.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -129,33 +129,9 @@ style="left: 50%; max-width: 500px; transform: translate(-50%, 0%); z-index: var
</div>
{/each}

{#each $waitingForApproval as status}
{#if status[1] === 'pending'}
<div class="my-1">
<Toast transition={fly} class="p-2 rounded-lg dark:bg-green-800 dark:border-dark-700 border-2 border-green-500" divClass="flex items-center gap-3">
<div style="position: relative; left: 50%; transform: translate(-25%, -50%);">

</div>
<div class="mb-1 text-base font-medium text-green-700 dark:text-green-500 inline-flex items-center">

<p class="text-sm font-medium text-gray-500 dark:text-gray-400 pr-4 overflow-hidden max-w-80">
Connection request to peer:&nbsp;{status[0]} <br />
Status: {status[1]}
</p>

<!-- CN: cancel the outbound request (same path as the pill's Cancel) -->
<Button
color="yellow"
class="nob rounded bg-amber-500 text-white hover:bg-amber-600 dark:bg-amber-600 dark:text-gray-900 dark:hover:bg-amber-500"
onclick={() => cancelOutboundRequest(status[0])}
>Cancel</Button
>
</div>

</Toast>
</div>
{/if}
{/each}
<!-- CN: the OUTBOUND "Connection request to peer / pending" toast was removed — the
Connect pill already shows the "Waiting for approval…" state + a Cancel button, so
the toast was redundant chrome. Incoming approval requests (above) still toast. -->
</div>

<!-- pointer-events: none lets clicks pass through the (invisible) container area;
Expand Down
3 changes: 3 additions & 0 deletions src/lib/peerServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ export function peerServerPingUrl(status) {
* @param {PeerServerStatus | null} status @param {string=} key @returns {string | null}
*/
export function peerServerPeersUrl(status, key = 'peerjs') {
// the PUBLIC PeerJS cloud has no discovery endpoint — probing it just logs a
// noisy 404, so skip it (discovery shows as "—").
if (!status || status.kind === 'public') return null;
const base = peerServerPingUrl(status);
if (!base) return null;
return base.replace(/\/$/, '') + '/' + key + '/peers';
Expand Down