feat: enhance learn-number with dynamic SVG icons, multi-page support, and modular UI
Build and Push Docker Image / build (push) Successful in 2m26s
Build and Push Docker Image / build (push) Successful in 2m26s
This commit is contained in:
+11
-4
@@ -9,6 +9,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"toolbox/pkg/base"
|
||||
_ "toolbox/pkg/learnnumber"
|
||||
@@ -81,11 +82,17 @@ func main() {
|
||||
r.GET("/", serveIndex)
|
||||
r.GET("/api/tools", func(c *gin.Context) {
|
||||
var list []map[string]string
|
||||
for _, t := range base.Registry {
|
||||
ids := make([]string, 0, len(base.Registry))
|
||||
for id := range base.Registry { ids = append(ids, id) }
|
||||
sort.Strings(ids)
|
||||
|
||||
for _, id := range ids {
|
||||
t := base.Registry[id]
|
||||
list = append(list, map[string]string{
|
||||
"id": t.ID(),
|
||||
"name": t.Name(),
|
||||
"desc": t.Description(),
|
||||
"id": t.ID(),
|
||||
"name": t.Name(),
|
||||
"desc": t.Description(),
|
||||
"emoji": t.Emoji(),
|
||||
})
|
||||
}
|
||||
c.JSON(http.StatusOK, list)
|
||||
|
||||
Reference in New Issue
Block a user