[liveposting] Add support for preserve-proxy for stream previews

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-10-26 17:13:13 +02:00
parent d7b74f4d6c
commit cb4dd4d4cf
Signed by: luzifer
GPG Key ID: 0066F03ED215AD7D
2 changed files with 7 additions and 0 deletions

View File

@ -272,6 +272,12 @@ func (m *modLivePosting) sendLivePost(username, displayName, title, game, previe
previewImageQuery.Add("_discordNoCache", time.Now().Format(time.RFC3339))
previewImageURL.RawQuery = previewImageQuery.Encode()
// @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() != "" {
proxy.Path = "/" + previewImageURL.String()
previewImageURL = proxy
}
msgEmbed := &discordgo.MessageEmbed{
Author: &discordgo.MessageEmbedAuthor{
Name: displayName,

View File

@ -84,6 +84,7 @@ Announces stream live status based on Discord streaming status
| `cron` | | string | `*/5 * * * *` | Fetch live status of `poll_usernames` (set to empty string to disable): keep this below `stream_freshness` or you might miss streams |
| `disable_presence` | | bool | `false` | Disable posting live-postings for discord presence changes |
| `poll_usernames` | | []string | `[]` | Check these usernames for active streams when executing the `cron` (at most 100 users can be checked) |
| `preserve_proxy` | | string | | URL prefix of a Luzifer/preserve proxy to cache stream preview for longer |
| `stream_freshness` | | duration | `5m` | How long after stream start to post shoutout |
| `whitelisted_role` | | string | | Only post for members of this role ID |