Skip to content

Commit

Permalink
do not check ddan if address or api key is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
mpkondrashin committed Mar 16, 2024
1 parent 2a40945 commit 8b9200d
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions pkg/settings/ddan_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ func (s *DDAn) Widget() fyne.CanvasObject {
ignoreTLSFormItem := widget.NewFormItem("TLS Errors: ", s.ddanIgnoreTLSCheck)

s.ddanTest = canvas.NewText("", color.Black)
//s.ddanTest = widget.NewLabel("")
//s.ddanTest.Truncation = fyne.TextTruncateEllipsis

//stateText := canvas.NewText(tsk.GetChannel(), tsk.RiskLevel.Color())
//stateText.TextStyle = fyne.TextStyle{Bold: tsk.Active}
ddanForm := widget.NewForm(urlFormItem, apiKeyFormItem, ignoreTLSFormItem)
return container.NewVBox(ddanForm, container.NewHScroll(s.ddanTest))
}
Expand All @@ -81,18 +77,6 @@ func (s *DDAn) Update() {
s.TestAnalyzer()
}

/*
const MaxLength = 64
func LimitLength(s string) string {
logging.Errorf("DDAn Connection: %s", s)
if len(s) < MaxLength {
return "Error: " + s
}
return "Error: ..." + s[len(s)-MaxLength+7:]
}
*/

func (s *DDAn) SetMessageError(message string) {
s.ddanTest.Text = "Error: " + message
s.ddanTest.Color = color.RGBA{255, 0, 0, 255}
Expand All @@ -119,6 +103,11 @@ func (s *DDAn) TestAnalyzer() {
}
s.cancelTestDDAn = nil
}()
if s.ddanURLEntry.Text == "" || s.ddanAPIKeyEntry.Text == "" {
s.SetMessageOk("")
return
}

s.SetMessageOk("Checking connection...")

u, err := url.Parse(s.GetDDAnURL())
Expand Down

0 comments on commit 8b9200d

Please sign in to comment.