mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
Add sentry dsn
This commit is contained in:
3
.github/workflows/github_actions.yml
vendored
3
.github/workflows/github_actions.yml
vendored
@@ -121,6 +121,9 @@ jobs:
|
|||||||
- name: Restore dependencies
|
- name: Restore dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Build Cef-html
|
- name: Build Cef-html
|
||||||
|
env:
|
||||||
|
SENTRY_URL: ${{ secrets.SentryUrl }}
|
||||||
|
SENTRY_AUTH_TOKEN: ${{ secrets.SentryAuthToken }}
|
||||||
run: npm run prod
|
run: npm run prod
|
||||||
- name: Upload Cef-html artifacts
|
- name: Upload Cef-html artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|||||||
@@ -1,29 +1,60 @@
|
|||||||
import * as Sentry from '@sentry/vue';
|
import * as Sentry from '@sentry/vue';
|
||||||
import configRepository from '../service/config';
|
import configRepository from '../service/config';
|
||||||
|
|
||||||
export function initSentry(app) {
|
export async function initSentry(app) {
|
||||||
configRepository
|
const enabled = await configRepository.getString(
|
||||||
.getString('VRCX_SentryEnabled', 'false')
|
'VRCX_SentryEnabled',
|
||||||
.then((enabled) => {
|
'false'
|
||||||
let isNightly = false;
|
);
|
||||||
AppApi.GetVersion().then(
|
const version = await AppApi.GetVersion();
|
||||||
(v) => (isNightly = v.includes('Nightly'))
|
const isNightly = version.includes('Nightly');
|
||||||
);
|
if (enabled !== 'true' || !isNightly) {
|
||||||
if (enabled === 'true' && isNightly) {
|
return;
|
||||||
Sentry.init({
|
}
|
||||||
app,
|
const vrcxId = await configRepository.getString('VRCX_id', '');
|
||||||
dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',
|
const response = await webApiService.execute({
|
||||||
environment: 'nightly',
|
url: 'https://api0.vrcx.app/errorreporting/getdsn',
|
||||||
replaysSessionSampleRate: 0.1,
|
method: 'GET',
|
||||||
replaysOnErrorSampleRate: 1.0,
|
headers: {
|
||||||
integrations: [
|
Referer: 'https://vrcx.app',
|
||||||
Sentry.replayIntegration({
|
'VRCX-ID': vrcxId
|
||||||
maskAllText: true,
|
}
|
||||||
blockAllMedia: true
|
});
|
||||||
})
|
if (response.status !== 200) {
|
||||||
]
|
console.error(
|
||||||
});
|
'Failed to get Sentry DSN:',
|
||||||
console.log('Sentry initialized');
|
response.status,
|
||||||
}
|
response.data
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const dsn = atob(response.data);
|
||||||
|
Sentry.init({
|
||||||
|
app,
|
||||||
|
dsn,
|
||||||
|
environment: 'nightly',
|
||||||
|
replaysSessionSampleRate: 0.1,
|
||||||
|
replaysOnErrorSampleRate: 1.0,
|
||||||
|
beforeSend(event, hint) {
|
||||||
|
if (
|
||||||
|
event.request?.status &&
|
||||||
|
(event.request.status === 404 ||
|
||||||
|
event.request.status === 403)
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
integrations: [
|
||||||
|
Sentry.replayIntegration({
|
||||||
|
maskAllText: true,
|
||||||
|
blockAllMedia: true
|
||||||
|
})
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
console.log('Sentry initialized');
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Failed to initialize Sentry:', e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,18 +5,21 @@ import { fileURLToPath } from 'node:url';
|
|||||||
import { dirname, resolve } from 'node:path';
|
import { dirname, resolve } from 'node:path';
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const url = process.env.SENTRY_URL;
|
||||||
|
const authToken = process.env.SENTRY_AUTH_TOKEN;
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig(() => ({
|
export default defineConfig(() => ({
|
||||||
base: '',
|
base: '',
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
sentryVitePlugin({
|
url &&
|
||||||
authToken: process.env.SENTRY_AUTH_TOKEN,
|
sentryVitePlugin({
|
||||||
org: 'example',
|
url,
|
||||||
project: 'vrcx-web',
|
authToken,
|
||||||
url: 'https://example.example.example/'
|
org: 'vrcx',
|
||||||
})
|
project: 'vrcx-web'
|
||||||
|
})
|
||||||
],
|
],
|
||||||
define: {
|
define: {
|
||||||
LINUX: JSON.stringify(process.env.PLATFORM === 'linux'),
|
LINUX: JSON.stringify(process.env.PLATFORM === 'linux'),
|
||||||
|
|||||||
Reference in New Issue
Block a user