mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-23 13:06:08 +00:00
fix(sub): preserve external link names in Clash/JSON (#6049)
expandEntry cleared Name for external subscriptions and single links with empty remark, so Clash/JSON fell back to the client email. Keep each link's original name (#fragment / vmess ps); use the row remark when set. Pass remark from the client form for single external links. Fixes #6032
This commit is contained in:
@@ -48,6 +48,7 @@ const CLIENT_IP_LOG_MODAL_Z_INDEX = CLIENT_FORM_MODAL_Z_INDEX + 1;
|
||||
interface ExternalLinkRow {
|
||||
kind: 'link' | 'subscription';
|
||||
value: string;
|
||||
remark: string;
|
||||
}
|
||||
|
||||
interface ApiMsg<T = unknown> {
|
||||
@@ -138,6 +139,7 @@ function toExternalLinkRows(links: ExternalLink[] | undefined): ExternalLinkRow[
|
||||
return (links || []).map((l) => ({
|
||||
kind: l.kind === 'subscription' ? 'subscription' : 'link',
|
||||
value: l.value || '',
|
||||
remark: l.remark || '',
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -207,7 +209,7 @@ export default function ClientFormModal({
|
||||
const limitIpNotice = getLimitIpNotice(fail2ban, t);
|
||||
|
||||
function addExternalLinkRow(kind: 'link' | 'subscription') {
|
||||
appendExternalLink({ kind, value: '' });
|
||||
appendExternalLink({ kind, value: '', remark: '' });
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -547,7 +549,7 @@ export default function ClientFormModal({
|
||||
}
|
||||
|
||||
const externalLinks: ExternalLinkInput[] = values.externalLinks
|
||||
.map((r) => ({ kind: r.kind, value: r.value.trim(), remark: '' }))
|
||||
.map((r) => ({ kind: r.kind, value: r.value.trim(), remark: (r.remark || '').trim() }))
|
||||
.filter((r) => r.value !== '');
|
||||
|
||||
setSubmitting(true);
|
||||
@@ -917,6 +919,13 @@ export default function ClientFormModal({
|
||||
placeholder="vless:// · vmess:// · trojan:// · ss:// · hysteria2:// · wireguard://"
|
||||
/>
|
||||
</FormField>
|
||||
<FormField name={`externalLinks.${index}.remark`} noStyle>
|
||||
<Input
|
||||
style={{ width: 140 }}
|
||||
aria-label={t('remark')}
|
||||
placeholder={t('remark')}
|
||||
/>
|
||||
</FormField>
|
||||
<Tooltip title={t('delete')}>
|
||||
<Button aria-label={t('delete')} danger icon={<DeleteOutlined />} onClick={() => removeExternalLink(index)} />
|
||||
</Tooltip>
|
||||
|
||||
Reference in New Issue
Block a user