Force uniqueness with previews and logos on the fediverse. Closes #1777 and closes #1776

This commit is contained in:
Gabe Kangas
2022-03-17 13:09:38 -07:00
parent dc16eafea4
commit d1e39c4c1e
5 changed files with 33 additions and 3 deletions

View File

@ -69,7 +69,7 @@ func SendLive() error {
var imageToAttach string
previewGif := filepath.Join(config.WebRoot, "preview.gif")
thumbnailJpg := filepath.Join(config.WebRoot, "thumbnail.jpg")
uniquenessString := shortid.MustGenerate()
if utils.DoesFileExists(previewGif) {
imageToAttach = "preview.gif"
} else if utils.DoesFileExists(thumbnailJpg) {
@ -77,6 +77,7 @@ func SendLive() error {
}
if imageToAttach != "" {
previewURL.Path = imageToAttach
previewURL.RawQuery = "us=" + uniquenessString
apmodels.AddImageAttachmentToNote(note, previewURL.String())
}
}