tiny 88x31 lexicon for atproto
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add too much logging

+9
+9
handler/upload.go
··· 63 63 } 64 64 65 65 func (h *Handler) unlike(cs *oauth.ClientSession, w http.ResponseWriter, r *http.Request) { 66 + log.Println("unliking") 66 67 if cs == nil { 67 68 http.Error(w, "unlike requires auth", http.StatusUnauthorized) 68 69 return 69 70 } 71 + log.Println("has auth") 70 72 err := r.ParseForm() 71 73 if err != nil { 72 74 http.Error(w, "form failed to parse", http.StatusBadRequest) 73 75 return 74 76 } 77 + log.Println("form parsed") 75 78 uri := r.FormValue("uri") 76 79 if uri == "" { 77 80 http.Error(w, "must provide uri, don't tamper with form", http.StatusBadRequest) 78 81 return 79 82 } 83 + log.Println("has uri") 80 84 cid := r.FormValue("cid") 81 85 if cid == "" { 82 86 http.Error(w, "must provide a cid, don't tamper with form", http.StatusBadRequest) 83 87 return 84 88 } 89 + log.Println("has cid") 85 90 86 91 aturi, err := syntax.ParseATURI(uri) 87 92 if err != nil { 88 93 http.Error(w, "uri doesn't parse, don't tamper with form", http.StatusBadRequest) 94 + return 89 95 } 96 + log.Println("uri parsed") 90 97 err = myoauth.DeleteLike(cs, aturi.RecordKey().String(), cid, r.Context()) 91 98 if err != nil { 92 99 log.Println(err) 93 100 http.Error(w, "error deleting like", http.StatusInternalServerError) 94 101 return 95 102 } 103 + log.Println("deleted like") 96 104 err = h.db.DeleteLike(uri, r.Context()) 97 105 if err != nil { 98 106 log.Println(err) 99 107 http.Error(w, "error storing like", http.StatusInternalServerError) 100 108 return 101 109 } 110 + log.Println("cached deleted like") 102 111 http.Redirect(w, r, fmt.Sprintf("/button?uri=%s", uri), http.StatusCreated) 103 112 } 104 113