mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-04 16:34:52 +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.
29 lines
934 B
TypeScript
29 lines
934 B
TypeScript
import { z } from 'zod';
|
|
|
|
import { withBasePath } from '@/api/http-init';
|
|
import { InboundDetailSchema } from '@/schemas/inbound';
|
|
import { HttpUtil } from '@/utils';
|
|
import { parseMsg } from '@/utils/zodValidate';
|
|
|
|
export const INBOUND_PEER_PAGE_SIZE = 50;
|
|
export const InboundInfoPageSchema = z.object({
|
|
inbound: InboundDetailSchema,
|
|
totalPeers: z.number().int().nonnegative(),
|
|
peerOffset: z.number().int().nonnegative(),
|
|
});
|
|
|
|
export async function fetchInboundInfo(id: number, page: number, signal: AbortSignal) {
|
|
const response = await HttpUtil.get(
|
|
`/panel/api/inbounds/${id}/info`,
|
|
{ page },
|
|
{ signal, silent: true },
|
|
);
|
|
const result = parseMsg(response, InboundInfoPageSchema, 'inbounds/info');
|
|
if (!result.success || !result.obj) throw new Error(result.msg);
|
|
return result.obj;
|
|
}
|
|
|
|
export function inboundPeerExportPath(id: number) {
|
|
return withBasePath(`/panel/api/inbounds/${id}/peerExport`);
|
|
}
|