mirror of
https://codeberg.org/pluja/kycnot.me
synced 2025-08-12 00:11:21 -04:00
add user agent and referrer to the images request
This commit is contained in:
parent
c64ea21904
commit
a3a052b840
1 changed files with 10 additions and 1 deletions
|
@ -63,7 +63,16 @@ func (s *Server) handleApiPicture(c iris.Context) {
|
|||
}
|
||||
|
||||
log.Debug().Msgf("Image %s not found in cache", service.ID)
|
||||
resp, err := http.Get(service.LogoURL)
|
||||
client := &http.Client{}
|
||||
req, err := http.NewRequest("GET", service.LogoURL, nil)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("Failed to create HTTP request")
|
||||
return
|
||||
}
|
||||
|
||||
req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.3")
|
||||
req.Header.Set("Referer", service.Urls[0])
|
||||
resp, err := client.Do(req)
|
||||
if err != nil || resp.StatusCode != http.StatusOK {
|
||||
log.Error().Err(err).Msg("Could not get image")
|
||||
respondWithPlaceholder(c, service.Name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue