update: new logging functions
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"log"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.matterlinux.xyz/matter/security/lib"
|
||||
"git.matterlinux.xyz/matter/security/log"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
@ -21,7 +21,7 @@ func GetPage(c *fiber.Ctx) (int, int, int) {
|
||||
return page, page * PAGE_SIZE, (page * PAGE_SIZE) - PAGE_SIZE
|
||||
}
|
||||
|
||||
func GETDetails(c *fiber.Ctx) error {
|
||||
func GET_Details(c *fiber.Ctx) error {
|
||||
id := c.Params("id")
|
||||
if id == "" || !strings.HasPrefix(id, "MPSI-") {
|
||||
return lib.RenderError(c, 404)
|
||||
@ -32,19 +32,17 @@ func GETDetails(c *fiber.Ctx) error {
|
||||
return lib.RenderError(c, 404)
|
||||
}
|
||||
|
||||
return c.Render("details", fiber.Map{
|
||||
"v": v,
|
||||
})
|
||||
return c.Render("details", &v)
|
||||
}
|
||||
|
||||
func GETIndex(c *fiber.Ctx) error {
|
||||
func GET_Index(c *fiber.Ctx) error {
|
||||
cur, max, min := GetPage(c)
|
||||
search_qu := c.Query("q")
|
||||
search_in := c.Query("i")
|
||||
|
||||
vulns, err := lib.LoadVulns()
|
||||
if err != nil {
|
||||
log.Printf("Failed to load vulns: %s", err.Error())
|
||||
log.Error("Failed to load vulns: %s", err.Error())
|
||||
return lib.RenderError(c, 500)
|
||||
}
|
||||
|
||||
@ -74,7 +72,6 @@ func GETIndex(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
results = append(results, vulns[i])
|
||||
|
||||
}
|
||||
|
||||
pages := int64(math.Ceil(float64(len(results)) / float64(PAGE_SIZE)))
|
||||
|
Reference in New Issue
Block a user