mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-05 14:26:06 +02:00
add Sentry error reporting option
This commit is contained in:
+2
-3
@@ -6,9 +6,7 @@
|
||||
|
||||
import { createApp } from 'vue';
|
||||
import { pinia } from './stores';
|
||||
import { initPlugins } from './plugin';
|
||||
import { i18n } from './plugin/i18n';
|
||||
import { initComponents } from './plugin/components';
|
||||
import { initPlugins, i18n, initComponents, initSentry } from './plugin';
|
||||
import ElementPlus from 'element-plus';
|
||||
import App from './App.vue';
|
||||
|
||||
@@ -22,6 +20,7 @@ app.use(pinia);
|
||||
app.use(i18n);
|
||||
app.use(ElementPlus);
|
||||
initComponents(app);
|
||||
initSentry(app);
|
||||
|
||||
app.mount('#root');
|
||||
|
||||
|
||||
+4
-4
@@ -8,10 +8,6 @@
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
//
|
||||
|
||||
@use './assets/scss/flags.scss';
|
||||
@use './assets/scss/animated-emoji.scss';
|
||||
@use 'element-plus/theme-chalk/src/index.scss' as *;
|
||||
|
||||
@use '@fontsource/noto-sans-kr/korean.css';
|
||||
@use '@fontsource/noto-sans-jp/japanese.css';
|
||||
@use '@fontsource/noto-sans-sc/chinese-simplified.css';
|
||||
@@ -21,6 +17,10 @@
|
||||
@use '@fontsource/noto-sans-sc';
|
||||
@use '@fontsource/noto-sans-tc';
|
||||
|
||||
@use './assets/scss/flags.scss';
|
||||
@use './assets/scss/animated-emoji.scss';
|
||||
@use 'element-plus/theme-chalk/src/index.scss' as *;
|
||||
|
||||
@use 'element-plus/theme-chalk/src/dark/css-vars.scss';
|
||||
@use 'animate.css/animate.min.css';
|
||||
@use 'noty/lib/noty.css';
|
||||
|
||||
@@ -11,3 +11,7 @@ export async function initPlugins(isVrOverlay = false) {
|
||||
initDayjs();
|
||||
initNoty(isVrOverlay);
|
||||
}
|
||||
|
||||
export * from './i18n';
|
||||
export * from './components';
|
||||
export * from './sentry';
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -32,7 +32,10 @@ import { useVrcxStore } from './vrcx';
|
||||
import { useVRCXUpdaterStore } from './vrcxUpdater';
|
||||
import { useWorldStore } from './world';
|
||||
|
||||
import { createSentryPiniaPlugin } from '@sentry/vue';
|
||||
|
||||
export const pinia = createPinia();
|
||||
pinia.use(createSentryPiniaPlugin());
|
||||
|
||||
export function createGlobalStores() {
|
||||
return {
|
||||
|
||||
@@ -8,11 +8,13 @@ import webApiService from '../../service/webapi';
|
||||
import { watchState } from '../../service/watchState';
|
||||
import { useGameStore } from '../game';
|
||||
import { useVrcxStore } from '../vrcx';
|
||||
import { useVRCXUpdaterStore } from '../vrcxUpdater';
|
||||
import { AppDebug } from '../../service/appConfig';
|
||||
|
||||
export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
const gameStore = useGameStore();
|
||||
const vrcxStore = useVrcxStore();
|
||||
const VRCXUpdaterStore = useVRCXUpdaterStore();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -47,7 +49,8 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
isVRChatConfigDialogVisible: false,
|
||||
saveInstanceEmoji: false,
|
||||
vrcRegistryAutoBackup: true,
|
||||
vrcRegistryAskRestore: true
|
||||
vrcRegistryAskRestore: true,
|
||||
sentryErrorReporting: false
|
||||
});
|
||||
|
||||
async function initAdvancedSettings() {
|
||||
@@ -78,7 +81,8 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
notificationOpacity,
|
||||
saveInstanceEmoji,
|
||||
vrcRegistryAutoBackup,
|
||||
vrcRegistryAskRestore
|
||||
vrcRegistryAskRestore,
|
||||
sentryErrorReporting
|
||||
] = await Promise.all([
|
||||
configRepository.getBool('enablePrimaryPassword', false),
|
||||
configRepository.getBool('VRCX_relaunchVRChatAfterCrash', false),
|
||||
@@ -118,7 +122,8 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
configRepository.getFloat('VRCX_notificationOpacity', 100),
|
||||
configRepository.getBool('VRCX_saveInstanceEmoji', false),
|
||||
configRepository.getBool('VRCX_vrcRegistryAutoBackup', true),
|
||||
configRepository.getBool('VRCX_vrcRegistryAskRestore', true)
|
||||
configRepository.getBool('VRCX_vrcRegistryAskRestore', true),
|
||||
configRepository.getString('VRCX_SentryEnabled', 'false')
|
||||
]);
|
||||
|
||||
state.enablePrimaryPassword = enablePrimaryPassword;
|
||||
@@ -148,8 +153,18 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
state.saveInstanceEmoji = saveInstanceEmoji;
|
||||
state.vrcRegistryAutoBackup = vrcRegistryAutoBackup;
|
||||
state.vrcRegistryAskRestore = vrcRegistryAskRestore;
|
||||
state.sentryErrorReporting = sentryErrorReporting === 'true';
|
||||
|
||||
handleSetAppLauncherSettings();
|
||||
|
||||
setTimeout(() => {
|
||||
if (
|
||||
VRCXUpdaterStore.branch === 'Nightly' &&
|
||||
sentryErrorReporting === ''
|
||||
) {
|
||||
checkSentryConsent();
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
initAdvancedSettings();
|
||||
@@ -225,6 +240,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
});
|
||||
const vrcRegistryAutoBackup = computed(() => state.vrcRegistryAutoBackup);
|
||||
const vrcRegistryAskRestore = computed(() => state.vrcRegistryAskRestore);
|
||||
const sentryErrorReporting = computed(() => state.sentryErrorReporting);
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
@@ -422,6 +438,69 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
);
|
||||
}
|
||||
|
||||
async function checkSentryConsent() {
|
||||
ElMessageBox.confirm(
|
||||
'Help improve VRCX by allowing anonymous error reporting?\n\n' +
|
||||
'• Only collects crash and error information\n' +
|
||||
'• No personal data or VRChat information is collected\n' +
|
||||
'• Only enabled in nightly builds\n' +
|
||||
'• Can be disabled anytime in Advanced Settings',
|
||||
'Anonymous Error Reporting',
|
||||
{
|
||||
type: 'info',
|
||||
center: true
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
state.sentryErrorReporting = true;
|
||||
configRepository.setString('VRCX_SentryEnabled', 'true');
|
||||
|
||||
ElMessageBox.confirm(
|
||||
'Error reporting setting has been enabled. Would you like to restart VRCX now for the change to take effect?',
|
||||
'Restart Required',
|
||||
{
|
||||
confirmButtonText: 'Restart Now',
|
||||
cancelButtonText: 'Later',
|
||||
type: 'info',
|
||||
center: true
|
||||
}
|
||||
).then(() => {
|
||||
VRCXUpdaterStore.restartVRCX(false);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
state.sentryErrorReporting = false;
|
||||
configRepository.setString('VRCX_SentryEnabled', 'false');
|
||||
});
|
||||
}
|
||||
|
||||
async function setSentryErrorReporting() {
|
||||
if (VRCXUpdaterStore.branch !== 'Nightly') {
|
||||
return;
|
||||
}
|
||||
|
||||
state.sentryErrorReporting = !state.sentryErrorReporting;
|
||||
await configRepository.setString(
|
||||
'VRCX_SentryEnabled',
|
||||
state.sentryErrorReporting ? 'true' : 'false'
|
||||
);
|
||||
|
||||
ElMessageBox.confirm(
|
||||
'Error reporting setting has been disabled. Would you like to restart VRCX now for the change to take effect?',
|
||||
'Restart Required',
|
||||
{
|
||||
confirmButtonText: 'Restart Now',
|
||||
cancelButtonText: 'Later',
|
||||
type: 'info',
|
||||
center: true
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
VRCXUpdaterStore.restartVRCX(false);
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
async function getSqliteTableSizes() {
|
||||
const [
|
||||
gps,
|
||||
@@ -726,6 +805,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
saveInstanceEmoji,
|
||||
vrcRegistryAutoBackup,
|
||||
vrcRegistryAskRestore,
|
||||
sentryErrorReporting,
|
||||
|
||||
setEnablePrimaryPasswordConfigRepository,
|
||||
setRelaunchVRChatAfterCrash,
|
||||
@@ -764,6 +844,8 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
setSaveInstanceEmoji,
|
||||
setVrcRegistryAutoBackup,
|
||||
setVrcRegistryAskRestore,
|
||||
setSentryErrorReporting,
|
||||
checkSentryConsent,
|
||||
askDeleteAllScreenshotMetadata
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1486,6 +1486,17 @@
|
||||
setSelfInviteOverride();
|
||||
saveOpenVROption();
|
||||
" />
|
||||
|
||||
<!--//- Sentry Error Reporting (Nightly Only)-->
|
||||
<div v-if="isNightlyBuild">
|
||||
<span class="sub-header">Anonymous Error Reporting (Nightly Only)</span>
|
||||
<simple-switch
|
||||
label="Help improve VRCX by sending anonymous error reports. Only collects crash and error information, no personal data or VRChat information is collected."
|
||||
:value="sentryErrorReporting"
|
||||
:long-label="true"
|
||||
@change="setSentryErrorReporting()" />
|
||||
</div>
|
||||
|
||||
<!--//- Advanced | Disable local world database-->
|
||||
</div>
|
||||
|
||||
@@ -2164,7 +2175,9 @@
|
||||
ugcFolderPath,
|
||||
notificationOpacity,
|
||||
autoDeleteOldPrints,
|
||||
saveInstanceEmoji
|
||||
saveInstanceEmoji,
|
||||
sentryErrorReporting,
|
||||
isNightlyBuild
|
||||
} = storeToRefs(advancedSettingsStore);
|
||||
|
||||
const {
|
||||
@@ -2192,6 +2205,7 @@
|
||||
showVRChatConfig,
|
||||
promptAutoClearVRCXCacheFrequency,
|
||||
setSaveInstanceEmoji,
|
||||
setSentryErrorReporting,
|
||||
askDeleteAllScreenshotMetadata
|
||||
} = advancedSettingsStore;
|
||||
|
||||
|
||||
+2
-2
@@ -8,8 +8,6 @@
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
//
|
||||
|
||||
@use '../assets/scss/flags.scss';
|
||||
|
||||
@use '@fontsource/noto-sans-kr/korean.css';
|
||||
@use '@fontsource/noto-sans-jp/japanese.css';
|
||||
@use '@fontsource/noto-sans-sc/chinese-simplified.css';
|
||||
@@ -19,6 +17,8 @@
|
||||
@use '@fontsource/noto-sans-sc';
|
||||
@use '@fontsource/noto-sans-tc';
|
||||
|
||||
@use '../assets/scss/flags.scss';
|
||||
|
||||
@use 'animate.css/animate.min.css';
|
||||
@use 'noty/lib/noty.css';
|
||||
@use 'remixicon/fonts/remixicon.css';
|
||||
|
||||
Reference in New Issue
Block a user