9ce8ad58b1
CI / Build & Quality Checks (push) Failing after 6m11s
- CallEmbed: inject :root { color-scheme } into iframe so EC respects Cinny
theme regardless of OS preference (fixes white background in dark mode)
- CallEmbed: store themeKind, update color-scheme CSS on live setTheme() calls
- CallEmbed: catch transport.send() rejection in setTheme() to prevent
unhandled promise rejection when widget not ready yet (fixes REACT-8)
- CallEmbed: html + body both set to background:none so wallpaper shows through
- CallEmbedProvider: apply chatBackground wallpaper style to call embed
container in full-view mode (not PiP) -- wallpapers carry over to calls
- useCallEmbed: pass themeKind through to CallEmbed constructor
- index.tsx: ignoreErrors: [Request timed out] to suppress matrixRTC
heartbeat timeouts (REACT-9) from Sentry noise
- README: document 0.19.4, positioning fix, dark mode fix, wallpaper,
millify Rolldown interop fix, Sentry noise filter
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
107 lines
3.4 KiB
TypeScript
107 lines
3.4 KiB
TypeScript
/* eslint-disable import/first */
|
|
import * as Sentry from '@sentry/react';
|
|
import React from 'react';
|
|
import { createRoot } from 'react-dom/client';
|
|
import { enableMapSet } from 'immer';
|
|
import '@fontsource-variable/inter/index.css';
|
|
import 'folds/dist/style.css';
|
|
import { configClass, varsClass } from 'folds';
|
|
|
|
const sentryDsn = import.meta.env.VITE_SENTRY_DSN;
|
|
if (sentryDsn) {
|
|
Sentry.init({
|
|
dsn: sentryDsn,
|
|
environment: import.meta.env.MODE,
|
|
release: import.meta.env.VITE_APP_VERSION,
|
|
// browserTracingIntegration omitted — it injects sentry-trace/baggage headers
|
|
// into outgoing fetch calls, which breaks Synapse CORS on matrix.lotusguild.org
|
|
// No propagation targets — we don't control the Matrix server's CORS allow-list
|
|
tracePropagationTargets: [],
|
|
tracesSampleRate: 0,
|
|
// Don't send PII (IPs, usernames) — this is a private chat app
|
|
sendDefaultPii: false,
|
|
// Forward Sentry logs to the dashboard
|
|
enableLogs: true,
|
|
// Suppress benign PostmessageTransport / matrixRTC heartbeat timeouts (upstream library noise)
|
|
ignoreErrors: ['Request timed out'],
|
|
beforeSend(event) {
|
|
// Drop any event that may have leaked an access token into breadcrumbs/data
|
|
if (JSON.stringify(event).includes('access_token')) return null;
|
|
return event;
|
|
},
|
|
});
|
|
}
|
|
|
|
enableMapSet();
|
|
|
|
import './index.css';
|
|
|
|
import { trimTrailingSlash } from './app/utils/common';
|
|
import App from './app/pages/App';
|
|
|
|
// import i18n (needs to be bundled ;))
|
|
import './app/i18n';
|
|
import { pushSessionToSW } from './sw-session';
|
|
import { getFallbackSession } from './app/state/sessions';
|
|
|
|
document.body.classList.add(configClass, varsClass);
|
|
|
|
// Register Service Worker
|
|
if ('serviceWorker' in navigator) {
|
|
const swUrl =
|
|
import.meta.env.MODE === 'production'
|
|
? `${trimTrailingSlash(import.meta.env.BASE_URL)}/sw.js`
|
|
: `/dev-sw.js?dev-sw`;
|
|
|
|
const sendSessionToSW = () => {
|
|
const session = getFallbackSession();
|
|
pushSessionToSW(session?.baseUrl, session?.accessToken);
|
|
};
|
|
|
|
navigator.serviceWorker.register(swUrl).then(sendSessionToSW);
|
|
navigator.serviceWorker.ready.then(sendSessionToSW);
|
|
|
|
navigator.serviceWorker.addEventListener('message', (ev) => {
|
|
const { type } = ev.data ?? {};
|
|
|
|
if (type === 'requestSession') {
|
|
sendSessionToSW();
|
|
}
|
|
});
|
|
}
|
|
|
|
// Reload once if a lazy-loaded chunk is missing (stale deployment)
|
|
window.addEventListener('vite:preloadError', () => {
|
|
if (!sessionStorage.getItem('chunk-reload-attempted')) {
|
|
sessionStorage.setItem('chunk-reload-attempted', '1');
|
|
window.location.reload();
|
|
}
|
|
});
|
|
// Clear the reload flag after a successful load so future deploys can still trigger a reload
|
|
window.addEventListener('load', () => sessionStorage.removeItem('chunk-reload-attempted'));
|
|
|
|
// Synapse does not yet ship MSC3786/MSC3914 as server-default push rules.
|
|
// matrix-js-sdk patches them client-side on every login and logs a warn for each.
|
|
// Suppress the noise until Synapse implements these MSCs upstream.
|
|
{
|
|
const _warn = console.warn.bind(console);
|
|
console.warn = (...args: unknown[]) => {
|
|
if (typeof args[0] === 'string' && args[0].startsWith('Adding default global ')) return;
|
|
_warn(...args);
|
|
};
|
|
}
|
|
|
|
const mountApp = () => {
|
|
const rootContainer = document.getElementById('root');
|
|
|
|
if (rootContainer === null) {
|
|
console.error('Root container element not found!');
|
|
return;
|
|
}
|
|
|
|
const root = createRoot(rootContainer);
|
|
root.render(<App />);
|
|
};
|
|
|
|
mountApp();
|