Skip to content

Commit

Permalink
Skip Twitch clip projections because they can't be rendered locally (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz authored Feb 13, 2024
1 parent 4588bd0 commit 7c04db4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public async Task I_can_export_a_channel_that_contains_a_message_with_a_Spotify_
iframeUrl.Should().StartWith("https://open.spotify.com/embed/track/1LHZMWefF9502NPfArRfvP");
}

[Fact]
[Fact(Skip = "Twitch does not allow embeds from inside local HTML files")]
public async Task I_can_export_a_channel_that_contains_a_message_with_a_Twitch_clip_embed()
{
// https://github.com/Tyrrrz/DiscordChatExporter/issues/1196
Expand Down
14 changes: 4 additions & 10 deletions DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,6 @@
</div>
</div>
}
// Twitch embed
else if (embed.TryGetTwitchClip() is { } twitchClipEmbed)
{
<div class="chatlog__embed">
<div class="chatlog__embed-twitch-container">
<iframe class="chatlog__embed-twitch" src="@twitchClipEmbed.Url" width="400" height="225"></iframe>
</div>
</div>
}
// YouTube embed
else if (embed.TryGetYouTubeVideo() is { } youTubeVideoEmbed)
{
Expand Down Expand Up @@ -457,7 +448,10 @@
</div>
}
// Generic video embed
else if (embed.Kind == EmbedKind.Video && !string.IsNullOrWhiteSpace(embed.Url))
else if (embed.Kind == EmbedKind.Video
&& !string.IsNullOrWhiteSpace(embed.Url)
// Twitch clips cannot be embedded in local HTML files
&& embed.TryGetTwitchClip() is null)
{
var embedVideoUrl =
embed.Video?.ProxyUrl ?? embed.Video?.Url ??
Expand Down

0 comments on commit 7c04db4

Please sign in to comment.