Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f18ee5c
Create initial draft for .NET 10 changes
hhvrc Sep 24, 2025
3143802
Merge branch 'develop' into feature/dotnet-10
hhvrc Oct 1, 2025
b283abf
Update Directory.Packages.props
hhvrc Oct 1, 2025
510d44e
Use field keyword
hhvrc Oct 1, 2025
a6c9ec1
Merge branch 'develop' into feature/dotnet-10
hhvrc Oct 17, 2025
1320cbb
Update Directory.Packages.props
hhvrc Oct 17, 2025
2735fa6
Fix some errors
hhvrc Oct 17, 2025
67c7a4d
Merge branch 'develop' into feature/dotnet-10
hhvrc Oct 17, 2025
590ea33
Update Directory.Packages.props
hhvrc Oct 20, 2025
a9b75ad
Update global.json
hhvrc Oct 28, 2025
70124a0
Merge branch 'develop' into feature/dotnet-10
hhvrc Oct 28, 2025
6775c2d
Revert some changes
hhvrc Oct 28, 2025
cc11289
Improve SessionService SessionLister
hhvrc Oct 28, 2025
ba965b6
Update global.json
hhvrc Nov 6, 2025
d1adb30
Revert some changes
hhvrc Nov 6, 2025
e0307a5
Merge branch 'develop' into feature/dotnet-10
hhvrc Nov 6, 2025
c18cd36
Update ListSessions.cs
hhvrc Nov 6, 2025
63c6565
Update ListSessions.cs
hhvrc Nov 6, 2025
16ff23c
Merge branch 'develop' into feature/dotnet-10
hhvrc Nov 10, 2025
296df41
Update Directory.Packages.props
hhvrc Nov 11, 2025
3b10388
Update Directory.Packages.props
hhvrc Nov 11, 2025
a550140
Update workflows
hhvrc Nov 11, 2025
2395048
Update docker files
hhvrc Nov 11, 2025
63df5fd
Revert "Update Directory.Packages.props"
hhvrc Nov 11, 2025
35b530d
OpenAPI broke
hhvrc Nov 11, 2025
b669fd2
This is gonna be alot of work
hhvrc Nov 11, 2025
ae70c50
Oops
hhvrc Nov 11, 2025
1d1ee8c
Update Directory.Packages.props
hhvrc Nov 12, 2025
89dadb9
More changes
hhvrc Nov 12, 2025
22647c3
Revert "More changes"
hhvrc Nov 12, 2025
e90f7ef
Update Directory.Packages.props
hhvrc Nov 22, 2025
7bb8598
Update global.json
hhvrc Nov 22, 2025
9981506
Update ci-build.yml
hhvrc Nov 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ name: ci-build

env:
REGISTRY: ghcr.io
DOTNET_VERSION: 9.0.x
DOTNET_VERSION: 10.0.x

jobs:

Expand All @@ -60,7 +60,7 @@ jobs:
- name: Run ${{ matrix.name }} tests
run: |
set -euo pipefail
dotnet test -c Release ${{ matrix.project }}
dotnet test -c Release --project ${{ matrix.project }}

build:
name: Build (${{ matrix.image }})
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
name: ci-tag

env:
DOTNET_VERSION: 9.0.x
DOTNET_VERSION: 10.0.x
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/api

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- cron: '0 6 * * 1'

env:
DOTNET_VERSION: 9.x.x
DOTNET_VERSION: 10.x.x

