Merge branch 'main' into access-api
This commit is contained in:
commit
4f4165f46f
5 changed files with 1873 additions and 19 deletions
|
@ -1183,8 +1183,10 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release
|
||||||
**Bug fixes + maintenance:**
|
**Bug fixes + maintenance:**
|
||||||
|
|
||||||
* Removed old ntfy website from ntfy entirely (no ticket)
|
* Removed old ntfy website from ntfy entirely (no ticket)
|
||||||
|
* Make emoji lookup for emails more efficient ([#725](https://github.com/binwiederhier/ntfy/pull/725), thanks to [@adamantike](https://github.com/adamantike))
|
||||||
* Fix potential subscriber ID clash ([#712](https://github.com/binwiederhier/ntfy/issues/712), thanks to [@peterbourgon](https://github.com/peterbourgon) for reporting, and [@dropdevrahul](https://github.com/dropdevrahul) for fixing)
|
* Fix potential subscriber ID clash ([#712](https://github.com/binwiederhier/ntfy/issues/712), thanks to [@peterbourgon](https://github.com/peterbourgon) for reporting, and [@dropdevrahul](https://github.com/dropdevrahul) for fixing)
|
||||||
* Support for `quoted-printable` in incoming emails ([#719](https://github.com/binwiederhier/ntfy/pull/719), thanks to [@Aerion](https://github.com/Aerion))
|
* Support for `quoted-printable` in incoming emails ([#719](https://github.com/binwiederhier/ntfy/pull/719), thanks to [@Aerion](https://github.com/Aerion))
|
||||||
|
* Attachments with filenames that are downloaded using a browser will now download with the proper filename ([#726](https://github.com/binwiederhier/ntfy/issues/726), thanks to [un99known99](https://github.com/un99known99) for reporting, and [@wunter8](https://github.com/wunter8) for fixing)
|
||||||
|
|
||||||
### ntfy Android app v1.16.1 (UNRELEASED)
|
### ntfy Android app v1.16.1 (UNRELEASED)
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
1857
server/mailer_emoji_map.json
Normal file
1857
server/mailer_emoji_map.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -652,6 +652,9 @@ func (s *Server) handleFile(w http.ResponseWriter, r *http.Request, v *visitor)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
if m.Attachment.Name != "" {
|
||||||
|
w.Header().Set("Content-Disposition", "attachment; filename="+strconv.Quote(m.Attachment.Name))
|
||||||
|
}
|
||||||
_, err = io.Copy(util.NewContentTypeWriter(w, r.URL.Path), f)
|
_, err = io.Copy(util.NewContentTypeWriter(w, r.URL.Path), f)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,15 @@ import (
|
||||||
_ "embed" // required by go:embed
|
_ "embed" // required by go:embed
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"heckel.io/ntfy/log"
|
|
||||||
"heckel.io/ntfy/util"
|
|
||||||
"mime"
|
"mime"
|
||||||
"net"
|
"net"
|
||||||
"net/smtp"
|
"net/smtp"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"heckel.io/ntfy/log"
|
||||||
|
"heckel.io/ntfy/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mailer interface {
|
type mailer interface {
|
||||||
|
@ -131,31 +132,23 @@ This message was sent by {ip} at {time} via {topicURL}`
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
//go:embed "mailer_emoji.json"
|
//go:embed "mailer_emoji_map.json"
|
||||||
emojisJSON string
|
emojisJSON string
|
||||||
)
|
)
|
||||||
|
|
||||||
type emoji struct {
|
|
||||||
Emoji string `json:"emoji"`
|
|
||||||
Aliases []string `json:"aliases"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func toEmojis(tags []string) (emojisOut []string, tagsOut []string, err error) {
|
func toEmojis(tags []string) (emojisOut []string, tagsOut []string, err error) {
|
||||||
var emojis []emoji
|
var emojiMap map[string]string
|
||||||
if err = json.Unmarshal([]byte(emojisJSON), &emojis); err != nil {
|
if err = json.Unmarshal([]byte(emojisJSON), &emojiMap); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
tagsOut = make([]string, 0)
|
tagsOut = make([]string, 0)
|
||||||
emojisOut = make([]string, 0)
|
emojisOut = make([]string, 0)
|
||||||
nextTag:
|
for _, t := range tags {
|
||||||
for _, t := range tags { // TODO Super inefficient; we should just create a .json file with a map
|
if emoji, ok := emojiMap[t]; ok {
|
||||||
for _, e := range emojis {
|
emojisOut = append(emojisOut, emoji)
|
||||||
if util.Contains(e.Aliases, t) {
|
} else {
|
||||||
emojisOut = append(emojisOut, e.Emoji)
|
tagsOut = append(tagsOut, t)
|
||||||
continue nextTag
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tagsOut = append(tagsOut, t)
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue