mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-12-23 22:19:49 +00:00
Added optional filter for emojis on instance
This commit is contained in:
parent
c5d552e7d8
commit
cbbebe6b15
@ -12,6 +12,7 @@ type Settings struct {
|
||||
DarkMode bool `json:"dark_mode"`
|
||||
AntiDopamineMode bool `json:"anti_dopamine_mode"`
|
||||
HideUnsupportedNotifs bool `json:"hide_unsupported_notifs"`
|
||||
InstanceEmojiFilter string `json:"instance_emoji_filter"`
|
||||
AddReactionsFilter string `json:"add_reactions_filter"`
|
||||
CSS string `json:"css"`
|
||||
}
|
||||
@ -29,6 +30,7 @@ func NewSettings() *Settings {
|
||||
DarkMode: false,
|
||||
AntiDopamineMode: false,
|
||||
HideUnsupportedNotifs: false,
|
||||
InstanceEmojiFilter: "",
|
||||
AddReactionsFilter: "",
|
||||
CSS: "",
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ type Context struct {
|
||||
CSRFToken string
|
||||
UserID string
|
||||
AntiDopamineMode bool
|
||||
InstanceEmojiFilter string
|
||||
AddReactionsFilter string
|
||||
UserCSS string
|
||||
Referrer string
|
||||
|
@ -66,6 +66,7 @@ func (s *service) authenticate(c *client, sid string, csrf string, ref string, t
|
||||
UserID: c.s.UserID,
|
||||
AntiDopamineMode: sett.AntiDopamineMode,
|
||||
UserCSS: sett.CSS,
|
||||
InstanceEmojiFilter: sett.InstanceEmojiFilter,
|
||||
AddReactionsFilter: sett.AddReactionsFilter,
|
||||
Referrer: ref,
|
||||
}
|
||||
|
@ -519,6 +519,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
||||
darkMode := c.r.FormValue("dark_mode") == "true"
|
||||
antiDopamineMode := c.r.FormValue("anti_dopamine_mode") == "true"
|
||||
hideUnsupportedNotifs := c.r.FormValue("hide_unsupported_notifs") == "true"
|
||||
instanceEmojiFilter := c.r.FormValue("instance-emoji-filter")
|
||||
addReactionsFilter := c.r.FormValue("pleroma-reactions-filter")
|
||||
css := c.r.FormValue("css")
|
||||
|
||||
@ -534,6 +535,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
||||
DarkMode: darkMode,
|
||||
AntiDopamineMode: antiDopamineMode,
|
||||
HideUnsupportedNotifs: hideUnsupportedNotifs,
|
||||
InstanceEmojiFilter: instanceEmojiFilter,
|
||||
AddReactionsFilter: addReactionsFilter,
|
||||
CSS: css,
|
||||
}
|
||||
|
@ -3,8 +3,9 @@
|
||||
<div class="page-title"> Emojis </div>
|
||||
|
||||
<div class="emoji-list-container">
|
||||
{{$emoji_filter := $.Ctx.InstanceEmojiFilter}}
|
||||
{{range .Emojis}}
|
||||
{{if Allowed_emoji_page .ShortCode "blobfox senko shiro cirno pleroma udongein"}}
|
||||
{{if Allowed_emoji_page .ShortCode $emoji_filter}}
|
||||
<div class="emoji-item-container">
|
||||
<div class="emoji-item">
|
||||
<img class="emoji" src="{{.URL}}" alt="{{.ShortCode}}" height="32" loading="lazy" />
|
||||
|
@ -70,6 +70,12 @@
|
||||
<input id="dark-mode" name="dark_mode" type="checkbox" value="true" {{if .Settings.DarkMode}}checked{{end}}>
|
||||
<label for="dark-mode"> Use dark theme </label>
|
||||
</div>
|
||||
<div class="settings-form-field">
|
||||
<label for=""> Instance emoji filter (example_allowed anotherexample ...): </label>
|
||||
</div>
|
||||
<div>
|
||||
<textarea id="instance-emoji-filter" name="instance-emoji-filter" cols="80" rows="1">{{.Settings.InstanceEmojiFilter}}</textarea>
|
||||
</div>
|
||||
<div class="settings-form-field">
|
||||
<label for=""> Reactions filter (example_allowed anotherexample ...): </label>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user