mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-23 03:06:53 -04:00
parent
cb32cee5f5
commit
cbe4bc593c
4 changed files with 26 additions and 14 deletions
|
@ -12,11 +12,14 @@ namespace DiscordChatExporter.Core.Discord.Data
|
||||||
|
|
||||||
public string? IconUrl { get; }
|
public string? IconUrl { get; }
|
||||||
|
|
||||||
public EmbedAuthor(string? name, string? url, string? iconUrl)
|
public string? IconProxyUrl { get; }
|
||||||
|
|
||||||
|
public EmbedAuthor(string? name, string? url, string? iconUrl, string? iconProxyUrl)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Url = url;
|
Url = url;
|
||||||
IconUrl = iconUrl;
|
IconUrl = iconUrl;
|
||||||
|
IconProxyUrl = iconProxyUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() => Name ?? "<unnamed author>";
|
public override string ToString() => Name ?? "<unnamed author>";
|
||||||
|
@ -29,8 +32,9 @@ namespace DiscordChatExporter.Core.Discord.Data
|
||||||
var name = json.GetPropertyOrNull("name")?.GetString();
|
var name = json.GetPropertyOrNull("name")?.GetString();
|
||||||
var url = json.GetPropertyOrNull("url")?.GetString();
|
var url = json.GetPropertyOrNull("url")?.GetString();
|
||||||
var iconUrl = json.GetPropertyOrNull("icon_url")?.GetString();
|
var iconUrl = json.GetPropertyOrNull("icon_url")?.GetString();
|
||||||
|
var iconProxyUrl = json.GetPropertyOrNull("proxy_icon_url")?.GetString();
|
||||||
|
|
||||||
return new EmbedAuthor(name, url, iconUrl);
|
return new EmbedAuthor(name, url, iconUrl, iconProxyUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,10 +10,13 @@ namespace DiscordChatExporter.Core.Discord.Data
|
||||||
|
|
||||||
public string? IconUrl { get; }
|
public string? IconUrl { get; }
|
||||||
|
|
||||||
public EmbedFooter(string text, string? iconUrl)
|
public string? IconProxyUrl { get; }
|
||||||
|
|
||||||
|
public EmbedFooter(string text, string? iconUrl, string? iconProxyUrl)
|
||||||
{
|
{
|
||||||
Text = text;
|
Text = text;
|
||||||
IconUrl = iconUrl;
|
IconUrl = iconUrl;
|
||||||
|
IconProxyUrl = iconProxyUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() => Text;
|
public override string ToString() => Text;
|
||||||
|
@ -25,8 +28,9 @@ namespace DiscordChatExporter.Core.Discord.Data
|
||||||
{
|
{
|
||||||
var text = json.GetProperty("text").GetString();
|
var text = json.GetProperty("text").GetString();
|
||||||
var iconUrl = json.GetPropertyOrNull("icon_url")?.GetString();
|
var iconUrl = json.GetPropertyOrNull("icon_url")?.GetString();
|
||||||
|
var iconProxyUrl = json.GetPropertyOrNull("proxy_icon_url")?.GetString();
|
||||||
|
|
||||||
return new EmbedFooter(text, iconUrl);
|
return new EmbedFooter(text, iconUrl, iconProxyUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,13 +8,16 @@ namespace DiscordChatExporter.Core.Discord.Data
|
||||||
{
|
{
|
||||||
public string? Url { get; }
|
public string? Url { get; }
|
||||||
|
|
||||||
|
public string? ProxyUrl { get; }
|
||||||
|
|
||||||
public int? Width { get; }
|
public int? Width { get; }
|
||||||
|
|
||||||
public int? Height { get; }
|
public int? Height { get; }
|
||||||
|
|
||||||
public EmbedImage(string? url, int? width, int? height)
|
public EmbedImage(string? url, string? proxyUrl, int? width, int? height)
|
||||||
{
|
{
|
||||||
Url = url;
|
Url = url;
|
||||||
|
ProxyUrl = proxyUrl;
|
||||||
Height = height;
|
Height = height;
|
||||||
Width = width;
|
Width = width;
|
||||||
}
|
}
|
||||||
|
@ -25,10 +28,11 @@ namespace DiscordChatExporter.Core.Discord.Data
|
||||||
public static EmbedImage Parse(JsonElement json)
|
public static EmbedImage Parse(JsonElement json)
|
||||||
{
|
{
|
||||||
var url = json.GetPropertyOrNull("url")?.GetString();
|
var url = json.GetPropertyOrNull("url")?.GetString();
|
||||||
|
var proxyUrl = json.GetPropertyOrNull("proxy_url")?.GetString();
|
||||||
var width = json.GetPropertyOrNull("width")?.GetInt32();
|
var width = json.GetPropertyOrNull("width")?.GetInt32();
|
||||||
var height = json.GetPropertyOrNull("height")?.GetInt32();
|
var height = json.GetPropertyOrNull("height")?.GetInt32();
|
||||||
|
|
||||||
return new EmbedImage(url, width, height);
|
return new EmbedImage(url, proxyUrl, width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -180,7 +180,7 @@
|
||||||
<div class="chatlog__embed-author">
|
<div class="chatlog__embed-author">
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
||||||
{
|
{
|
||||||
<img class="chatlog__embed-author-icon" src="@await ResolveUrlAsync(embed.Author.IconUrl)" alt="Author icon">
|
<img class="chatlog__embed-author-icon" src="@await ResolveUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon">
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
||||||
|
@ -249,21 +249,21 @@
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (embed.Thumbnail is not null)
|
@if (embed.Thumbnail is not null && !string.IsNullOrWhiteSpace(embed.Thumbnail.Url))
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-thumbnail-container">
|
<div class="chatlog__embed-thumbnail-container">
|
||||||
<a class="chatlog__embed-thumbnail-link" href="@await ResolveUrlAsync(embed.Thumbnail.Url)">
|
<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.Url)" alt="Thumbnail">
|
<img class="chatlog__embed-thumbnail" src="@await ResolveUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)" alt="Thumbnail">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (embed.Image is not null)
|
@if (embed.Image is not null && !string.IsNullOrWhiteSpace(embed.Image.Url))
|
||||||
{
|
{
|
||||||
<div class="chatlog__embed-image-container">
|
<div class="chatlog__embed-image-container">
|
||||||
<a class="chatlog__embed-image-link" href="@await ResolveUrlAsync(embed.Image.Url)">
|
<a class="chatlog__embed-image-link" href="@await ResolveUrlAsync(embed.Image.ProxyUrl ?? embed.Image.Url)">
|
||||||
<img class="chatlog__embed-image" src="@await ResolveUrlAsync(embed.Image.Url)" alt="Image">
|
<img class="chatlog__embed-image" src="@await ResolveUrlAsync(embed.Image.ProxyUrl ?? embed.Image.Url)" alt="Image">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@
|
||||||
<div class="chatlog__embed-footer">
|
<div class="chatlog__embed-footer">
|
||||||
@if (!string.IsNullOrWhiteSpace(embed.Footer?.IconUrl))
|
@if (!string.IsNullOrWhiteSpace(embed.Footer?.IconUrl))
|
||||||
{
|
{
|
||||||
<img class="chatlog__embed-footer-icon" src="@await ResolveUrlAsync(embed.Footer.IconUrl)" alt="Footer icon">
|
<img class="chatlog__embed-footer-icon" src="@await ResolveUrlAsync(embed.Footer.IconProxyUrl ?? embed.Footer.IconUrl)" alt="Footer icon">
|
||||||
}
|
}
|
||||||
|
|
||||||
<span class="chatlog__embed-footer-text">
|
<span class="chatlog__embed-footer-text">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue