Compare commits
7 Commits
3eb043b24c
...
master
Author | SHA1 | Date | |
---|---|---|---|
95692a6a1f
|
|||
13eb3c0033
|
|||
f6d1543108 | |||
a4721c9739 | |||
46bbc34956 | |||
047ccfa754 | |||
b0d9a67c1c |
1
.github/workflows/code-analyze.yaml
vendored
1
.github/workflows/code-analyze.yaml
vendored
@ -25,6 +25,7 @@ jobs:
|
||||
sonarHostname: ${{ secrets.SONAR_HOST_URL }}
|
||||
dotnetPreBuildCmd: dotnet nuget add source --name="Winsomnia" --username ${{ secrets.NUGET_USERNAME }} --password ${{ secrets.NUGET_PASSWORD }} --store-password-in-clear-text ${{ secrets.NUGET_ADDRESS }} && dotnet format --verify-no-changes --diagnostics -v diag --severity warn
|
||||
dotnetTestArguments: --logger trx --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
|
||||
dotnetBuildArguments: -c Release
|
||||
sonarBeginArguments: /d:sonar.cs.opencover.reportsPaths="**/TestResults/**/coverage.opencover.xml" -d:sonar.cs.vstest.reportsPaths="**/TestResults/*.trx"
|
||||
env:
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
@ -19,4 +19,4 @@ public enum OAuthProvider
|
||||
/// OAuth provider for Mail.ru.
|
||||
/// </summary>
|
||||
MailRu
|
||||
}
|
||||
}
|
@ -29,4 +29,4 @@ public class PasswordPolicy
|
||||
/// Gets or sets a value indicating whether at least one special character is required in the password.
|
||||
/// </summary>
|
||||
public bool RequireSpecialCharacter { get; set; }
|
||||
}
|
||||
}
|
@ -14,4 +14,4 @@ public enum TwoFactorAuthentication
|
||||
/// TOTP (Time-based One-Time Password) is required for additional verification.
|
||||
/// </summary>
|
||||
TotpRequired,
|
||||
}
|
||||
}
|
@ -27,4 +27,4 @@ public class CreateUserRequest
|
||||
[Required]
|
||||
[MinLength(2)]
|
||||
public required string Password { get; set; }
|
||||
}
|
||||
}
|
@ -34,4 +34,4 @@ public class ScheduleRequest
|
||||
/// Gets or sets an array of lesson type IDs.
|
||||
/// </summary>
|
||||
public int[]? LessonType { get; set; } = null;
|
||||
}
|
||||
}
|
@ -28,4 +28,4 @@ public class CampusDetailsResponse
|
||||
/// Gets or sets the address of the campus (optional).
|
||||
/// </summary>
|
||||
public string? Address { get; set; }
|
||||
}
|
||||
}
|
@ -114,4 +114,4 @@ public class ScheduleResponse
|
||||
/// Gets or sets the links to online meetings for the schedule entry.
|
||||
/// </summary>
|
||||
public required IEnumerable<string?> LinkToMeet { get; set; }
|
||||
}
|
||||
}
|
@ -16,4 +16,4 @@ public static class CronUpdateSkipConverter
|
||||
}).ToList();
|
||||
public static List<ScheduleSettings.CronUpdateSkip> ConvertFromDto(this IEnumerable<Dto.Common.CronUpdateSkip> pairPeriod) =>
|
||||
pairPeriod.Select(x => x.Get()).ToList();
|
||||
}
|
||||
}
|
@ -11,4 +11,4 @@ public static class PairPeriodTimeConverter
|
||||
|
||||
public static Dictionary<int, ScheduleSettings.PairPeriodTime> ConvertFromDto(this IDictionary<int, Dto.Common.PairPeriodTime> pairPeriod) =>
|
||||
pairPeriod.ToDictionary(kvp => kvp.Key, kvp => new ScheduleSettings.PairPeriodTime(kvp.Value.Start, kvp.Value.End));
|
||||
}
|
||||
}
|
@ -45,32 +45,31 @@ public static class CronUpdateSkipService
|
||||
if (depth <= 0)
|
||||
return [];
|
||||
|
||||
currentDate ??= DateOnly.FromDateTime(DateTime.Now);
|
||||
DateTimeOffset nextRunTime = currentDate.Value.ToDateTime(TimeOnly.FromDateTime(DateTime.Now));
|
||||
|
||||
DateTimeOffset nextRunTime = (currentDate?.ToDateTime(TimeOnly.MinValue) ?? DateTime.Now);
|
||||
List<DateTimeOffset> result = [];
|
||||
|
||||
do
|
||||
{
|
||||
var lastSkip = data.FilterDateEntry(nextRunTime.DateTime).LastOrDefault();
|
||||
var lastSkippedEntry = data.FilterDateEntry(nextRunTime.DateTime).LastOrDefault();
|
||||
|
||||
if (lastSkip is { Start: not null, End: not null })
|
||||
nextRunTime = new DateTimeOffset(lastSkip.End.Value.AddDays(1), new TimeOnly(0, 0, 0), TimeSpan.Zero);
|
||||
else if (lastSkip.Date.HasValue)
|
||||
nextRunTime = new DateTimeOffset(lastSkip.Date.Value.AddDays(1), new TimeOnly(0, 0, 0), TimeSpan.Zero);
|
||||
if (lastSkippedEntry is { Start: not null, End: not null })
|
||||
nextRunTime = lastSkippedEntry.End.Value.ToDateTime(TimeOnly.MinValue).AddDays(1);
|
||||
else if (lastSkippedEntry.Date.HasValue)
|
||||
nextRunTime = lastSkippedEntry.Date.Value.ToDateTime(TimeOnly.MinValue).AddDays(1);
|
||||
|
||||
var next = expression.GetNextOccurrence(nextRunTime.ToUniversalTime(), TimeZoneInfo.Local);
|
||||
var nextOccurrence = expression.GetNextOccurrence(nextRunTime.AddMinutes(-1), TimeZoneInfo.Local);
|
||||
|
||||
if (!next.HasValue)
|
||||
if (!nextOccurrence.HasValue)
|
||||
return result;
|
||||
|
||||
nextRunTime = next.Value;
|
||||
|
||||
if (data.FilterDateEntry(nextRunTime.DateTime).Any())
|
||||
if (data.FilterDateEntry(nextOccurrence.Value.DateTime).Count != 0)
|
||||
{
|
||||
nextRunTime = nextOccurrence.Value.AddDays(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
result.Add(nextRunTime);
|
||||
nextRunTime = nextRunTime.AddMinutes(1);
|
||||
result.Add(nextOccurrence.Value);
|
||||
nextRunTime = nextOccurrence.Value.AddMinutes(1);
|
||||
|
||||
} while (result.Count < depth);
|
||||
|
||||
|
@ -64,4 +64,4 @@ public static class JwtConfiguration
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -99,4 +99,4 @@ public static class LoggerConfiguration
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
public interface ISaveSettings
|
||||
{
|
||||
void SaveSetting();
|
||||
}
|
||||
}
|
@ -315,4 +315,4 @@ public class AuthController(IOptionsSnapshot<Admin> user, IOptionsSnapshot<Gener
|
||||
|
||||
return Ok(password);
|
||||
}
|
||||
}
|
||||
}
|
@ -203,10 +203,10 @@ public class ScheduleController(ILogger<ScheduleController> logger, IOptionsSnap
|
||||
{
|
||||
try
|
||||
{
|
||||
using var scope = scopeFactory.CreateScope();
|
||||
using var scope = scopeFactory.CreateScope();
|
||||
var sync = (ScheduleSynchronizer)ActivatorUtilities.GetServiceOrCreateInstance(scope.ServiceProvider, typeof(ScheduleSynchronizer));
|
||||
|
||||
await sync.StartSync(filePaths, CancellationToken.None);
|
||||
await sync.StartSync(filePaths, CancellationToken.None);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -24,20 +24,22 @@
|
||||
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="9.0.0" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.System" Version="9.0.0" />
|
||||
<PackageReference Include="Cronos" Version="0.9.0" />
|
||||
<PackageReference Include="EPPlus" Version="7.6.0" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.72" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.12" />
|
||||
<PackageReference Include="Microsoft.Build.Framework" Version="17.12.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.1">
|
||||
<PackageReference Include="EPPlus" Version="7.6.1" />
|
||||
<PackageReference Include="EPPlus.System.Drawing" Version="8.0.0" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.12.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.13" />
|
||||
<PackageReference Include="Microsoft.Build.Framework" Version="17.13.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.ApiDescription.Server" Version="9.0.1">
|
||||
<PackageReference Include="Microsoft.Extensions.ApiDescription.Server" Version="9.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.4.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Protocols" Version="8.6.1" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.6.1" />
|
||||
<PackageReference Include="Mirea.Tools.Schedule.Parser" Version="1.2.5" />
|
||||
<PackageReference Include="Mirea.Tools.Schedule.WebParser" Version="1.0.6" />
|
||||
<PackageReference Include="QRCoder" Version="1.6.0" />
|
||||
@ -47,25 +49,21 @@
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Debug" Version="3.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.2" />
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="9.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.8.24" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
|
||||
<PackageReference Include="System.CodeDom" Version="[8.0.0, 9.0.0)" />
|
||||
<PackageReference Include="System.Composition" Version="[8.0.0, 9.0.0)" />
|
||||
<PackageReference Include="System.Composition.AttributedModel" Version="9.0.1" />
|
||||
<PackageReference Include="System.Composition.Convention" Version="9.0.1" />
|
||||
<PackageReference Include="System.Composition.Hosting" Version="9.0.1" />
|
||||
<PackageReference Include="System.Composition.Runtime" Version="9.0.1" />
|
||||
<PackageReference Include="System.Composition.TypedParts" Version="9.0.1" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.1" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="9.0.1" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.4.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="9.0.1" />
|
||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="9.0.1" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.1" />
|
||||
<PackageReference Include="System.Threading.Channels" Version="[8.0.0, 9.0.0)" />
|
||||
<PackageReference Include="Z.EntityFramework.Extensions.EFCore" Version="9.103.7" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.8.31" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.3.1" />
|
||||
<PackageReference Include="System.CodeDom" Version="9.0.2" />
|
||||
<PackageReference Include="System.Composition" Version="9.0.2" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.2" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="9.0.2" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.6.1" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="9.0.2" />
|
||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="9.0.2" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.2" />
|
||||
<PackageReference Include="System.Threading.Channels" Version="9.0.2" />
|
||||
<PackageReference Include="Z.EntityFramework.Extensions.EFCore" Version="9.103.7.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -86,12 +86,11 @@ To set up the `redirect URL` when registering and logging in using OAuth 2, use
|
||||
|
||||
**Where:**
|
||||
|
||||
- `{schema}` is the protocol you are using (`http` or `https').
|
||||
- `{domain}` is your domain (for example, `mydomain.com ` or IP address).
|
||||
- `{portString}` is a port string that is only needed if your application is running on a non—standard port (for
|
||||
- `{schema}` is the protocol you are using (`http` or `https`).
|
||||
- `{domain}` is your domain (for example, `mydomain.com` or IP address).
|
||||
- `{portString}` is a port string that is only needed if your application is running on a non-standard port (for
|
||||
example, `:8080`). If you use standard ports (`80` for `http` and `443` for `https`), this parameter can be omitted.
|
||||
- `{ACTUAL_SUB_PATH}` is the path to your API that you specify in the settings. If it ends with `/api', then don't add `
|
||||
/api` at the end of the URL.
|
||||
- `{ACTUAL_SUB_PATH}` is the path to your API that you specify in the settings. If it ends with `/api`, then don't add `/api` at the end of the URL.
|
||||
|
||||
**Examples:**
|
||||
|
||||
|
@ -13,4 +13,4 @@ public interface ICacheService
|
||||
|
||||
Task<T?> GetAsync<T>(string key, CancellationToken cancellationToken = default);
|
||||
Task RemoveAsync(string key, CancellationToken cancellationToken = default);
|
||||
}
|
||||
}
|
@ -26,4 +26,4 @@ public class CookieOptions
|
||||
|
||||
internal void DropCookie(HttpContext context, string name) =>
|
||||
SetCookie(context, name, "", DateTimeOffset.MinValue);
|
||||
}
|
||||
}
|
@ -15,8 +15,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.2" />
|
||||
<PackageReference Include="Otp.NET" Version="1.4.0" />
|
||||
<PackageReference Include="System.Memory" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<PackageReference Include="FluentValidation" Version="11.11.0" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.11.0" />
|
||||
<PackageReference Include="MediatR" Version="12.4.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -386,4 +386,4 @@ namespace MysqlMigrations.Migrations
|
||||
name: "Campus");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -80,4 +80,4 @@ namespace MysqlMigrations.Migrations
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -362,4 +362,4 @@ namespace PsqlMigrations.Migrations
|
||||
name: "Campus");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -46,4 +46,4 @@ namespace PsqlMigrations.Migrations
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -361,4 +361,4 @@ namespace SqliteMigrations.Migrations
|
||||
name: "Campus");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -46,4 +46,4 @@ namespace SqliteMigrations.Migrations
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -19,4 +19,4 @@ public static class ModelBuilderExtensions
|
||||
var applyConcreteMethod = applyGenericMethod.MakeGenericMethod(entityType);
|
||||
applyConcreteMethod.Invoke(modelBuilder, [configuration]);
|
||||
}
|
||||
}
|
||||
}
|
@ -16,14 +16,15 @@
|
||||
<PackageReference Include="AspNetCore.HealthChecks.MySql" Version="9.0.0" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="9.0.0" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.Sqlite" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="9.0.2" />
|
||||
<PackageReference Include="MySqlConnector" Version="2.4.0" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.3" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0-preview.2.efcore.9.0.0" />
|
||||
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.10" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0-preview.3.efcore.9.0.0" />
|
||||
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.11" />
|
||||
<PackageReference Include="SQLitePCLRaw.core" Version="2.1.11" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Reference in New Issue
Block a user