🔧 Simplify developer tools availability logic by removing authentication checks and using a feature flag
This commit is contained in:
@@ -120,36 +120,20 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||
import { useAuth } from '../composables/useAuth.js';
|
||||
import { useDiscordOAuth } from '../composables/useDiscordOAuth.js';
|
||||
import { useFeatureFlags } from '../composables/useFeatureFlags.js';
|
||||
|
||||
const { user, token } = useAuth();
|
||||
const discord = useDiscordOAuth();
|
||||
const {
|
||||
getFlags,
|
||||
toggle: toggleFlagOverride,
|
||||
resetAll: resetAllOverrides
|
||||
resetAll: resetAllOverrides,
|
||||
isEnabled
|
||||
} = useFeatureFlags();
|
||||
|
||||
const isOpen = ref(false);
|
||||
|
||||
// Show in development mode or when authenticated with permission in production
|
||||
// Always show in development mode, otherwise only if enabled via feature flag
|
||||
const isAvailable = computed(() => {
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
// Check JWT token permissions
|
||||
const hasJwtPermission = user.value?.permissions?.includes(
|
||||
'developer_tools.view'
|
||||
);
|
||||
|
||||
// Check Discord OAuth permissions
|
||||
const hasDiscordPermission = discord.hasDevAccess();
|
||||
|
||||
const hasPermission = hasJwtPermission || hasDiscordPermission;
|
||||
const isAuthenticatedInProduction =
|
||||
process.env.NODE_ENV === 'production' && hasPermission;
|
||||
return isDev || isAuthenticatedInProduction;
|
||||
return process.env.NODE_ENV === 'development' || isEnabled('developer-tools');
|
||||
});
|
||||
const nodeEnv = computed(() => process.env.NODE_ENV || 'unknown');
|
||||
const appVersion = computed(
|
||||
|
||||
Reference in New Issue
Block a user