add sentry for webui error reporting

This commit is contained in:
ArabCoders 2025-02-27 23:54:49 +03:00
parent 3a964a6ac3
commit 689ce421e9
6 changed files with 919 additions and 10 deletions

View file

@ -143,6 +143,9 @@ class Config:
file_logging: bool = False file_logging: bool = False
"Enable file logging." "Enable file logging."
sentry_dsn: str | None = None
"The Sentry DSN to use for error reporting."
_manual_vars: tuple = ( _manual_vars: tuple = (
"temp_path", "temp_path",
"config_path", "config_path",
@ -200,6 +203,7 @@ class Config:
"basic_mode", "basic_mode",
"default_preset", "default_preset",
"instance_title", "instance_title",
"sentry_dsn",
) )
"The variables that are relevant to the frontend." "The variables that are relevant to the frontend."

View file

@ -93,6 +93,7 @@ import 'assets/css/style.css'
import 'assets/css/all.css' import 'assets/css/all.css'
import { useStorage } from '@vueuse/core' import { useStorage } from '@vueuse/core'
import moment from 'moment' import moment from 'moment'
import * as Sentry from "@sentry/nuxt";
const Year = new Date().getFullYear() const Year = new Date().getFullYear()
const selectedTheme = useStorage('theme', 'auto') const selectedTheme = useStorage('theme', 'auto')
@ -144,6 +145,8 @@ const applyPreferredColorScheme = scheme => {
} }
} }
watch(() => config.app.sentry_dsn, dsn => dsn ? Sentry.init({ dsn: dsn }) : null)
onMounted(async () => { onMounted(async () => {
try { try {
applyPreferredColorScheme(selectedTheme.value) applyPreferredColorScheme(selectedTheme.value)

View file

@ -33,6 +33,7 @@ export default defineNuxtConfig({
domain: '/', domain: '/',
wss: process.env.VUE_APP_BASE_URL ?? '', wss: process.env.VUE_APP_BASE_URL ?? '',
version: '2.0.0', version: '2.0.0',
sentry: process.env.NUXT_PUBLIC_SENTRY_DSN ?? '',
} }
}, },
build: { build: {
@ -60,6 +61,7 @@ export default defineNuxtConfig({
'@pinia/nuxt', '@pinia/nuxt',
'@vueuse/nuxt', '@vueuse/nuxt',
'floating-vue/nuxt', 'floating-vue/nuxt',
'@sentry/nuxt/module',
], ],
nitro: { nitro: {

View file

@ -12,6 +12,7 @@
"web-types": "./web-types.json", "web-types": "./web-types.json",
"dependencies": { "dependencies": {
"@pinia/nuxt": "^0.5.1", "@pinia/nuxt": "^0.5.1",
"@sentry/nuxt": "^9.2.0",
"@vueuse/core": "^10.9.0", "@vueuse/core": "^10.9.0",
"@vueuse/nuxt": "^10.9.0", "@vueuse/nuxt": "^10.9.0",
"@xterm/addon-fit": "^0.10.0", "@xterm/addon-fit": "^0.10.0",

View file

@ -15,6 +15,7 @@ const CONFIG_KEYS = {
basic_mode: true, basic_mode: true,
default_preset: 'default', default_preset: 'default',
instance_title: null, instance_title: null,
sentry_dsn: null,
}, },
presets: [ presets: [
{ {

File diff suppressed because it is too large Load diff