jobs:
analyze:
Expand Down
2 changes: 1 addition & 1 deletion API/Controller/Admin/GetOnlineDevices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public async Task<IActionResult> GetOnlineDevices()
{
var devicesOnline = _redis.RedisCollection<DeviceOnline>(false);

var allOnlineDevices = await devicesOnline.ToArrayAsync();
var allOnlineDevices = await devicesOnline.ToListAsync();
var dbLookup = await _db.Devices
.Where(x => allOnlineDevices.Select(y => y.Id).Contains(x.Id))
.Select(x => new
Expand Down
1 change: 1 addition & 0 deletions API/Controller/Admin/_ApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace OpenShock.API.Controller.Admin;

[ApiController]
[Tags("Admin")]
[EndpointGroupName("admin")]
[Route("/{version:apiVersion}/admin")]
[Authorize(AuthenticationSchemes = OpenShockAuthSchemes.UserSessionCookie, Roles = "Admin")]
public sealed partial class AdminController : AuthenticatedSessionControllerBase
Expand Down
1 change: 0 additions & 1 deletion API/Controller/OAuth/Authorize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public sealed partial class OAuthController
/// <response code="400">Unsupported or misconfigured provider.</response>
[EnableRateLimiting("auth")]
[HttpPost("{provider}/authorize")]
[ApiExplorerSettings(IgnoreApi = true)]
public async Task<IActionResult> OAuthAuthorize([FromRoute] string provider, [FromQuery(Name="flow"), Required] OAuthFlow flow)
{
if (!await _schemeProvider.IsSupportedOAuthScheme(provider))
Expand Down
1 change: 0 additions & 1 deletion API/Controller/OAuth/HandOff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public sealed partial class OAuthController
/// </remarks>
[EnableRateLimiting("auth")]
[HttpGet("{provider}/handoff")]
[ApiExplorerSettings(IgnoreApi = true)]
public async Task<IActionResult> OAuthHandOff(
[FromRoute] string provider,
[FromServices] IOAuthConnectionService connectionService,
Expand Down
1 change: 0 additions & 1 deletion API/Controller/OAuth/SignupFinalize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public sealed partial class OAuthController
/// <param name="cancellationToken"></param>
[EnableRateLimiting("auth")]
[HttpPost("{provider}/signup-finalize")]
[ApiExplorerSettings(IgnoreApi = true)]
public async Task<IActionResult> OAuthSignupFinalize(
[FromRoute] string provider,
[FromBody] OAuthFinalizeRequest body,
Expand Down
1 change: 0 additions & 1 deletion API/Controller/OAuth/SignupGetData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public sealed partial class OAuthController
[ResponseCache(NoStore = true)]
[EnableRateLimiting("auth")]
[HttpGet("{provider}/signup-data")]
[ApiExplorerSettings(IgnoreApi = true)]
public async Task<IActionResult> OAuthSignupGetData([FromRoute] string provider)
{
if (User.HasOpenShockUserIdentity())
Expand Down
5 changes: 2 additions & 3 deletions API/Controller/OAuth/_ApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ namespace OpenShock.API.Controller.OAuth;
/// OAuth management endpoints (provider listing, authorize, data handoff).
/// </summary>
[ApiController]
[Tags("OAuth")]
[ApiVersion("1")]
[Route("/{version:apiVersion}/oauth")]
[EndpointGroupName("oauth")]
[Route("/{version:apiVersion}/oauth"), ApiVersion("1")]
public sealed partial class OAuthController : OpenShockControllerBase
{
private readonly IAccountService _accountService;
Expand Down
9 changes: 3 additions & 6 deletions API/Controller/Sessions/ListSessions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net.Mime;
using System.Runtime.CompilerServices;
using Microsoft.AspNetCore.Mvc;
using OpenShock.API.Models.Response;

Expand All @@ -9,11 +8,9 @@ public sealed partial class SessionsController
{
[HttpGet]
[ProducesResponseType<LoginSessionResponse[]>(StatusCodes.Status200OK, MediaTypeNames.Application.Json)]
public async IAsyncEnumerable<LoginSessionResponse> ListSessions([EnumeratorCancellation] CancellationToken cancellationToken)
public IAsyncEnumerable<LoginSessionResponse> ListSessions()
{
await foreach (var session in _sessionService.ListSessionsByUserIdAsync(CurrentUser.Id).WithCancellation(cancellationToken))
{
yield return LoginSessionResponse.MapFrom(session);
}
return _sessionService.ListSessionsByUserIdAsync(CurrentUser.Id)
.Select(LoginSessionResponse.MapFrom);
}
}
4 changes: 2 additions & 2 deletions API/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
using OpenShock.Common;
using OpenShock.Common.Extensions;
using OpenShock.Common.Hubs;
using OpenShock.Common.OpenAPI;
using OpenShock.Common.Services;
using OpenShock.Common.Services.Device;
using OpenShock.Common.Services.LCGNodeProvisioner;
using OpenShock.Common.Services.Ota;
using OpenShock.Common.Swagger;
using Serilog;
using OAuthConstants = OpenShock.API.OAuth.OAuthConstants;

Expand Down Expand Up @@ -103,7 +103,7 @@ static void DefaultOptions(RemoteAuthenticationOptions options, string provider)
builder.Services.AddScoped<IUserService, UserService>();
builder.Services.AddScoped<ILCGNodeProvisioner, LCGNodeProvisioner>();

builder.AddSwaggerExt<Program>();
builder.AddOpenApiExt<Program>();

builder.AddCloudflareTurnstileService();
builder.AddEmailService();
Expand Down
2 changes: 1 addition & 1 deletion Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</PackageReference>
<PackageReference Include="MessagePack" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" />
<PackageReference Include="Microsoft.Extensions.Caching.Hybrid" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />
Expand All @@ -31,7 +32,6 @@
<PackageReference Include="OneOf" />
<PackageReference Include="Serilog.AspNetCore" />
<PackageReference Include="Serilog.Sinks.OpenTelemetry" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" />
<PackageReference Include="Z.EntityFramework.Plus.EFCore" />
</ItemGroup>

Expand Down
18 changes: 2 additions & 16 deletions Common/DataAnnotations/EmailAddressAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.Net.Mail;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
using OpenShock.Common.Constants;
using OpenShock.Common.DataAnnotations.Interfaces;

namespace OpenShock.Common.DataAnnotations;

Expand All @@ -13,8 +10,8 @@ namespace OpenShock.Common.DataAnnotations;
/// <remarks>
/// Inherits from <see cref="ValidationAttribute"/>.
/// </remarks>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class EmailAddressAttribute : ValidationAttribute, IParameterAttribute
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
public sealed class EmailAddressAttribute : ValidationAttribute
{
/// <summary>
/// Example value used to generate OpenApi documentation.
Expand Down Expand Up @@ -55,15 +52,4 @@ public sealed class EmailAddressAttribute : ValidationAttribute, IParameterAttri

return ValidationResult.Success;
}

/// <inheritdoc/>
public void Apply(OpenApiSchema schema)
{
//if (ShouldValidate) schema.Pattern = ???;

schema.Example = new OpenApiString(ExampleValue);
}

/// <inheritdoc/>
public void Apply(OpenApiParameter parameter) => Apply(parameter.Schema);
}
15 changes: 0 additions & 15 deletions Common/DataAnnotations/Interfaces/IOperationAttribute.cs

This file was deleted.

21 changes: 0 additions & 21 deletions Common/DataAnnotations/Interfaces/IParameterAttribute.cs

This file was deleted.

31 changes: 0 additions & 31 deletions Common/DataAnnotations/OpenApiSchemas.cs

This file was deleted.

18 changes: 2 additions & 16 deletions Common/DataAnnotations/PasswordAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
using OpenShock.Common.Constants;
using OpenShock.Common.DataAnnotations.Interfaces;

namespace OpenShock.Common.DataAnnotations;

Expand All @@ -12,8 +9,8 @@ namespace OpenShock.Common.DataAnnotations;
/// <remarks>
/// Inherits from <see cref="ValidationAttribute"/>.
/// </remarks>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class PasswordAttribute : ValidationAttribute, IParameterAttribute
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
public sealed class PasswordAttribute : ValidationAttribute
{
/// <summary>
/// Example value used to generate OpenApi documentation.
Expand Down Expand Up @@ -54,15 +51,4 @@ public sealed class PasswordAttribute : ValidationAttribute, IParameterAttribute

return ValidationResult.Success;
}

/// <inheritdoc/>
public void Apply(OpenApiSchema schema)
{
//if (ShouldValidate) schema.Pattern = ???;

schema.Example = new OpenApiString(ExampleValue);
}

/// <inheritdoc/>
public void Apply(OpenApiParameter parameter) => Apply(parameter.Schema);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OpenShock.Common.DataAnnotations;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public sealed class StringCollectionItemMaxLengthAttribute : ValidationAttribute
{
public StringCollectionItemMaxLengthAttribute(int maxLength)
Expand Down
18 changes: 2 additions & 16 deletions Common/DataAnnotations/UsernameAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
using OpenShock.Common.DataAnnotations.Interfaces;
using OpenShock.Common.Validation;

namespace OpenShock.Common.DataAnnotations;
Expand All @@ -12,8 +9,8 @@ namespace OpenShock.Common.DataAnnotations;
/// <remarks>
/// Inherits from <see cref="ValidationAttribute"/>.
/// </remarks>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class UsernameAttribute : ValidationAttribute, IParameterAttribute
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
public sealed class UsernameAttribute : ValidationAttribute
{
/// <summary>
/// Example value used to generate OpenApi documentation.
Expand Down Expand Up @@ -50,15 +47,4 @@ public sealed class UsernameAttribute : ValidationAttribute, IParameterAttribute
error => new ValidationResult($"{error.Type} - {error.Message}")
);
}

/// <inheritdoc/>
public void Apply(OpenApiSchema schema)
{
//if (ShouldValidate) schema.Pattern = ???;

schema.Example = new OpenApiString(ExampleValue);
}

/// <inheritdoc/>
public void Apply(OpenApiParameter parameter) => Apply(parameter.Schema);
}
2 changes: 1 addition & 1 deletion Common/Hubs/UserHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override async Task OnConnectedAsync()
.Where(x => x.Shockers.Any(y => y.UserShares.Any(z => z.SharedWithUserId == UserId)))
.Select(x => x.Id.ToString()).ToArrayAsync();

var own = devicesOnline.Where(x => x.Owner == UserId).ToArrayAsync();
var own = devicesOnline.Where(x => x.Owner == UserId).ToListAsync();
var shared = devicesOnline.FindByIdsAsync(sharedDevices);
await Task.WhenAll(own, shared);

Expand Down
Loading