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:
authored and GitHub committed 2026-09-13 22:03:50 +02:00 Unverified
1 parent 4760ccaba0
commit 939c470698
7 files changed
+141 -11

No files matched your search

@@ -803,6 +803,7 @@ export default function InboundsPage() {
subEnable={subSettings.enable}
nodesById={nodesById}
hasActiveNode={showNodeInfo}
hosts={hosts}
onAddInbound={onAddInbound}
onGeneralAction={onGeneralAction}
onRowAction={({ key, dbInbound }) =>
@@ -180,3 +180,34 @@
padding: 4px;
}
}
.inbound-remark-cell {
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
min-width: 0;
}
.inbound-remark {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.inbound-host-remarks {
font-size: 11px;
font-weight: 400;
opacity: 0.65;
line-height: 1.2;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
.tag-name .inbound-host-remarks {
font-weight: 400;
}
@@ -32,10 +32,21 @@ import { activateOnKey } from '@/utils/a11y';
import { buildRowActionsMenu } from './RowActions';
import { useInboundColumns } from './useInboundColumns';
import { buildHostRemarksByInboundId, formatHostRemarksLabel } from './helpers';
import InboundStatsModal from './InboundStatsModal';
import type { DBInboundRecord, GeneralAction, InboundListProps, RowAction } from './types';
import './InboundList.css';
function HostRemarksSuffix({ remarks }: { remarks: string[] }) {
if (remarks.length === 0) return null;
const { display, full } = formatHostRemarksLabel(remarks);
return (
<Tooltip title={full}>
<span className="inbound-host-remarks"> ({display})</span>
</Tooltip>
);
}
export default function InboundList({
dbInbounds,
clientCount,
@@ -48,6 +59,7 @@ export default function InboundList({
subEnable,
nodesById,
hasActiveNode,
hosts,
onAddInbound,
onGeneralAction,
onRowAction,
@@ -86,19 +98,22 @@ export default function InboundList({
[nodesById, t],
);
const hostRemarksByInboundId = useMemo(() => buildHostRemarksByInboundId(hosts), [hosts]);
const visibleInbounds = useMemo(() => {
let list = dbInbounds;
if (nodeFilter === 0) list = list.filter((ib) => ib.nodeId == null);
else if (nodeFilter !== 'all') list = list.filter((ib) => ib.nodeId === nodeFilter);
const q = searchKey.trim().toLowerCase();
if (!q) return list;
return list.filter(
(ib) =>
(ib.remark || '').toLowerCase().includes(q) ||
String(ib.port).includes(q) ||
(ib.protocol || '').toLowerCase().includes(q),
);
}, [dbInbounds, nodeFilter, searchKey]);
return list.filter((ib) => {
if ((ib.remark || '').toLowerCase().includes(q)) return true;
if (String(ib.port).includes(q)) return true;
if ((ib.protocol || '').toLowerCase().includes(q)) return true;
const hostRemarks = hostRemarksByInboundId.get(ib.id) ?? [];
return hostRemarks.some((remark) => remark.toLowerCase().includes(q));
});
}, [dbInbounds, nodeFilter, searchKey, hostRemarksByInboundId]);
const onSwitchEnable = useCallback(async (dbInbound: DBInboundRecord, next: boolean) => {
const previous = dbInbound.enable;
@@ -114,8 +129,10 @@ export default function InboundList({
}, []);
const hasAnyRemark = useMemo(
() => dbInbounds.some((i) => typeof i.remark === 'string' && i.remark.trim() !== ''),
[dbInbounds],
() =>
dbInbounds.some((i) => typeof i.remark === 'string' && i.remark.trim() !== '') ||
dbInbounds.some((i) => (hostRemarksByInboundId.get(i.id)?.length ?? 0) > 0),
[dbInbounds, hostRemarksByInboundId],
);
const hasAnySubSortIndex = useMemo(
@@ -154,6 +171,7 @@ export default function InboundList({
hasAnySubSortIndex,
hasActiveNode,
nodesById,
hostRemarksByInboundId,
clientCount,
inboundSpeed,
subEnable,
@@ -293,7 +311,10 @@ export default function InboundList({
onChange={(e) => toggleSelect(record.id, e.target.checked)}
/>
<span className="card-id">#{record.id}</span>
<span className="tag-name">{record.remark}</span>
<span className="tag-name">
<span className="inbound-remark">{record.remark}</span>
<HostRemarksSuffix remarks={hostRemarksByInboundId.get(record.id) ?? []} />
</span>
<div className="card-actions">
<Tooltip title={t('pages.inbounds.inboundInfo')}>
<InfoCircleOutlined
Loaded 3 of 7 files, more files were not shown because too many files have changed in this diff. Show more