mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 22:33:50 +02:00
lazyload sentry preventing unauthorized connections
This commit is contained in:
@@ -15,11 +15,12 @@ import {
|
||||
initRouter,
|
||||
initSentry
|
||||
} from './plugin';
|
||||
import { pinia } from './stores';
|
||||
import { initPiniaPlugins, pinia } from './stores';
|
||||
|
||||
import App from './App.vue';
|
||||
|
||||
await initPlugins();
|
||||
await initPiniaPlugins();
|
||||
|
||||
// #region | Hey look it's most of VRCX!
|
||||
|
||||
|
||||
@@ -215,8 +215,6 @@
|
||||
import { THEME_CONFIG } from '../shared/constants';
|
||||
import { openExternalLink } from '../shared/utils';
|
||||
|
||||
import * as Sentry from '@sentry/vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
|
||||
@@ -457,8 +455,10 @@
|
||||
onMounted(() => {
|
||||
if (!sentryErrorReporting.value) return;
|
||||
try {
|
||||
const feedback = Sentry.getFeedback();
|
||||
feedback?.attachTo(document.getElementById('feedback'));
|
||||
import('@sentry/vue').then((Sentry) => {
|
||||
const feedback = Sentry.getFeedback();
|
||||
feedback?.attachTo(document.getElementById('feedback'));
|
||||
});
|
||||
window.addEventListener('keydown', handleKeydown);
|
||||
} catch (error) {
|
||||
console.error('Error setting up Sentry feedback:', error);
|
||||
|
||||
@@ -2,17 +2,24 @@ import { router } from './router';
|
||||
|
||||
import configRepository from '../service/config';
|
||||
|
||||
import * as Sentry from '@sentry/vue';
|
||||
let version = '';
|
||||
|
||||
export async function isSentryEnabled() {
|
||||
const enabled = await configRepository.getString(
|
||||
'VRCX_SentryEnabled',
|
||||
'false'
|
||||
);
|
||||
version = await AppApi.GetVersion();
|
||||
const isNightly = version.includes('Nightly');
|
||||
if (enabled !== 'true' || !isNightly) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function initSentry(app) {
|
||||
try {
|
||||
const enabled = await configRepository.getString(
|
||||
'VRCX_SentryEnabled',
|
||||
'false'
|
||||
);
|
||||
const version = await AppApi.GetVersion();
|
||||
const isNightly = version.includes('Nightly');
|
||||
if (enabled !== 'true' || !isNightly) {
|
||||
if (!(await isSentryEnabled())) {
|
||||
return;
|
||||
}
|
||||
const vrcxId = await configRepository.getString('VRCX_id', '');
|
||||
@@ -33,6 +40,7 @@ export async function initSentry(app) {
|
||||
return;
|
||||
}
|
||||
const dsn = atob(response.data);
|
||||
const Sentry = await import('@sentry/vue');
|
||||
Sentry.init({
|
||||
app,
|
||||
dsn,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { createPinia } from 'pinia';
|
||||
import { createSentryPiniaPlugin } from '@sentry/vue';
|
||||
|
||||
import { isSentryEnabled } from '../plugin';
|
||||
import { useAdvancedSettingsStore } from './settings/advanced';
|
||||
import { useAppearanceSettingsStore } from './settings/appearance';
|
||||
import { useAuthStore } from './auth';
|
||||
@@ -37,74 +38,85 @@ import { useWristOverlaySettingsStore } from './settings/wristOverlay';
|
||||
|
||||
export const pinia = createPinia();
|
||||
|
||||
pinia.use(
|
||||
createSentryPiniaPlugin({
|
||||
stateTransformer: (state) => ({
|
||||
...state,
|
||||
Auth: null,
|
||||
Feed: null,
|
||||
Favorite: null,
|
||||
Friend: null,
|
||||
User: {
|
||||
// @ts-ignore
|
||||
...state.User,
|
||||
currentUser: null,
|
||||
subsetOfLanguages: null,
|
||||
languageDialog: {
|
||||
async function registerSentryPiniaPlugin() {
|
||||
if (!(await isSentryEnabled())) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Sentry = await import('@sentry/vue');
|
||||
pinia.use(
|
||||
Sentry.createSentryPiniaPlugin({
|
||||
stateTransformer: (state) => ({
|
||||
...state,
|
||||
Auth: null,
|
||||
Feed: null,
|
||||
Favorite: null,
|
||||
Friend: null,
|
||||
User: {
|
||||
// @ts-ignore
|
||||
...state.User.languageDialog,
|
||||
languages: null
|
||||
...state.User,
|
||||
currentUser: null,
|
||||
subsetOfLanguages: null,
|
||||
languageDialog: {
|
||||
// @ts-ignore
|
||||
...state.User.languageDialog,
|
||||
languages: null
|
||||
}
|
||||
},
|
||||
GameLog: {
|
||||
// @ts-ignore
|
||||
...state.GameLog,
|
||||
gameLogTable: null,
|
||||
gameLogSessionTable: null
|
||||
},
|
||||
Notification: {
|
||||
// @ts-ignore
|
||||
...state.Notification,
|
||||
notificationTable: null
|
||||
},
|
||||
Moderation: {
|
||||
// @ts-ignore
|
||||
...state.Moderation,
|
||||
playerModerationTable: null,
|
||||
cachedPlayerModerations: null,
|
||||
cachedPlayerModerationsUserIds: null
|
||||
},
|
||||
Photon: null,
|
||||
SharedFeed: {
|
||||
// @ts-ignore
|
||||
...state.SharedFeed,
|
||||
sharedFeed: null
|
||||
},
|
||||
Group: {
|
||||
// @ts-ignore
|
||||
...state.Group,
|
||||
groupInstances: null,
|
||||
inGameGroupOrder: null
|
||||
},
|
||||
Avatar: {
|
||||
// @ts-ignore
|
||||
...state.Avatar,
|
||||
avatarHistory: null
|
||||
},
|
||||
Gallery: {
|
||||
// @ts-ignore
|
||||
...state.Gallery,
|
||||
emojiTable: null,
|
||||
galleryTable: null,
|
||||
instanceStickersCache: null,
|
||||
inventoryTable: null,
|
||||
printTable: null,
|
||||
stickerTable: null,
|
||||
VRCPlusIconsTable: null
|
||||
}
|
||||
},
|
||||
GameLog: {
|
||||
// @ts-ignore
|
||||
...state.GameLog,
|
||||
gameLogTable: null,
|
||||
gameLogSessionTable: null
|
||||
},
|
||||
Notification: {
|
||||
// @ts-ignore
|
||||
...state.Notification,
|
||||
notificationTable: null
|
||||
},
|
||||
Moderation: {
|
||||
// @ts-ignore
|
||||
...state.Moderation,
|
||||
playerModerationTable: null,
|
||||
cachedPlayerModerations: null,
|
||||
cachedPlayerModerationsUserIds: null
|
||||
},
|
||||
Photon: null,
|
||||
SharedFeed: {
|
||||
// @ts-ignore
|
||||
...state.SharedFeed,
|
||||
sharedFeed: null
|
||||
},
|
||||
Group: {
|
||||
// @ts-ignore
|
||||
...state.Group,
|
||||
groupInstances: null,
|
||||
inGameGroupOrder: null
|
||||
},
|
||||
Avatar: {
|
||||
// @ts-ignore
|
||||
...state.Avatar,
|
||||
avatarHistory: null
|
||||
},
|
||||
Gallery: {
|
||||
// @ts-ignore
|
||||
...state.Gallery,
|
||||
emojiTable: null,
|
||||
galleryTable: null,
|
||||
instanceStickersCache: null,
|
||||
inventoryTable: null,
|
||||
printTable: null,
|
||||
stickerTable: null,
|
||||
VRCPlusIconsTable: null
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
export async function initPiniaPlugins() {
|
||||
await registerSentryPiniaPlugin();
|
||||
}
|
||||
|
||||
export function createGlobalStores() {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user