Files
momentry_studio/vite.config.ts
Momentry Studio f68cee8276 fix: add missing proxy routes for Core API endpoints
- Added /api/v1/files, /api/v1/file/, /api/v1/jobs, /api/v1/bookmarks to port 3002
- Fixes 500 errors when MarkBase (port 8888) is not running
- All Core API endpoints now correctly route to port 3002
2026-10-31 05:00:50 +08:00

98 lines
2.4 KiB
TypeScript

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import { execSync } from 'child_process'
const gitHash = execSync('git log --format="%h" -1', { encoding: 'utf-8' }).trim()
const buildTime = new Date().toISOString().slice(0, 19).replace(/[-:T]/g, '')
const buildVersion = `${buildTime}-${gitHash}`
export default defineConfig({
plugins: [vue()],
define: {
__BUILD_VERSION__: JSON.stringify(buildVersion)
},
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
server: {
host: '0.0.0.0',
port: 5173,
strictPort: true,
allowedHosts: [
'studio.momentry.ddns.net',
'localhost',
'127.0.0.1',
'.ddns.net'
],
proxy: {
'/api/v1/auth': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1/trace-profile-file': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1/trace-profile': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1/cluster-results': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1/file/*/thumbnail': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1/file/*/json/face_cluster': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1/file/*/traces': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1/admin/config': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1/file-profile': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1/files': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1/file/': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1/jobs': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1/bookmarks': {
target: 'http://localhost:3002',
changeOrigin: true,
},
'/api/v1': {
target: 'http://localhost:8888',
changeOrigin: true,
},
'/api/v2': {
target: 'http://localhost:11438',
changeOrigin: true
},
'/health': {
target: 'http://localhost:8888',
changeOrigin: true
}
}
}
})