Skip to content

Commit 3af6e9e

Browse files
gitcoder89431claude
andcommitted
feat: d removes approved device, i ignores pending (was d)
- d on an approved device removes it from Syncthing entirely (global config + all folders) so pairing can be retested from scratch; local device is protected and cannot be removed - i replaces d for ignoring/dismissing a pending device - Footer and inline hints updated to match Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent de5472b commit 3af6e9e

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

internal/screens/connections.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,20 @@ func (c Connections) handleKey(msg tea.KeyPressMsg) (Screen, tea.Cmd) {
182182
return ConnectionActionMsg{Err: client.AcceptDevice(id, name)}
183183
}
184184
}
185-
case "d":
185+
case "i":
186186
if dev := c.selectedPending(); dev != nil {
187187
client, id := c.client, dev.ID
188188
return c, func() tea.Msg {
189189
return ConnectionActionMsg{Err: client.DismissDevice(id)}
190190
}
191191
}
192+
case "d":
193+
if dev := c.selectedApproved(); dev != nil && dev.ID != c.local.ID {
194+
client, id := c.client, dev.ID
195+
return c, func() tea.Msg {
196+
return ConnectionActionMsg{Err: client.RemoveDevice(id)}
197+
}
198+
}
192199
case "p":
193200
c.pairing = true
194201
c.pairInput = ""
@@ -232,7 +239,7 @@ func (c Connections) View(width, height int) string {
232239
rows = append(rows, c.pendingRow(dev, i == c.cursor, width))
233240
}
234241
if dev := c.selectedPending(); dev != nil {
235-
rows = append(rows, "", c.theme.Muted.Render(" [a] accept [d] dismiss"))
242+
rows = append(rows, "", c.theme.Muted.Render(" [a] accept [i] ignore"))
236243
}
237244
}
238245

@@ -342,10 +349,11 @@ func (c Connections) CapturesKey(msg tea.KeyPressMsg) bool {
342349
func (c Connections) KeyBindings() []key.Binding {
343350
return []key.Binding{
344351
key.NewBinding(key.WithKeys("j", "k"), key.WithHelp("j/k", "navigate")),
345-
key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "rename device")),
346-
key.NewBinding(key.WithKeys("p"), key.WithHelp("p", "pair by device ID")),
347-
key.NewBinding(key.WithKeys("a"), key.WithHelp("a", "accept pending")),
348-
key.NewBinding(key.WithKeys("d"), key.WithHelp("d", "dismiss pending")),
352+
key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "rename")),
353+
key.NewBinding(key.WithKeys("p"), key.WithHelp("p", "pair by ID")),
354+
key.NewBinding(key.WithKeys("a"), key.WithHelp("a", "accept")),
355+
key.NewBinding(key.WithKeys("i"), key.WithHelp("i", "ignore pending")),
356+
key.NewBinding(key.WithKeys("d"), key.WithHelp("d", "remove device")),
349357
}
350358
}
351359

internal/syncthing/client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,11 @@ func (c *Client) DismissDevice(deviceID string) error {
658658
return c.delete("/rest/cluster/pending/devices?device=" + deviceID)
659659
}
660660

661+
// RemoveDevice removes a device from the Syncthing config entirely (approved list + all folders).
662+
func (c *Client) RemoveDevice(deviceID string) error {
663+
return c.delete("/rest/config/devices/" + deviceID)
664+
}
665+
661666
// GetIgnorePatterns returns the user-visible lines in ~/meshd/.stignore
662667
// (blank lines and // comments are stripped for display).
663668
func (c *Client) GetIgnorePatterns(folderPath string) ([]string, error) {

0 commit comments

Comments
 (0)