fix(api): allow cors

This commit is contained in:
Guanran Wang 2024-10-26 15:37:22 +08:00
parent 3b6cca1b08
commit 36fe7b5e15
Signed by: nyancat
GPG key ID: 91F97D9ED12639CF

View file

@ -128,6 +128,8 @@ func generateJSON(ip string) (body, error) {
}
func handleRequest(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Access-Control-Allow-Origin", "*")
sourceIP := func() string {
if q := r.URL.Query().Get("q"); q != "" {
return q