aboutsummaryrefslogtreecommitdiff
path: root/outboxPost.go
diff options
context:
space:
mode:
authorFChannel <>2021-06-28 11:08:15 -0700
committerFChannel <>2021-06-28 11:08:15 -0700
commit94c92948ae7ae669b6b6466ef4b7f00cc430f7ef (patch)
treed832efcc1590d0d7b40ef639712324a0103fb070 /outboxPost.go
parent34fa3d38b97ff08130e8709c4820915dfd684b19 (diff)
added proxy wrapper with tor support
Diffstat (limited to 'outboxPost.go')
-rw-r--r--outboxPost.go35
1 files changed, 7 insertions, 28 deletions
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
-}