diff --git a/app/backend/binary.go b/app/backend/binary.go index 23956fa..50d22b9 100644 --- a/app/backend/binary.go +++ b/app/backend/binary.go @@ -44,7 +44,7 @@ func instagramHandleExists(username string, bypass ...bool) string { utils.Logger.Infof("Checking Insta account: %v", username) records, _ := db.GetRecords(db.QueryOptions{Where: fmt.Sprintf(`handle='%v'`, username)}) if len(records) > 0 && len(bypass) == 0 { - utils.Logger.Infof("Using stored value") + utils.Logger.Infof("Using stored value from DB") return records[0].URL } url := fmt.Sprintf("https://www.instagram.com/%s/", username) @@ -92,6 +92,7 @@ func BinaryHandler(w http.ResponseWriter, req *http.Request) { var handle string var err error if binaryInput == "" { + utils.Logger.Infof("Got Request for Text to Binary") asciiInput := req.URL.Query().Get("text") if asciiInput == "" { fmt.Fprintf(w, "Could not encode or decode!\n") @@ -101,6 +102,7 @@ func BinaryHandler(w http.ResponseWriter, req *http.Request) { fmt.Fprintf(w, "%v\n", GetFancyResponse(`

`+text+`

`, "")) return } else { + utils.Logger.Infof("Got Request for Binary to Text") text, err = binaryToASCII(binaryInput) text = strings.ReplaceAll(text, "@", "") handle = text diff --git a/app/backend/report.go b/app/backend/report.go index bac9f84..7b61609 100644 --- a/app/backend/report.go +++ b/app/backend/report.go @@ -2,19 +2,22 @@ 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") - db.DeleteRecord(records[0]) + utils.Logger.Infof("Fixing bad link") } else { fmt.Fprintf(w, "Link seems to be active and working!\n") + utils.Logger.Infof("Link is fine") } } }