diff --git a/go.mod b/go.mod index 1330edc..11a8a0b 100644 --- a/go.mod +++ b/go.mod @@ -6,14 +6,9 @@ require ( github.com/dustin/go-humanize v1.0.1 github.com/julienschmidt/httprouter v1.3.0 github.com/k3a/html2text v1.2.1 - github.com/rystaf/go-lemmy v0.0.0-20230903163721-9db5472b7a03 + github.com/rystaf/go-lemmy v0.0.0-20231217010740-5b1f4cc46ca8 github.com/yuin/goldmark v1.5.4 golang.org/x/text v0.10.0 ) -require ( - github.com/cenkalti/backoff/v4 v4.2.0 // indirect - github.com/google/go-querystring v1.1.0 // indirect - github.com/gorilla/websocket v1.4.2 // indirect - go.elara.ws/go-lemmy v0.19.0 // indirect -) +require github.com/google/go-querystring v1.1.0 // indirect diff --git a/go.sum b/go.sum index 60c179a..f4b9062 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= @@ -8,26 +6,20 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/k3a/html2text v1.2.1 h1:nvnKgBvBR/myqrwfLuiqecUtaK1lB9hGziIJKatNFVY= github.com/k3a/html2text v1.2.1/go.mod h1:ieEXykM67iT8lTvEWBh6fhpH4B23kB9OMKPdIBmgUqA= -github.com/rystaf/go-lemmy v0.0.0-20230720221045-c6d79b98e968 h1:wfyB6wQzYMH2U8xQvdamExbyCyPhe4o8HP47FMZM5Jk= -github.com/rystaf/go-lemmy v0.0.0-20230720221045-c6d79b98e968/go.mod h1:nRSkTD+ARAHXtqlSPdf5q3hjHLP1ALsS1m5D3o86o+4= -github.com/rystaf/go-lemmy v0.0.0-20230903163721-9db5472b7a03 h1:g2vV60Mc3naU1NtGvx+l/W7AAckawsPRVmaR/XvcRh0= -github.com/rystaf/go-lemmy v0.0.0-20230903163721-9db5472b7a03/go.mod h1:nRSkTD+ARAHXtqlSPdf5q3hjHLP1ALsS1m5D3o86o+4= +github.com/rystaf/go-lemmy v0.0.0-20231217010740-5b1f4cc46ca8 h1:GoUxHONo2E9L3pAhPj9FLSEteJYjZKZVHiYudj0uunE= +github.com/rystaf/go-lemmy v0.0.0-20231217010740-5b1f4cc46ca8/go.mod h1:pCCcm1YH2pDzoO8MqjcwnQGoMBwRRIvqMmYZosF1lXw= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/yuin/goldmark v1.5.4 h1:2uY/xC0roWy8IBEGLgB1ywIoEJFGmRrX21YQcvGZzjU= github.com/yuin/goldmark v1.5.4/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.elara.ws/go-lemmy v0.19.0 h1:FdPfiA+8yOa2IhrLdBp8jdYbnY6H55bfwnBbiGr0OHg= -go.elara.ws/go-lemmy v0.19.0/go.mod h1:aZbF/4c1VA7qPXsP4Pth0ERu3HGZFPPl8bTY1ltBrcQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/routes.go b/routes.go index 89d5a92..4ffdf78 100644 --- a/routes.go +++ b/routes.go @@ -19,7 +19,7 @@ import ( "github.com/dustin/go-humanize" "github.com/julienschmidt/httprouter" "github.com/k3a/html2text" - "go.elara.ws/go-lemmy" + "github.com/rystaf/go-lemmy" "golang.org/x/text/language" "golang.org/x/text/message" ) diff --git a/state.go b/state.go index cc41906..1a49aed 100644 --- a/state.go +++ b/state.go @@ -16,9 +16,8 @@ import ( "sort" "strconv" "strings" - "time" - "go.elara.ws/go-lemmy" + "github.com/rystaf/go-lemmy" ) type Comment struct { @@ -45,7 +44,7 @@ type Person struct { } type Activity struct { - Timestamp time.Time + Timestamp lemmy.LemmyTime Comment *Comment Post *Post Message *lemmy.PrivateMessageView @@ -498,7 +497,7 @@ func (state *State) GetUser(username string) { }) } sort.Slice(state.Activities, func(i, j int) bool { - return state.Activities[i].Timestamp.After(state.Activities[j].Timestamp) + return state.Activities[i].Timestamp.After(state.Activities[j].Timestamp.Time) }) } diff --git a/templates/activities.html b/templates/activities.html index 6f3fdb9..110419b 100644 --- a/templates/activities.html +++ b/templates/activities.html @@ -47,7 +47,7 @@ {{- end -}} {{end}} - sent {{ humanize $activity.Message.PrivateMessage.Published }} + sent {{ humanize $activity.Message.PrivateMessage.Published.Time }}
{{ markdown "" $activity.Message.PrivateMessage.Content }}
diff --git a/templates/comment.html b/templates/comment.html index bb1ac69..ed7fa61 100644 --- a/templates/comment.html +++ b/templates/comment.html @@ -28,9 +28,9 @@ {{ fullname .P.Creator }} {{- end -}} - {{.P.Counts.Score}} points {{ humanize .P.Comment.Published }} - {{- if gt .P.Comment.Updated.Unix .P.Comment.Published.Unix -}} - * (last edited {{ humanize .P.Comment.Updated }}) + {{.P.Counts.Score}} points {{ humanize .P.Comment.Published.Time }} + {{- if gt .P.Comment.Updated.ValueOrZero.Time.Unix .P.Comment.Published.Time.Unix -}} + * (last edited {{ humanize .P.Comment.Updated.ValueOrZero.Time }}) {{ end }}
diff --git a/templates/community.html b/templates/community.html index f8b1310..287e868 100644 --- a/templates/community.html +++ b/templates/community.html @@ -12,7 +12,7 @@ {{ end }}
{{ if .Counts.Subscribers }}{{ printer .Counts.Subscribers }} subscribers,{{end}} - a community founded {{ humanize .Community.Published }} + a community founded {{ humanize .Community.Published.Time }}
diff --git a/templates/post.html b/templates/post.html index e93deff..6823108 100644 --- a/templates/post.html +++ b/templates/post.html @@ -44,9 +44,9 @@
submitted - {{ humanize .Post.Published -}} - {{- if gt .Post.Updated.Unix .Post.Published.Unix -}} - * (last edited {{ humanize .Post.Updated }}) + {{ humanize .Post.Published.Time -}} + {{- if gt .Post.Updated.ValueOrZero.Time.Unix .Post.Published.Time.Unix -}} + * (last edited {{ humanize .Post.Updated.ValueOrZero.Time }}) {{ end }} by diff --git a/templates/sidebar.html b/templates/sidebar.html index 76d2300..2fdf1ae 100644 --- a/templates/sidebar.html +++ b/templates/sidebar.html @@ -33,7 +33,7 @@ {{ end }}
{{ if .Session }}send a message{{end}} - joined {{ humanize .User.PersonView.Person.Published }} + joined {{ humanize .User.PersonView.Person.Published.Time }}
{{ if .User.Moderates }} MODERATOR OF @@ -47,7 +47,7 @@ {{ if and .PostID .Posts }}
- this post was submitted on {{ (index .Posts 0).Post.Published.Format "02 Jan 2006" }} + this post was submitted on {{ (index .Posts 0).Post.Published.Time.Format "02 Jan 2006" }}
{{ (index .Posts 0).Counts.Score }} points ({{likedPerc (index .Posts 0).Counts}}% liked)
{{ end }} @@ -72,7 +72,7 @@ {{ printer .Site.SiteView.Counts.UsersActiveDay }} users here now {{ markdown .Host .Site.SiteView.Site.Sidebar.String }} -
founded {{ humanize .Site.SiteView.Site.Published }}
+
founded {{ humanize .Site.SiteView.Site.Published.Time }}
{{ if .Site.Admins }} ADMINS
@@ -110,8 +110,8 @@

you are a moderator of this community

{{ end }}

{{ markdown .Host .Community.CommunityView.Community.Description.String }}

-
- founded {{ humanize .Community.CommunityView.Counts.Published }} +
+ founded {{ humanize .Community.CommunityView.Counts.Published.Time }}
{{ if and .Session (isMod .Community .Session.UserName) }} MODERATOR TOOLS