add Sentry error reporting option

This commit is contained in:
pa
2025-09-14 17:43:09 +09:00
committed by Natsumi
parent 76ca91dcc2
commit 7bd7b4ae71
10 changed files with 267 additions and 26 deletions

33
src/plugin/sentry.js Normal file
View File

@@ -0,0 +1,33 @@
import * as Sentry from '@sentry/vue';
import configRepository from '../service/config';
export function initSentry(app) {
configRepository
.getString('VRCX_SentryEnabled', 'false')
.then((enabled) => {
let isNightly = false;
AppApi.GetVersion().then(
(v) => (isNightly = v.includes('Nightly'))
);
if (enabled === 'true' && isNightly) {
Sentry.init({
app,
dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',
environment: 'nightly',
sampleRate: 0.1,
beforeSend(event) {
if (
event.message &&
(event.message.toLowerCase().includes('password') ||
event.message.toLowerCase().includes('token'))
) {
return null;
}
return event;
},
integrations: []
});
console.log('Sentry initialized');
}
});
}