mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-11-23 13:19:22 +02:00
Compare commits
3 Commits
a678b620a1
...
e924503f2d
Author | SHA1 | Date | |
---|---|---|---|
localhost_frssoft | e924503f2d | ||
localhost_frssoft | f729e29a8d | ||
localhost_frssoft | 8c41878b6d |
|
@ -200,9 +200,11 @@ func (c *Client) UnReaction(ctx context.Context, id string, emoji string) (*Stat
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reblog is reblog the toot of id and return status of reblog.
|
// Reblog is reblog the toot of id and return status of reblog.
|
||||||
func (c *Client) Reblog(ctx context.Context, id string) (*Status, error) {
|
func (c *Client) Reblog(ctx context.Context, id string, visibility string) (*Status, error) {
|
||||||
var status Status
|
var status Status
|
||||||
err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/reblog", id), nil, &status, nil)
|
params := url.Values{}
|
||||||
|
params.Set("visibility", visibility)
|
||||||
|
err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/reblog", id), params, &status, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,10 +162,12 @@ func (s *service) TimelinePage(c *client, tType, instance, listId, maxID,
|
||||||
}
|
}
|
||||||
title = "The Whole Known Network"
|
title = "The Whole Known Network"
|
||||||
case "tag":
|
case "tag":
|
||||||
|
if len(tag) > 0 {
|
||||||
statuses, err = c.GetTimelineHashtag(c.ctx, tag, false, &pg)
|
statuses, err = c.GetTimelineHashtag(c.ctx, tag, false, &pg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
title = "Tag timeline"
|
title = "Tag timeline"
|
||||||
|
|
||||||
case "list":
|
case "list":
|
||||||
|
@ -203,6 +205,9 @@ func (s *service) TimelinePage(c *client, tType, instance, listId, maxID,
|
||||||
if len(instance) > 0 {
|
if len(instance) > 0 {
|
||||||
v.Set("instance", instance)
|
v.Set("instance", instance)
|
||||||
}
|
}
|
||||||
|
if len(tag) > 0 {
|
||||||
|
v.Set("tag", tag)
|
||||||
|
}
|
||||||
if len(listId) > 0 {
|
if len(listId) > 0 {
|
||||||
v.Set("list", listId)
|
v.Set("list", listId)
|
||||||
}
|
}
|
||||||
|
@ -215,6 +220,9 @@ func (s *service) TimelinePage(c *client, tType, instance, listId, maxID,
|
||||||
if len(instance) > 0 {
|
if len(instance) > 0 {
|
||||||
v.Set("instance", instance)
|
v.Set("instance", instance)
|
||||||
}
|
}
|
||||||
|
if len(tag) > 0 {
|
||||||
|
v.Set("tag", tag)
|
||||||
|
}
|
||||||
if len(listId) > 0 {
|
if len(listId) > 0 {
|
||||||
v.Set("list", listId)
|
v.Set("list", listId)
|
||||||
}
|
}
|
||||||
|
@ -1052,8 +1060,8 @@ func (s *service) UnReact(c *client, id string, emoji string) (count int64, err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *service) Retweet(c *client, id string) (count int64, err error) {
|
func (s *service) Retweet(c *client, id string, visibility string) (count int64, err error) {
|
||||||
st, err := c.Reblog(c.ctx, id)
|
st, err := c.Reblog(c.ctx, id, visibility)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,7 +381,8 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
||||||
retweet := handle(func(c *client) error {
|
retweet := handle(func(c *client) error {
|
||||||
id, _ := mux.Vars(c.r)["id"]
|
id, _ := mux.Vars(c.r)["id"]
|
||||||
rid := c.r.FormValue("retweeted_by_id")
|
rid := c.r.FormValue("retweeted_by_id")
|
||||||
_, err := s.Retweet(c, id)
|
visibility := c.r.FormValue("retweet_visibility")
|
||||||
|
_, err := s.Retweet(c, id, visibility)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -773,7 +774,8 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
||||||
|
|
||||||
fRetweet := handle(func(c *client) error {
|
fRetweet := handle(func(c *client) error {
|
||||||
id, _ := mux.Vars(c.r)["id"]
|
id, _ := mux.Vars(c.r)["id"]
|
||||||
count, err := s.Retweet(c, id)
|
visibility := c.r.FormValue("retweet_visibility")
|
||||||
|
count, err := s.Retweet(c, id, visibility)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,8 @@ function handleRetweetForm(id, f) {
|
||||||
updateActionForm(id, forms[i], reverseActions[action]);
|
updateActionForm(id, forms[i], reverseActions[action]);
|
||||||
}
|
}
|
||||||
|
|
||||||
var body = "csrf_token=" + encodeURIComponent(csrfToken);
|
var retweetVisibility = document.querySelector('input[id="retweet_visibility-'+id+'"]:checked').value;
|
||||||
|
var body = "csrf_token=" + encodeURIComponent(csrfToken) + "&retweet_visibility=" + encodeURIComponent(retweetVisibility);
|
||||||
var contentType = "application/x-www-form-urlencoded";
|
var contentType = "application/x-www-form-urlencoded";
|
||||||
http("POST", "/fluoride/" + action + "/" + id,
|
http("POST", "/fluoride/" + action + "/" + id,
|
||||||
body, contentType, function(res, type) {
|
body, contentType, function(res, type) {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<a class="nav-link" href="/search" accesskey="6" title="Search (6)">search</a>
|
<a class="nav-link" href="/search" accesskey="6" title="Search (6)">search</a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
<a class="nav-link" href="/timeline/tag">tag</a>
|
||||||
<a class="nav-link" href="/lists" accesskey="7" title="Lists (7)">lists</a>
|
<a class="nav-link" href="/lists" accesskey="7" title="Lists (7)">lists</a>
|
||||||
<a class="nav-link" href="/settings" target="_top" accesskey="8" title="Settings (8)">settings</a>
|
<a class="nav-link" href="/settings" target="_top" accesskey="8" title="Settings (8)">settings</a>
|
||||||
<form class="signout" action="/signout" method="post" target="_top">
|
<form class="signout" action="/signout" method="post" target="_top">
|
||||||
|
|
|
@ -225,11 +225,27 @@
|
||||||
<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">
|
||||||
|
|
||||||
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
|
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
|
||||||
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
|
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
|
||||||
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
|
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
|
||||||
|
<div class="more-container">
|
||||||
|
|
||||||
<input type="submit" value="{{$rt}}" class="btn-link"
|
<input type="submit" value="{{$rt}}" class="btn-link"
|
||||||
{{if or (eq .Visibility "private") (eq .Visibility "direct")}}title="this status cannot be retweeted" disabled{{end}}>
|
{{if or (eq .Visibility "private") (eq .Visibility "direct")}}title="this status cannot be retweeted" disabled{{end}}>
|
||||||
|
<div class="more-content">
|
||||||
|
{{if or (eq .Visibility "private") (eq .Visibility "direct")}}
|
||||||
|
Locked
|
||||||
|
{{else}}
|
||||||
|
<input type="radio" id="retweet_visibility-{{.ID}}" name="retweet_visibility" value="public" checked>
|
||||||
|
<label for="retweet_visibility">public</label>
|
||||||
|
<input type="radio" id="retweet_visibility-{{.ID}}" name="retweet_visibility" value="unlisted">
|
||||||
|
<label for="retweet_visibility">unlisted</label>
|
||||||
|
<input type="radio" id="retweet_visibility-{{.ID}}" name="retweet_visibility" value="private">
|
||||||
|
<label for="retweet_visibility">private</label>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list">
|
<a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list">
|
||||||
{{if and (not $.Ctx.AntiDopamineMode) .ReblogsCount}}
|
{{if and (not $.Ctx.AntiDopamineMode) .ReblogsCount}}
|
||||||
({{DisplayInteractionCount .ReblogsCount}})
|
({{DisplayInteractionCount .ReblogsCount}})
|
||||||
|
|
|
@ -14,6 +14,16 @@
|
||||||
<button type="submit"> Submit </button>
|
<button type="submit"> Submit </button>
|
||||||
</form>
|
</form>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{if eq .Type "tag"}}
|
||||||
|
<form class="search-form" action="/timeline/tag" method="GET">
|
||||||
|
<span class="post-form-field">
|
||||||
|
<label for="tag"> Tag </label>
|
||||||
|
<input id="tag" name="tag" value="">
|
||||||
|
</span>
|
||||||
|
<button type="submit"> Submit </button>
|
||||||
|
</form>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
|
||||||
{{range .Statuses}}
|
{{range .Statuses}}
|
||||||
{{template "status.tmpl" (WithContext . $.Ctx)}}
|
{{template "status.tmpl" (WithContext . $.Ctx)}}
|
||||||
|
|
Loading…
Reference in New Issue