mirror of
https://git.phreedom.club/localhost_frssoft/bloat.git
synced 2024-11-25 13:21:28 +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"`
|
DarkMode bool `json:"dark_mode"`
|
||||||
AntiDopamineMode bool `json:"anti_dopamine_mode"`
|
AntiDopamineMode bool `json:"anti_dopamine_mode"`
|
||||||
HideUnsupportedNotifs bool `json:"hide_unsupported_notifs"`
|
HideUnsupportedNotifs bool `json:"hide_unsupported_notifs"`
|
||||||
|
InstanceEmojiFilter string `json:"instance_emoji_filter"`
|
||||||
AddReactionsFilter string `json:"add_reactions_filter"`
|
AddReactionsFilter string `json:"add_reactions_filter"`
|
||||||
CSS string `json:"css"`
|
CSS string `json:"css"`
|
||||||
}
|
}
|
||||||
|
@ -29,6 +30,7 @@ func NewSettings() *Settings {
|
||||||
DarkMode: false,
|
DarkMode: false,
|
||||||
AntiDopamineMode: false,
|
AntiDopamineMode: false,
|
||||||
HideUnsupportedNotifs: false,
|
HideUnsupportedNotifs: false,
|
||||||
|
InstanceEmojiFilter: "",
|
||||||
AddReactionsFilter: "",
|
AddReactionsFilter: "",
|
||||||
CSS: "",
|
CSS: "",
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ type Context struct {
|
||||||
CSRFToken string
|
CSRFToken string
|
||||||
UserID string
|
UserID string
|
||||||
AntiDopamineMode bool
|
AntiDopamineMode bool
|
||||||
|
InstanceEmojiFilter string
|
||||||
AddReactionsFilter string
|
AddReactionsFilter string
|
||||||
UserCSS string
|
UserCSS string
|
||||||
Referrer string
|
Referrer string
|
||||||
|
|
|
@ -66,6 +66,7 @@ func (s *service) authenticate(c *client, sid string, csrf string, ref string, t
|
||||||
UserID: c.s.UserID,
|
UserID: c.s.UserID,
|
||||||
AntiDopamineMode: sett.AntiDopamineMode,
|
AntiDopamineMode: sett.AntiDopamineMode,
|
||||||
UserCSS: sett.CSS,
|
UserCSS: sett.CSS,
|
||||||
|
InstanceEmojiFilter: sett.InstanceEmojiFilter,
|
||||||
AddReactionsFilter: sett.AddReactionsFilter,
|
AddReactionsFilter: sett.AddReactionsFilter,
|
||||||
Referrer: ref,
|
Referrer: ref,
|
||||||
}
|
}
|
||||||
|
|
|
@ -519,6 +519,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
||||||
darkMode := c.r.FormValue("dark_mode") == "true"
|
darkMode := c.r.FormValue("dark_mode") == "true"
|
||||||
antiDopamineMode := c.r.FormValue("anti_dopamine_mode") == "true"
|
antiDopamineMode := c.r.FormValue("anti_dopamine_mode") == "true"
|
||||||
hideUnsupportedNotifs := c.r.FormValue("hide_unsupported_notifs") == "true"
|
hideUnsupportedNotifs := c.r.FormValue("hide_unsupported_notifs") == "true"
|
||||||
|
instanceEmojiFilter := c.r.FormValue("instance-emoji-filter")
|
||||||
addReactionsFilter := c.r.FormValue("pleroma-reactions-filter")
|
addReactionsFilter := c.r.FormValue("pleroma-reactions-filter")
|
||||||
css := c.r.FormValue("css")
|
css := c.r.FormValue("css")
|
||||||
|
|
||||||
|
@ -534,6 +535,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
||||||
DarkMode: darkMode,
|
DarkMode: darkMode,
|
||||||
AntiDopamineMode: antiDopamineMode,
|
AntiDopamineMode: antiDopamineMode,
|
||||||
HideUnsupportedNotifs: hideUnsupportedNotifs,
|
HideUnsupportedNotifs: hideUnsupportedNotifs,
|
||||||
|
InstanceEmojiFilter: instanceEmojiFilter,
|
||||||
AddReactionsFilter: addReactionsFilter,
|
AddReactionsFilter: addReactionsFilter,
|
||||||
CSS: css,
|
CSS: css,
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
<div class="page-title"> Emojis </div>
|
<div class="page-title"> Emojis </div>
|
||||||
|
|
||||||
<div class="emoji-list-container">
|
<div class="emoji-list-container">
|
||||||
|
{{$emoji_filter := $.Ctx.InstanceEmojiFilter}}
|
||||||
{{range .Emojis}}
|
{{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-container">
|
||||||
<div class="emoji-item">
|
<div class="emoji-item">
|
||||||
<img class="emoji" src="{{.URL}}" alt="{{.ShortCode}}" height="32" loading="lazy" />
|
<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}}>
|
<input id="dark-mode" name="dark_mode" type="checkbox" value="true" {{if .Settings.DarkMode}}checked{{end}}>
|
||||||
<label for="dark-mode"> Use dark theme </label>
|
<label for="dark-mode"> Use dark theme </label>
|
||||||
</div>
|
</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">
|
<div class="settings-form-field">
|
||||||
<label for=""> Reactions filter (example_allowed anotherexample ...): </label>
|
<label for=""> Reactions filter (example_allowed anotherexample ...): </label>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue