diff --git a/README b/README index 5a0e5c1..d149b86 100644 --- a/README +++ b/README @@ -9,6 +9,7 @@ Changes (localhost_custom fork): - Is personal fork, no recommended for public use (use as local frontend) - Add reactions for pleroma (includes custom emojis input) - tag timeline +- true remote timeline - visible edited post time - visible quoted post (status in status) - visible profile banner in spoiler diff --git a/mastodon/status.go b/mastodon/status.go index af1910c..8ef7cde 100644 --- a/mastodon/status.go +++ b/mastodon/status.go @@ -11,8 +11,6 @@ import ( "path/filepath" "time" "encoding/json" - "path" - "strings" "strconv" ) @@ -244,21 +242,22 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, pg *Pa if pg != nil { params = pg.setValues(params) } - u, err := url.Parse("https://" + instance) - if err != nil { - return nil, err - } - u.Path = path.Join(u.Path, "/api/v1/timelines/public") - req, err := http.NewRequest(http.MethodGet, u.String(), strings.NewReader(params.Encode())) + perform := url.URL{ + Scheme: "https", + Host: instance, + Path: "api/v1/timelines/public", + RawQuery: params.Encode(), + } + + req, err := http.NewRequest(http.MethodGet, perform.String(), nil) if err != nil { return nil, err } req = req.WithContext(ctx) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + req.Header.Set("User-Agent", "Bloat") resp, err := httpclient.Do(req) - fmt.Println(req) - fmt.Println(resp) if err != nil { return nil, err } @@ -269,10 +268,10 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, pg *Pa } err = json.NewDecoder(resp.Body).Decode(&publicstatuses) - fmt.Println(resp.Body) if err != nil { return nil, err } + return publicstatuses, nil } diff --git a/service/service.go b/service/service.go index e96db65..3c9b8a4 100644 --- a/service/service.go +++ b/service/service.go @@ -163,6 +163,10 @@ func (s *service) TimelinePage(c *client, tType, instance, listId, maxID, if err != nil { return err } + v := make(url.Values) + v.Set("max_id", statuses[len(statuses)-1].ID) + v.Set("instance", instance) + nextLink = "/timeline/" + tType + "?" + v.Encode() } title = "True Remote Timeline" case "twkn": @@ -207,6 +211,10 @@ func (s *service) TimelinePage(c *client, tType, instance, listId, maxID, } statuses[i].Pleroma.Reactions = reactions } + if tType == "tremote" { + statuses[i].URL = fmt.Sprintf("/search?q=%s&type=statuses", statuses[i].URL) + } + } if (len(maxID) > 0 || len(minID) > 0) && len(statuses) > 0 { diff --git a/templates/status.tmpl b/templates/status.tmpl index 2713fdf..2a1314a 100644 --- a/templates/status.tmpl +++ b/templates/status.tmpl @@ -227,6 +227,11 @@ {{end}}