Clean up, handle sentry init fail

This commit is contained in:
Natsumi
2025-11-14 17:45:36 +11:00
parent 747204171a
commit c11a79f76f
3 changed files with 85 additions and 72 deletions

View File

@@ -5,33 +5,33 @@ import configRepository from '../service/config';
import * as Sentry from '@sentry/vue';
export async function initSentry(app) {
const enabled = await configRepository.getString(
'VRCX_SentryEnabled',
'false'
);
const version = await AppApi.GetVersion();
const isNightly = version.includes('Nightly');
if (enabled !== 'true' || !isNightly) {
return;
}
const vrcxId = await configRepository.getString('VRCX_id', '');
const response = await webApiService.execute({
url: 'https://api0.vrcx.app/errorreporting/getdsn',
method: 'GET',
headers: {
Referer: 'https://vrcx.app',
'VRCX-ID': vrcxId
}
});
if (response.status !== 200) {
console.error(
'Failed to get Sentry DSN:',
response.status,
response.data
);
return;
}
try {
const enabled = await configRepository.getString(
'VRCX_SentryEnabled',
'false'
);
const version = await AppApi.GetVersion();
const isNightly = version.includes('Nightly');
if (enabled !== 'true' || !isNightly) {
return;
}
const vrcxId = await configRepository.getString('VRCX_id', '');
const response = await webApiService.execute({
url: 'https://api0.vrcx.app/errorreporting/getdsn',
method: 'GET',
headers: {
Referer: 'https://vrcx.app',
'VRCX-ID': vrcxId
}
});
if (response.status !== 200) {
console.error(
'Failed to get Sentry DSN:',
response.status,
response.data
);
return;
}
const dsn = atob(response.data);
Sentry.init({
app,