converter/app/backend/report.go
2025-06-26 11:56:30 -04:00

24 lines
689 B
Go

package backend
import (
"binaryserver/app/db"
"binaryserver/app/utils"
"fmt"
"net/http"
)
func ReportHandler(w http.ResponseWriter, req *http.Request) {
utils.Logger.Infof("Got Request for reporting a link")
handle := req.URL.Query().Get("handle")
records, _ := db.GetRecords(db.QueryOptions{Where: fmt.Sprintf(`handle='%v'`, handle)})
if len(records) > 0 {
if result := instagramHandleExists(records[0].Handle, true); result == "" && records[0].URL != "" {
fmt.Fprintf(w, "Link does seem to be bad. Fixing...\n")
utils.Logger.Infof("Fixing bad link")
} else {
fmt.Fprintf(w, "Link seems to be active and working!\n")
utils.Logger.Infof("Link is fine")
}
}
}