From cb4dd4d4cfe899f4e896621db841c85a44114758 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Tue, 26 Oct 2021 17:13:13 +0200 Subject: [PATCH] [liveposting] Add support for preserve-proxy for stream previews Signed-off-by: Knut Ahlers --- mod_livePosting.go | 6 ++++++ wiki/Home.md | 1 + 2 files changed, 7 insertions(+) diff --git a/mod_livePosting.go b/mod_livePosting.go index e36124f..e387a98 100644 --- a/mod_livePosting.go +++ b/mod_livePosting.go @@ -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, diff --git a/wiki/Home.md b/wiki/Home.md index 7885281..a6de8df 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -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 |