ref: 04d99d13340ed42c1c111339cfe7f6aab2fd9851
parent: e05e853fbf7a0232a64f6c1e1e3e9282a2f23b7f
author: penny <penny@limitedideas.org>
date: Tue Oct 28 15:58:25 EDT 2025
add /hrt to toggle hiding RTs from account
--- a/commands.go
+++ b/commands.go
@@ -4,7 +4,7 @@
"strings"
)
-var commands = []string{"examine", "reply", "like", "thread", "open", "prev", "download", "dm", "rt", "parent", "children", "rm", "mark", "unmark", "account", "import", "pause", "resume", "url", "fpost", "ufpost", "edit", "notice", "stats", "next", "view", "bookmarks", "follow", "unfollow", "likes", "help", "reload", "attach", "detach", "pinned", "cat", "play", "translate", "read", "version", "local", "public", "block", "unblock", "unlike", "home", "page"}+var commands = []string{"examine", "reply", "like", "thread", "open", "prev", "download", "dm", "rt", "hrt", "parent", "children", "rm", "mark", "unmark", "account", "import", "pause", "resume", "url", "fpost", "ufpost", "edit", "notice", "stats", "next", "view", "bookmarks", "follow", "unfollow", "likes", "help", "reload", "attach", "detach", "pinned", "cat", "play", "translate", "read", "version", "local", "public", "block", "unblock", "unlike", "home", "page"} func processInput(input string) (command string, arguments string, found bool) {--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@
go 1.23.8
require (
- codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028175833-e74448941d05
+ codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028231008-1218d098bd98
github.com/ergochat/readline v0.1.3
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/k3a/html2text v1.2.1
--- a/go.sum
+++ b/go.sum
@@ -8,6 +8,16 @@
codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028175607-b69810a2c1e3/go.mod h1:uBGYW1AuCWBfm/LaIH4X4SnuWGWcSP4DNH/v/KUUMj8=
codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028175833-e74448941d05 h1:Pml5pJGj01TpdzgLZrQBE0evgCzIn1QnArrXOz1xRUk=
codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028175833-e74448941d05/go.mod h1:uBGYW1AuCWBfm/LaIH4X4SnuWGWcSP4DNH/v/KUUMj8=
+codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028215959-0a722e119e0a h1:dmoovfe3axSD9D7ABIXXogxTcf8/Zu4tM8fhLFozYSE=
+codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028215959-0a722e119e0a/go.mod h1:uBGYW1AuCWBfm/LaIH4X4SnuWGWcSP4DNH/v/KUUMj8=
+codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028221536-05350a5c7d32 h1:pJI1Da8MvniyNG6Zt2I4tSLXBx9bJ9yOjae0AvLjW64=
+codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028221536-05350a5c7d32/go.mod h1:uBGYW1AuCWBfm/LaIH4X4SnuWGWcSP4DNH/v/KUUMj8=
+codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028225040-2b589a27b774 h1:EvU5TJiaibxX6j4W+aT/7Z0g2kd+eO0z/ym8YV1VwuQ=
+codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028225040-2b589a27b774/go.mod h1:uBGYW1AuCWBfm/LaIH4X4SnuWGWcSP4DNH/v/KUUMj8=
+codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028230912-df1090ededf3 h1:/WTQFr1leWTgYw1Jyki/E3Ev6zxtl7lYFqRkayFsH40=
+codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028230912-df1090ededf3/go.mod h1:uBGYW1AuCWBfm/LaIH4X4SnuWGWcSP4DNH/v/KUUMj8=
+codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028231008-1218d098bd98 h1:RTfvPmEwZjoVbjcZ68HKW57/TfRslY1zLSg83IrhRj0=
+codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251028231008-1218d098bd98/go.mod h1:uBGYW1AuCWBfm/LaIH4X4SnuWGWcSP4DNH/v/KUUMj8=
github.com/ergochat/readline v0.1.3 h1:/DytGTmwdUJcLAe3k3VJgowh5vNnsdifYT6uVaf4pSo=
github.com/ergochat/readline v0.1.3/go.mod h1:o3ux9QLHLm77bq7hDB21UTm6HlV2++IPDMfIfKDuOgY=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
--- a/help.go
+++ b/help.go
@@ -51,8 +51,9 @@
/url <index> [url tag] Open URL from status content.
If no tag is provided, will open the first url.
- /play <index> [url tag] Like /url but calls configured media player
+ /play <index> [url tag] Like /url but calls configured media player
/fpost <index> Add status to account's filters.
+ /hrt [index] [account] Toggle RT filtering for target.
/ufpost <index> Unfilter status.
/edit <index> [content] Set targeted status to [content].
Use without content argument to load post into input bar.
--- a/main.go
+++ b/main.go
@@ -79,14 +79,28 @@
if !foundindex && index == "." {index = lastindex
}
-
+ var reblogger *mastodon.Status
//Okay now see if the post we end up with is a reblog
if postOK { if postItem.Reblog != nil {+ reblogger = postItem
postItem = postItem.Reblog
+
}
}
+ accByNameOrRef := func() (account *mastodon.Account) {+ if foundindex || index == "" {+ account = &postItem.Account
+ } else {+ account = hc.resolveAccount(index)
+ if account == nil {+ return
+ }
+ }
+ return
+ }
+
//Contextual commands that need to handle their own requirements
switch command {case "detach":
@@ -424,6 +438,43 @@
case "download":
savePostImages(postItem, hc.preferences.Save_Location)
return
+ case "hrt":
+ // We want to filter RTs from the RTer
+ if reblogger != nil {+ postItem = reblogger
+ }
+ account := accByNameOrRef()
+ if account == nil {+ fmt.Printf("Account lookup failed.\n")+ return
+ }
+ relationships, err := hc.client.GetAccountRelationships(context.Background(), []string{string(account.ID)})+ if err != nil {+ fmt.Printf("Error loading relationship.\n")+ return
+ }
+ relationship := relationships[0]
+ if !relationship.Following {+ fmt.Printf("can't filter rts from user you don't follow!\n")+ return
+ }
+ if relationship.ShowingReblogs {+ _, err := hc.client.AccountFollowDetailed(context.Background(), account.ID, true, relationship.Notifying)
+ if err != nil {+ fmt.Printf("Error updating settings\n")+ return
+ }
+ fmt.Printf("No longer showing RTs from <%s>", account.Acct)+ return
+ }
+ //Turn them back on if they were off!
+ _, err = hc.client.AccountFollowDetailed(context.Background(), account.ID, false, relationship.Notifying)
+ if err != nil {+ fmt.Printf("Error updating settings\n")+ return
+ }
+ fmt.Printf("Now showing RTs from <%s>", account.Acct)+ return
case "rt":
rtfunc := func() {rtStatus, err := client.Reblog(context.Background(), postItem.ID)
@@ -531,16 +582,11 @@
fmt.Print(hc.page.String())
return
case "account":
- var account *mastodon.Account
- if foundindex || index == "" {- account = &postItem.Account
- } else {- account = hc.resolveAccount(index)
- if account == nil {- return
- }
+ account := accByNameOrRef()
+ if account == nil {+ fmt.Printf("Account lookup failed.\n")+ return
}
-
hc.pause(true)
hc.page = &Page{}hc.page.itembuffer = new([]PageItem)
@@ -551,14 +597,10 @@
fmt.Print(hc.page.String())
return
case "unfollow":
- var account *mastodon.Account
- if foundindex || index == "" {- account = &postItem.Account
- } else {- account = hc.resolveAccount(index)
- if account == nil {- return
- }
+ account := accByNameOrRef()
+ if account == nil {+ fmt.Printf("Account lookup failed.")+ return
}
var relationship *mastodon.Relationship
unfollowfunc := func(job *GenericJob) { relationship, err = hc.client.AccountUnfollow(context.Background(), account.ID) }@@ -575,15 +617,11 @@
fmt.Printf("Unknown failure, account is still followed\n")return
- case "follow":
- var account *mastodon.Account
- if foundindex || index == "" {- account = &postItem.Account
- } else {- account = hc.resolveAccount(index)
- if account == nil {- return
- }
+ case "follow":
+ account := accByNameOrRef()
+ if account == nil {+ fmt.Printf("Account lookup failed.\n")+ return
}
var relationship *mastodon.Relationship
followfunc := func(job *GenericJob) { relationship, err = hc.client.AccountFollow(context.Background(), account.ID) }--- a/web/readme.md
+++ b/web/readme.md
@@ -35,6 +35,7 @@
* Rebloging
* Status editing
* Account info page
+* Account RT filtering
* Timeline pausing
* Status filtering
* Image descriptions
--
⑨