|
|
|
@ -10,13 +10,17 @@
|
|
|
|
|
@inherits MiniRazor.TemplateBase<MessageGroupTemplateContext>
|
|
|
|
|
|
|
|
|
|
@{
|
|
|
|
|
ValueTask<string> ResolveUrlAsync(string url) => Model.ExportContext.ResolveMediaUrlAsync(url);
|
|
|
|
|
ValueTask<string> ResolveAssetUrlAsync(string url) =>
|
|
|
|
|
Model.ExportContext.ResolveAssetUrlAsync(url);
|
|
|
|
|
|
|
|
|
|
string FormatDate(DateTimeOffset date) => Model.ExportContext.FormatDate(date);
|
|
|
|
|
string FormatDate(DateTimeOffset date) =>
|
|
|
|
|
Model.ExportContext.FormatDate(date);
|
|
|
|
|
|
|
|
|
|
ValueTask<string> FormatMarkdownAsync(string markdown) => Model.FormatMarkdownAsync(markdown);
|
|
|
|
|
ValueTask<string> FormatMarkdownAsync(string markdown) =>
|
|
|
|
|
Model.FormatMarkdownAsync(markdown);
|
|
|
|
|
|
|
|
|
|
ValueTask<string> FormatEmbedMarkdownAsync(string markdown) => Model.FormatMarkdownAsync(markdown, false);
|
|
|
|
|
ValueTask<string> FormatEmbedMarkdownAsync(string markdown) =>
|
|
|
|
|
Model.FormatMarkdownAsync(markdown, false);
|
|
|
|
|
|
|
|
|
|
var firstMessage = Model.Messages.First();
|
|
|
|
|
|
|
|
|
@ -102,7 +106,7 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Avatar
|
|
|
|
|
<img class="chatlog__avatar" src="@await ResolveUrlAsync(message.Author.AvatarUrl)" alt="Avatar" loading="lazy">
|
|
|
|
|
<img class="chatlog__avatar" src="@await ResolveAssetUrlAsync(message.Author.AvatarUrl)" alt="Avatar" loading="lazy">
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -119,7 +123,7 @@
|
|
|
|
|
<div class="chatlog__reference">
|
|
|
|
|
@if (message.ReferencedMessage is not null)
|
|
|
|
|
{
|
|
|
|
|
<img class="chatlog__reference-avatar" src="@await ResolveUrlAsync(message.ReferencedMessage.Author.AvatarUrl)" alt="Avatar" loading="lazy">
|
|
|
|
|
<img class="chatlog__reference-avatar" src="@await ResolveAssetUrlAsync(message.ReferencedMessage.Author.AvatarUrl)" alt="Avatar" loading="lazy">
|
|
|
|
|
<div class="chatlog__reference-author" style="@(referencedUserColor is not null ? $"color: rgb({referencedUserColor.Value.R}, {referencedUserColor.Value.G}, {referencedUserColor.Value.B})" : null)" title="@message.ReferencedMessage.Author.FullName">@referencedUserNick</div>
|
|
|
|
|
<div class="chatlog__reference-content">
|
|
|
|
|
<span class="chatlog__reference-link" onclick="scrollToMessage(event, '@message.ReferencedMessage.Id')">
|
|
|
|
@ -200,20 +204,20 @@
|
|
|
|
|
@{/* Attachment preview */}
|
|
|
|
|
@if (attachment.IsImage)
|
|
|
|
|
{
|
|
|
|
|
<a href="@await ResolveUrlAsync(attachment.Url)">
|
|
|
|
|
<img class="chatlog__attachment-media" src="@await ResolveUrlAsync(attachment.Url)" alt="@(attachment.Description ?? "Image attachment")" title="Image: @attachment.FileName (@attachment.FileSize)" loading="lazy">
|
|
|
|
|
<a href="@await ResolveAssetUrlAsync(attachment.Url)">
|
|
|
|
|
<img class="chatlog__attachment-media" src="@await ResolveAssetUrlAsync(attachment.Url)" alt="@(attachment.Description ?? "Image attachment")" title="Image: @attachment.FileName (@attachment.FileSize)" loading="lazy">
|
|
|
|
|
</a>
|
|
|
|
|
}
|
|
|
|
|
else if (attachment.IsVideo)
|
|
|
|
|
{
|
|
|
|
|
<video class="chatlog__attachment-media" controls>
|
|
|
|
|
<source src="@await ResolveUrlAsync(attachment.Url)" alt="@(attachment.Description ?? "Video attachment")" title="Video: @attachment.FileName (@attachment.FileSize)">
|
|
|
|
|
<source src="@await ResolveAssetUrlAsync(attachment.Url)" alt="@(attachment.Description ?? "Video attachment")" title="Video: @attachment.FileName (@attachment.FileSize)">
|
|
|
|
|
</video>
|
|
|
|
|
}
|
|
|
|
|
else if (attachment.IsAudio)
|
|
|
|
|
{
|
|
|
|
|
<audio class="chatlog__attachment-media" controls>
|
|
|
|
|
<source src="@await ResolveUrlAsync(attachment.Url)" alt="@(attachment.Description ?? "Audio attachment")" title="Audio: @attachment.FileName (@attachment.FileSize)">
|
|
|
|
|
<source src="@await ResolveAssetUrlAsync(attachment.Url)" alt="@(attachment.Description ?? "Audio attachment")" title="Audio: @attachment.FileName (@attachment.FileSize)">
|
|
|
|
|
</audio>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -223,7 +227,7 @@
|
|
|
|
|
<use href="#attachment-icon"/>
|
|
|
|
|
</svg>
|
|
|
|
|
<div class="chatlog__attachment-generic-name">
|
|
|
|
|
<a href="@await ResolveUrlAsync(attachment.Url)">
|
|
|
|
|
<a href="@await ResolveAssetUrlAsync(attachment.Url)">
|
|
|
|
|
@attachment.FileName
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
@ -270,7 +274,7 @@
|
|
|
|
|
<div class="chatlog__embed-author-container">
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
|
|
|
|
{
|
|
|
|
|
<img class="chatlog__embed-author-icon" src="@await ResolveUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'">
|
|
|
|
|
<img class="chatlog__embed-author-icon" src="@await ResolveAssetUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'">
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
|
|
|
@ -319,8 +323,8 @@
|
|
|
|
|
else if (embed.Kind == EmbedKind.Image && !string.IsNullOrWhiteSpace(embed.Url))
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed">
|
|
|
|
|
<a href="@await ResolveUrlAsync(embed.Url)">
|
|
|
|
|
<img class="chatlog__embed-generic-image" src="@await ResolveUrlAsync(embed.Url)" alt="Embedded image" loading="lazy">
|
|
|
|
|
<a href="@await ResolveAssetUrlAsync(embed.Url)">
|
|
|
|
|
<img class="chatlog__embed-generic-image" src="@await ResolveAssetUrlAsync(embed.Url)" alt="Embedded image" loading="lazy">
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
@ -329,7 +333,7 @@
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed">
|
|
|
|
|
<video class="chatlog__embed-generic-gifv" loop width="@embed.Video.Width" height="@embed.Video.Height" onmouseover="this.play()" onmouseout="this.pause()">
|
|
|
|
|
<source src="@await ResolveUrlAsync(embed.Video.ProxyUrl ?? embed.Video.Url)" alt="Embedded video">
|
|
|
|
|
<source src="@await ResolveAssetUrlAsync(embed.Video.ProxyUrl ?? embed.Video.Url)" alt="Embedded video">
|
|
|
|
|
</video>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
@ -356,7 +360,7 @@
|
|
|
|
|
<div class="chatlog__embed-author-container">
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
|
|
|
|
{
|
|
|
|
|
<img class="chatlog__embed-author-icon" src="@await ResolveUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'">
|
|
|
|
|
<img class="chatlog__embed-author-icon" src="@await ResolveAssetUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'">
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
|
|
|
@ -430,8 +434,8 @@
|
|
|
|
|
@if (embed.Thumbnail is not null && !string.IsNullOrWhiteSpace(embed.Thumbnail.Url))
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed-thumbnail-container">
|
|
|
|
|
<a class="chatlog__embed-thumbnail-link" href="@await ResolveUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)">
|
|
|
|
|
<img class="chatlog__embed-thumbnail" src="@await ResolveUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)" alt="Thumbnail" loading="lazy">
|
|
|
|
|
<a class="chatlog__embed-thumbnail-link" href="@await ResolveAssetUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)">
|
|
|
|
|
<img class="chatlog__embed-thumbnail" src="@await ResolveAssetUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)" alt="Thumbnail" loading="lazy">
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
@ -446,8 +450,8 @@
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(image.Url))
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed-image-container">
|
|
|
|
|
<a class="chatlog__embed-image-link" href="@await ResolveUrlAsync(image.ProxyUrl ?? image.Url)">
|
|
|
|
|
<img class="chatlog__embed-image" src="@await ResolveUrlAsync(image.ProxyUrl ?? image.Url)" alt="Image" loading="lazy">
|
|
|
|
|
<a class="chatlog__embed-image-link" href="@await ResolveAssetUrlAsync(image.ProxyUrl ?? image.Url)">
|
|
|
|
|
<img class="chatlog__embed-image" src="@await ResolveAssetUrlAsync(image.ProxyUrl ?? image.Url)" alt="Image" loading="lazy">
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
@ -462,7 +466,7 @@
|
|
|
|
|
@{/* Footer icon */}
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(embed.Footer?.IconUrl))
|
|
|
|
|
{
|
|
|
|
|
<img class="chatlog__embed-footer-icon" src="@await ResolveUrlAsync(embed.Footer.IconProxyUrl ?? embed.Footer.IconUrl)" alt="Footer icon" loading="lazy">
|
|
|
|
|
<img class="chatlog__embed-footer-icon" src="@await ResolveAssetUrlAsync(embed.Footer.IconProxyUrl ?? embed.Footer.IconUrl)" alt="Footer icon" loading="lazy">
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<span class="chatlog__embed-footer-text">
|
|
|
|
@ -496,11 +500,11 @@
|
|
|
|
|
<div class="chatlog__sticker" title="@sticker.Name">
|
|
|
|
|
@if (sticker.Format is StickerFormat.Png or StickerFormat.PngAnimated)
|
|
|
|
|
{
|
|
|
|
|
<img class="chatlog__sticker--media" src="@await ResolveUrlAsync(sticker.SourceUrl)" alt="Sticker">
|
|
|
|
|
<img class="chatlog__sticker--media" src="@await ResolveAssetUrlAsync(sticker.SourceUrl)" alt="Sticker">
|
|
|
|
|
}
|
|
|
|
|
else if (sticker.Format == StickerFormat.Lottie)
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__sticker--media" data-source="@await ResolveUrlAsync(sticker.SourceUrl)"></div>
|
|
|
|
|
<div class="chatlog__sticker--media" data-source="@await ResolveAssetUrlAsync(sticker.SourceUrl)"></div>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
@ -512,7 +516,7 @@
|
|
|
|
|
@foreach (var reaction in message.Reactions)
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__reaction" title="@reaction.Emoji.Code">
|
|
|
|
|
<img class="chatlog__emoji chatlog__emoji--small" alt="@reaction.Emoji.Name" src="@await ResolveUrlAsync(reaction.Emoji.ImageUrl)" loading="lazy">
|
|
|
|
|
<img class="chatlog__emoji chatlog__emoji--small" alt="@reaction.Emoji.Name" src="@await ResolveAssetUrlAsync(reaction.Emoji.ImageUrl)" loading="lazy">
|
|
|
|
|
<span class="chatlog__reaction-count">@reaction.Count</span>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|