Commit f0da96f46b

f0da96f46b741ddc3c6e765bac308dcd9a9960a7

parent: 4e99b84b38

Unsigned

Wraient <wraient.911@gmail.com> · 2026-04-05 21:25 UTC

Fix: Every allanime api call uses POST request now

Layout: unified · split

Build/curd-windows-build.iss +1 −1
@@ -1,6 +1,6 @@
11[Setup]
22AppName=Curd Installer
3AppVersion=1.2.0
3AppVersion=1.2.1
44DefaultDirName={userappdata}\Curd
55PrivilegesRequired=lowest
66AllowNoIcons=yes
internal/anime_list.go +11 −9
@@ -1,11 +1,11 @@
11package internal
22
33import (
4 "bytes"
45 "encoding/json"
56 "fmt"
67 "io"
78 "net/http"
8 "net/url"
99 "os"
1010 "path/filepath"
1111 "strings"
@@ -137,24 +137,26 @@ func searchAnimeByMode(query, mode, preferredMode string) ([]SelectionOption, er
137137 "countryOrigin": "ALL",
138138 }
139139
140 // Marshal the variables to JSON
141 variablesJSON, err := json.Marshal(variables)
140 // Build POST request body
141 requestBody, err := json.Marshal(map[string]interface{}{
142 "query": searchGql,
143 "variables": variables,
144 })
142145 if err != nil {
143 Log(fmt.Sprintf("Error encoding variables to JSON: %v", err))
146 Log(fmt.Sprintf("Error encoding request body to JSON: %v", err))
144147 return animeList, err
145148 }
146149
147 // Build the request URL
148 url := fmt.Sprintf("%s?variables=%s&query=%s", allanimeAPI, url.QueryEscape(string(variablesJSON)), url.QueryEscape(searchGql))
149
150 // Make the HTTP request
151 req, err := http.NewRequest("GET", url, nil)
150 // Make the HTTP POST request
151 req, err := http.NewRequest("POST", allanimeAPI, bytes.NewBuffer(requestBody))
152152 if err != nil {
153153 Log(fmt.Sprintf("Error creating HTTP request: %v", err))
154154 return animeList, err
155155 }
156 req.Header.Set("Content-Type", "application/json")
156157 req.Header.Set("User-Agent", agent)
157158 req.Header.Set("Referer", allanimeRef)
159 req.Header.Set("Origin", allanimeRef)
158160
159161 client := &http.Client{}
160162 resp, err := client.Do(req)