mirror of
https://github.com/Luzifer/discord-community.git
synced 2024-12-20 10:21:22 +00:00
Fix: Work around Discord screwing up image URLs
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
f3d31a4242
commit
0c01506152
1 changed files with 3 additions and 1 deletions
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/base64"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -274,7 +275,8 @@ func (m *modLivePosting) sendLivePost(username, displayName, title, game, previe
|
||||||
|
|
||||||
// @attr preserve_proxy optional string "" URL prefix of a Luzifer/preserve proxy to cache stream preview for longer
|
// @attr preserve_proxy optional string "" URL prefix of a Luzifer/preserve proxy to cache stream preview for longer
|
||||||
if proxy, err := url.Parse(m.attrs.MustString("preserve_proxy", ptrStringEmpty)); err == nil && proxy.String() != "" {
|
if proxy, err := url.Parse(m.attrs.MustString("preserve_proxy", ptrStringEmpty)); err == nil && proxy.String() != "" {
|
||||||
proxy.Path = "/" + previewImageURL.String()
|
// Discord screws up the plain-text URL format, so we need to use the b64-format
|
||||||
|
proxy.Path = "/b64:" + base64.URLEncoding.EncodeToString([]byte(previewImageURL.String()))
|
||||||
previewImageURL = proxy
|
previewImageURL = proxy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue