mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-11-22 15:03:01 +00:00
Added filter reactions settings; Change allowed emoji filter; Emoji module correct commit
This commit is contained in:
parent
9cdac3e623
commit
c5d552e7d8
1
go.mod
1
go.mod
@ -1,6 +1,7 @@
|
|||||||
module bloat
|
module bloat
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/enescakir/emoji v1.0.0 // indirect
|
||||||
github.com/gorilla/mux v1.7.3
|
github.com/gorilla/mux v1.7.3
|
||||||
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80
|
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80
|
||||||
)
|
)
|
||||||
|
2
go.sum
2
go.sum
@ -1,3 +1,5 @@
|
|||||||
|
github.com/enescakir/emoji v1.0.0 h1:W+HsNql8swfCQFtioDGDHCHri8nudlK1n5p2rHCJoog=
|
||||||
|
github.com/enescakir/emoji v1.0.0/go.mod h1:Bt1EKuLnKDTYpLALApstIkAjdDrS/8IAgTkKp+WKFD0=
|
||||||
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
|
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
|
||||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||||
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 h1:nrZ3ySNYwJbSpD6ce9duiP+QkD3JuLCcWkdaehUS/3Y=
|
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 h1:nrZ3ySNYwJbSpD6ce9duiP+QkD3JuLCcWkdaehUS/3Y=
|
||||||
|
@ -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"`
|
||||||
|
AddReactionsFilter string `json:"add_reactions_filter"`
|
||||||
CSS string `json:"css"`
|
CSS string `json:"css"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ func NewSettings() *Settings {
|
|||||||
DarkMode: false,
|
DarkMode: false,
|
||||||
AntiDopamineMode: false,
|
AntiDopamineMode: false,
|
||||||
HideUnsupportedNotifs: false,
|
HideUnsupportedNotifs: false,
|
||||||
|
AddReactionsFilter: "",
|
||||||
CSS: "",
|
CSS: "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ type Context struct {
|
|||||||
CSRFToken string
|
CSRFToken string
|
||||||
UserID string
|
UserID string
|
||||||
AntiDopamineMode bool
|
AntiDopamineMode bool
|
||||||
|
AddReactionsFilter string
|
||||||
UserCSS string
|
UserCSS string
|
||||||
Referrer string
|
Referrer string
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,9 @@ type TemplateData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func allowed_emoji_page(emoj string, codes ...string) bool {
|
func allowed_emoji_page(emoj string, codes string) bool {
|
||||||
for _, code := range codes {
|
s := strings.Split(codes, " ")
|
||||||
|
for _, code := range s {
|
||||||
if strings.Contains(emoj, code) {
|
if strings.Contains(emoj, code) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
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"
|
||||||
|
addReactionsFilter := c.r.FormValue("pleroma-reactions-filter")
|
||||||
css := c.r.FormValue("css")
|
css := c.r.FormValue("css")
|
||||||
|
|
||||||
settings := &model.Settings{
|
settings := &model.Settings{
|
||||||
@ -533,6 +534,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
|||||||
DarkMode: darkMode,
|
DarkMode: darkMode,
|
||||||
AntiDopamineMode: antiDopamineMode,
|
AntiDopamineMode: antiDopamineMode,
|
||||||
HideUnsupportedNotifs: hideUnsupportedNotifs,
|
HideUnsupportedNotifs: hideUnsupportedNotifs,
|
||||||
|
AddReactionsFilter: addReactionsFilter,
|
||||||
CSS: css,
|
CSS: css,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<div class="emoji-list-container">
|
<div class="emoji-list-container">
|
||||||
{{range .Emojis}}
|
{{range .Emojis}}
|
||||||
{{if Allowed_emoji_page .ShortCode "blobfox" "senko" "shiro" "cirno" "pleroma" "udongein"}}
|
{{if Allowed_emoji_page .ShortCode "blobfox senko shiro cirno pleroma udongein"}}
|
||||||
<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" />
|
||||||
|
@ -1,18 +1,24 @@
|
|||||||
{{with .Data}}
|
{{with .Data}}
|
||||||
{{template "header.tmpl" (WithContext .CommonData $.Ctx)}}
|
{{template "header.tmpl" (WithContext .CommonData $.Ctx)}}
|
||||||
|
<div class="page-title"> Reactions </div>
|
||||||
{{$st_id := .ID}}
|
{{$st_id := .ID}}
|
||||||
<div class="scrollable-emoji" style="overflow-y: scroll; height:400px;">
|
<div class="page-title"> Add reaction </div>
|
||||||
<div class="pleroma-reactions">
|
<div class="scrollable-emoji" style="overflow-y: scroll; height:200px;">
|
||||||
|
<div class="pleroma-reactions">
|
||||||
|
{{$emoji_filter := $.Ctx.AddReactionsFilter}}
|
||||||
{{range $shortcode, $code := .ReactionEmojis}}
|
{{range $shortcode, $code := .ReactionEmojis}}
|
||||||
|
{{if Allowed_emoji_page $shortcode $emoji_filter}}
|
||||||
<form action="/react-with/{{$st_id}}?emoji={{$code}}" method="post" target="_self" title="{{$shortcode}}">
|
<form action="/react-with/{{$st_id}}?emoji={{$code}}" method="post" target="_self" title="{{$shortcode}}">
|
||||||
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
|
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
|
||||||
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
|
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
|
||||||
<input type="submit" value="{{$code}}" class="pleroma-emoji">
|
<input type="submit" value="{{$code}}" class="pleroma-emoji">
|
||||||
</form>
|
</form>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="page-title"> Who reacted </div>
|
||||||
{{range .Reactions}}
|
{{range .Reactions}}
|
||||||
<div class="page-title">{{.Name}}</div>
|
<div class="page-title">{{.Name}}</div>
|
||||||
{{template "userlist.tmpl" (WithContext .Accounts $.Ctx)}}
|
{{template "userlist.tmpl" (WithContext .Accounts $.Ctx)}}
|
||||||
|
@ -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=""> Reactions filter (example_allowed anotherexample ...): </label>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<textarea id="pleroma-reactions-filter" name="pleroma-reactions-filter" cols="80" rows="1">{{.Settings.AddReactionsFilter}}</textarea>
|
||||||
|
</div>
|
||||||
<div class="settings-form-field">
|
<div class="settings-form-field">
|
||||||
<label for="css"> Custom CSS: </label>
|
<label for="css"> Custom CSS: </label>
|
||||||
</div>
|
</div>
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -1,3 +1,5 @@
|
|||||||
|
# github.com/enescakir/emoji v1.0.0
|
||||||
|
github.com/enescakir/emoji
|
||||||
# github.com/gorilla/mux v1.7.3
|
# github.com/gorilla/mux v1.7.3
|
||||||
github.com/gorilla/mux
|
github.com/gorilla/mux
|
||||||
# github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80
|
# github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80
|
||||||
|
Loading…
Reference in New Issue
Block a user