Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03caa22f0e | ||
|
|
eedd19f515 | ||
|
|
6bb004ea55 | ||
|
|
2f0469880b | ||
|
|
96eafef027 | ||
|
|
b748c03e74 | ||
|
|
4469cece86 | ||
|
|
3016866a4b | ||
|
|
2cfa007d4c | ||
|
|
03a2350e5c | ||
|
|
f29dafc5c4 | ||
|
|
d6c3559a6e | ||
|
|
db67343133 | ||
|
|
77f7551ab0 | ||
|
|
c0c59dcb74 | ||
|
|
8f42aca6e2 | ||
|
|
ec9d82b99c | ||
|
|
e2a42656de | ||
|
|
dc27cd67e8 | ||
|
|
da8745871c | ||
|
|
11255ce550 | ||
|
|
23e7abecbc | ||
|
|
c4a5232cd5 | ||
|
|
4613d43c3c | ||
|
|
a1aaacaad7 | ||
|
|
1d018eeead | ||
|
|
5dae6e1168 | ||
|
|
7d3e2b9958 | ||
|
|
0657edee90 | ||
|
|
39ee20ab0c | ||
|
|
499ba0e059 | ||
|
|
6f425abd5f | ||
|
|
87fb3398d4 | ||
|
|
a57db61aed | ||
|
|
0423f2f4bb | ||
|
|
01c9454f92 | ||
|
|
31446e7997 | ||
|
|
02db81d846 | ||
|
|
5f72ec2416 | ||
|
|
4330b46086 | ||
|
|
988f0a8bc9 | ||
|
|
14bd53c02b | ||
|
|
172c7664be | ||
|
|
c546042d18 | ||
|
|
7dac9caa6b | ||
|
|
15566770f9 | ||
|
|
f053ecfa98 | ||
|
|
39dd60598e | ||
|
|
e790c13112 | ||
|
|
946ab6ff1a | ||
|
|
e730926eab | ||
|
|
7195bf7672 | ||
|
|
8e2c1dd164 | ||
|
|
448865b0d5 | ||
|
|
c75b21e0cb | ||
|
|
8a22aa55a6 | ||
|
|
b6e9a0869a | ||
|
|
37e69f6023 | ||
|
|
d672190c6f | ||
|
|
ac6747bbf3 | ||
|
|
6c5e9226cf | ||
|
|
0a12766171 | ||
|
|
703aa661ea | ||
|
|
edd4ff077b |
@@ -33,6 +33,8 @@ module.exports = {
|
||||
rules: {
|
||||
// We're aiming to convert this code to strict mode
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
// We should use the js-sdk logger, never console directly.
|
||||
"no-console": ["error"],
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
2
.github/workflows/netlify-fullmesh.yaml
vendored
2
.github/workflows/netlify-fullmesh.yaml
vendored
@@ -60,7 +60,7 @@ jobs:
|
||||
|
||||
- name: Deploy to Netlify
|
||||
id: netlify
|
||||
uses: nwtgck/actions-netlify@v1.2.4
|
||||
uses: nwtgck/actions-netlify@v2.1.0
|
||||
with:
|
||||
publish-dir: dist
|
||||
deploy-message: "Deploy from GitHub Actions"
|
||||
|
||||
2
.github/workflows/netlify-livekit.yaml
vendored
2
.github/workflows/netlify-livekit.yaml
vendored
@@ -60,7 +60,7 @@ jobs:
|
||||
|
||||
- name: Deploy to Netlify
|
||||
id: netlify
|
||||
uses: nwtgck/actions-netlify@v1.2.4
|
||||
uses: nwtgck/actions-netlify@v2.1.0
|
||||
with:
|
||||
publish-dir: dist
|
||||
deploy-message: "Deploy from GitHub Actions"
|
||||
|
||||
2
.github/workflows/netlify-pr.yaml
vendored
2
.github/workflows/netlify-pr.yaml
vendored
@@ -53,7 +53,7 @@ jobs:
|
||||
|
||||
- name: ☁️ Deploy to Netlify
|
||||
id: netlify
|
||||
uses: nwtgck/actions-netlify@v1.2
|
||||
uses: nwtgck/actions-netlify@v2.1
|
||||
with:
|
||||
publish-dir: webapp
|
||||
deploy-message: "Deploy from GitHub Actions"
|
||||
|
||||
17
package.json
17
package.json
@@ -47,15 +47,15 @@
|
||||
"@sentry/react": "^6.13.3",
|
||||
"@sentry/tracing": "^6.13.3",
|
||||
"@use-gesture/react": "^10.2.11",
|
||||
"@vector-im/compound-design-tokens": "^0.0.5",
|
||||
"@vector-im/compound-design-tokens": "^0.0.6",
|
||||
"@vector-im/compound-web": "^0.4.0",
|
||||
"@vitejs/plugin-basic-ssl": "^1.0.1",
|
||||
"@vitejs/plugin-react": "^4.0.1",
|
||||
"classnames": "^2.3.1",
|
||||
"events": "^3.3.0",
|
||||
"i18next": "^21.10.0",
|
||||
"i18next-browser-languagedetector": "^6.1.8",
|
||||
"i18next-http-backend": "^1.4.4",
|
||||
"i18next": "^23.0.0",
|
||||
"i18next-browser-languagedetector": "^7.0.0",
|
||||
"i18next-http-backend": "^2.0.0",
|
||||
"livekit-client": "^1.12.3",
|
||||
"lodash": "^4.17.21",
|
||||
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#6385c9c0dab8fe67bd3a8992a4777f243fdd1b68",
|
||||
@@ -63,12 +63,12 @@
|
||||
"mermaid": "^9.0.0",
|
||||
"normalize.css": "^8.0.1",
|
||||
"pako": "^2.0.4",
|
||||
"postcss-preset-env": "^7",
|
||||
"postcss-preset-env": "^9.0.0",
|
||||
"posthog-js": "^1.29.0",
|
||||
"re-resizable": "^6.9.0",
|
||||
"react": "18",
|
||||
"react-dom": "18",
|
||||
"react-i18next": "^11.18.6",
|
||||
"react-i18next": "^13.0.0",
|
||||
"react-json-view": "^1.21.3",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-use-clipboard": "^1.0.7",
|
||||
@@ -85,13 +85,14 @@
|
||||
"@react-types/dialog": "^3.5.5",
|
||||
"@sentry/vite-plugin": "^2.0.0",
|
||||
"@storybook/react": "^6.5.0-alpha.5",
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/jest-dom": "^6.0.0",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"@types/content-type": "^1.1.5",
|
||||
"@types/d3": "^7.4.0",
|
||||
"@types/dom-screen-wake-lock": "^1.0.1",
|
||||
"@types/dompurify": "^3.0.2",
|
||||
"@types/grecaptcha": "^3.0.4",
|
||||
"@types/jest": "^29.5.5",
|
||||
"@types/node": "^18.13.0",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"@types/request": "^2.48.8",
|
||||
@@ -109,7 +110,7 @@
|
||||
"eslint-plugin-matrix-org": "^0.4.0",
|
||||
"eslint-plugin-react": "^7.29.4",
|
||||
"eslint-plugin-react-hooks": "^4.5.0",
|
||||
"i18next-parser": "^6.6.0",
|
||||
"i18next-parser": "^8.0.0",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^29.2.2",
|
||||
"jest-environment-jsdom": "^29.3.1",
|
||||
|
||||
@@ -19,6 +19,7 @@ import { useLocation } from "react-router-dom";
|
||||
import classNames from "classnames";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import * as Sentry from "@sentry/react";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import { Header, HeaderLogo, LeftNav, RightNav } from "./Header";
|
||||
import { LinkButton, Button } from "./button";
|
||||
@@ -57,7 +58,7 @@ export function ErrorView({ error }: ErrorViewProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
console.error(error);
|
||||
logger.error(error);
|
||||
Sentry.captureException(error);
|
||||
}, [error]);
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import { useHistory, useLocation } from "react-router-dom";
|
||||
import { captureException } from "@sentry/react";
|
||||
import { sleep } from "matrix-js-sdk/src/utils";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import { FieldRow, InputField, ErrorMessage } from "../input/Input";
|
||||
import { Button } from "../button";
|
||||
@@ -97,7 +98,7 @@ export const RegisterPage: FC = () => {
|
||||
await newClient.joinRoom(roomId);
|
||||
} else {
|
||||
captureException(error);
|
||||
console.error(`Couldn't join room ${roomId}`, error);
|
||||
logger.error(`Couldn't join room ${roomId}`, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
import { useEffect, useCallback, useRef, useState } from "react";
|
||||
import { randomString } from "matrix-js-sdk/src/randomstring";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import { translatedError } from "../TranslatedError";
|
||||
|
||||
@@ -74,7 +75,7 @@ export const useRecaptcha = (sitekey?: string) => {
|
||||
}
|
||||
|
||||
if (!window.grecaptcha) {
|
||||
console.log("Recaptcha not loaded");
|
||||
logger.log("Recaptcha not loaded");
|
||||
return Promise.reject(translatedError("Recaptcha not loaded", t));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||
import { randomString } from "matrix-js-sdk/src/randomstring";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Heading } from "@vector-im/compound-web";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import {
|
||||
createRoom,
|
||||
@@ -97,7 +98,7 @@ export function RegisteredView({ client }: Props) {
|
||||
setError(undefined);
|
||||
setJoinExistingCallModalOpen(true);
|
||||
} else {
|
||||
console.error(error);
|
||||
logger.error(error);
|
||||
setLoading(false);
|
||||
setError(error);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import { useHistory } from "react-router-dom";
|
||||
import { randomString } from "matrix-js-sdk/src/randomstring";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { Heading } from "@vector-im/compound-web";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import { useClient } from "../ClientContext";
|
||||
import { Header, HeaderLogo, LeftNav, RightNav } from "../Header";
|
||||
@@ -130,7 +131,7 @@ export const UnauthenticatedView: FC = () => {
|
||||
}
|
||||
|
||||
submit().catch((error) => {
|
||||
console.error(error);
|
||||
logger.error(error);
|
||||
setLoading(false);
|
||||
setError(error);
|
||||
reset();
|
||||
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
ExternalE2EEKeyProvider,
|
||||
Room,
|
||||
RoomOptions,
|
||||
setLogLevel,
|
||||
} from "livekit-client";
|
||||
import { useLiveKitRoom } from "@livekit/components-react";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
@@ -44,8 +43,6 @@ export type E2EEConfig = {
|
||||
sharedKey: string;
|
||||
};
|
||||
|
||||
setLogLevel("debug");
|
||||
|
||||
interface UseLivekitResult {
|
||||
livekitRoom?: Room;
|
||||
connState: ECConnectionState;
|
||||
|
||||
11
src/main.tsx
11
src/main.tsx
@@ -23,15 +23,22 @@ import "matrix-js-sdk/src/browser-index";
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { createBrowserHistory } from "history";
|
||||
|
||||
import "./index.css";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import {
|
||||
setLogExtension as setLKLogExtension,
|
||||
setLogLevel,
|
||||
} from "livekit-client";
|
||||
|
||||
import App from "./App";
|
||||
import { init as initRageshake } from "./settings/rageshake";
|
||||
import { Initializer } from "./initializer";
|
||||
|
||||
initRageshake();
|
||||
setLogLevel("debug");
|
||||
setLKLogExtension(global.mx_rage_logger.log);
|
||||
|
||||
console.info(`Element Call ${import.meta.env.VITE_APP_VERSION || "dev"}`);
|
||||
logger.info(`Element Call ${import.meta.env.VITE_APP_VERSION || "dev"}`);
|
||||
|
||||
const root = createRoot(document.getElementById("root")!);
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ export async function initClient(
|
||||
try {
|
||||
await client.store.startup();
|
||||
} catch (error) {
|
||||
console.error(
|
||||
logger.error(
|
||||
"Error starting matrix client store. Falling back to memory store.",
|
||||
error
|
||||
);
|
||||
|
||||
@@ -19,6 +19,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { User, UserEvent } from "matrix-js-sdk/src/models/user";
|
||||
import { FileType } from "matrix-js-sdk/src/http-api";
|
||||
import { useState, useCallback, useEffect } from "react";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface ProfileLoadState {
|
||||
success: boolean;
|
||||
@@ -127,7 +128,7 @@ export function useProfile(client: MatrixClient | undefined) {
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
console.error("Client not initialized before calling saveProfile");
|
||||
logger.error("Client not initialized before calling saveProfile");
|
||||
}
|
||||
},
|
||||
[client]
|
||||
|
||||
@@ -17,18 +17,18 @@ limitations under the License.
|
||||
.inRoom {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-height: 100%;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
--footerPadding: var(--cpd-space-4x);
|
||||
--footerHeight: calc(50px + 2 * var(--footerPadding));
|
||||
}
|
||||
|
||||
.controlsOverlay {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: auto;
|
||||
overflow-inline: hidden;
|
||||
contain: strict;
|
||||
}
|
||||
|
||||
.centerMessage {
|
||||
@@ -45,17 +45,15 @@ limitations under the License.
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
position: sticky;
|
||||
inset-block-end: 0;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto 1fr;
|
||||
grid-template-areas: "logo buttons layout";
|
||||
align-items: center;
|
||||
gap: var(--cpd-space-3x);
|
||||
padding: var(--footerPadding) var(--inline-content-inset);
|
||||
padding-block: var(--cpd-space-4x);
|
||||
padding-inline: var(--inline-content-inset);
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(0, 0, 0, 0) 0%,
|
||||
@@ -84,14 +82,14 @@ limitations under the License.
|
||||
}
|
||||
|
||||
@media (min-height: 400px) {
|
||||
.inRoom {
|
||||
--footerPadding: var(--cpd-space-10x);
|
||||
.footer {
|
||||
padding-block: var(--cpd-space-10x);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-height: 800px) {
|
||||
.inRoom {
|
||||
--footerPadding: var(--cpd-space-15x);
|
||||
.footer {
|
||||
padding-block: var(--cpd-space-15x);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -344,19 +344,19 @@ export function InCallView({
|
||||
const buttons: JSX.Element[] = [];
|
||||
|
||||
buttons.push(
|
||||
<VideoButton
|
||||
key="2"
|
||||
muted={!muteStates.video.enabled}
|
||||
onPress={toggleCamera}
|
||||
disabled={muteStates.video.setEnabled === null}
|
||||
data-testid="incall_videomute"
|
||||
/>,
|
||||
<MicButton
|
||||
key="1"
|
||||
muted={!muteStates.audio.enabled}
|
||||
onPress={toggleMicrophone}
|
||||
disabled={muteStates.audio.setEnabled === null}
|
||||
data-testid="incall_mute"
|
||||
/>,
|
||||
<VideoButton
|
||||
key="2"
|
||||
muted={!muteStates.video.enabled}
|
||||
onPress={toggleCamera}
|
||||
disabled={muteStates.video.setEnabled === null}
|
||||
data-testid="incall_videomute"
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ limitations under the License.
|
||||
padding: 2px;
|
||||
border: 1px solid var(--cpd-color-border-interactive-secondary);
|
||||
border-radius: var(--cpd-radius-pill-effect);
|
||||
background: var(--cpd-color-bg-canvas-default);
|
||||
box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ limitations under the License.
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
padding-block-end: var(--footerHeight);
|
||||
}
|
||||
|
||||
@media (max-width: 500px) {
|
||||
|
||||
@@ -129,16 +129,16 @@ export const LobbyView: FC<Props> = ({
|
||||
<div className={inCallStyles.footer}>
|
||||
{recentsButtonInFooter && recentsButton}
|
||||
<div className={inCallStyles.buttons}>
|
||||
<VideoButton
|
||||
muted={!muteStates.video.enabled}
|
||||
onPress={onVideoPress}
|
||||
disabled={muteStates.video.setEnabled === null}
|
||||
/>
|
||||
<MicButton
|
||||
muted={!muteStates.audio.enabled}
|
||||
onPress={onAudioPress}
|
||||
disabled={muteStates.audio.setEnabled === null}
|
||||
/>
|
||||
<VideoButton
|
||||
muted={!muteStates.video.enabled}
|
||||
onPress={onVideoPress}
|
||||
disabled={muteStates.video.setEnabled === null}
|
||||
/>
|
||||
<SettingsButton onPress={openSettings} />
|
||||
{!confineToRoom && <HangupButton onPress={onLeaveClick} />}
|
||||
</div>
|
||||
|
||||
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
import { useCallback, useState } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import styles from "./RoomAuthView.module.css";
|
||||
import { Button } from "../button";
|
||||
@@ -46,7 +47,7 @@ export function RoomAuthView() {
|
||||
typeof dataForDisplayName === "string" ? dataForDisplayName : "";
|
||||
|
||||
registerPasswordlessUser(displayName).catch((error) => {
|
||||
console.error("Failed to register passwordless user", e);
|
||||
logger.error("Failed to register passwordless user", e);
|
||||
setLoading(false);
|
||||
setError(error);
|
||||
});
|
||||
|
||||
@@ -16,6 +16,7 @@ limitations under the License.
|
||||
|
||||
import { FC, useEffect, useState, useCallback, ReactNode } from "react";
|
||||
import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import { useClientLegacy } from "../ClientContext";
|
||||
import { ErrorView, LoadingView } from "../FullScreenView";
|
||||
@@ -37,7 +38,7 @@ export const RoomPage: FC = () => {
|
||||
|
||||
const roomIdOrAlias = roomId ?? roomAlias;
|
||||
if (!roomIdOrAlias) {
|
||||
console.error("No room specified");
|
||||
logger.error("No room specified");
|
||||
}
|
||||
|
||||
const [optInAnalytics, setOptInAnalytics] = useOptInAnalytics();
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
Track,
|
||||
} from "livekit-client";
|
||||
import classNames from "classnames";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import { Avatar } from "../Avatar";
|
||||
import styles from "./VideoPreview.module.css";
|
||||
@@ -80,7 +81,7 @@ export const VideoPreview: FC<Props> = ({
|
||||
},
|
||||
},
|
||||
(error) => {
|
||||
console.error("Error while creating preview Tracks:", error);
|
||||
logger.error("Error while creating preview Tracks:", error);
|
||||
}
|
||||
);
|
||||
const videoTrack = useMemo(
|
||||
|
||||
@@ -50,15 +50,13 @@ const MAX_LOG_SIZE = 1024 * 1024 * 5; // 5 MB
|
||||
// we can batch the writes a little.
|
||||
const MAX_FLUSH_INTERVAL_MS = 2 * 1000;
|
||||
|
||||
// only descend this far into nested object trees
|
||||
const DEPTH_LIMIT = 3;
|
||||
|
||||
enum ConsoleLoggerEvent {
|
||||
Log = "log",
|
||||
}
|
||||
|
||||
type LogFunction = (
|
||||
...args: (Error | DOMException | object | string)[]
|
||||
) => void;
|
||||
type LogFunctionName = "log" | "info" | "warn" | "error";
|
||||
|
||||
// A class which monkey-patches the global console and stores log lines.
|
||||
|
||||
interface LogEntry {
|
||||
@@ -69,37 +67,11 @@ interface LogEntry {
|
||||
|
||||
class ConsoleLogger extends EventEmitter {
|
||||
private logs = "";
|
||||
private originalFunctions: { [key in LogFunctionName]?: LogFunction } = {};
|
||||
|
||||
public monkeyPatch(consoleObj: Console): void {
|
||||
// Monkey-patch console logging
|
||||
const consoleFunctionsToLevels = {
|
||||
log: "I",
|
||||
info: "I",
|
||||
warn: "W",
|
||||
error: "E",
|
||||
};
|
||||
|
||||
Object.entries(consoleFunctionsToLevels).forEach(([name, level]) => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const originalFn = consoleObj[name].bind(consoleObj);
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
this.originalFunctions[name] = originalFn;
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
consoleObj[name] = (...args) => {
|
||||
this.log(level, ...args);
|
||||
originalFn(...args);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
public log(
|
||||
level: string,
|
||||
...args: (Error | DOMException | object | string)[]
|
||||
): void {
|
||||
public log = (
|
||||
level: LogLevel,
|
||||
...args: (Error | DOMException | object | string | undefined)[]
|
||||
): void => {
|
||||
// We don't know what locale the user may be running so use ISO strings
|
||||
const ts = new Date().toISOString();
|
||||
|
||||
@@ -129,7 +101,7 @@ class ConsoleLogger extends EventEmitter {
|
||||
this.logs += line;
|
||||
|
||||
this.emit(ConsoleLoggerEvent.Log);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the log lines to flush to disk and empties the internal log buffer
|
||||
@@ -510,7 +482,7 @@ declare global {
|
||||
*/
|
||||
export function init(): Promise<void> {
|
||||
global.mx_rage_logger = new ConsoleLogger();
|
||||
global.mx_rage_logger.monkeyPatch(window.console);
|
||||
setLogExtension(global.mx_rage_logger.log);
|
||||
|
||||
return tryInitStorage();
|
||||
}
|
||||
@@ -581,13 +553,61 @@ type StringifyReplacer = (
|
||||
// Injects `<$ cycle-trimmed $>` wherever it cuts a cyclical object relationship
|
||||
const getCircularReplacer = (): StringifyReplacer => {
|
||||
const seen = new WeakSet();
|
||||
return (key: string, value: unknown): unknown => {
|
||||
const depthMap = new WeakMap<object, number>();
|
||||
return function (this: unknown, key: string, value: unknown): unknown {
|
||||
if (typeof value === "object" && value !== null) {
|
||||
if (seen.has(value)) {
|
||||
return "<$ cycle-trimmed $>";
|
||||
}
|
||||
seen.add(value);
|
||||
|
||||
let depth = 0;
|
||||
if (this) {
|
||||
depth = depthMap.get(this) ?? 0;
|
||||
}
|
||||
depthMap.set(value, depth + 1);
|
||||
|
||||
if (depth > DEPTH_LIMIT) return "<$ object-pruned $>";
|
||||
}
|
||||
return value;
|
||||
};
|
||||
};
|
||||
|
||||
enum LogLevel {
|
||||
trace = 0,
|
||||
debug = 1,
|
||||
info = 2,
|
||||
warn = 3,
|
||||
error = 4,
|
||||
silent = 5,
|
||||
}
|
||||
|
||||
type LogExtensionFunc = (
|
||||
level: LogLevel,
|
||||
...rest: (Error | DOMException | object | string)[]
|
||||
) => void;
|
||||
type LogLevelString = keyof typeof LogLevel;
|
||||
|
||||
/**
|
||||
* This method borrowed from livekit (who also use loglevel and in turn essentially
|
||||
* took loglevel's example honouring log levels). Adds a loglevel logging extension
|
||||
* in the recommended way.
|
||||
*/
|
||||
export function setLogExtension(extension: LogExtensionFunc) {
|
||||
const originalFactory = logger.methodFactory;
|
||||
|
||||
logger.methodFactory = function (methodName, configLevel, loggerName) {
|
||||
const rawMethod = originalFactory(methodName, configLevel, loggerName);
|
||||
|
||||
const logLevel = LogLevel[methodName as LogLevelString];
|
||||
const needLog = logLevel >= configLevel && logLevel < LogLevel.silent;
|
||||
|
||||
return (...args) => {
|
||||
rawMethod.apply(this, args);
|
||||
if (needLog) {
|
||||
extension(logLevel, ...args);
|
||||
}
|
||||
};
|
||||
};
|
||||
logger.setLevel(logger.getLevel()); // Be sure to call setLevel method in order to apply plugin
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
import pako from "pako";
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { ClientEvent } from "matrix-js-sdk/src/client";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import { getLogsForReport } from "./rageshake";
|
||||
import { useClient } from "../ClientContext";
|
||||
@@ -296,7 +297,7 @@ export function useSubmitRageshake(): {
|
||||
setState({ sending: false, sent: true, error: undefined });
|
||||
} catch (error) {
|
||||
setState({ sending: false, sent: false, error: error as Error });
|
||||
console.error(error);
|
||||
logger.error(error);
|
||||
}
|
||||
},
|
||||
[client, inspectorState, sending]
|
||||
|
||||
@@ -15,14 +15,11 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
.grid {
|
||||
contain: strict;
|
||||
contain: layout style;
|
||||
position: relative;
|
||||
flex-grow: 1;
|
||||
margin-inline: var(--inline-content-inset);
|
||||
padding-block-end: var(--footerHeight);
|
||||
margin-block-start: var(--cpd-space-4x);
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
margin-block: var(--cpd-space-4x);
|
||||
}
|
||||
|
||||
.slots {
|
||||
|
||||
@@ -19,5 +19,4 @@ limitations under the License.
|
||||
overflow: hidden;
|
||||
flex: 1;
|
||||
touch-action: none;
|
||||
margin-bottom: var(--footerHeight);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import {
|
||||
} from "@react-spring/web";
|
||||
import useMeasure from "react-use-measure";
|
||||
import { ResizeObserver as JuggleResizeObserver } from "@juggle/resize-observer";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import styles from "./VideoGrid.module.css";
|
||||
import { Layout } from "../room/LayoutToggle";
|
||||
@@ -298,7 +299,7 @@ function getFreedomLayoutTilePositions(
|
||||
}
|
||||
|
||||
if (tileCount > 12) {
|
||||
console.warn("Over 12 tiles is not currently supported");
|
||||
logger.warn("Over 12 tiles is not currently supported");
|
||||
}
|
||||
|
||||
const { layoutDirection, itemGridRatio } = getGridLayout(
|
||||
|
||||
@@ -43,7 +43,8 @@ limitations under the License.
|
||||
}
|
||||
|
||||
.videoTile.speaking {
|
||||
outline: 4px solid var(--cpd-color-border-accent);
|
||||
/* !important because speaking border should take priority over hover */
|
||||
outline: 4px solid var(--cpd-color-border-accent) !important;
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
|
||||
Reference in New Issue
Block a user