This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
forked from elk-zone/elk
-
Notifications
You must be signed in to change notification settings - Fork 7
feat(glean): enable glean in prod - SOCWEB-145 #92
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
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 { linkClick, pageUrl, pageView, referrerUrl } from '~~/telemetry/generated/web' | ||
import { engagementDetails } from '~~/telemetry/engagementDetails' | ||
|
||
export default defineNuxtPlugin((nuxtApp) => { | ||
nuxtApp.hook('app:mounted', () => { | ||
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 env = useBuildInfo().env | ||
const devMode = env === 'dev' | ||
const userSettings = useUserSettings() | ||
const allowGlean = getPreferences(userSettings.value, 'allowGlean') | ||
const uploadEnabled = devMode && allowGlean | ||
const userAllowGlean = getPreferences(userSettings.value, 'allowGlean') | ||
const uploadEnabled = userAllowGlean | ||
Comment on lines
+14
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have removed the environment check from |
||
|
||
Glean.initialize(GLEAN_APP_ID, uploadEnabled, { channel: env }) | ||
userAgent.set(navigator.userAgent) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ useHydratedHead({ | |
const route = useRoute() | ||
|
||
const isRootPath = computedEager(() => route.name === 'settings') | ||
const devMode = useAppConfig().env === ('dev' || 'canary' || 'preview') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
</script> | ||
|
||
<template> | ||
|
@@ -65,7 +64,6 @@ const devMode = useAppConfig().env === ('dev' || 'canary' || 'preview') | |
:match="$route.path.startsWith('/settings/preferences/')" | ||
/> | ||
<SettingsItem | ||
v-if="devMode" | ||
command | ||
icon="i-ri-lock-line" | ||
:text="isHydrated ? $t('settings.privacy.label') : ''" | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
~~
syntax is new and exciting to me! Are you able to share documentation on how this works? Does it work in all environments? Unix/Windows etc?If this is a home path, can we be sure it leads to the same place, vs traversing relatively?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a fun one to track down! It's built into Nuxt actually: https://nuxt.com/docs/api/nuxt-config#alias. It looks like the
~~
will always lead to/<rootDir>