mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Attempt to fix the HIBP index out of range bug
This commit is contained in:
parent
7b9dbdc943
commit
f934f21638
@ -12,7 +12,7 @@ type Widget struct {
|
||||
view.TextWidget
|
||||
|
||||
settings *Settings
|
||||
data []*Status
|
||||
statuses []*Status
|
||||
err error
|
||||
}
|
||||
|
||||
@ -47,14 +47,14 @@ func (widget *Widget) Fetch(accounts []string) ([]*Status, error) {
|
||||
|
||||
// Refresh updates the data for this widget and displays it onscreen
|
||||
func (widget *Widget) Refresh() {
|
||||
data, err := widget.Fetch(widget.settings.accounts)
|
||||
statuses, err := widget.Fetch(widget.settings.accounts)
|
||||
|
||||
if err != nil {
|
||||
widget.err = err
|
||||
widget.data = nil
|
||||
widget.statuses = nil
|
||||
} else {
|
||||
widget.err = nil
|
||||
widget.data = data
|
||||
widget.statuses = statuses
|
||||
}
|
||||
|
||||
widget.Redraw(widget.content)
|
||||
@ -71,15 +71,17 @@ func (widget *Widget) content() (string, string, bool) {
|
||||
title = title + widget.sinceDateForTitle()
|
||||
str := ""
|
||||
|
||||
for _, status := range widget.data {
|
||||
for _, status := range widget.statuses {
|
||||
color := widget.settings.colors.ok
|
||||
|
||||
if status.HasBeenCompromised() {
|
||||
color = widget.settings.colors.pwned
|
||||
}
|
||||
|
||||
if status != nil {
|
||||
str += fmt.Sprintf(" [%s]%s[white]\n", color, status.Account)
|
||||
}
|
||||
}
|
||||
|
||||
return title, str, false
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user