Compare commits

...

9 Commits

Author SHA1 Message Date
Tyrrrz e849c9516c Update version 2021-08-28 19:51:11 +03:00
Tyrrrz 524d0a1bb2 Fix breaking changes in tests 2021-08-28 19:47:51 +03:00
Tyrrrz f0a4410ee0 Update NuGet packages 2021-08-28 19:44:02 +03:00
Tyrrrz a98772e46e Try using ConcurrentDictionary for caching in tests 2021-08-28 19:41:50 +03:00
Tyrrrz b6fdea11a2 Refactor webhook trigger in CD 2021-08-28 19:27:34 +03:00
Tyrrrz fcca052165 Ignore unix timestamp markers with invalid offsets
Fixes #681
2021-08-28 19:17:57 +03:00
Chris Helder ac7ebd6f91 Use higher resolution for user profile pictures (#685) 2021-08-27 05:03:51 -07:00
Lucas LaBuff 9303383662 Fix parsing of "has:file" filter (#678) 2021-08-08 13:49:50 -07:00
Tyrrrz 7fa908ce34 Fix Docker CD workflow 2021-08-08 19:13:15 +03:00
10 changed files with 47 additions and 20 deletions
+6 -2
View File
@@ -13,13 +13,17 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2.3.3 uses: actions/checkout@v2.3.3
- name: Get release version
id: get-version
uses: dawidd6/action-get-tag@v1
- name: Login - name: Login
run: docker login -u tyrrrz -p ${{ secrets.DOCKER_TOKEN }} run: docker login -u tyrrrz -p ${{ secrets.DOCKER_TOKEN }}
- name: Build - name: Build
run: docker build -t tyrrrz/discordchatexporter:${{ github.ref }} -t tyrrrz/discordchatexporter:stable . run: docker build -t tyrrrz/discordchatexporter:${{ steps.get-version.outputs.tag }} -t tyrrrz/discordchatexporter:stable .
- name: Deploy - name: Deploy
run: | run: |
docker push tyrrrz/discordchatexporter:${{ github.ref }} docker push tyrrrz/discordchatexporter:${{ steps.get-version.outputs.tag }}
docker push tyrrrz/discordchatexporter:stable docker push tyrrrz/discordchatexporter:stable
+16 -8
View File
@@ -13,6 +13,10 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2.3.3 uses: actions/checkout@v2.3.3
- name: Get release version
id: get-version
uses: dawidd6/action-get-tag@v1
- name: Install .NET (v3.1) - name: Install .NET (v3.1)
uses: actions/setup-dotnet@v1.7.2 uses: actions/setup-dotnet@v1.7.2
with: with:
@@ -71,11 +75,15 @@ jobs:
asset_content_type: application/zip asset_content_type: application/zip
- name: Notify Discord - name: Notify Discord
run: | uses: satak/webrequest-action@v1.2.4
Invoke-WebRequest ` with:
-Uri "${{ secrets.DISCORD_WEBHOOK }}" ` url: ${{ secrets.DISCORD_WEBHOOK }}
-Method "POST" ` method: POST
-ContentType "application/json; charset=UTF-8" ` headers: |
-Body '{"content":"**DiscordChatExporter** new version released!\nRef: `${{ github.ref }}`\nChangelog: <https://github.com/Tyrrrz/DiscordChatExporter/blob/${{ github.sha }}/Changelog.md>"}' ` {
-UseBasicParsing "ContentType": "application/json; charset=UTF-8"
shell: pwsh }
payload: |
{
"content": "**DiscordChatExporter** new version released!\nVersion: `${{ steps.get-version.outputs.tag }}`\nChangelog: <https://github.com/Tyrrrz/DiscordChatExporter/blob/${{ steps.get-version.outputs.tag }}/Changelog.md>"
}
+6
View File
@@ -1,3 +1,9 @@
### v2.30.1 (28-Aug-2021)
- [HTML] Changed user avatars to render using higher resolution images. (Thanks [@Chris Helder](https://github.com/TheDude53))
- Fixed an issue where `has:file` message filter was not recognized. (Thanks [@Lucas LaBuff](https://github.com/96-LB))
- Fixed an issue where a unix timestamp marker with an invalid offset crashed the export process.
### v2.30 (08-Aug-2021) ### v2.30 (08-Aug-2021)
- [HTML] Added special casing for Spotify track embeds to render them directly using an embedded player. - [HTML] Added special casing for Spotify track embeds to render them directly using an embedded player.
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<Version>2.30</Version> <Version>2.30.1</Version>
<Company>Tyrrrz</Company> <Company>Tyrrrz</Company>
<Copyright>Copyright (c) Alexey Golub</Copyright> <Copyright>Copyright (c) Alexey Golub</Copyright>
<LangVersion>preview</LangVersion> <LangVersion>preview</LangVersion>
@@ -14,10 +14,10 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AngleSharp" Version="0.16.0" /> <PackageReference Include="AngleSharp" Version="0.16.0" />
<PackageReference Include="FluentAssertions" Version="5.10.3" /> <PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" /> <PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="JsonExtensions" Version="1.1.0" /> <PackageReference Include="JsonExtensions" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="coverlet.msbuild" Version="3.1.0" PrivateAssets="all" /> <PackageReference Include="coverlet.msbuild" Version="3.1.0" PrivateAssets="all" />
<PackageReference Include="System.Reactive" Version="5.0.0" /> <PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="xunit" Version="2.4.1" />
+3 -2
View File
@@ -170,7 +170,7 @@ namespace DiscordChatExporter.Cli.Tests
// Assert // Assert
iframeHtml.Should().NotBeNull(); iframeHtml.Should().NotBeNull();
iframeHtml?.GetAttribute("src").Should() iframeHtml?.GetAttribute("src").Should()
.StartWithEquivalent("https://open.spotify.com/embed/track/1LHZMWefF9502NPfArRfvP"); .StartWithEquivalentOf("https://open.spotify.com/embed/track/1LHZMWefF9502NPfArRfvP");
} }
[Fact] [Fact]
@@ -203,7 +203,8 @@ namespace DiscordChatExporter.Cli.Tests
// Assert // Assert
iframeHtml.Should().NotBeNull(); iframeHtml.Should().NotBeNull();
iframeHtml?.GetAttribute("src").Should().StartWithEquivalent("https://www.youtube.com/embed/qOWW4OlgbvE"); iframeHtml?.GetAttribute("src").Should()
.StartWithEquivalentOf("https://www.youtube.com/embed/qOWW4OlgbvE");
} }
} }
} }
@@ -1,12 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Concurrent;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace DiscordChatExporter.Cli.Tests.Utils namespace DiscordChatExporter.Cli.Tests.Utils
{ {
internal static class GlobalCache internal static class GlobalCache
{ {
private static readonly Dictionary<string, object?> Dictionary = new(); private static readonly ConcurrentDictionary<string, object?> Dictionary = new();
public static async Task<T> WrapAsync<T>(string key, Func<Task<T>> getAsync) public static async Task<T> WrapAsync<T>(string key, Func<Task<T>> getAsync)
{ {
@@ -53,7 +53,7 @@ namespace DiscordChatExporter.Core.Discord.Data
? "gif" ? "gif"
: "png"; : "png";
return $"https://cdn.discordapp.com/avatars/{id}/{avatarHash}.{extension}?size=40"; return $"https://cdn.discordapp.com/avatars/{id}/{avatarHash}.{extension}?size=128";
} }
public static User Parse(JsonElement json) public static User Parse(JsonElement json)
@@ -54,6 +54,7 @@ namespace DiscordChatExporter.Core.Exporting.Filtering.Parsing
.IgnoreThen(Choice( .IgnoreThen(Choice(
Span.EqualToIgnoreCase("link").IgnoreThen(Parse.Return(MessageContentMatchKind.Link)), Span.EqualToIgnoreCase("link").IgnoreThen(Parse.Return(MessageContentMatchKind.Link)),
Span.EqualToIgnoreCase("embed").IgnoreThen(Parse.Return(MessageContentMatchKind.Embed)), Span.EqualToIgnoreCase("embed").IgnoreThen(Parse.Return(MessageContentMatchKind.Embed)),
Span.EqualToIgnoreCase("file").IgnoreThen(Parse.Return(MessageContentMatchKind.File)),
Span.EqualToIgnoreCase("video").IgnoreThen(Parse.Return(MessageContentMatchKind.Video)), Span.EqualToIgnoreCase("video").IgnoreThen(Parse.Return(MessageContentMatchKind.Video)),
Span.EqualToIgnoreCase("image").IgnoreThen(Parse.Return(MessageContentMatchKind.Image)), Span.EqualToIgnoreCase("image").IgnoreThen(Parse.Return(MessageContentMatchKind.Image)),
Span.EqualToIgnoreCase("sound").IgnoreThen(Parse.Return(MessageContentMatchKind.Sound)) Span.EqualToIgnoreCase("sound").IgnoreThen(Parse.Return(MessageContentMatchKind.Sound))
@@ -238,8 +238,8 @@ namespace DiscordChatExporter.Core.Markdown.Parsing
new Regex("<t:(\\d+)(?::\\w)?>", DefaultRegexOptions), new Regex("<t:(\\d+)(?::\\w)?>", DefaultRegexOptions),
(_, m) => (_, m) =>
{ {
// We don't care about the 'R' parameter because we're not going to // TODO: support formatting parameters
// show relative timestamps in an export anyway. // See: https://github.com/Tyrrrz/DiscordChatExporter/issues/662
if (!long.TryParse(m.Groups[1].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, if (!long.TryParse(m.Groups[1].Value, NumberStyles.Integer, CultureInfo.InvariantCulture,
out var offset)) out var offset))
@@ -247,6 +247,13 @@ namespace DiscordChatExporter.Core.Markdown.Parsing
return null; return null;
} }
// Bound check
// https://github.com/Tyrrrz/DiscordChatExporter/issues/681
if (offset < TimeSpan.MinValue.TotalSeconds || offset > TimeSpan.MaxValue.TotalSeconds)
{
return null;
}
return new UnixTimestampNode(DateTimeOffset.UnixEpoch + TimeSpan.FromSeconds(offset)); return new UnixTimestampNode(DateTimeOffset.UnixEpoch + TimeSpan.FromSeconds(offset));
} }
); );