feat(inbounds): show linked host remarks in inbound list (#6468)

* feat(inbounds): show linked host remarks in inbound list

Join Host Group remarks from the existing hosts list onto each inbound
row client-side so multiple endpoints (IPv4/IPv6/CDN) are visible without
opening the inbound. Truncate long lists with a tooltip for the full set.

Fixes #6026

* fix(inbounds): skip disabled host groups in inbound list remarks

buildHostRemarksByInboundId joined every host group from /hosts/list
onto its inbounds, so a group toggled off on the Hosts page still read
as a live endpoint in the inbound remark cell and matched the search
box. A disabled group serves nothing: internal/sub/host_sub.go filters
it out of subscription output and withMtprotoHostEndpoints skips it for
MTProto share links. Skip it here the same way, and drop the unread
`truncated` field from formatHostRemarksLabel.

---------

Co-authored-by: mrchatam <287639636+mrchatam@users.noreply.github.com>
Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
This commit is contained in:
mrchatam
2026-09-13 23:33:50 +03:30
committed by GitHub
parent 4760ccaba0
commit 939c470698
7 changed files with 141 additions and 11 deletions
@@ -0,0 +1,17 @@
import { describe, expect, it } from 'vitest';
import { buildHostRemarksByInboundId } from '@/pages/inbounds/list/helpers';
describe('buildHostRemarksByInboundId', () => {
it('joins only host groups a client can reach (#6026)', () => {
const map = buildHostRemarksByInboundId([
{ remark: 'USA IPv4', inboundIds: [1, 2], hosts: ['1.2.3.4:443'], isDisabled: false },
{ remark: 'USA IPv6', inboundIds: [1], hosts: ['[2001:db8::1]:443'], isDisabled: true },
{ remark: '', inboundIds: [2], hosts: ['', 'cdn.example.com:443'], isDisabled: false },
{ remark: 'USA IPv4', inboundIds: [2], hosts: ['5.6.7.8'] },
]);
expect(map.get(1)).toEqual(['USA IPv4']);
expect(map.get(2)).toEqual(['USA IPv4', 'cdn.example.com:443']);
expect(map.has(3)).toBe(false);
});
});