From e159ad5a8c90e6d8b7412b419605a0d1c194bc42 Mon Sep 17 00:00:00 2001 From: aceberg <1502200+aceberg@users.noreply.github.com> Date: Tue, 3 Jan 2023 19:39:49 +0700 Subject: [PATCH] Search fix --- README.md | 2 +- internal/web/search.go | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 07aac5a..e8587af 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [![Docker](https://github.com/aceberg/WatchYourLAN/actions/workflows/main-docker-all.yml/badge.svg)](https://github.com/aceberg/WatchYourLAN/actions/workflows/main-docker-all.yml) [![Binary-release](https://github.com/aceberg/WatchYourLAN/actions/workflows/release.yml/badge.svg)](https://github.com/aceberg/WatchYourLAN/actions/workflows/release.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/aceberg/WatchYourLAN)](https://goreportcard.com/report/github.com/aceberg/WatchYourLAN) -![GitHub](https://img.shields.io/github/license/aceberg/WatchYourLAN) +[![Maintainability](https://api.codeclimate.com/v1/badges/46b17f99edc1726b5d7d/maintainability)](https://codeclimate.com/github/aceberg/WatchYourLAN/maintainability) ![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/aceberg/watchyourlan) Lightweight network IP scanner with web GUI diff --git a/internal/web/search.go b/internal/web/search.go index 2259971..897e9af 100644 --- a/internal/web/search.go +++ b/internal/web/search.go @@ -12,15 +12,7 @@ func searchHandler(w http.ResponseWriter, r *http.Request) { foundHosts := []models.Host{} for _, oneHost := range AllHosts { - if inString(oneHost.Name, search) { - foundHosts = append(foundHosts, oneHost) - } else if inString(oneHost.IP, search) { - foundHosts = append(foundHosts, oneHost) - } else if inString(oneHost.Mac, search) { - foundHosts = append(foundHosts, oneHost) - } else if inString(oneHost.Date, search) { - foundHosts = append(foundHosts, oneHost) - } else if inString(oneHost.Hw, search) { + if inString(oneHost.Name, search) || inString(oneHost.IP, search) || inString(oneHost.Mac, search) || inString(oneHost.Hw, search) || inString(oneHost.Date, search) { foundHosts = append(foundHosts, oneHost) } }