From b4df925f8e441f239703cfea89265fc12dc86c9c Mon Sep 17 00:00:00 2001 From: ngn Date: Fri, 22 Mar 2024 13:53:32 +0300 Subject: [PATCH] fix: Fix status updates, add color to status --- lib/vuln.go | 21 ++++++++++++++++++++- templates/details.html | 2 +- templates/index.html | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/vuln.go b/lib/vuln.go index 17e8516..02a13c7 100644 --- a/lib/vuln.go +++ b/lib/vuln.go @@ -34,6 +34,25 @@ func ValidSeverity(s string) bool { return false } +func (v Vuln) StatusColor() string { + switch v.Status { + case "Waiting for review": + return "blue" + case "Ongoing review": + return "blue" + case "Working on a patch": + return "blue" + case "Won't patch": + return "red" + case "Patched": + return "green" + case "Not affected": + return "red" + } + + return "" +} + func GetID() string { now := time.Now() mic := strconv.FormatInt(now.UnixMicro(), 10) @@ -109,7 +128,7 @@ func UpdateVuln(v Vuln) error { } _, err = smt.Exec(v.Status, v.Message, - v.Author, v.Severity, v.ID, GetFTime()) + v.Author, v.Severity, GetFTime(), v.ID) if err != nil { return err } diff --git a/templates/details.html b/templates/details.html index 1c86749..1e2bc95 100644 --- a/templates/details.html +++ b/templates/details.html @@ -20,7 +20,7 @@ Status - {{.v.Status}} + {{.v.Status}}
{{.v.Message}} diff --git a/templates/index.html b/templates/index.html index 56ca415..b70bd85 100644 --- a/templates/index.html +++ b/templates/index.html @@ -50,7 +50,7 @@