mirror of
https://git.phreedom.club/localhost_frssoft/bloat.git
synced 2024-11-25 13:21:28 +00:00
true remote timeline fixed
This commit is contained in:
parent
34940a65df
commit
eedd9d2c5c
1
README
1
README
|
@ -9,6 +9,7 @@ Changes (localhost_custom fork):
|
||||||
- Is personal fork, no recommended for public use (use as local frontend)
|
- Is personal fork, no recommended for public use (use as local frontend)
|
||||||
- Add reactions for pleroma (includes custom emojis input)
|
- Add reactions for pleroma (includes custom emojis input)
|
||||||
- tag timeline
|
- tag timeline
|
||||||
|
- true remote timeline
|
||||||
- visible edited post time
|
- visible edited post time
|
||||||
- visible quoted post (status in status)
|
- visible quoted post (status in status)
|
||||||
- visible profile banner in spoiler
|
- visible profile banner in spoiler
|
||||||
|
|
|
@ -11,8 +11,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"path"
|
|
||||||
"strings"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -244,21 +242,22 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, pg *Pa
|
||||||
if pg != nil {
|
if pg != nil {
|
||||||
params = pg.setValues(params)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
req = req.WithContext(ctx)
|
req = req.WithContext(ctx)
|
||||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
req.Header.Set("User-Agent", "Bloat")
|
||||||
resp, err := httpclient.Do(req)
|
resp, err := httpclient.Do(req)
|
||||||
fmt.Println(req)
|
|
||||||
fmt.Println(resp)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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)
|
err = json.NewDecoder(resp.Body).Decode(&publicstatuses)
|
||||||
fmt.Println(resp.Body)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return publicstatuses, nil
|
return publicstatuses, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,10 @@ func (s *service) TimelinePage(c *client, tType, instance, listId, maxID,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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"
|
title = "True Remote Timeline"
|
||||||
case "twkn":
|
case "twkn":
|
||||||
|
@ -207,6 +211,10 @@ func (s *service) TimelinePage(c *client, tType, instance, listId, maxID,
|
||||||
}
|
}
|
||||||
statuses[i].Pleroma.Reactions = reactions
|
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 {
|
if (len(maxID) > 0 || len(minID) > 0) && len(statuses) > 0 {
|
||||||
|
|
|
@ -227,6 +227,11 @@
|
||||||
</form>
|
</form>
|
||||||
{{end}}
|
{{end}}
|
||||||
<div class="status-action-container">
|
<div class="status-action-container">
|
||||||
|
{{if eq (printf "%.7s" .URL) "/search"}}
|
||||||
|
<div class="status-action">
|
||||||
|
<a href="{{.URL}}">Federate!</a>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
<div class="status-action">
|
<div class="status-action">
|
||||||
<a href="/thread/{{.ID}}?reply=true#status-{{.ID}}">
|
<a href="/thread/{{.ID}}?reply=true#status-{{.ID}}">
|
||||||
reply
|
reply
|
||||||
|
@ -237,6 +242,7 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
{{end}}
|
||||||
<div class="status-action">
|
<div class="status-action">
|
||||||
{{$rt := "retweet"}} {{if .Reblogged}} {{$rt = "unretweet"}} {{end}}
|
{{$rt := "retweet"}} {{if .Reblogged}} {{$rt = "unretweet"}} {{end}}
|
||||||
<form class="status-retweet" data-action="{{$rt}}" action="/{{$rt}}/{{.ID}}" method="post" target="_self">
|
<form class="status-retweet" data-action="{{$rt}}" action="/{{$rt}}/{{.ID}}" method="post" target="_self">
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
</span>
|
</span>
|
||||||
<button type="submit"> Submit </button>
|
<button type="submit"> Submit </button>
|
||||||
</form>
|
</form>
|
||||||
|
{{if eq .Instance ""}}
|
||||||
|
{{else}}
|
||||||
|
<a href="/timeline/tremote?instance={{.Instance}}"> Look via True remote timeline viewer (works with mastodon API compatible instances) </a>
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if eq .Type "tag"}}
|
{{if eq .Type "tag"}}
|
||||||
<form class="search-form" action="/timeline/tag" method="GET">
|
<form class="search-form" action="/timeline/tag" method="GET">
|
||||||
|
|
Loading…
Reference in a new issue