diff options
author | r <r@freesoftwareextremist.com> | 2020-01-28 20:56:15 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2020-01-28 20:56:15 +0000 |
commit | 2c084dfd097da448a830a8e017af0175209259ab (patch) | |
tree | b3b339f645d88442505eb79729b7983b68950206 | |
parent | a877c58ac38f1616080edfe2fad477cbb5f03c9a (diff) | |
download | bloat-2c084dfd097da448a830a8e017af0175209259ab.tar.gz bloat-2c084dfd097da448a830a8e017af0175209259ab.zip |
Add direct timeline
-rw-r--r-- | mastodon/status.go | 12 | ||||
-rw-r--r-- | service/service.go | 3 | ||||
-rw-r--r-- | templates/navigation.tmpl | 1 |
3 files changed, 16 insertions, 0 deletions
diff --git a/mastodon/status.go b/mastodon/status.go index d6a9330..bce283f 100644 --- a/mastodon/status.go +++ b/mastodon/status.go @@ -329,3 +329,15 @@ func (c *Client) UploadMediaFromMultipartFileHeader(ctx context.Context, fh *mul } return &attachment, nil } + +// GetTimelineDirect return statuses from direct timeline. +func (c *Client) GetTimelineDirect(ctx context.Context, pg *Pagination) ([]*Status, error) { + params := url.Values{} + + var statuses []*Status + err := c.doAPI(ctx, http.MethodGet, "/api/v1/timelines/direct", params, &statuses, pg) + if err != nil { + return nil, err + } + return statuses, nil +} diff --git a/service/service.go b/service/service.go index 7ad860f..0ef8f09 100644 --- a/service/service.go +++ b/service/service.go @@ -211,6 +211,9 @@ func (svc *service) ServeTimelinePage(ctx context.Context, c *model.Client, case "home": statuses, err = c.GetTimelineHome(ctx, &pg) title = "Timeline" + case "direct": + statuses, err = c.GetTimelineDirect(ctx, &pg) + title = "Local Timeline" case "local": statuses, err = c.GetTimelinePublic(ctx, true, &pg) title = "Local Timeline" diff --git a/templates/navigation.tmpl b/templates/navigation.tmpl index e2547ea..a85f9fd 100644 --- a/templates/navigation.tmpl +++ b/templates/navigation.tmpl @@ -15,6 +15,7 @@ <div> <a class="nav-link" href="/timeline/home">home</a> <a class="nav-link" href="/notifications">notifications{{if gt .NotificationCount 0}}({{.NotificationCount}}){{end}}</a> + <a class="nav-link" href="/timeline/direct">direct</a> <a class="nav-link" href="/timeline/local">local</a> <a class="nav-link" href="/timeline/twkn">twkn</a> <a class="nav-link" href="/search">search</a> |