mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-12 07:36:07 +00:00
fix(inbounds): preserve client data on delete and show traffic in detail
Deleting an inbound now only detaches its clients (removes the client_inbounds rows). It no longer deletes client_traffics or client IP logs: those are keyed centrally by email (one row per client) and must survive, since a client may stay attached to other inbounds and is managed from the Clients page. Separately, /get/:id now uses a new GetInboundDetail that preloads and enriches ClientStats, so hydrated records (info / QR / export) carry per-client traffic instead of null. DBInbound.toJSON drops the internal _clientStatsMap cache so it no longer leaks into the exported JSON.
This commit is contained in:
@@ -190,6 +190,12 @@ export class DBInbound {
|
||||
this._clientStatsMap = null;
|
||||
}
|
||||
|
||||
toJSON(): Record<string, unknown> {
|
||||
const out: Record<string, unknown> = { ...(this as unknown as Record<string, unknown>) };
|
||||
delete out._clientStatsMap;
|
||||
return out;
|
||||
}
|
||||
|
||||
getClientStats(email: string): ClientStats | undefined {
|
||||
if (!this._clientStatsMap) {
|
||||
this._clientStatsMap = new Map();
|
||||
|
||||
Reference in New Issue
Block a user