From 37afeb92cb224623c94a71675f161559acd61923 Mon Sep 17 00:00:00 2001 From: Aly Fluckey Date: Tue, 28 Nov 2023 13:18:53 -0500 Subject: [PATCH 1/3] feat(glean): enable glean in prod --- modules/glean/runtime/glean-plugin.client.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/glean/runtime/glean-plugin.client.ts b/modules/glean/runtime/glean-plugin.client.ts index 04ad40bd77..32796ee614 100644 --- a/modules/glean/runtime/glean-plugin.client.ts +++ b/modules/glean/runtime/glean-plugin.client.ts @@ -1,10 +1,10 @@ import Glean from '@mozilla/glean/web' import * as log from 'tauri-plugin-log-api' -import { linkClick, pageUrl, pageView, referrerUrl } from '../../../telemetry/generated/web' -import { userAgent } from '../../../telemetry/generated/identifiers' -import { engagement } from '../../../telemetry/generated/ui' -import { engagementDetails } from '../../../telemetry/engagementDetails' +import { userAgent } from '~~/telemetry/generated/identifiers' +import { engagement } from '~~/telemetry/generated/ui' +import { engagementDetails } from '~~/telemetry/engagementDetails' +import { linkClick, pageUrl, pageView, referrerUrl } from '~~/telemetry/generated/web' export default defineNuxtPlugin((nuxtApp) => { nuxtApp.hook('app:mounted', () => { @@ -13,9 +13,11 @@ export default defineNuxtPlugin((nuxtApp) => { const GLEAN_APP_ID = 'moso-mastodon-web' const env = useAppConfig().env const devMode = env === ('dev' || 'canary' || 'preview') + const prodMode = env === 'release' + const gleanEnabled = (devMode || prodMode) const userSettings = useUserSettings() - const allowGlean = getPreferences(userSettings.value, 'allowGlean') - const uploadEnabled = devMode && allowGlean + const userAllowGlean = getPreferences(userSettings.value, 'allowGlean') + const uploadEnabled = gleanEnabled && userAllowGlean Glean.initialize(GLEAN_APP_ID, uploadEnabled, { channel: env }) userAgent.set(navigator.userAgent) From 229829fdf6be4558c0a39fef86fbae504244037f Mon Sep 17 00:00:00 2001 From: Aly Fluckey Date: Tue, 28 Nov 2023 13:20:13 -0500 Subject: [PATCH 2/3] fix(imports): rearrange --- modules/glean/runtime/glean-plugin.client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/glean/runtime/glean-plugin.client.ts b/modules/glean/runtime/glean-plugin.client.ts index 32796ee614..e9d9757b85 100644 --- a/modules/glean/runtime/glean-plugin.client.ts +++ b/modules/glean/runtime/glean-plugin.client.ts @@ -3,8 +3,8 @@ import * as log from 'tauri-plugin-log-api' import { userAgent } from '~~/telemetry/generated/identifiers' import { engagement } from '~~/telemetry/generated/ui' -import { engagementDetails } from '~~/telemetry/engagementDetails' import { linkClick, pageUrl, pageView, referrerUrl } from '~~/telemetry/generated/web' +import { engagementDetails } from '~~/telemetry/engagementDetails' export default defineNuxtPlugin((nuxtApp) => { nuxtApp.hook('app:mounted', () => { From 90ef3ca922c2c6ca4f3fa1abf3886927839dc2bc Mon Sep 17 00:00:00 2001 From: Aly Fluckey Date: Wed, 29 Nov 2023 14:34:51 -0500 Subject: [PATCH 3/3] feat(glean): remove env check --- modules/glean/runtime/glean-plugin.client.ts | 8 +++----- pages/settings.vue | 2 -- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/glean/runtime/glean-plugin.client.ts b/modules/glean/runtime/glean-plugin.client.ts index e9d9757b85..d4b8e2c2df 100644 --- a/modules/glean/runtime/glean-plugin.client.ts +++ b/modules/glean/runtime/glean-plugin.client.ts @@ -11,13 +11,11 @@ export default defineNuxtPlugin((nuxtApp) => { log.info('Glean: App mounted, start initing glean') const GLEAN_APP_ID = 'moso-mastodon-web' - const env = useAppConfig().env - const devMode = env === ('dev' || 'canary' || 'preview') - const prodMode = env === 'release' - const gleanEnabled = (devMode || prodMode) + const env = useBuildInfo().env + const devMode = env === 'dev' const userSettings = useUserSettings() const userAllowGlean = getPreferences(userSettings.value, 'allowGlean') - const uploadEnabled = gleanEnabled && userAllowGlean + const uploadEnabled = userAllowGlean Glean.initialize(GLEAN_APP_ID, uploadEnabled, { channel: env }) userAgent.set(navigator.userAgent) diff --git a/pages/settings.vue b/pages/settings.vue index b050619e01..a36ae006de 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -12,7 +12,6 @@ useHydratedHead({ const route = useRoute() const isRootPath = computedEager(() => route.name === 'settings') -const devMode = useAppConfig().env === ('dev' || 'canary' || 'preview')