preview-demo: lint
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8431827077
commit
0f1fc066e4
2 changed files with 4 additions and 1 deletions
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
Loading…
Reference in a new issue