mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +02:00
23 lines
541 B
Go
23 lines
541 B
Go
package v1
|
|
|
|
import (
|
|
"net/http"
|
|
"strconv"
|
|
|
|
config "github.com/yusing/go-proxy/internal/config/types"
|
|
"github.com/yusing/go-proxy/internal/homepage"
|
|
"github.com/yusing/go-proxy/internal/net/gphttp"
|
|
)
|
|
|
|
func ListIconsHandler(cfg config.ConfigInstance, w http.ResponseWriter, r *http.Request) {
|
|
limit, err := strconv.Atoi(r.FormValue("limit"))
|
|
if err != nil {
|
|
limit = 0
|
|
}
|
|
icons, err := homepage.SearchIcons(r.FormValue("keyword"), limit)
|
|
if err != nil {
|
|
gphttp.ClientError(w, r, err)
|
|
return
|
|
}
|
|
gphttp.RespondJSON(w, r, icons)
|
|
}
|