Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix cast sentry

Manav Rathibd345c958315
diff --git a/apps/accounts/sentry.client.config.ts b/apps/accounts/sentry.client.config.ts
index 227d206117..760b53d76d 100644
--- a/apps/accounts/sentry.client.config.ts
+++ b/apps/accounts/sentry.client.config.ts
@@ -1,3 +1,3 @@
import { initSentry } from '@ente/shared/sentry/config/sentry.config.base';
-initSentry('https://[email protected]/2');
+initSentry('https://[email protected]/2');
diff --git a/apps/cast/sentry.server.config.js b/apps/accounts/sentry.edge.config.ts
similarity index 100%
rename from apps/cast/sentry.server.config.js
rename to apps/accounts/sentry.edge.config.ts
diff --git a/apps/accounts/sentry.properties b/apps/accounts/sentry.properties
index 3bcfe48bc1..425eb0d8d4 100644
--- a/apps/accounts/sentry.properties
+++ b/apps/accounts/sentry.properties
@@ -1,3 +1,6 @@
-defaults.url=https://sentry.ente.io/
-defaults.org=ente
-defaults.project=photos-web
+# This file is used by the SentryWebpackPlugin to upload sourcemaps when the
+# SENTRY_AUTH_TOKEN environment variable is defined.
+
+defaults.url = https://sentry.ente.io/
+defaults.org = ente
+defaults.project = photos-web
diff --git a/apps/auth/sentry.edge.config.ts b/apps/auth/sentry.edge.config.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/apps/auth/sentry.properties b/apps/auth/sentry.properties
index 60503f2c31..33acd8e222 100644
--- a/apps/auth/sentry.properties
+++ b/apps/auth/sentry.properties
@@ -1,3 +1,6 @@
-defaults.url=https://sentry.ente.io/
-defaults.org=ente
-defaults.project=auth-web
+# This file is used by the SentryWebpackPlugin to upload sourcemaps when the
+# SENTRY_AUTH_TOKEN environment variable is defined.
+
+defaults.url = https://sentry.ente.io/
+defaults.org = ente
+defaults.project = auth-web
diff --git a/apps/cast/configUtil.js b/apps/cast/configUtil.js
deleted file mode 100644
index 795cf15dc2..0000000000
--- a/apps/cast/configUtil.js
+++ /dev/null
@@ -1,53 +0,0 @@
-const cp = require('child_process');
-const { getIsSentryEnabled } = require('./sentryConfigUtil');
-
-module.exports = {
- WEB_SECURITY_HEADERS: {
- 'Strict-Transport-Security': ' max-age=63072000',
- 'X-Content-Type-Options': 'nosniff',
- 'X-Download-Options': 'noopen',
- 'X-Frame-Options': 'deny',
- 'X-XSS-Protection': '1; mode=block',
- 'Referrer-Policy': 'same-origin',
- },
-
- CSP_DIRECTIVES: {
- // self is safe enough
- 'default-src': "'self'",
- // data to allow two factor qr code
- 'img-src': "'self' blob: data: https://*.openstreetmap.org",
- 'media-src': "'self' blob:",
- 'manifest-src': "'self'",
- 'style-src': "'self' 'unsafe-inline'",
- 'font-src ': "'self'; script-src 'self' 'unsafe-eval' blob:",
- 'connect-src':
- "'self' https://*.ente.io http://localhost:8080 data: blob: https://ente-prod-eu.s3.eu-central-003.backblazeb2.com https://ente-prod-v3.s3.eu-central-2.wasabisys.com/ https://ente-staging-eu.s3.eu-central-003.backblazeb2.com/ ws://localhost:3000/",
- 'base-uri ': "'self'",
- // to allow worker
- 'child-src': "'self' blob:",
- 'object-src': "'none'",
- 'frame-ancestors': " 'none'",
- 'form-action': "'none'",
- 'report-uri': ' https://csp-reporter.ente.io/local',
- 'report-to': ' https://csp-reporter.ente.io/local',
- 'script-src-elem': "'self' https://www.gstatic.com",
- },
-
- ALL_ROUTES: '/(.*)',
-
- buildCSPHeader: (directives) => ({
- 'Content-Security-Policy-Report-Only': Object.entries(
- directives
- ).reduce((acc, [key, value]) => acc + `${key} ${value};`, ''),
- }),
-
- convertToNextHeaderFormat: (headers) =>
- Object.entries(headers).map(([key, value]) => ({ key, value })),
-
- getGitSha: () =>
- cp.execSync('git rev-parse --short HEAD', {
- cwd: __dirname,
- encoding: 'utf8',
- }),
- getIsSentryEnabled: getIsSentryEnabled,
-};
diff --git a/apps/cast/sentry.client.config.js b/apps/cast/sentry.client.config.js
deleted file mode 100644
index f07284c492..0000000000
--- a/apps/cast/sentry.client.config.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import { setupSentry } from '@ente/shared/sentry/config/sentry.config.base';
-setupSentry('https://[email protected]/2');
diff --git a/apps/cast/sentry.client.config.ts b/apps/cast/sentry.client.config.ts
new file mode 100644
index 0000000000..760b53d76d
--- /dev/null
+++ b/apps/cast/sentry.client.config.ts
@@ -0,0 +1,3 @@
+import { initSentry } from '@ente/shared/sentry/config/sentry.config.base';
+
+initSentry('https://[email protected]/2');
diff --git a/apps/cast/sentry.edge.config.ts b/apps/cast/sentry.edge.config.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/apps/cast/sentry.properties b/apps/cast/sentry.properties
index 3bcfe48bc1..425eb0d8d4 100644
--- a/apps/cast/sentry.properties
+++ b/apps/cast/sentry.properties
@@ -1,3 +1,6 @@
-defaults.url=https://sentry.ente.io/
-defaults.org=ente
-defaults.project=photos-web
+# This file is used by the SentryWebpackPlugin to upload sourcemaps when the
+# SENTRY_AUTH_TOKEN environment variable is defined.
+
+defaults.url = https://sentry.ente.io/
+defaults.org = ente
+defaults.project = photos-web
diff --git a/apps/cast/sentry.server.config.ts b/apps/cast/sentry.server.config.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/apps/cast/sentryConfigUtil.js b/apps/cast/sentryConfigUtil.js
deleted file mode 100644
index 84d4a76282..0000000000
--- a/apps/cast/sentryConfigUtil.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const ENV_DEVELOPMENT = 'development';
-
-module.exports.getIsSentryEnabled = () => {
- if (process.env.NEXT_PUBLIC_SENTRY_ENV === ENV_DEVELOPMENT) {
- return false;
- } else if (process.env.NEXT_PUBLIC_DISABLE_SENTRY === 'true') {
- return false;
- } else {
- return true;
- }
-};
diff --git a/apps/cast/src/constants/sentry.ts b/apps/cast/src/constants/sentry.ts
deleted file mode 100644
index a8a05aff9d..0000000000
--- a/apps/cast/src/constants/sentry.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-export const ENV_DEVELOPMENT = 'development';
-export const ENV_PRODUCTION = 'production';
-
-export const getSentryDSN = () =>
- process.env.NEXT_PUBLIC_SENTRY_DSN ??
- 'https://[email protected]/2';
-
-export const getSentryENV = () =>
- process.env.NEXT_PUBLIC_SENTRY_ENV ?? ENV_PRODUCTION;
-
-export const getSentryRelease = () => process.env.SENTRY_RELEASE;
-
-export { getIsSentryEnabled } from '../../sentryConfigUtil';
-
-export const isDEVSentryENV = () => getSentryENV() === ENV_DEVELOPMENT;
diff --git a/apps/photos/sentry.properties b/apps/photos/sentry.properties
index 850c6c258e..425eb0d8d4 100644
--- a/apps/photos/sentry.properties
+++ b/apps/photos/sentry.properties
@@ -1,5 +1,5 @@
-# This file is used by the SentryWebpackPlugin to upload sourcemaps (if the
-# SENTRY_AUTH_TOKEN environment variable is defined).
+# This file is used by the SentryWebpackPlugin to upload sourcemaps when the
+# SENTRY_AUTH_TOKEN environment variable is defined.
defaults.url = https://sentry.ente.io/
defaults.org = ente