Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

Expose Git SHA to window (#1847)

Kostas Bariotis2a2548027265
diff --git a/src/global.d.ts b/src/global.d.ts
index 7046dae35f..f1ce450caf 100644
--- a/src/global.d.ts
+++ b/src/global.d.ts
@@ -10,6 +10,7 @@ interface Document {
interface Window {
ClipboardItem: any;
+ __EXCALIDRAW_SHA__: string;
}
interface Clipboard extends EventTarget {
diff --git a/src/index.tsx b/src/index.tsx
index f78ba77cbf..cd6671dd65 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -25,12 +25,16 @@ if (
const SentryEnvHostnameMap: { [key: string]: string } = {
"excalidraw.com": "production",
- "now.sh": "staging",
+ "vercel.app": "staging",
};
+const REACT_APP_DISABLE_SENTRY =
+ process.env.REACT_APP_DISABLE_SENTRY === "true";
+const REACT_APP_GIT_SHA = process.env.REACT_APP_GIT_SHA as string;
+
// Disable Sentry locally or inside the Docker to avoid noise/respect privacy
const onlineEnv =
- process.env.REACT_APP_DISABLE_SENTRY !== "true" &&
+ !REACT_APP_DISABLE_SENTRY &&
Object.keys(SentryEnvHostnameMap).find(
(item) => window.location.hostname.indexOf(item) >= 0,
);
@@ -40,7 +44,7 @@ Sentry.init({
? "https://[email protected]/5179260"
: undefined,
environment: onlineEnv ? SentryEnvHostnameMap[onlineEnv] : undefined,
- release: process.env.REACT_APP_GIT_SHA,
+ release: REACT_APP_GIT_SHA,
ignoreErrors: [
"undefined is not an object (evaluating 'window.__pad.performLoop')", // Only happens on Safari, but spams our servers. Doesn't break anything
],
@@ -51,6 +55,8 @@ Sentry.init({
],
});
+window.__EXCALIDRAW_SHA__ = REACT_APP_GIT_SHA;
+
// Block pinch-zooming on iOS outside of the content area
document.addEventListener(
"touchmove",