From 727b5701327a7e1c5f826f496b8e99c2004e471a Mon Sep 17 00:00:00 2001 From: KushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com> Date: Wed, 18 Aug 2021 17:34:12 -0300 Subject: 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. --- activityPubStruct.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'activityPubStruct.go') 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"` -- cgit v1.2.3