Skip to content

Commit 2d684fb

Browse files
committed
fix: send full host data when toggling disabled status
1 parent 2f549cf commit 2d684fb

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

dashboard/src/components/dialogs/HostModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ const HostModal: React.FC<HostModalProps> = ({ isDialogOpen, onOpenChange, onSub
377377

378378
return (
379379
<Dialog open={isDialogOpen} onOpenChange={handleModalOpenChange}>
380-
<DialogContent className="h-full w-full max-w-2xl md:max-h-[95dvh]" onOpenAutoFocus={e => e.preventDefault()}>
380+
<DialogContent className="h-full sm:py-4 w-full max-w-2xl sm:max-h-[95dvh]" onOpenAutoFocus={e => e.preventDefault()}>
381381
<DialogHeader>
382382
<DialogTitle className={cn(dir === 'rtl' ? 'text-right' : 'text-left')}>{editingHost ? t('editHost.title') : t('hostsDialog.addHost')}</DialogTitle>
383383
</DialogHeader>
@@ -2787,7 +2787,7 @@ const HostModal: React.FC<HostModalProps> = ({ isDialogOpen, onOpenChange, onSub
27872787
<Button type="button" variant="outline" onClick={() => handleModalOpenChange(false)}>
27882788
{t('cancel')}
27892789
</Button>
2790-
<LoaderButton type="submit" disabled={form.formState.isSubmitting} isLoading={form.formState.isSubmitting} loadingText={editingHost ? t('modifying') : t('creating')} size="sm">
2790+
<LoaderButton type="submit" disabled={form.formState.isSubmitting} isLoading={form.formState.isSubmitting} loadingText={editingHost ? t('modifying') : t('creating')}>
27912791
{editingHost ? t('modify') : t('create')}
27922792
</LoaderButton>
27932793
</div>

dashboard/src/components/hosts/SortableHost.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,30 @@ export default function SortableHost({ host, onEdit, onDuplicate, onDataChanged
6969
if (!host.id) return
7070

7171
try {
72-
// Include required fields for the modify operation
72+
// Send full host data with only is_disabled toggled
7373
await modifyHost(host.id, {
7474
remark: host.remark || '',
75-
priority: host.priority || 0,
75+
address: host.address || [],
76+
port: host.port,
77+
inbound_tag: host.inbound_tag || '',
78+
status: host.status || [],
79+
host: host.host || [],
80+
sni: host.sni || [],
81+
path: host.path || '',
82+
security: host.security || 'inbound_default',
83+
alpn: (!host.alpn || host.alpn.length === 0) ? undefined : host.alpn,
84+
fingerprint: host.fingerprint === '' ? undefined : host.fingerprint,
85+
allowinsecure: host.allowinsecure || false,
7686
is_disabled: !host.is_disabled,
87+
random_user_agent: host.random_user_agent || false,
88+
use_sni_as_host: host.use_sni_as_host || false,
89+
priority: host.priority || 0,
90+
ech_config_list: host.ech_config_list,
91+
fragment_settings: host.fragment_settings,
92+
noise_settings: host.noise_settings,
93+
mux_settings: host.mux_settings,
94+
transport_settings: host.transport_settings as any, // Type cast needed due to Output/Input mismatch
95+
http_headers: host.http_headers || {},
7796
})
7897

7998
toast.success(

0 commit comments

Comments
 (0)