diff --git a/config/nginx.conf b/config/nginx.conf index 2af6c30..f725346 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -2,9 +2,24 @@ server { listen 8080; server_name localhost; + root /app; + location / { - root /app; + # disable cache entriely by default (apart from Etag which is accurate enough) + add_header Cache-Control 'private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; + if_modified_since off; + expires off; + # also turn off last-modified since they are just the timestamps of the file in the docker image + # and may or may not bear any resemblance to when the resource changed + add_header Last-Modified ""; + try_files $uri /$uri /index.html; } + + # assets can be cached because they have hashed filenames + location /assets { + expires 1w; + add_header Cache-Control "public, no-transform"; + } } diff --git a/src/matrix-utils.ts b/src/matrix-utils.ts index 3e01d16..dc55702 100644 --- a/src/matrix-utils.ts +++ b/src/matrix-utils.ts @@ -94,12 +94,17 @@ export async function initClient( const storeOpts = {} as ICreateClientOpts; - if (indexedDB && localStorage && !import.meta.env.DEV) { + if (indexedDB && localStorage) { storeOpts.store = new IndexedDBStore({ indexedDB: window.indexedDB, localStorage, dbName: SYNC_STORE_NAME, - workerFactory: () => new IndexedDBWorker(), + // We can't use the worker in dev mode because Vite simply doesn't bundle workers + // in dev mode: it expects them to use native modules. Ours don't, and even then only + // Chrome supports it. (It bundles them fine in production mode.) + workerFactory: import.meta.env.DEV + ? undefined + : () => new IndexedDBWorker(), }); } else if (localStorage) { storeOpts.store = new MemoryStore({ localStorage }); diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 2969c9a..2214501 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -63,7 +63,7 @@ import { usePrefersReducedMotion } from "../usePrefersReducedMotion"; import { ParticipantInfo } from "./useGroupCall"; import { TileDescriptor } from "../video-grid/TileDescriptor"; import { AudioSink } from "../video-grid/AudioSink"; -import { useKeyboardShortcuts } from "../useKeyboardShortcuts"; +import { useCallViewKeyboardShortcuts } from "../useCallViewKeyboardShortcuts"; const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {}); // There is currently a bug in Safari our our code with cloning and sending MediaStreams @@ -144,7 +144,7 @@ export function InCallView({ const { hideScreensharing } = useUrlParams(); - useKeyboardShortcuts( + useCallViewKeyboardShortcuts( !feedbackModalState.isOpen, toggleMicrophoneMuted, toggleLocalVideoMuted, diff --git a/src/useCallViewKeyboardShortcuts.ts b/src/useCallViewKeyboardShortcuts.ts index 6356b52..8a247d0 100644 --- a/src/useCallViewKeyboardShortcuts.ts +++ b/src/useCallViewKeyboardShortcuts.ts @@ -19,7 +19,7 @@ import { useCallback, useState } from "react"; import { getSetting } from "./settings/useSetting"; import { useEventTarget } from "./useEvents"; -export function useKeyboardShortcuts( +export function useCallViewKeyboardShortcuts( enabled: boolean, toggleMicrophoneMuted: () => void, toggleLocalVideoMuted: () => void,