From 94c92948ae7ae669b6b6466ef4b7f00cc430f7ef Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Mon, 28 Jun 2021 11:08:15 -0700 Subject: added proxy wrapper with tor support --- outboxPost.go | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) (limited to 'outboxPost.go') diff --git a/outboxPost.go b/outboxPost.go index 5772932..cc66677 100644 --- a/outboxPost.go +++ b/outboxPost.go @@ -366,8 +366,7 @@ func ObjectFromForm(r *http.Request, db *sql.DB, obj ObjectBase) ObjectBase { if originalPost.Id != "" { if !IsActivityLocal(db, activity) { - id := FingerActor(originalPost.Id).Id - actor := GetActor(id) + actor := FingerActor(originalPost.Id) if !IsInStringArray(obj.To, actor.Id) { obj.To = append(obj.To, actor.Id) } @@ -395,8 +394,7 @@ func ObjectFromForm(r *http.Request, db *sql.DB, obj ObjectBase) ObjectBase { activity.To = append(activity.To, e.Id) if !IsActivityLocal(db, activity) { - id := FingerActor(e.Id).Id - actor := GetActor(id) + actor := FingerActor(e.Id) if !IsInStringArray(obj.To, actor.Id) { obj.To = append(obj.To, actor.Id) } @@ -579,10 +577,14 @@ func ParseInboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) { func MakeActivityFollowingReq(w http.ResponseWriter, r *http.Request, activity Activity) bool { actor := GetActor(activity.Object.Id) - resp, err := http.NewRequest("POST", actor.Inbox, nil) + req, err := http.NewRequest("POST", actor.Inbox, nil) CheckError(err, "Cannot make new get request to actor inbox for following req") + resp, err := RouteProxy(req) + + CheckError(err, "could not make remote actor auth resp") + defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) @@ -597,26 +599,3 @@ func MakeActivityFollowingReq(w http.ResponseWriter, r *http.Request, activity A return false } - -func RemoteActorHasAuth(actor string, code string) bool { - - if actor == "" || code == "" { - return false - } - - req, err := http.NewRequest("GET", actor + "/verification&code=" + code, nil) - - CheckError(err, "could not make remote actor auth req") - - resp, err := http.DefaultClient.Do(req) - - CheckError(err, "could not make remote actor auth resp") - - defer resp.Body.Close() - - if resp.StatusCode == 200 { - return true - } - - return false -} -- cgit v1.2.3