Merge pull request #672 from robintown/fatal-error

Show an error when the browser does not support WebRTC
This commit is contained in:
Robin 2022-10-27 09:46:45 -04:00 committed by GitHub
commit 0d22ef2104
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,12 +39,21 @@ initRageshake();
console.info(`matrix-video-chat ${import.meta.env.VITE_APP_VERSION || "dev"}`);
let fatalError: Error | null = null;
if (!window.isSecureContext) {
throw new Error(
fatalError = new Error(
"This app cannot run in an insecure context. To fix this, access the app " +
"via a local loopback address, or serve it over HTTPS.\n" +
"https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts"
);
} else if (!navigator.mediaDevices) {
fatalError = new Error("Your browser does not support WebRTC.");
}
if (fatalError !== null) {
ReactDOM.render(<>fatalError.message</>, document.getElementById("root"));
throw fatalError; // Stop the app early
}
if (import.meta.env.VITE_CUSTOM_THEME) {