diff --git a/src/preview-demo/install.ts b/src/preview-demo/install.ts index 426c2d21..a5677e8f 100644 --- a/src/preview-demo/install.ts +++ b/src/preview-demo/install.ts @@ -1,3 +1,5 @@ +/* eslint-disable no-param-reassign */ +// Patching the window's network entry points is this module's whole job. // Routes the page's network through the pretend homeserver and refuses everything else. Installed // only by a build with VITE_PREVIEW_DEMO=1 whose config.json says previewDemo: true (src/index.tsx). // Own-origin requests (the app's static files) pass; the demo origin is answered in-page; any @@ -87,7 +89,7 @@ export const installDemo = (win: Window & typeof globalThis = window) => { win.fetch = guardedFetch(server, origin, realFetch); - const RealSocket = win.WebSocket; + const { WebSocket: RealSocket } = win; class GuardedSocket extends RealSocket { constructor(url: string | URL, protocols?: string | string[]) { if (routeOf(String(url), origin) !== 'own') throw refusal('WebSocket', String(url)); diff --git a/src/preview-demo/server.test.ts b/src/preview-demo/server.test.ts index 7140a76f..2af43fa9 100644 --- a/src/preview-demo/server.test.ts +++ b/src/preview-demo/server.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable max-classes-per-file, no-promise-executor-return, no-useless-constructor, no-empty-function, no-void, @typescript-eslint/no-non-null-assertion */ import { afterEach, describe, expect, it, vi } from 'vitest'; import { ClientEvent, MatrixClient, SyncState, createClient } from 'matrix-js-sdk'; import { DEMO_ORIGIN, ME, ROOMS, GENERAL, COMMONS } from './fixtures';