mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 22:33:50 +02:00
Clean up, handle sentry init fail
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user