mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-14 15:53:30 -07:00
Remove conditional checks for canonical URLs in HTML and JSON exports
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
parent
197c9f39e3
commit
27c0d60812
|
|
@ -138,12 +138,7 @@ internal class JsonMessageWriter(Stream stream, ExportContext context)
|
||||||
cancellationToken
|
cancellationToken
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
_writer.WriteString("iconCanonicalUrl", embedAuthor.IconUrl);
|
||||||
// Include canonical URL if present
|
|
||||||
if (!string.IsNullOrWhiteSpace(embedAuthor.IconUrl))
|
|
||||||
{
|
|
||||||
_writer.WriteString("iconCanonicalUrl", embedAuthor.IconUrl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_writer.WriteEndObject();
|
_writer.WriteEndObject();
|
||||||
|
|
@ -166,12 +161,7 @@ internal class JsonMessageWriter(Stream stream, ExportContext context)
|
||||||
cancellationToken
|
cancellationToken
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
_writer.WriteString("canonicalUrl", embedImage.Url);
|
||||||
// Include canonical URL if present
|
|
||||||
if (!string.IsNullOrWhiteSpace(embedImage.Url))
|
|
||||||
{
|
|
||||||
_writer.WriteString("canonicalUrl", embedImage.Url);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_writer.WriteNumber("width", embedImage.Width);
|
_writer.WriteNumber("width", embedImage.Width);
|
||||||
|
|
@ -197,12 +187,7 @@ internal class JsonMessageWriter(Stream stream, ExportContext context)
|
||||||
cancellationToken
|
cancellationToken
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
_writer.WriteString("canonicalUrl", embedVideo.Url);
|
||||||
// Include canonical URL if present
|
|
||||||
if (!string.IsNullOrWhiteSpace(embedVideo.Url))
|
|
||||||
{
|
|
||||||
_writer.WriteString("canonicalUrl", embedVideo.Url);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_writer.WriteNumber("width", embedVideo.Width);
|
_writer.WriteNumber("width", embedVideo.Width);
|
||||||
|
|
@ -230,12 +215,7 @@ internal class JsonMessageWriter(Stream stream, ExportContext context)
|
||||||
cancellationToken
|
cancellationToken
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
_writer.WriteString("iconCanonicalUrl", embedFooter.IconUrl);
|
||||||
// Include canonical URL if present
|
|
||||||
if (!string.IsNullOrWhiteSpace(embedFooter.IconUrl))
|
|
||||||
{
|
|
||||||
_writer.WriteString("iconCanonicalUrl", embedFooter.IconUrl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_writer.WriteEndObject();
|
_writer.WriteEndObject();
|
||||||
|
|
|
||||||
|
|
@ -388,7 +388,7 @@
|
||||||
<div class="chatlog__embed-author-container">
|
<div class="chatlog__embed-author-container">
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
||||||
{
|
{
|
||||||
<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'" @(embed.Author.IconProxyUrl is not null && embed.Author.IconUrl is not null ? $"data-canonical-url=\"{embed.Author.IconUrl}\"" : null)>
|
<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'" data-canonical-url="@embed.Author.IconUrl">
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
||||||
|
|
@ -442,13 +442,11 @@
|
||||||
embed.Url;
|
embed.Url;
|
||||||
|
|
||||||
var embedImageCanonicalUrl =
|
var embedImageCanonicalUrl =
|
||||||
(embed.Image?.ProxyUrl is not null && embed.Image?.Url is not null) ? embed.Image?.Url :
|
embed.Image?.Url ?? embed.Thumbnail?.Url ?? embed.Url;
|
||||||
(embed.Thumbnail?.ProxyUrl is not null && embed.Thumbnail?.Url is not null) ? embed.Thumbnail?.Url :
|
|
||||||
null;
|
|
||||||
|
|
||||||
<div class="chatlog__embed">
|
<div class="chatlog__embed">
|
||||||
<a href="@await ResolveAssetUrlAsync(embedImageUrl)">
|
<a href="@await ResolveAssetUrlAsync(embedImageUrl)">
|
||||||
<img class="chatlog__embed-generic-image" src="@await ResolveAssetUrlAsync(embedImageUrl)" alt="Embedded image" loading="lazy" @(embedImageCanonicalUrl is not null ? $"data-canonical-url=\"{embedImageCanonicalUrl}\"" : null)>
|
<img class="chatlog__embed-generic-image" src="@await ResolveAssetUrlAsync(embedImageUrl)" alt="Embedded image" loading="lazy" data-canonical-url="@embedImageCanonicalUrl">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
@ -462,11 +460,10 @@
|
||||||
embed.Video?.ProxyUrl ?? embed.Video?.Url ??
|
embed.Video?.ProxyUrl ?? embed.Video?.Url ??
|
||||||
embed.Url;
|
embed.Url;
|
||||||
|
|
||||||
var embedVideoCanonicalUrl =
|
var embedVideoCanonicalUrl = embed.Video?.Url ?? embed.Url;
|
||||||
embed.Video?.ProxyUrl is not null && embed.Video?.Url is not null ? embed.Video?.Url : null;
|
|
||||||
|
|
||||||
<div class="chatlog__embed">
|
<div class="chatlog__embed">
|
||||||
<video class="chatlog__embed-generic-video" width="@embed.Video?.Width" height="@embed.Video?.Height" controls @(embedVideoCanonicalUrl is not null ? $"data-canonical-url=\"{embedVideoCanonicalUrl}\"" : null)>
|
<video class="chatlog__embed-generic-video" width="@embed.Video?.Width" height="@embed.Video?.Height" controls data-canonical-url="@embedVideoCanonicalUrl">
|
||||||
<source src="@await ResolveAssetUrlAsync(embedVideoUrl)" alt="Embedded video">
|
<source src="@await ResolveAssetUrlAsync(embedVideoUrl)" alt="Embedded video">
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -478,11 +475,10 @@
|
||||||
embed.Video?.ProxyUrl ?? embed.Video?.Url ??
|
embed.Video?.ProxyUrl ?? embed.Video?.Url ??
|
||||||
embed.Url;
|
embed.Url;
|
||||||
|
|
||||||
var embedVideoCanonicalUrl =
|
var embedVideoCanonicalUrl = embed.Video?.Url ?? embed.Url;
|
||||||
embed.Video?.ProxyUrl is not null && embed.Video?.Url is not null ? embed.Video?.Url : null;
|
|
||||||
|
|
||||||
<div class="chatlog__embed">
|
<div class="chatlog__embed">
|
||||||
<video class="chatlog__embed-generic-gifv" width="@embed.Video?.Width" height="@embed.Video?.Height" loop onmouseover="this.play()" onmouseout="this.pause()" @(embedVideoCanonicalUrl is not null ? $"data-canonical-url=\"{embedVideoCanonicalUrl}\"" : null)>
|
<video class="chatlog__embed-generic-gifv" width="@embed.Video?.Width" height="@embed.Video?.Height" loop onmouseover="this.play()" onmouseout="this.pause()" data-canonical-url="@embedVideoCanonicalUrl">
|
||||||
<source src="@await ResolveAssetUrlAsync(embedVideoUrl)" alt="Embedded gifv">
|
<source src="@await ResolveAssetUrlAsync(embedVideoUrl)" alt="Embedded gifv">
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -510,7 +506,7 @@
|
||||||
<div class="chatlog__embed-author-container">
|
<div class="chatlog__embed-author-container">
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
||||||
{
|
{
|
||||||
<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'" @(embed.Author.IconProxyUrl is not null && embed.Author.IconUrl is not null ? $"data-canonical-url=\"{embed.Author.IconUrl}\"" : null)>
|
<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'" data-canonical-url="@embed.Author.IconUrl">
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
||||||
|
|
@ -585,7 +581,7 @@
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-thumbnail-container">
|
<div class="chatlog__embed-thumbnail-container">
|
||||||
<a class="chatlog__embed-thumbnail-link" href="@await ResolveAssetUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)">
|
<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" @(embed.Thumbnail.ProxyUrl is not null && embed.Thumbnail.Url is not null ? $"data-canonical-url=\"{embed.Thumbnail.Url}\"" : null)>
|
<img class="chatlog__embed-thumbnail" src="@await ResolveAssetUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)" alt="Thumbnail" loading="lazy" data-canonical-url="@embed.Thumbnail.Url">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
@ -601,7 +597,7 @@
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-image-container">
|
<div class="chatlog__embed-image-container">
|
||||||
<a class="chatlog__embed-image-link" href="@await ResolveAssetUrlAsync(image.ProxyUrl ?? image.Url)">
|
<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" @(image.ProxyUrl is not null && image.Url is not null ? $"data-canonical-url=\"{image.Url}\"" : null)>
|
<img class="chatlog__embed-image" src="@await ResolveAssetUrlAsync(image.ProxyUrl ?? image.Url)" alt="Image" loading="lazy" data-canonical-url="@image.Url">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
@ -616,7 +612,7 @@
|
||||||
@* Footer icon *@
|
@* Footer icon *@
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Footer?.IconUrl))
|
@if (!string.IsNullOrWhiteSpace(embed.Footer?.IconUrl))
|
||||||
{
|
{
|
||||||
<img class="chatlog__embed-footer-icon" src="@await ResolveAssetUrlAsync(embed.Footer.IconProxyUrl ?? embed.Footer.IconUrl)" alt="Footer icon" loading="lazy" @(embed.Footer.IconProxyUrl is not null && embed.Footer.IconUrl is not null ? $"data-canonical-url=\"{embed.Footer.IconUrl}\"" : null)>
|
<img class="chatlog__embed-footer-icon" src="@await ResolveAssetUrlAsync(embed.Footer.IconProxyUrl ?? embed.Footer.IconUrl)" alt="Footer icon" loading="lazy" data-canonical-url="@embed.Footer.IconUrl">
|
||||||
}
|
}
|
||||||
|
|
||||||
<span class="chatlog__embed-footer-text">
|
<span class="chatlog__embed-footer-text">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue