mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-12 15:46:06 +00:00
feat(wireguard): per-peer comments for identifying devices (#5168)
WG peers were only identifiable by their keys. Add an optional panel-side comment per peer: editable in the inbound form (echoed next to "Peer N" in the section header), stored in the settings JSON alongside the panel-only privateKey (xray-core ignores unknown peer fields), and appended to the share link / .conf remark so the device is identifiable in client apps too.
This commit is contained in:
@@ -102,6 +102,12 @@ export default function WireguardFields({ wgPubKey, regenInboundWg, regenWgPeerK
|
||||
<Divider titlePlacement="center">
|
||||
<Space>
|
||||
<span>{t('pages.inbounds.info.peerNumber', { n: idx + 1 })}</span>
|
||||
<Form.Item noStyle shouldUpdate>
|
||||
{() => {
|
||||
const comment = form.getFieldValue(['settings', 'peers', field.name, 'comment']) as string | undefined;
|
||||
return comment ? <span style={{ opacity: 0.65 }}>— {comment}</span> : null;
|
||||
}}
|
||||
</Form.Item>
|
||||
{fields.length > 1 && (
|
||||
<Button
|
||||
size="small"
|
||||
@@ -112,6 +118,9 @@ export default function WireguardFields({ wgPubKey, regenInboundWg, regenWgPeerK
|
||||
)}
|
||||
</Space>
|
||||
</Divider>
|
||||
<Form.Item name={[field.name, 'comment']} label={t('comment')}>
|
||||
<Input placeholder="e.g. Alice's laptop" />
|
||||
</Form.Item>
|
||||
<Form.Item label={t('pages.xray.wireguard.secretKey')}>
|
||||
<Space.Compact block>
|
||||
<Form.Item name={[field.name, 'privateKey']} noStyle>
|
||||
|
||||
Reference in New Issue
Block a user