Produce a more informative error when running in an insecure context

This commit is contained in:
Robin Townsend 2022-07-03 10:36:16 -04:00
commit 71a819fcf0
2 changed files with 9 additions and 1 deletions

View file

@ -36,6 +36,14 @@ initRageshake();
console.info(`matrix-video-chat ${import.meta.env.VITE_APP_VERSION || "dev"}`);
if (!window.isSecureContext) {
throw 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"
);
}
if (import.meta.env.VITE_CUSTOM_THEME) {
const style = document.documentElement.style;
style.setProperty("--accent", import.meta.env.VITE_THEME_ACCENT as string);