aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--OutboxPost.go9
-rw-r--r--clientkey1
-rw-r--r--main.go27
4 files changed, 23 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index 5e2780e..1f7a89d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
*~
#*
public/
-config \ No newline at end of file
+config
+clientkey \ No newline at end of file
diff --git a/OutboxPost.go b/OutboxPost.go
index dbb49d2..12f9441 100644
--- a/OutboxPost.go
+++ b/OutboxPost.go
@@ -468,8 +468,6 @@ func GetActivityFromJson(r *http.Request, db *sql.DB) Activity {
to := GetToFromJson(respActivity.ToRaw)
cc := GetToFromJson(respActivity.CcRaw)
- jObj.AttributedTo = actor.Id
-
nActivity.AtContext.Context = "https://www.w3.org/ns/activitystreams"
nActivity.Type = nType
nActivity.Actor = &actor
@@ -517,6 +515,13 @@ func ParseInboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) {
WriteObjectToCache(db, *activity.Object)
}
}
+
+ for _, e := range activity.To {
+ if IsActorLocal(db, e) {
+ WriteObjectToCache(db, *activity.Object)
+ }
+ }
+
break
case "Delete":
diff --git a/clientkey b/clientkey
deleted file mode 100644
index 37b5687..0000000
--- a/clientkey
+++ /dev/null
@@ -1 +0,0 @@
-515ff978b24a657d3d1076da3cfe5102 \ No newline at end of file
diff --git a/main.go b/main.go
index e9cdb2f..874dc4d 100644
--- a/main.go
+++ b/main.go
@@ -339,7 +339,7 @@ func main() {
resp, err := http.DefaultClient.Do(req)
- CheckError(err, "error with post form resp")
+ CheckError(err, "error with post form resp")
defer resp.Body.Close()
@@ -581,7 +581,6 @@ func main() {
CheckError(err, "error getting actor from body in new board")
//update board list with new instances following
- fmt.Println(resp.StatusCode)
if resp.StatusCode == 200 {
var board []ObjectBase
var item ObjectBase
@@ -751,8 +750,6 @@ func main() {
actor := GetActorFromPath(db, id, "/")
_, auth := GetPasswordFromSession(r)
- fmt.Println(actor.Id)
-
if id == "" || auth == "" {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte(""))
@@ -1387,11 +1384,14 @@ func IsObjectLocal(db *sql.DB, id string) bool {
query := `select id from activitystream where id=$1`
- rows, err := db.Query(query, id)
+ rows, _ := db.Query(query, id)
+ var nID string
defer rows.Close()
-
- if err != nil {
+ rows.Next()
+ rows.Scan(&nID)
+
+ if nID == "" {
return false
}
@@ -1401,15 +1401,18 @@ func IsObjectLocal(db *sql.DB, id string) bool {
func IsObjectCached(db *sql.DB, id string) bool {
query := `select id from cacheactivitystream where id=$1`
- rows, err := db.Query(query, id)
+ rows, _ := db.Query(query, id)
+ var nID string
defer rows.Close()
-
- if err != nil {
+ rows.Next()
+ rows.Scan(&nID)
+
+ if nID == "" {
return false
}
- return true
+ return true
}
func GetObjectFromActivity(activity Activity) ObjectBase {
@@ -1555,8 +1558,6 @@ func MakeActivityRequest(activity Activity) {
for _, e := range activity.To {
- fmt.Println(e)
-
actor := GetActor(e)
if actor.Inbox != "" {