chore(style): codebase em-dash sweep + minor layout polish
Replaces every em-dash and en-dash with regular ASCII hyphens across comments, JSX strings, and dev-facing logs. Mostly cosmetic but stops the inconsistent mix that crept in over the last few months (some files used em-dashes in comments, others didn't, some used both). Bundles two small dashboard-layout tweaks that touch a couple of already-modified files: - (dashboard)/layout.tsx main padding goes from p-6 to pt-3 px-6 pb-6 so page content sits closer to the topbar. - Sidebar now receives the ports list it needs for the footer port switcher. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -266,7 +266,7 @@ export interface ServerToClientEvents {
|
||||
'alert:dismissed': (payload: { alertId: string; portId: string }) => void;
|
||||
}
|
||||
|
||||
// Client → Server events (minimal — most actions go through REST API)
|
||||
// Client → Server events (minimal - most actions go through REST API)
|
||||
export interface ClientToServerEvents {
|
||||
'join:entity': (payload: { type: 'berth' | 'client' | 'interest'; id: string }) => void;
|
||||
'leave:entity': (payload: { type: 'berth' | 'client' | 'interest'; id: string }) => void;
|
||||
|
||||
@@ -18,7 +18,7 @@ let io: Server<ClientToServerEvents, ServerToClientEvents> | null = null;
|
||||
/**
|
||||
* Returns true if the user is a super-admin OR holds a userPortRoles row
|
||||
* for the given portId. The Socket.IO auth middleware uses this to decide
|
||||
* whether to honour a client-supplied `auth.portId` — the prior code
|
||||
* whether to honour a client-supplied `auth.portId` - the prior code
|
||||
* trusted whatever the client passed and thereby joined the socket to a
|
||||
* foreign tenant's broadcast room.
|
||||
*/
|
||||
@@ -35,7 +35,7 @@ async function userCanAccessPort(userId: string, portId: string): Promise<boolea
|
||||
|
||||
/**
|
||||
* Verify the user can join an entity-scoped room. Each entity type's own
|
||||
* tenant column is checked — if the user can access the entity's port,
|
||||
* tenant column is checked - if the user can access the entity's port,
|
||||
* they may subscribe to that entity's room.
|
||||
*/
|
||||
async function userCanJoinEntity(
|
||||
@@ -84,7 +84,7 @@ export function initSocketServer(
|
||||
maxHttpBufferSize: 1e6, // 1MB message limit
|
||||
});
|
||||
|
||||
// Auth middleware — validate session cookie + verify the user actually
|
||||
// Auth middleware - validate session cookie + verify the user actually
|
||||
// holds a role in the requested port. The handshake's auth.portId is
|
||||
// user-supplied; we MUST cross-check it against userPortRoles or any
|
||||
// authenticated user could subscribe to a foreign tenant's broadcasts.
|
||||
@@ -132,7 +132,7 @@ export function initSocketServer(
|
||||
socket.join(`user:${userId}`);
|
||||
if (portId) socket.join(`port:${portId}`);
|
||||
|
||||
// Entity-level room management — verify the user can access the
|
||||
// Entity-level room management - verify the user can access the
|
||||
// entity's port before joining. Without this, any authenticated user
|
||||
// could subscribe to a foreign-tenant entity's broadcast (note
|
||||
// previews, signer emails, etc.) by guessing or harvesting an id.
|
||||
@@ -149,7 +149,7 @@ export function initSocketServer(
|
||||
socket.leave(`${type}:${id}`);
|
||||
});
|
||||
|
||||
// Idle timeout (30 seconds — for development only, would be longer in prod)
|
||||
// Idle timeout (30 seconds - for development only, would be longer in prod)
|
||||
let idleTimer = setTimeout(() => socket.disconnect(), 30_000);
|
||||
socket.onAny(() => {
|
||||
clearTimeout(idleTimer);
|
||||
|
||||
Reference in New Issue
Block a user