lazyload sentry preventing unauthorized connections

This commit is contained in:
pa
2025-11-16 17:37:32 +09:00
committed by Natsumi
parent eaa62bede0
commit 603b7b2013
4 changed files with 99 additions and 78 deletions
+77 -65
View File
@@ -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 {