Merge pull request #901 from 13xforever/vnext

Try to fix time zone info after upgrading the docker image
This commit is contained in:
clienthax 2022-08-16 22:59:29 +01:00 committed by GitHub
commit e38e9c9251
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 20 deletions

View File

@ -17,7 +17,7 @@
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.0" />
<PackageReference Include="NLog" Version="5.0.1" />
<PackageReference Include="NLog" Version="5.0.2" />
</ItemGroup>
</Project>

View File

@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
<PackageReference Include="Octokit" Version="1.0.1" />
<PackageReference Include="Octokit" Version="2.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CompatApiClient\CompatApiClient.csproj" />

View File

@ -74,7 +74,7 @@ internal sealed class BotStats: BaseCommandModuleCustom
.Append(File.Exists(Config.GoogleApiConfigPath) ? "✅" : "❌").AppendLine(" Google Drive")
.Append(string.IsNullOrEmpty(Config.AzureDevOpsToken) ? "❌" : "✅").AppendLine(" Azure DevOps")
.Append(string.IsNullOrEmpty(Config.AzureComputerVisionKey) ? "❌" : "✅").AppendLine(" Computer Vision")
.Append(string.IsNullOrEmpty(Config.AzureAppInsightsKey) ? "❌" : "✅").AppendLine(" AppInsights")
.Append(string.IsNullOrEmpty(Config.AzureAppInsightsConnectionString) ? "❌" : "✅").AppendLine(" AppInsights")
.Append(string.IsNullOrEmpty(Config.GithubToken) ? "❌" : "✅").AppendLine(" Github")
.ToString()
.Trim();

View File

@ -39,10 +39,10 @@
<AdditionalFiles Include="..\win32_error_codes.txt" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DSharpPlus" Version="4.3.0-nightly-01160" />
<PackageReference Include="DSharpPlus.CommandsNext" Version="4.3.0-nightly-01160" />
<PackageReference Include="DSharpPlus.Interactivity" Version="4.3.0-nightly-01160" />
<PackageReference Include="DSharpPlus.SlashCommands" Version="4.3.0-nightly-01160" />
<PackageReference Include="DSharpPlus" Version="4.3.0-nightly-01169" />
<PackageReference Include="DSharpPlus.CommandsNext" Version="4.3.0-nightly-01169" />
<PackageReference Include="DSharpPlus.Interactivity" Version="4.3.0-nightly-01169" />
<PackageReference Include="DSharpPlus.SlashCommands" Version="4.3.0-nightly-01169" />
<PackageReference Include="Google.Apis.Drive.v3" Version="1.57.0.2746" />
<PackageReference Include="ksemenenko.ColorThief" Version="1.1.1.4" />
<PackageReference Include="MathParser.org-mXparser" Version="5.0.6" />
@ -50,21 +50,21 @@
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.21.0" />
<PackageReference Include="Microsoft.ApplicationInsights.PerfCounterCollector" Version="2.21.0" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.Vision.ComputerVision" Version="7.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.7">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.8" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.0" />
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="16.170.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.16.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
<PackageReference Include="Nerdbank.Streams" Version="2.8.61" />
<PackageReference Include="NLog" Version="5.0.1" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.0.1" />
<PackageReference Include="NLog" Version="5.0.2" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.0.2" />
<PackageReference Include="NReco.Text.AhoCorasickDoubleArrayTrie" Version="1.1.1" />
<PackageReference Include="SharpCompress" Version="0.32.2" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta15" />

View File

@ -82,7 +82,7 @@ internal static class Config
public static string AzureComputerVisionKey => config.GetValue(nameof(AzureComputerVisionKey), "");
public static string AzureComputerVisionEndpoint => config.GetValue(nameof(AzureComputerVisionEndpoint), "https://westeurope.api.cognitive.microsoft.com/");
public static Guid AzureDevOpsProjectId => config.GetValue(nameof(AzureDevOpsProjectId), new Guid("3598951b-4d39-4fad-ad3b-ff2386a649de"));
public static string AzureAppInsightsKey => config.GetValue(nameof(AzureAppInsightsKey), "");
public static string AzureAppInsightsConnectionString => config.GetValue(nameof(AzureAppInsightsConnectionString), "");
public static string GithubToken => config.GetValue(nameof(GithubToken), "");
public static string PreferredFontFamily => config.GetValue(nameof(PreferredFontFamily), "");
public static string LogPath => config.GetValue(nameof(LogPath), "./logs/"); // paths are relative to the working directory
@ -305,14 +305,14 @@ internal static class Config
{
get
{
if (string.IsNullOrEmpty(AzureAppInsightsKey))
if (string.IsNullOrEmpty(AzureAppInsightsConnectionString))
return null;
if (telemetryClient?.InstrumentationKey == AzureAppInsightsKey)
if (telemetryClient?.InstrumentationKey == AzureAppInsightsConnectionString)
return telemetryClient;
var telemetryConfig = TelemetryConfiguration.CreateDefault();
telemetryConfig.InstrumentationKey = AzureAppInsightsKey;
telemetryConfig.ConnectionString = AzureAppInsightsConnectionString;
telemetryConfig.TelemetryInitializers.Add(new HttpDependenciesParsingTelemetryInitializer());
DependencyTrackingTelemetryModule.Initialize(telemetryConfig);
PerformanceCollectorModule.Initialize(telemetryConfig);

View File

@ -32,6 +32,8 @@ public static class TimeParser
var tzList = TimeZoneInfo.GetSystemTimeZones();
Config.Log.Trace("[TZI] System TZI count: " + tzList.Count);
var result = new Dictionary<string, TimeZoneInfo>();
var standardNames = new Dictionary<string, TimeZoneInfo>();
var daylightNames = new Dictionary<string, TimeZoneInfo>();
foreach (var tzi in tzList)
{
Config.Log.Trace($"[TZI] Checking {tzi.Id} ({tzi.DisplayName} / {tzi.StandardName} / {tzi.DaylightName})");
@ -47,9 +49,26 @@ public static class TimeParser
foreach (var tza in acronyms)
result[tza] = tzi;
}
else
{
var a = tzi.StandardName.GetAcronym();
if (TimeZoneAcronyms.ContainsKey(a))
continue;
if (!standardNames.ContainsKey(a))
standardNames[a] = tzi;
a = tzi.DaylightName.GetAcronym();
if (TimeZoneAcronyms.ContainsKey(a) || standardNames.ContainsKey(a))
continue;
if (!daylightNames.ContainsKey(a))
daylightNames[a] = tzi;
}
}
Config.Log.Trace("[TZI] Total matched acronyms: " + result.Count);
TimeZoneMap = result;
TimeZoneMap = result.Concat(standardNames).Concat(daylightNames)
.DistinctBy(kvp => kvp.Key)
.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
}
public static bool TryParse(string dateTime, out DateTime result)

View File

@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy AS base
# Native libgdiplus dependencies
RUN apt-get update
RUN apt-get install -y --allow-unauthenticated libc6-dev libgdiplus libx11-dev fonts-roboto
RUN apt-get install -y --allow-unauthenticated libc6-dev libgdiplus libx11-dev fonts-roboto tzdata
# debian-specific?
#RUN rm -rf /var/lib/apt/lists/*

View File

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DuoVia.FuzzyStrings" Version="2.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1">
<PrivateAssets>all</PrivateAssets>