From def93b4598ed2c6d194e575117746bdc967c1a6a Mon Sep 17 00:00:00 2001 From: r Date: Thu, 26 Aug 2021 04:55:30 +0000 Subject: Show spoiler text even when post content is emtpy --- templates/status.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/status.tmpl b/templates/status.tmpl index 9109f4e..7ca8192 100644 --- a/templates/status.tmpl +++ b/templates/status.tmpl @@ -87,7 +87,7 @@ {{end}} {{end}} - {{if .Content}} + {{if (or .Content .SpoilerText)}}
{{StatusContentFilter (html .SpoilerText) .Content .Emojis .Mentions}}
{{end}} {{if .MediaAttachments}} -- cgit v1.2.3 From c493e18bc7f79d216a009426af7026ea93477834 Mon Sep 17 00:00:00 2001 From: r Date: Thu, 26 Aug 2021 05:05:49 +0000 Subject: Swap the position of twkn and remote timeline --- templates/nav.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/nav.tmpl b/templates/nav.tmpl index 88458c8..cbf65c9 100644 --- a/templates/nav.tmpl +++ b/templates/nav.tmpl @@ -17,8 +17,8 @@ home direct local - remote - twkn + twkn + remote search
-- cgit v1.2.3 From 5ffe18067ff733de0103a604bd00f27e2c18effb Mon Sep 17 00:00:00 2001 From: r Date: Thu, 26 Aug 2021 05:06:23 +0000 Subject: Fix accesskey list --- templates/about.tmpl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/about.tmpl b/templates/about.tmpl index 6357bcb..c0b8418 100644 --- a/templates/about.tmpl +++ b/templates/about.tmpl @@ -38,11 +38,11 @@ 4 - Search + Remote timeline 5 - About + Search 6 @@ -53,6 +53,10 @@ Signout 8 + + About + 9 + Emoji list L -- cgit v1.2.3 From e2499a8d1c8cc23ee1db198a5c452744b1db2eab Mon Sep 17 00:00:00 2001 From: r Date: Thu, 26 Aug 2021 05:08:15 +0000 Subject: Fix settings label --- templates/settings.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/settings.tmpl b/templates/settings.tmpl index 500aea8..6bae9c7 100644 --- a/templates/settings.tmpl +++ b/templates/settings.tmpl @@ -7,7 +7,7 @@ {{if .PostFormats}}
- + {{$defFormat := .Settings.DefaultFormat}} {{if .ReplyContext}} + {{else}} diff --git a/templates/quickreply.tmpl b/templates/quickreply.tmpl new file mode 100644 index 0000000..97ff20a --- /dev/null +++ b/templates/quickreply.tmpl @@ -0,0 +1,12 @@ +{{with $s := .Data}} +{{template "header.tmpl" (WithContext .CommonData $.Ctx)}} +
Quick Reply
+ +{{if .Ancestor}} +{{template "status.tmpl" (WithContext .Ancestor $.Ctx)}} +{{end}} +{{template "status.tmpl" (WithContext .Status $.Ctx)}} +{{template "postform.tmpl" (WithContext $s.PostContext $.Ctx)}} + +{{template "footer.tmpl"}} +{{end}} diff --git a/templates/status.tmpl b/templates/status.tmpl index 7ca8192..a7cc10d 100644 --- a/templates/status.tmpl +++ b/templates/status.tmpl @@ -35,6 +35,9 @@ source + + quickreply + {{if .Muted}}
-- cgit v1.2.3 From 7d389d22581cc785005a42d655eb7f9c32aac3ec Mon Sep 17 00:00:00 2001 From: r Date: Sat, 23 Oct 2021 13:41:41 +0000 Subject: Show signin button in case of an auth error --- mastodon/helper.go | 23 +++++++++++++++++++++-- service/service.go | 3 ++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/mastodon/helper.go b/mastodon/helper.go index 05af20f..cb0013d 100644 --- a/mastodon/helper.go +++ b/mastodon/helper.go @@ -3,12 +3,28 @@ package mastodon import ( "encoding/base64" "encoding/json" - "errors" "fmt" "net/http" "os" ) +type Error struct { + code int + err string +} + +func (e Error) Error() string { + return e.err +} + +func (e Error) IsAuthError() bool { + switch e.code { + case http.StatusForbidden, http.StatusUnauthorized: + return true + } + return false +} + // Base64EncodeFileName returns the base64 data URI format string of the file with the file name. func Base64EncodeFileName(filename string) (string, error) { file, err := os.Open(filename) @@ -51,5 +67,8 @@ func parseAPIError(prefix string, resp *http.Response) error { errMsg = fmt.Sprintf("%s: %s", errMsg, e.Error) } - return errors.New(errMsg) + return Error{ + code: resp.StatusCode, + err: errMsg, + } } diff --git a/service/service.go b/service/service.go index 03f0ff3..244fd81 100644 --- a/service/service.go +++ b/service/service.go @@ -114,7 +114,8 @@ func (s *service) ErrorPage(c *client, err error, retry bool) error { var sessionErr bool if err != nil { errStr = err.Error() - if err == errInvalidSession || err == errInvalidCSRFToken { + if me, ok := err.(mastodon.Error); ok && me.IsAuthError() || + err == errInvalidSession || err == errInvalidCSRFToken { sessionErr = true } } -- cgit v1.2.3 From 4d68062f2d0525a9d2a40e50d60ea9b25daae9ad Mon Sep 17 00:00:00 2001 From: r Date: Fri, 29 Oct 2021 14:20:15 +0000 Subject: Add "mute (keep notifications)" button --- mastodon/accounts.go | 8 ++++++-- service/service.go | 4 ++-- service/transport.go | 8 +++++++- templates/user.tmpl | 6 ++++++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/mastodon/accounts.go b/mastodon/accounts.go index 694e672..df0a3b7 100644 --- a/mastodon/accounts.go +++ b/mastodon/accounts.go @@ -243,9 +243,13 @@ func (c *Client) AccountUnblock(ctx context.Context, id string) (*Relationship, } // AccountMute mute the account. -func (c *Client) AccountMute(ctx context.Context, id string) (*Relationship, error) { +func (c *Client) AccountMute(ctx context.Context, id string, notifications *bool) (*Relationship, error) { + params := url.Values{} + if notifications != nil { + params.Set("notifications", strconv.FormatBool(*notifications)) + } var relationship Relationship - err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/mute", url.PathEscape(string(id))), nil, &relationship, nil) + err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/mute", url.PathEscape(string(id))), params, &relationship, nil) if err != nil { return nil, err } diff --git a/service/service.go b/service/service.go index 244fd81..7122666 100644 --- a/service/service.go +++ b/service/service.go @@ -907,8 +907,8 @@ func (s *service) Reject(c *client, id string) (err error) { return c.FollowRequestReject(c.ctx, id) } -func (s *service) Mute(c *client, id string) (err error) { - _, err = c.AccountMute(c.ctx, id) +func (s *service) Mute(c *client, id string, notifications *bool) (err error) { + _, err = c.AccountMute(c.ctx, id, notifications) return } diff --git a/service/transport.go b/service/transport.go index 42b371a..a7912e6 100644 --- a/service/transport.go +++ b/service/transport.go @@ -406,7 +406,13 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler { mute := handle(func(c *client) error { id, _ := mux.Vars(c.r)["id"] - err := s.Mute(c, id) + q := c.r.URL.Query() + var notifications *bool + if r, ok := q["notifications"]; ok && len(r) > 0 { + notifications = new(bool) + *notifications = r[0] == "true" + } + err := s.Mute(c, id, notifications) if err != nil { return err } diff --git a/templates/user.tmpl b/templates/user.tmpl index c7b3164..32b5681 100644 --- a/templates/user.tmpl +++ b/templates/user.tmpl @@ -83,6 +83,12 @@ + - +
+ + + +
{{end}} {{if .User.Pleroma.Relationship.Following}} - -- cgit v1.2.3 From b2a9e44db1a703fe0150c5aef7097020a9e1550d Mon Sep 17 00:00:00 2001 From: r Date: Tue, 16 Nov 2021 15:29:27 +0000 Subject: Escape user display name --- templates/nav.tmpl | 2 +- templates/notification.tmpl | 4 ++-- templates/requestlist.tmpl | 2 +- templates/status.tmpl | 4 ++-- templates/user.tmpl | 2 +- templates/userlist.tmpl | 2 +- templates/usersearch.tmpl | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/templates/nav.tmpl b/templates/nav.tmpl index cbf65c9..ea18a5f 100644 --- a/templates/nav.tmpl +++ b/templates/nav.tmpl @@ -8,7 +8,7 @@