zwischenstand

This commit is contained in:
2025-10-02 09:03:39 +00:00
parent 099530b7c8
commit f3dc0dc9bd
52 changed files with 994 additions and 5602 deletions

View File

@@ -2,41 +2,50 @@ import * as Sentry from "@sentry/svelte"
let initialized = false
export const init = (dsn: string, tracingOrigins: (string | RegExp)[], environment: string, release: string) => {
if (typeof window !== "undefined") {
Sentry.init({
dsn: dsn,
tunnel: "/_s",
integrations: [
new Sentry.BrowserTracing({
tracingOrigins: tracingOrigins,
traceFetch: false,
traceXHR: false,
}),
new Sentry.Replay({
maskAllText: false,
maskAllInputs: false,
blockAllMedia: false,
networkDetailAllowUrls: [/\/api\//, /\/tibiapi\//],
}),
],
environment: environment,
tracesSampleRate: 1.0,
debug: false,
release: release,
replaysSessionSampleRate: 1.0,
replaysOnErrorSampleRate: 1.0,
})
console.log("Sentry initialized")
initialized = true
export const init = (
dsn: string | undefined,
_tracingOrigins: (string | RegExp)[] = [],
environment?: string,
release?: string
) => {
if (!dsn || typeof window === "undefined" || initialized) {
return
}
Sentry.init({
dsn,
tunnel: "/_s",
environment,
release,
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration({
maskAllText: false,
maskAllInputs: false,
blockAllMedia: false,
}),
],
tracesSampleRate: 1.0,
replaysSessionSampleRate: 1.0,
replaysOnErrorSampleRate: 1.0,
})
initialized = true
}
export const currentTransaction = () => Sentry.getCurrentHub().getScope().getTransaction()
export const currentTransaction = () => {
try {
const hub = (Sentry as any).getCurrentHub?.()
return hub?.getScope?.()?.getTransaction?.() ?? null
} catch {
return null
}
}
export const setUser = (user: Sentry.User) => {
if (typeof window !== "undefined" && initialized) {
user.ip_address = "{{auto}}"
Sentry.setUser(user)
if (!initialized || typeof window === "undefined") {
return
}
Sentry.setUser({ ...user, ip_address: "{{auto}}" })
}