Files
afilmory/be/apps/dashboard/vite.config.ts
Innei b42bfbc520 feat: implement tenant suspension handling and deletion functionality
- Added a new tenant suspension page and related components to inform users when their tenant is suspended due to policy violations.
- Implemented deletion functionality for tenants in the SuperAdminTenantManager, allowing super admins to permanently delete tenant accounts.
- Updated localization files to include new strings for tenant suspension and deletion prompts.
- Enhanced the DataManagementService to handle tenant deletion with metadata checks.

Signed-off-by: Innei <tukon479@gmail.com>
2025-12-05 15:28:21 +08:00

97 lines
2.7 KiB
TypeScript

import 'dotenv/config'
import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import tailwindcss from '@tailwindcss/vite'
import reactRefresh from '@vitejs/plugin-react'
import { codeInspectorPlugin } from 'code-inspector-plugin'
import { defineConfig } from 'vite'
import { checker } from 'vite-plugin-checker'
import { routeBuilderPlugin } from 'vite-plugin-route-builder'
import tsconfigPaths from 'vite-tsconfig-paths'
import { astPlugin } from '../../../plugins/vite/ast'
import PKG from './package.json'
const ROOT = fileURLToPath(new URL('./', import.meta.url))
const isSaas = process.env.SAAS === '1'
export default defineConfig({
base: isSaas ? 'https://static.afilmory.art/platform/' : '/',
plugins: [
codeInspectorPlugin({
bundler: 'vite',
hotKeys: ['altKey'],
}),
reactRefresh({
babel: {
plugins: [['babel-plugin-react-compiler', {}]],
},
}),
tsconfigPaths(),
checker({
typescript: true,
enableBuild: true,
}),
tailwindcss(),
routeBuilderPlugin({
pagePattern: `${resolve(ROOT, './src/pages')}/**/*.tsx`,
outputPath: `${resolve(ROOT, './src/generated-routes.ts')}`,
enableInDev: true,
}),
astPlugin,
],
define: {
APP_DEV_CWD: JSON.stringify(process.cwd()),
APP_NAME: JSON.stringify(PKG.name),
},
resolve: {
alias: {
'@locales': resolve(ROOT, '../../../locales'),
},
},
server: {
cors: {
origin: true,
credentials: true,
},
proxy: {
'/api': {
target: 'http://localhost:1841',
changeOrigin: true,
xfwd: true,
// keep path as-is so /api -> backend /api
configure: (proxy) => {
proxy.on('proxyReq', (proxyReq, req) => {
const originalHost = req.headers.host
if (originalHost) {
const normalizedHost = Array.isArray(originalHost) ? originalHost[0] : originalHost
// Preserve SPA host for tenant resolution regardless of changeOrigin behaviour
proxyReq.setHeader('host', normalizedHost)
proxyReq.setHeader('x-forwarded-host', normalizedHost)
}
const originHeader = req.headers.origin
if (originHeader) {
proxyReq.setHeader('origin', Array.isArray(originHeader) ? originHeader[0] : originHeader)
}
})
},
},
},
},
build: {
rollupOptions: {
input: {
main: resolve(ROOT, 'index.html'),
'tenant-missing': resolve(ROOT, 'tenant-missing.html'),
'tenant-restricted': resolve(ROOT, 'tenant-restricted.html'),
'tenant-suspended': resolve(ROOT, 'tenant-suspended.html'),
},
},
},
})