diff --git a/model/settings.go b/model/settings.go index b1463c7..fa69672 100644 --- a/model/settings.go +++ b/model/settings.go @@ -4,6 +4,7 @@ type Settings struct { DefaultVisibility string `json:"default_visibility"` CopyScope bool `json:"copy_scope"` ThreadInNewTab bool `json:"thread_in_new_tab"` + HideAttachments bool `json:"hide_attachments"` MaskNSFW bool `json:"mask_nfsw"` AutoRefreshNotifications bool `json:"auto_refresh_notifications"` FluorideMode bool `json:"fluoride_mode"` @@ -15,6 +16,7 @@ func NewSettings() *Settings { DefaultVisibility: "public", CopyScope: true, ThreadInNewTab: false, + HideAttachments: false, MaskNSFW: true, AutoRefreshNotifications: false, FluorideMode: false, diff --git a/renderer/model.go b/renderer/model.go index 96907b3..85c73b8 100644 --- a/renderer/model.go +++ b/renderer/model.go @@ -6,12 +6,13 @@ import ( ) type Context struct { - MaskNSFW bool - FluorideMode bool - ThreadInNewTab bool - DarkMode bool - CSRFToken string - UserID string + HideAttachments bool + MaskNSFW bool + FluorideMode bool + ThreadInNewTab bool + DarkMode bool + CSRFToken string + UserID string } type NavData struct { diff --git a/service/service.go b/service/service.go index 02c55cb..d6ff192 100644 --- a/service/service.go +++ b/service/service.go @@ -107,12 +107,13 @@ func getRendererContext(c *model.Client) *renderer.Context { settings = *model.NewSettings() } return &renderer.Context{ - MaskNSFW: settings.MaskNSFW, - ThreadInNewTab: settings.ThreadInNewTab, - FluorideMode: settings.FluorideMode, - DarkMode: settings.DarkMode, - CSRFToken: session.CSRFToken, - UserID: session.UserID, + HideAttachments: settings.HideAttachments, + MaskNSFW: settings.MaskNSFW, + ThreadInNewTab: settings.ThreadInNewTab, + FluorideMode: settings.FluorideMode, + DarkMode: settings.DarkMode, + CSRFToken: session.CSRFToken, + UserID: session.UserID, } } diff --git a/service/transport.go b/service/transport.go index f52cca0..840f4cc 100644 --- a/service/transport.go +++ b/service/transport.go @@ -615,6 +615,7 @@ func NewHandler(s Service, staticDir string) http.Handler { visibility := req.FormValue("visibility") copyScope := req.FormValue("copy_scope") == "true" threadInNewTab := req.FormValue("thread_in_new_tab") == "true" + hideAttachments := req.FormValue("hide_attachments") == "true" maskNSFW := req.FormValue("mask_nsfw") == "true" arn := req.FormValue("auto_refresh_notifications") == "true" fluorideMode := req.FormValue("fluoride_mode") == "true" @@ -624,6 +625,7 @@ func NewHandler(s Service, staticDir string) http.Handler { DefaultVisibility: visibility, CopyScope: copyScope, ThreadInNewTab: threadInNewTab, + HideAttachments: hideAttachments, MaskNSFW: maskNSFW, AutoRefreshNotifications: arn, FluorideMode: fluorideMode, diff --git a/templates/settings.tmpl b/templates/settings.tmpl index 2773deb..d0710c3 100644 --- a/templates/settings.tmpl +++ b/templates/settings.tmpl @@ -21,6 +21,10 @@ +
+ + +
diff --git a/templates/status.tmpl b/templates/status.tmpl index ade9d25..6433b9c 100644 --- a/templates/status.tmpl +++ b/templates/status.tmpl @@ -75,31 +75,48 @@ {{end}}
{{range .MediaAttachments}} + {{if eq .Type "image"}} + {{if $.Ctx.HideAttachments}} + [image] + {{else}} status-image {{if (and $.Ctx.MaskNSFW $s.Sensitive)}}
{{end}}
+ {{end}} + {{else if eq .Type "audio"}} + {{if $.Ctx.HideAttachments}} + [audio] + {{else}} + {{end}} + {{else if eq .Type "video"}} + {{if $.Ctx.HideAttachments}} + [video] + {{else}}
{{if (and $.Ctx.MaskNSFW $s.Sensitive)}}
{{end}}
- {{else}} - attachment {{end}} + + {{else}} + [attachment] + {{end}} + {{end}}
{{if .Poll}}