mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-05-05 03:18:44 +00:00
Add the Anti Dopamine feature
This commit is contained in:
parent
71c5da7b3b
commit
28695fb8e6
7 changed files with 30 additions and 5 deletions
|
@ -116,6 +116,7 @@ func getRendererContext(c *model.Client) *renderer.Context {
|
|||
DarkMode: settings.DarkMode,
|
||||
CSRFToken: session.CSRFToken,
|
||||
UserID: session.UserID,
|
||||
AntiDopamineMode: settings.AntiDopamineMode,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,13 +403,19 @@ func (svc *service) ServeNotificationPage(c *model.Client, maxID string,
|
|||
var nextLink string
|
||||
var unreadCount int
|
||||
var readID string
|
||||
var excludes []string
|
||||
var pg = mastodon.Pagination{
|
||||
MaxID: maxID,
|
||||
MinID: minID,
|
||||
Limit: 20,
|
||||
}
|
||||
|
||||
notifications, err := c.GetNotifications(ctx, &pg)
|
||||
dope := c.Session.Settings.AntiDopamineMode
|
||||
if dope {
|
||||
excludes = append(excludes, "follow", "favourite", "reblog")
|
||||
}
|
||||
|
||||
notifications, err := c.GetNotifications(ctx, &pg, excludes...)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -591,6 +591,7 @@ func NewHandler(s Service, staticDir string) http.Handler {
|
|||
arn := req.FormValue("auto_refresh_notifications") == "true"
|
||||
fluorideMode := req.FormValue("fluoride_mode") == "true"
|
||||
darkMode := req.FormValue("dark_mode") == "true"
|
||||
antiDopamineMode := req.FormValue("anti_dopamine_mode") == "true"
|
||||
|
||||
settings := &model.Settings{
|
||||
DefaultVisibility: visibility,
|
||||
|
@ -601,6 +602,7 @@ func NewHandler(s Service, staticDir string) http.Handler {
|
|||
AutoRefreshNotifications: arn,
|
||||
FluorideMode: fluorideMode,
|
||||
DarkMode: darkMode,
|
||||
AntiDopamineMode: antiDopamineMode,
|
||||
}
|
||||
|
||||
err := s.SaveSettings(c, settings)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue