aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <>2021-06-24 23:45:18 -0700
committerFChannel <>2021-06-24 23:45:18 -0700
commitef7eb7330018c84a44fb24711982c25f51749d2e (patch)
tree8da97fce2dad238b994eede1f0b9ce2bf9b3a7ff
parentb4f7d00ad9d13f96323366ded2eb7702e37f6e52 (diff)
changed activitystream formating for objects to better align with pleromas actor field
-rw-r--r--activityPubStruct.go4
-rw-r--r--cacheDatabase.go4
-rw-r--r--client.go11
-rw-r--r--database.go30
-rw-r--r--follow.go37
-rw-r--r--main.go74
-rw-r--r--outboxGet.go6
-rw-r--r--outboxPost.go20
-rw-r--r--static/main.html10
9 files changed, 84 insertions, 112 deletions
diff --git a/activityPubStruct.go b/activityPubStruct.go
index b19536a..06c97e1 100644
--- a/activityPubStruct.go
+++ b/activityPubStruct.go
@@ -109,7 +109,7 @@ type ObjectBase struct {
Alias string `json:"alias,omitempty"`
AttributedTo string `json:"attributedTo,omitempty"`
TripCode string `json:"tripcode,omitempty"`
- Actor *Actor `json:"actor,omitempty"`
+ Actor string `json:"actor,omitempty"`
Audience string `json:"audience,omitempty"`
Content string `json:"content,omitempty"`
EndTime string `json:"endTime,omitempty"`
@@ -154,7 +154,7 @@ type NestedObjectBase struct {
Alias string `json:"alias,omitempty"`
AttributedTo string `json:"attributedTo,omitempty"`
TripCode string `json:"tripcode,omitempty"`
- Actor *Actor `json:"actor,omitempty"`
+ Actor string `json:"actor,omitempty"`
Audience string `json:"audience,omitempty"`
Content string `json:"content,omitempty"`
EndTime string `json:"endTime,omitempty"`
diff --git a/cacheDatabase.go b/cacheDatabase.go
index c234520..94f88d2 100644
--- a/cacheDatabase.go
+++ b/cacheDatabase.go
@@ -79,7 +79,7 @@ func WriteActivitytoCache(db *sql.DB, obj ObjectBase) {
query = `insert into cacheactivitystream (id, type, name, content, published, updated, attributedto, actor, tripcode, sensitive) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)`
- _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Content, obj.Published, obj.Published, obj.AttributedTo, obj.Actor.Id, obj.TripCode, obj.Sensitive)
+ _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Content, obj.Published, obj.Published, obj.AttributedTo, obj.Actor, obj.TripCode, obj.Sensitive)
if e != nil{
fmt.Println("error inserting new activity cache")
@@ -110,7 +110,7 @@ func WriteActivitytoCacheWithAttachment(db *sql.DB, obj ObjectBase, attachment O
query = `insert into cacheactivitystream (id, type, name, content, attachment, preview, published, updated, attributedto, actor, tripcode, sensitive) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`
- _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Content, attachment.Id, preview.Id, obj.Published, obj.Published, obj.AttributedTo, obj.Actor.Id, obj.TripCode, obj.Sensitive)
+ _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Content, attachment.Id, preview.Id, obj.Published, obj.Published, obj.AttributedTo, obj.Actor, obj.TripCode, obj.Sensitive)
if e != nil{
fmt.Println("error inserting new activity with attachment cache")
diff --git a/client.go b/client.go
index 1c3ae93..91f5f1f 100644
--- a/client.go
+++ b/client.go
@@ -89,7 +89,8 @@ func IndexGet(w http.ResponseWriter, r *http.Request, db *sql.DB) {
data.Board.Domain = Domain
data.Board.ModCred, _ = GetPasswordFromSession(r)
data.Board.Actor = actor
- data.Board.Post.Actor = &actor
+ data.Board.Post.Actor = actor.Id
+ data.Board.Restricted = actor.Restricted
t.ExecuteTemplate(w, "layout", data)
}
@@ -117,7 +118,7 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co
returnData.Board.Restricted = actor.Restricted
returnData.CurrentPage = page
- returnData.Board.Post.Actor = actor
+ returnData.Board.Post.Actor = actor.Id
returnData.Board.Captcha = Domain + "/" + GetRandomCaptcha(db)
returnData.Board.CaptchaCode = GetCaptchaCode(returnData.Board.Captcha)
@@ -160,7 +161,7 @@ func CatalogGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection C
returnData.Board.Restricted = actor.Restricted
returnData.Key = *Key
- returnData.Board.Post.Actor = actor
+ returnData.Board.Post.Actor = actor.Id
returnData.Instance = GetActorFromDB(db, Domain)
@@ -220,12 +221,12 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){
returnData.Posts = append(returnData.Posts, followCollection.OrderedItems[0])
var actor Actor
actor = FingerActor(returnData.Board.InReplyTo)
- returnData.Board.Post.Actor = &actor
+ returnData.Board.Post.Actor = actor.Id
}
} else {
collection := GetObjectByIDFromDB(db, inReplyTo)
- returnData.Board.Post.Actor = collection.Actor
+ returnData.Board.Post.Actor = collection.Actor.Id
returnData.Board.InReplyTo = inReplyTo
if len(collection.OrderedItems) > 0 {
diff --git a/database.go b/database.go
index 5e6e960..e88dd1e 100644
--- a/database.go
+++ b/database.go
@@ -119,7 +119,7 @@ func CreateNewBoardDB(db *sql.DB, actor Actor) Actor{
nActivity.Object = &nObject
mActor := GetActorFromDB(db, actor.Id)
- nActivity.Object.Actor = &mActor
+ nActivity.Object.Actor = mActor.Id
nActivity.To = append(nActivity.To, actor.Id)
response := AcceptFollow(nActivity)
@@ -159,10 +159,10 @@ func GetBoards(db *sql.DB) []Actor {
}
func WriteObjectToDB(db *sql.DB, obj ObjectBase) ObjectBase {
- obj.Id = fmt.Sprintf("%s/%s", obj.Actor.Id, CreateUniqueID(db, obj.Actor.Id))
+ obj.Id = fmt.Sprintf("%s/%s", obj.Actor, CreateUniqueID(db, obj.Actor))
if len(obj.Attachment) > 0 {
if obj.Preview.Href != "" {
- obj.Preview.Id = fmt.Sprintf("%s/%s", obj.Actor.Id, CreateUniqueID(db, obj.Actor.Id))
+ obj.Preview.Id = fmt.Sprintf("%s/%s", obj.Actor, CreateUniqueID(db, obj.Actor))
obj.Preview.Published = time.Now().Format(time.RFC3339)
obj.Preview.Updated = time.Now().Format(time.RFC3339)
obj.Preview.AttributedTo = obj.Id
@@ -170,7 +170,7 @@ func WriteObjectToDB(db *sql.DB, obj ObjectBase) ObjectBase {
}
for i, _ := range obj.Attachment {
- obj.Attachment[i].Id = fmt.Sprintf("%s/%s", obj.Actor.Id, CreateUniqueID(db, obj.Actor.Id))
+ obj.Attachment[i].Id = fmt.Sprintf("%s/%s", obj.Actor, CreateUniqueID(db, obj.Actor))
obj.Attachment[i].Published = time.Now().Format(time.RFC3339)
obj.Attachment[i].Updated = time.Now().Format(time.RFC3339)
obj.Attachment[i].AttributedTo = obj.Id
@@ -366,7 +366,7 @@ func WriteActivitytoDB(db *sql.DB, obj ObjectBase) {
query := `insert into activitystream (id, type, name, content, published, updated, attributedto, actor, tripcode, sensitive) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)`
- _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Content, obj.Published, obj.Updated, obj.AttributedTo, obj.Actor.Id, obj.TripCode, obj.Sensitive)
+ _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Content, obj.Published, obj.Updated, obj.AttributedTo, obj.Actor, obj.TripCode, obj.Sensitive)
if e != nil{
fmt.Println("error inserting new activity")
@@ -382,7 +382,7 @@ func WriteActivitytoDBWithAttachment(db *sql.DB, obj ObjectBase, attachment Obje
query := `insert into activitystream (id, type, name, content, attachment, preview, published, updated, attributedto, actor, tripcode, sensitive) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`
- _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Content, attachment.Id, preview.Id, obj.Published, obj.Updated, obj.AttributedTo, obj.Actor.Id, obj.TripCode, obj.Sensitive)
+ _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Content, attachment.Id, preview.Id, obj.Published, obj.Updated, obj.AttributedTo, obj.Actor, obj.TripCode, obj.Sensitive)
if e != nil{
fmt.Println("error inserting new activity with attachment")
@@ -436,7 +436,7 @@ func GetActivityFromDB(db *sql.DB, id string) Collection {
CheckError(err, "error scan object into post struct")
- post.Actor = &actor
+ post.Actor = actor.Id
var postCnt int
var imgCnt int
@@ -479,7 +479,7 @@ func GetObjectFromDBPage(db *sql.DB, id string, page int) Collection {
CheckError(err, "error scan object into post struct")
- post.Actor = &actor
+ post.Actor = actor.Id
var postCnt int
var imgCnt int
@@ -522,7 +522,7 @@ func GetObjectFromDB(db *sql.DB, id string) Collection {
CheckError(err, "error scan object into post struct")
- post.Actor = &actor
+ post.Actor = actor.Id
var postCnt int
var imgCnt int
@@ -564,7 +564,7 @@ func GetObjectFromDBCatalog(db *sql.DB, id string) Collection {
CheckError(err, "error scan object into post struct")
- post.Actor = &actor
+ post.Actor = actor.Id
var replies CollectionBase
@@ -607,7 +607,7 @@ func GetObjectByIDFromDB(db *sql.DB, postID string) Collection {
actor = GetActorFromDB(db, actor.Id)
- post.Actor = &actor
+ post.Actor = actor.Id
nColl.Actor = &actor
@@ -678,7 +678,7 @@ func GetObjectRepliesDBLimit(db *sql.DB, parent ObjectBase, limit int) (*Collect
CheckError(err, "error with replies db scan")
- post.Actor = &actor
+ post.Actor = actor.Id
var postCnt int
var imgCnt int
@@ -728,7 +728,7 @@ func GetObjectRepliesDB(db *sql.DB, parent ObjectBase) (*CollectionBase, int, in
CheckError(err, "error with replies db scan")
- post.Actor = &actor
+ post.Actor = actor.Id
var postCnt int
var imgCnt int
@@ -773,7 +773,7 @@ func GetObjectRepliesReplies(db *sql.DB, parent ObjectBase) (*CollectionBase, in
CheckError(err, "error with replies replies db scan")
- post.Actor = &actor
+ post.Actor = actor.Id
post.Attachment = GetObjectAttachment(db, attachID)
@@ -813,7 +813,7 @@ func GetObjectRepliesRepliesDB(db *sql.DB, parent ObjectBase) (*CollectionBase,
CheckError(err, "error with replies replies db scan")
- post.Actor = &actor
+ post.Actor = actor.Id
post.Attachment = GetObjectAttachment(db, attachID)
diff --git a/follow.go b/follow.go
index 667c6bd..d62e3b8 100644
--- a/follow.go
+++ b/follow.go
@@ -118,19 +118,17 @@ func AcceptFollow(activity Activity) Activity {
var accept Activity
accept.AtContext.Context = activity.AtContext.Context
accept.Type = "Accept"
- accept.Actor = activity.Object.Actor
+ var nActor Actor
+ accept.Actor = &nActor
+ accept.Actor.Id = activity.Object.Actor
var nObj ObjectBase
- var nActor Actor
accept.Object = &nObj
- accept.Object.Actor = &nActor
- accept.Object.Actor = activity.Actor
+ accept.Object.Actor = activity.Actor.Id
var nNested NestedObjectBase
- var mActor Actor
accept.Object.Object = &nNested
- accept.Object.Object.Actor = &mActor
accept.Object.Object.Actor = activity.Object.Actor
accept.Object.Object.Type = "Follow"
- accept.To = append(accept.To, activity.Object.Actor.Id)
+ accept.To = append(accept.To, activity.Object.Actor)
return accept
}
@@ -140,15 +138,11 @@ func RejectActivity(activity Activity) Activity {
accept.AtContext.Context = activity.AtContext.Context
accept.Type = "Reject"
var nObj ObjectBase
- var nActor Actor
accept.Object = &nObj
- accept.Object.Actor = &nActor
- accept.Actor = activity.Object.Actor
- accept.Object.Actor = activity.Actor
+ accept.Actor.Id = activity.Object.Actor
+ accept.Object.Actor = activity.Actor.Id
var nNested NestedObjectBase
- var mActor Actor
accept.Object.Object = &nNested
- accept.Object.Object.Actor = &mActor
accept.Object.Object.Actor = activity.Object.Actor
accept.Object.Object.Type = "Follow"
accept.To = append(accept.To, activity.Actor.Id)
@@ -162,19 +156,20 @@ func SetActorFollowerDB(db *sql.DB, activity Activity) Activity {
followers := GetActorFollowDB(db, activity.Actor.Id)
for _, e := range followers {
- if e.Id == activity.Object.Actor.Id {
+ if e.Id == activity.Object.Actor {
alreadyFollow = true
}
}
+
if alreadyFollow {
query = `delete from follower where id=$1 and follower=$2`
- activity.Summary = activity.Object.Actor.Id + " Unfollow " + activity.Actor.Id
+ activity.Summary = activity.Object.Actor + " Unfollow " + activity.Actor.Id
} else {
query = `insert into follower (id, follower) values ($1, $2)`
- activity.Summary = activity.Object.Actor.Id + " Follow " + activity.Actor.Id
+ activity.Summary = activity.Object.Actor + " Follow " + activity.Actor.Id
}
- _, err := db.Exec(query, activity.Actor.Id, activity.Object.Actor.Id)
+ _, err := db.Exec(query, activity.Actor.Id, activity.Object.Actor)
if CheckError(err, "error with follower db insert/delete") != nil {
activity.Type = "Reject"
@@ -188,7 +183,7 @@ func SetActorFollowerDB(db *sql.DB, activity Activity) Activity {
func SetActorFollowingDB(db *sql.DB, activity Activity) Activity {
var query string
alreadyFollow := false
- following := GetActorFollowingDB(db, activity.Object.Actor.Id)
+ following := GetActorFollowingDB(db, activity.Object.Actor)
for _, e := range following {
if e.Id == activity.Actor.Id {
@@ -198,19 +193,19 @@ func SetActorFollowingDB(db *sql.DB, activity Activity) Activity {
if alreadyFollow {
query = `delete from following where id=$1 and following=$2`
- activity.Summary = activity.Object.Actor.Id + " Unfollowing " + activity.Actor.Id
+ activity.Summary = activity.Object.Actor + " Unfollowing " + activity.Actor.Id
if !IsActorLocal(db, activity.Actor.Id) {
go DeleteActorCache(db, activity.Actor.Id)
}
} else {
query = `insert into following (id, following) values ($1, $2)`
- activity.Summary = activity.Object.Actor.Id + " Following " + activity.Actor.Id
+ activity.Summary = activity.Object.Actor + " Following " + activity.Actor.Id
if !IsActorLocal(db, activity.Actor.Id) {
go WriteActorToCache(db, activity.Actor.Id)
}
}
- _, err := db.Exec(query, activity.Object.Actor.Id, activity.Actor.Id)
+ _, err := db.Exec(query, activity.Object.Actor, activity.Actor.Id)
if CheckError(err, "error with following db insert/delete") != nil {
activity.Type = "Reject"
diff --git a/main.go b/main.go
index 8886266..44e7ea3 100644
--- a/main.go
+++ b/main.go
@@ -446,12 +446,10 @@ func main() {
followActivity.Actor = &nactor
followActivity.Object = &obj
- var mactor Actor
- followActivity.Object.Actor = &mactor
- followActivity.Object.Actor.Id = r.FormValue("follow")
+ followActivity.Object.Actor = r.FormValue("follow")
followActivity.To = append(followActivity.To, r.FormValue("follow"))
- if followActivity.Actor.Id == Domain && !IsActorLocal(db, followActivity.Object.Actor.Id) {
+ if followActivity.Actor.Id == Domain && !IsActorLocal(db, followActivity.Object.Actor) {
w.Write([]byte("main board can only follow local boards. Create a new board and then follow outside boards from it."))
return
}
@@ -514,7 +512,7 @@ func main() {
adminData.Key = *Key
adminData.Board.TP = TP
- adminData.Board.Post.Actor = &actor
+ adminData.Board.Post.Actor = actor.Id
t.ExecuteTemplate(w, "layout", adminData)
@@ -547,7 +545,7 @@ func main() {
adminData.Boards = Boards
- adminData.Board.Post.Actor = &actor
+ adminData.Board.Post.Actor = actor.Id
t.ExecuteTemplate(w, "layout", adminData)
}
@@ -578,8 +576,12 @@ func main() {
var nobj ObjectBase
newActorActivity.Actor = &actor
- newActorActivity.Object = &nobj
- newActorActivity.Object.Actor = &board
+ newActorActivity.Object = &nobj
+
+ newActorActivity.Object.Alias = board.Name
+ newActorActivity.Object.Name = board.PreferredUsername
+ newActorActivity.Object.Summary = board.Summary
+ newActorActivity.Object.Sensitive = board.Restricted
MakeActivityRequestOutbox(db, newActorActivity)
http.Redirect(w, r, "/" + *Key, http.StatusSeeOther)
@@ -680,7 +682,7 @@ func main() {
actor := col.OrderedItems[0].Actor
- if !HasAuth(db, auth, actor.Id) {
+ if !HasAuth(db, auth, actor) {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte(""))
return
@@ -774,7 +776,7 @@ func main() {
OP = id
}
- if !HasAuth(db, auth, actor.Id) {
+ if !HasAuth(db, auth, actor) {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte(""))
return
@@ -838,7 +840,7 @@ func main() {
OP = id
}
- if !HasAuth(db, auth, actor.Id) {
+ if !HasAuth(db, auth, actor) {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte(""))
return
@@ -872,7 +874,7 @@ func main() {
return
}
- if !HasAuth(db, auth, actor.Id) {
+ if !HasAuth(db, auth, actor) {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte(""))
return
@@ -938,7 +940,7 @@ func main() {
return
}
- if !HasAuth(db, auth, actor.Id) {
+ if !HasAuth(db, auth, actor) {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte(""))
return
@@ -1344,7 +1346,7 @@ func AddFollowersToActivity(db *sql.DB, activity Activity) Activity{
func CreateActivity(activityType string, obj ObjectBase) Activity {
var newActivity Activity
- actor := FingerActor(obj.Actor.Id)
+ actor := FingerActor(obj.Actor)
newActivity.AtContext.Context = "https://www.w3.org/ns/activitystreams"
newActivity.Type = activityType
@@ -1353,13 +1355,13 @@ func CreateActivity(activityType string, obj ObjectBase) Activity {
newActivity.Object = &obj
for _, e := range obj.To {
- if obj.Actor.Id != e {
+ if obj.Actor != e {
newActivity.To = append(newActivity.To, e)
}
}
for _, e := range obj.Cc {
- if obj.Actor.Id != e {
+ if obj.Actor != e {
newActivity.Cc = append(newActivity.Cc, e)
}
}
@@ -1919,30 +1921,6 @@ func GetCollectionFromID(id string) Collection {
return nColl
}
-func GetActorFromID(id string) Actor {
- req, err := http.NewRequest("GET", id, nil)
-
- CheckError(err, "error getting actor from id req")
-
- req.Header.Set("Accept", activitystreams)
-
- resp, err := http.DefaultClient.Do(req)
-
- CheckError(err, "error getting actor from id resp")
-
- defer resp.Body.Close()
-
- body, _ := ioutil.ReadAll(resp.Body)
-
- var respCollection Collection
-
- err = json.Unmarshal(body, &respCollection)
-
- CheckError(err, "error getting actor resp from json body")
-
- return *respCollection.OrderedItems[0].Actor
-}
-
func GetConfigValue(value string) string{
file, err := os.Open("config")
@@ -2007,21 +1985,21 @@ func DeleteObjectRequest(db *sql.DB, id string) {
var nObj ObjectBase
var nActor Actor
nObj.Id = id
- nObj.Actor = &nActor
+ nObj.Actor = nActor.Id
activity := CreateActivity("Delete", nObj)
obj := GetObjectFromPath(db, id)
- actor := FingerActor(obj.Actor.Id)
+ actor := FingerActor(obj.Actor)
activity.Actor = &actor
- followers := GetActorFollowDB(db, obj.Actor.Id)
+ followers := GetActorFollowDB(db, obj.Actor)
for _, e := range followers {
activity.To = append(activity.To, e.Id)
}
- following := GetActorFollowingDB(db, obj.Actor.Id)
+ following := GetActorFollowingDB(db, obj.Actor)
for _, e := range following {
activity.To = append(activity.To, e.Id)
}
@@ -2033,22 +2011,22 @@ func DeleteObjectAndRepliesRequest(db *sql.DB, id string) {
var nObj ObjectBase
var nActor Actor
nObj.Id = id
- nObj.Actor = &nActor
+ nObj.Actor = nActor.Id
activity := CreateActivity("Delete", nObj)
obj := GetObjectByIDFromDB(db, id)
- activity.Actor.Id = obj.OrderedItems[0].Actor.Id
+ activity.Actor.Id = obj.OrderedItems[0].Actor
activity.Object = &obj.OrderedItems[0]
- followers := GetActorFollowDB(db, obj.OrderedItems[0].Actor.Id)
+ followers := GetActorFollowDB(db, obj.OrderedItems[0].Actor)
for _, e := range followers {
activity.To = append(activity.To, e.Id)
}
- following := GetActorFollowingDB(db, obj.OrderedItems[0].Actor.Id)
+ following := GetActorFollowingDB(db, obj.OrderedItems[0].Actor)
for _, e := range following {
activity.To = append(activity.To, e.Id)
}
diff --git a/outboxGet.go b/outboxGet.go
index 49b7bd5..acc1eee 100644
--- a/outboxGet.go
+++ b/outboxGet.go
@@ -45,7 +45,7 @@ func GetCollectionFromPath(db *sql.DB, path string) Collection {
CheckError(err, "error scan object into post struct from path")
- post.Actor = &actor
+ post.Actor = actor.Id
post.InReplyTo = GetInReplyToDB(db, post)
@@ -88,9 +88,9 @@ func GetObjectFromPath(db *sql.DB, path string) ObjectBase{
var previewID string
var nActor Actor
- nObj.Actor = &nActor
+ nObj.Actor = nActor.Id
- err = rows.Scan(&nObj.Id, &nObj.Name, &nObj.Content, &nObj.Type, &nObj.Published, &nObj.AttributedTo, &attachID, &previewID, &nObj.Actor.Id)
+ err = rows.Scan(&nObj.Id, &nObj.Name, &nObj.Content, &nObj.Type, &nObj.Published, &nObj.AttributedTo, &attachID, &previewID, &nObj.Actor)
CheckError(err, "error scan object into post struct from path")
diff --git a/outboxPost.go b/outboxPost.go
index c5e582a..774ac62 100644
--- a/outboxPost.go
+++ b/outboxPost.go
@@ -43,9 +43,7 @@ func ParseOutboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) {
var nObj = CreateObject("Note")
nObj = ObjectFromForm(r, db, nObj)
- var act Actor
- nObj.Actor = &act
- nObj.Actor.Id = Domain + "/" + actor.Name
+ nObj.Actor = Domain + "/" + actor.Name
nObj = WriteObjectToDB(db, nObj)
activity := CreateActivity("Create", nObj)
@@ -88,9 +86,9 @@ func ParseOutboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) {
var validActor bool
var validLocalActor bool
- validActor = (activity.Object.Actor.Id != "")
+ validActor = (activity.Object.Actor != "")
validLocalActor = (activity.Actor.Id == actor.Id)
-
+
var rActivity Activity
if validActor && validLocalActor {
rActivity = AcceptFollow(activity)
@@ -114,10 +112,10 @@ func ParseOutboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) {
break
case "New":
- name := activity.Object.Actor.Name
- prefname := activity.Object.Actor.PreferredUsername
- summary := activity.Object.Actor.Summary
- restricted := activity.Object.Actor.Restricted
+ name := activity.Object.Alias
+ prefname := activity.Object.Name
+ summary := activity.Object.Summary
+ restricted := activity.Object.Sensitive
actor := CreateNewBoardDB(db, *CreateNewActor(name, prefname, summary, authReq, restricted))
@@ -368,7 +366,7 @@ func ObjectFromForm(r *http.Request, db *sql.DB, obj ObjectBase) ObjectBase {
if originalPost.Id != "" {
if !IsActivityLocal(db, activity) {
- id := GetActorFromID(originalPost.Id).Id
+ id := FingerActor(originalPost.Id).Id
actor := GetActor(id)
if !IsInStringArray(obj.To, actor.Id) {
obj.To = append(obj.To, actor.Id)
@@ -397,7 +395,7 @@ func ObjectFromForm(r *http.Request, db *sql.DB, obj ObjectBase) ObjectBase {
activity.To = append(activity.To, e.Id)
if !IsActivityLocal(db, activity) {
- id := GetActorFromID(e.Id).Id
+ id := FingerActor(e.Id).Id
actor := GetActor(id)
if !IsInStringArray(obj.To, actor.Id) {
obj.To = append(obj.To, actor.Id)
diff --git a/static/main.html b/static/main.html
index 172f90b..91d8344 100644
--- a/static/main.html
+++ b/static/main.html
@@ -22,7 +22,7 @@
}
body {
- {{ if .Board.Post.Actor.Restricted }}
+ {{ if .Board.Restricted }}
background-color: #eef2fe;
color: black;
{{ else }}
@@ -32,7 +32,7 @@
}
.popup-box {
- {{ if .Board.Post.Actor.Restricted }}
+ {{ if .Board.Restricted }}
border: 4px solid #d3caf0;
background-color: #eff5ff;
{{ else }}
@@ -46,7 +46,7 @@
}
.reply {
- {{ if .Board.Post.Actor.Restricted }}
+ {{ if .Board.Restricted }}
color:#af0a0f;
{{ else }}
color:#000080;
@@ -54,7 +54,7 @@
}
.post {
- {{ if .Board.Post.Actor.Restricted }}
+ {{ if .Board.Restricted }}
background-color: #d5daf0;
{{ else }}
background-color: #f0e0d6;
@@ -62,7 +62,7 @@
}
:target > div > .post {
- {{ if .Board.Post.Actor.Restricted }}
+ {{ if .Board.Restricted }}
background-color: #d6bad0;
{{ else }}
background-color: #f0c0b0;