feat: add proxy layer option for requests

Fixes #56 #21
This commit is contained in:
rramiachraf
2024-05-03 12:45:58 +01:00
parent c940b4a2cd
commit 2c0f43b8f7
15 changed files with 78 additions and 450 deletions

View File

@ -28,7 +28,7 @@ func lyrics(l *utils.Logger) http.HandlerFunc {
}
url := fmt.Sprintf("https://genius.com/%s", id)
resp, err := sendRequest(url)
resp, err := utils.SendRequest(url)
if err != nil {
l.Error(err.Error())
w.WriteHeader(http.StatusInternalServerError)
@ -55,7 +55,7 @@ func lyrics(l *utils.Logger) http.HandlerFunc {
cf := doc.Find(".cloudflare_content").Length()
if cf > 0 {
l.Error("cloudflare got in the way")
views.ErrorPage(500, "TODO: fix Cloudflare #21").Render(context.Background(), w)
views.ErrorPage(500, "cloudflare is detected").Render(context.Background(), w)
return
}