aboutsummaryrefslogtreecommitdiff
path: root/activityPubStruct.go
diff options
context:
space:
mode:
authorKushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com>2021-08-18 17:34:12 -0300
committerKushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com>2021-08-18 17:34:12 -0300
commit727b5701327a7e1c5f826f496b8e99c2004e471a (patch)
treeba7db03ffa5abf5fb893303c7f8f36339f7998e2 /activityPubStruct.go
parentd2cb70e8725371a72c0f9db36ad734041f4fb977 (diff)
experimental type change for times: string to time.Time
idk what i was doing before this but i wanted to use time.Time to get something similar to how 4chan's timestamps work, it would've also been easier for scripts to interface with it, since we have data we can work with much easier than a string i am not sure what this means for federation yet, so i'll test it out before i do anything.
Diffstat (limited to 'activityPubStruct.go')
-rw-r--r--activityPubStruct.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/activityPubStruct.go b/activityPubStruct.go
index 459259a..2c57c61 100644
--- a/activityPubStruct.go
+++ b/activityPubStruct.go
@@ -1,6 +1,8 @@
package main
import (
+ "time"
+
"encoding/json"
"html/template"
)
@@ -19,7 +21,7 @@ type ActivityRaw struct {
ToRaw json.RawMessage `json:"to,omitempty"`
BtoRaw json.RawMessage `json:"bto,omitempty"`
CcRaw json.RawMessage `json:"cc,omitempty"`
- Published string `json:"published,omitempty"`
+ Published time.Time `json:"published,omitempty"`
ActorRaw json.RawMessage `json:"actor,omitempty"`
ObjectRaw json.RawMessage `json:"object,omitempty"`
}
@@ -100,7 +102,7 @@ type Activity struct {
To []string `json:"to, omitempty"`
Bto []string `json:"bto,omitempty"`
Cc []string `json:"cc, omitempty"`
- Published string `json:"published,omitempty"`
+ Published time.Time `json:"published,omitempty"`
Object *ObjectBase `json:"object, omitempty"`
}
@@ -123,8 +125,8 @@ type ObjectBase struct {
InReplyTo []ObjectBase `json:"inReplyTo,omitempty"`
Location string `json:"location,omitempty"`
Preview *NestedObjectBase `json:"preview,omitempty"`
- Published string `json:"published,omitempty"`
- Updated string `json:"updated,omitempty"`
+ Published time.Time `json:"published,omitempty"`
+ Updated time.Time `json:"updated,omitempty"`
Object *NestedObjectBase `json:"object,omitempty"`
Attachment []ObjectBase `json:"attachment,omitempty"`
Replies *CollectionBase `json:"replies,omitempty"`
@@ -169,13 +171,13 @@ type NestedObjectBase struct {
InReplyTo []ObjectBase `json:"inReplyTo,omitempty"`
Location string `json:"location,omitempty"`
Preview ObjectBase `json:"preview,omitempty"`
- Published string `json:"published,omitempty"`
+ Published time.Time `json:"published,omitempty"`
Attachment []ObjectBase `json:"attachment,omitempty"`
Replies *CollectionBase `json:"replies,omitempty"`
StartTime string `json:"startTime,omitempty"`
Summary string `json:"summary,omitempty"`
Tag []ObjectBase `json:"tag,omitempty"`
- Updated string `json:"updated,omitempty"`
+ Updated time.Time `json:"updated,omitempty"`
Deleted string `json:"deleted,omitempty"`
Url []ObjectBase `json:"url,omitempty"`
Href string `json:"href,omitempty"`