- Updated OAuth endpoints for Challonge and Discord in platforms configuration. - Implemented session and CSRF cookie initialization in main application entry. - Enhanced Challonge API client to avoid sending sensitive API keys from the browser. - Modified tournament querying to handle new state definitions and improved error handling. - Updated UI components to reflect server-side storage of authentication tokens. - Improved user experience in API Key Manager and Authentication Hub with clearer messaging. - Refactored client credentials management to support asynchronous operations. - Adjusted API client tests to validate new request configurations. - Updated Vite configuration to support session and CSRF handling through proxies.
110 lines
3.0 KiB
JavaScript
110 lines
3.0 KiB
JavaScript
import { defineConfig } from 'vite';
|
|
import vue from '@vitejs/plugin-vue';
|
|
import { fileURLToPath, URL } from 'node:url';
|
|
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
},
|
|
build: {
|
|
// Production build optimizations
|
|
target: 'es2015',
|
|
minify: 'terser',
|
|
sourcemap: true, // Enable source maps for production debugging
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
// Split vendor chunks for better caching
|
|
'vue-vendor': ['vue', 'vue-router'],
|
|
highlight: ['highlight.js'],
|
|
'virtual-scroller': ['vue-virtual-scroller']
|
|
}
|
|
}
|
|
},
|
|
// Increase chunk size warning limit (default is 500kb)
|
|
chunkSizeWarningLimit: 600,
|
|
// Enable CSS code splitting
|
|
cssCodeSplit: true,
|
|
// Asset inlining threshold (10kb)
|
|
assetsInlineLimit: 10240
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5173,
|
|
strictPort: true, // Fail if port is already in use instead of trying next available port
|
|
proxy: {
|
|
// Session + CSRF helpers
|
|
'/api/session': {
|
|
target: 'http://localhost:3001',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api/, ''),
|
|
secure: false
|
|
},
|
|
|
|
// Admin auth helpers
|
|
'/api/auth': {
|
|
target: 'http://localhost:3001',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api/, ''),
|
|
secure: false
|
|
},
|
|
|
|
// API v1 proxy (legacy)
|
|
'/api/challonge/v1': {
|
|
target: 'http://localhost:3001',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api/, ''),
|
|
secure: false,
|
|
headers: {
|
|
Accept: 'application/json',
|
|
'Content-Type': 'application/json'
|
|
}
|
|
},
|
|
// API v2.1 proxy (current)
|
|
'/api/challonge/v2.1': {
|
|
target: 'http://localhost:3001',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api/, ''),
|
|
secure: false,
|
|
headers: {
|
|
Accept: 'application/json',
|
|
'Content-Type': 'application/vnd.api+json'
|
|
}
|
|
},
|
|
// OAuth proxy (token exchange)
|
|
'/api/oauth': {
|
|
target: 'http://localhost:3001',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api\/oauth/, '/oauth'),
|
|
secure: false
|
|
},
|
|
// Gamemaster API proxy
|
|
'/api/gamemaster': {
|
|
target: 'http://localhost:3001',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api/, ''),
|
|
secure: false
|
|
},
|
|
|
|
// Discord API proxy
|
|
'/api/discord': {
|
|
target: 'http://localhost:3001',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api/, ''),
|
|
secure: false
|
|
},
|
|
|
|
// Convenience: health check through the frontend origin
|
|
'/api/health': {
|
|
target: 'http://localhost:3001',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api/, ''),
|
|
secure: false
|
|
}
|
|
}
|
|
}
|
|
});
|