refactor: unify image download into a single DownloadImageCmd
DownloadImageCmd and DownloadWireguardImageCmd were identical except for the image URL. Collapse them into one DownloadImageCmd that takes the image as a parameter, passing imageName/wireguardImageName at the call sites. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
m.configValues.Login = m.loginForm.Values()
|
||||
m.currentStep = StepDownloadImage
|
||||
|
||||
return m, DownloadImageCmd(m.configValues.Login["user"], m.configValues.Login["password"])
|
||||
return m, DownloadImageCmd(imageName, m.configValues.Login["user"], m.configValues.Login["password"])
|
||||
}
|
||||
|
||||
return m, cmd
|
||||
@@ -245,7 +245,7 @@ func (m Model) updateGenerateWireguardFile(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
if msg.Err == nil {
|
||||
m.currentStep = StepDownloadWireguard
|
||||
|
||||
return m, DownloadWireguardImageCmd(m.configValues.Login["user"], m.configValues.Login["password"])
|
||||
return m, DownloadImageCmd(wireguardImageName, m.configValues.Login["user"], m.configValues.Login["password"])
|
||||
}
|
||||
|
||||
case tea.KeyPressMsg:
|
||||
@@ -254,7 +254,7 @@ func (m Model) updateGenerateWireguardFile(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
} else if m.finishedFile && m.configFileError == nil {
|
||||
m.currentStep = StepDownloadWireguard
|
||||
|
||||
return m, DownloadWireguardImageCmd(m.configValues.Login["user"], m.configValues.Login["password"])
|
||||
return m, DownloadImageCmd(wireguardImageName, m.configValues.Login["user"], m.configValues.Login["password"])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user