blob: 6e7bd47ff3e581fadf3040f8568e0f3ce0f4d36a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package main
import (
"net/http"
"encoding/json"
"github.com/FChannel0/FChannel-Server/activitypub"
"github.com/FChannel0/FChannel-Server/config"
"github.com/FChannel0/FChannel-Server/db"
_ "github.com/lib/pq"
)
func GetActorOutbox(w http.ResponseWriter, r *http.Request) error {
actor, err := db.GetActorFromPath(r.URL.Path, "/")
if err != nil {
return err
}
var collection activitypub.Collection
c, err := db.GetActorObjectCollectionFromDB(actor.Id)
if err != nil {
return err
}
collection.OrderedItems = c.OrderedItems
collection.AtContext.Context = "https://www.w3.org/ns/activitystreams"
collection.Actor = &actor
collection.TotalItems, err = db.GetObjectPostsTotalDB(actor)
if err != nil {
return err
}
collection.TotalImgs, err = db.GetObjectImgsTotalDB(actor)
if err != nil {
return err
}
enc, _ := json.Marshal(collection)
w.Header().Set("Content-Type", config.ActivityStreams)
_, err = w.Write(enc)
return err
}
|