mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-04 00:15:09 +03:00
fda676e62a
Replace full inbound hydration in Show Info with owner-scoped, no-store reads of one display client or up to 50 WireGuard/AmneziaWG peers. Preserve absolute peer numbering, Host/node endpoint projection, selected tab and IP logs across live traffic updates; keep edit and clone on full detail. Stream ordered NDJSON pages from a single stored inbound snapshot for explicit Export All Peers. Generate an ordered ZIP64 archive with existing client config/link generators; validate page offsets, protocol and total, and reject incomplete or cancelled exports. Renew the per-page HTTP write deadline through the original response writer before gzip wrapping, keeping ordinary endpoint timeouts unchanged. Validated on head0f853351: all 12 CI jobs and Docs CI passed, including 2,350 frontend tests, bounded-info Chromium stories, live-traffic and archive regressions, Go/race, PostgreSQL, and node/Xray E2E. The final review also verified a conflict-free test merge with main38452eac, matching regenerated API contracts and passing focused controller tests, including the real HTTP deadline regression for identity and gzip. The author's synthetic 50,000-peer fixture reduces the uncompressed Show Info response from 2,650,526 to 3,184 bytes. Stored JSON still requires a linear scan per page; explicit ZIP export retains archive data in browser memory. Slow individual writes and reverse-proxy timeouts remain operational limits. No production latency or memory guarantee is implied. Fixes #7330.
70 lines
1.9 KiB
TypeScript
70 lines
1.9 KiB
TypeScript
import path from 'node:path';
|
|
|
|
import react from '@vitejs/plugin-react';
|
|
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
import { playwright } from '@vitest/browser-playwright';
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
const dirname = import.meta.dirname;
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(dirname, 'src'),
|
|
},
|
|
},
|
|
test: {
|
|
globals: false,
|
|
// Keep jsdom-heavy form tests within the memory budget of local and CI runners.
|
|
maxWorkers: 2,
|
|
projects: [
|
|
{
|
|
extends: true,
|
|
test: {
|
|
name: 'unit',
|
|
include: ['src/test/**/*.test.ts'],
|
|
environment: 'node',
|
|
// msw probes localStorage on load; Node 25+'s file-less one warns per worker.
|
|
execArgv: ['--no-experimental-webstorage'],
|
|
setupFiles: ['./src/test/setup.ts', './src/test/setup.msw.ts'],
|
|
},
|
|
},
|
|
{
|
|
extends: true,
|
|
test: {
|
|
name: 'components',
|
|
include: ['src/test/**/*.test.tsx'],
|
|
environment: 'jsdom',
|
|
setupFiles: ['./src/test/setup.ts', './src/test/setup.components.ts'],
|
|
},
|
|
},
|
|
{
|
|
extends: true,
|
|
optimizeDeps: {
|
|
// Lazy-loaded stories must not trigger an optimizer reload mid-test.
|
|
include: [
|
|
'aria-query',
|
|
'lz-string',
|
|
'pretty-format',
|
|
'dom-accessibility-api',
|
|
'@tanstack/react-query-devtools',
|
|
'react-router',
|
|
'react-router/dom',
|
|
],
|
|
},
|
|
plugins: [storybookTest({ configDir: path.join(dirname, '.storybook') })],
|
|
test: {
|
|
name: 'storybook',
|
|
browser: {
|
|
enabled: true,
|
|
headless: true,
|
|
provider: playwright({}),
|
|
instances: [{ browser: 'chromium' }],
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|