fix: Fix status updates, add color to status

This commit is contained in:
ngn 2024-03-22 13:53:32 +03:00
parent 05b909c76e
commit b4df925f8e
3 changed files with 22 additions and 3 deletions

View File

@ -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
}

View File

@ -20,7 +20,7 @@
<tr>
<td>Status</td>
<td>
<strong>{{.v.Status}}</strong>
<strong style="color: var(--{{.v.StatusColor}})">{{.v.Status}}</strong>
</br>{{.v.Message}}
</td>
</tr>

View File

@ -50,7 +50,7 @@
</tr>
</table>
<div class="vuln-footer">
<p><strong>Status:</strong> {{.Status}}</p>
<p style="color: var(--{{.StatusColor}})"><strong>Status:</strong> {{.Status}}</p>
<a href="/details/{{.ID}}">View details</a>
</div>
</div>