diff options
-rw-r--r-- | OutboxPost.go | 5 | ||||
-rw-r--r-- | main.go | 11 |
2 files changed, 10 insertions, 6 deletions
diff --git a/OutboxPost.go b/OutboxPost.go index aae2d45..7388aed 100644 --- a/OutboxPost.go +++ b/OutboxPost.go @@ -496,7 +496,7 @@ func CheckCaptcha(db *sql.DB, captcha string) bool { if (code == strings.ToUpper(parts[1])) { return true - } +p } return false } @@ -505,8 +505,7 @@ func ParseInboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) { activity := GetActivityFromJson(r, db) header := r.Header.Get("Authorization") - - auth := strings.Split(header, " ") + auth := strings.Split(header, " ") switch(activity.Type) { case "Create": for _, e := range activity.To { @@ -422,7 +422,7 @@ func main() { CheckError(err, "error with follow req") _, pass := GetPasswordFromSession(r) - + req.Header.Set("Authorization", "Basic " + pass) req.Header.Set("Content-Type", activitystreams) @@ -899,7 +899,9 @@ func CreateTripCode(input string) string { CheckError(err, "error with create trip code") - return out.String() + code := strings.Split(out.String(), " ") + + return code[0] } func CreateNameTripCode(input string) string { @@ -1615,7 +1617,10 @@ func MakeActivityRequest(db *sql.DB, activity Activity) { req, err := http.NewRequest("POST", actor.Inbox, bytes.NewBuffer(j)) req.Header.Set("Content-Type", activitystreams) - req.Header.Set("Authorization", "Basic " + auth) + + if activity.Type == "Create" { + req.Header.Set("Authorization", "Basic " + auth) + } CheckError(err, "error with sending activity req to") |