small tweaks

This commit is contained in:
2024-01-19 17:43:40 -06:00
parent c1739856ce
commit 567cfe8083
6 changed files with 20 additions and 12795 deletions

View File

@@ -55,6 +55,7 @@ func tmpltWebRoot(w http.ResponseWriter, r *http.Request) {
var (
msgBuffer bytes.Buffer
cves []cisa.VulStruct
num int = 3
)
c := cisa.Read()
@@ -65,10 +66,14 @@ func tmpltWebRoot(w http.ResponseWriter, r *http.Request) {
}
}
if len(cves) < 3 {
num = len(cves)
}
if err := tmplt.Execute(&msgBuffer, struct {
CVEs []cisa.VulStruct
}{
CVEs: cves[len(cves)-3:],
CVEs: cves[len(cves)-num:],
}); err != nil {
config.Cfg.Log.Debug("unable to execute html template", err)
tmpltError(w, http.StatusInternalServerError, "Template Parse Error.")