mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-04 19:39:35 +00:00
Inbound pickers and chips across the Users area, the inbounds attach-clients modals, and the routing rule inbound-tags selector showed the auto-generated tag (in-443-tcp). Show the inbound remark when set, falling back to the tag. Only display labels change; option values keep using the inbound id (or tag for routing rules, which match inbounds by tag), so filtering, attaching, and saved rules are unaffected. Routing reads remarks via a shared useInboundOptions hook that reuses the existing options query cache.
22 lines
801 B
TypeScript
22 lines
801 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
|
|
import { HttpUtil } from '@/utils';
|
|
import { parseMsg } from '@/utils/zodValidate';
|
|
import { keys } from '@/api/queryKeys';
|
|
import { InboundOptionsSchema, type InboundOption } from '@/schemas/client';
|
|
|
|
async function fetchInboundOptions(): Promise<InboundOption[]> {
|
|
const msg = await HttpUtil.get('/panel/api/inbounds/options', undefined, { silent: true });
|
|
if (!msg?.success) throw new Error(msg?.msg || 'Failed to fetch inbound options');
|
|
const validated = parseMsg(msg, InboundOptionsSchema, 'inbounds/options');
|
|
return Array.isArray(validated.obj) ? validated.obj : [];
|
|
}
|
|
|
|
export function useInboundOptions() {
|
|
return useQuery({
|
|
queryKey: keys.inbounds.options(),
|
|
queryFn: fetchInboundOptions,
|
|
staleTime: Infinity,
|
|
});
|
|
}
|