aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--model/settings.go2
-rw-r--r--renderer/model.go13
-rw-r--r--service/service.go13
-rw-r--r--service/transport.go2
-rw-r--r--templates/settings.tmpl4
-rw-r--r--templates/status.tmpl23
6 files changed, 42 insertions, 15 deletions
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
@@ -22,6 +22,10 @@
<label for="thread-tab"> Open threads in new tab from timeline </label>
</div>
<div class="settings-form-field">
+ <input id="hide-attachments" name="hide_attachments" type="checkbox" value="true" {{if .Settings.HideAttachments}}checked{{end}}>
+ <label for="hide-attachments"> Hide attachments </label>
+ </div>
+ <div class="settings-form-field">
<input id="mask-nsfw" name="mask_nsfw" type="checkbox" value="true" {{if .Settings.MaskNSFW}}checked{{end}}>
<label for="mask-nsfw"> Mask NSFW attachments </label>
</div>
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}}
<div class="status-media-container">
{{range .MediaAttachments}}
+
{{if eq .Type "image"}}
+ {{if $.Ctx.HideAttachments}}
+ <a href="{{.URL}}" target="_blank"> [image] </a>
+ {{else}}
<a class="img-link" href="{{.URL}}" target="_blank">
<img class="status-image" src="{{.URL}}" alt="status-image" />
{{if (and $.Ctx.MaskNSFW $s.Sensitive)}}
<div class="status-nsfw-overlay"></div>
{{end}}
</a>
+ {{end}}
+
{{else if eq .Type "audio"}}
+ {{if $.Ctx.HideAttachments}}
+ <a href="{{.URL}}" target="_blank"> [audio] </a>
+ {{else}}
<audio class="status-audio" controls preload="none">
<source src="{{.URL}}">
- <p> Your browser doesn't support HTML5 audio </p>
+ <a href="{{.URL}}" target="_blank"> [audio] </a>
</audio>
+ {{end}}
+
{{else if eq .Type "video"}}
+ {{if $.Ctx.HideAttachments}}
+ <a href="{{.URL}}" target="_blank"> [video] </a>
+ {{else}}
<div class="status-video-container">
<video class="status-video" controls preload="none">
<source src="{{.URL}}">
- <p> Your browser doesn't support HTML5 video </p>
+ <a href="{{.URL}}" target="_blank"> [video] </a>
</video>
{{if (and $.Ctx.MaskNSFW $s.Sensitive)}}
<div class="status-nsfw-overlay"></div>
{{end}}
</div>
+ {{end}}
+
{{else}}
- <a href="{{.URL}}" target="_blank"> attachment </a>
+ <a href="{{.URL}}" target="_blank"> [attachment] </a>
{{end}}
+
{{end}}
</div>
{{if .Poll}}