feat: disable sentry if telemetry is off
This commit is contained in:
@@ -57,6 +57,7 @@ import { logPageView } from "~/helpers/fb/analytics"
|
||||
import { hookKeybindingsListener } from "~/helpers/keybindings"
|
||||
import { defineActionHandler } from "~/helpers/actions"
|
||||
import useWindowSize from "~/helpers/utils/useWindowSize"
|
||||
import { useSentry } from "~/helpers/sentry"
|
||||
|
||||
function appLayout() {
|
||||
const rightSidebar = useSetting("SIDEBAR")
|
||||
@@ -80,6 +81,23 @@ function appLayout() {
|
||||
})
|
||||
}
|
||||
|
||||
function setupSentry() {
|
||||
const sentry = useSentry()
|
||||
const telemetryEnabled = useSetting("TELEMETRY_ENABLED")
|
||||
|
||||
// Disable sentry error reporting if no telemetry allowed
|
||||
watch(
|
||||
telemetryEnabled,
|
||||
() => {
|
||||
const client = sentry.getCurrentHub()?.getClient()
|
||||
if (!client) return
|
||||
|
||||
client.getOptions().enabled = telemetryEnabled.value
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
}
|
||||
|
||||
function updateThemes() {
|
||||
const { $colorMode } = useContext() as any
|
||||
|
||||
@@ -140,6 +158,7 @@ export default defineComponent({
|
||||
|
||||
updateThemes()
|
||||
|
||||
setupSentry()
|
||||
return {
|
||||
windowInnerWidth: useWindowSize(),
|
||||
ZEN_MODE: useSetting("ZEN_MODE"),
|
||||
|
||||
Reference in New Issue
Block a user