Skip to content

Commit efd5d7e

Browse files
authored
feat(templates): remove redundant client version check of AppHub in boilerplate #11518 (#11533)
1 parent 65da247 commit efd5d7e

File tree

1 file changed

+0
-16
lines changed
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/SignalR

1 file changed

+0
-16
lines changed

src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/SignalR/AppHub.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ public partial class AppHub : Hub
2828

2929
public override async Task OnConnectedAsync()
3030
{
31-
CheckClientAppVersion();
32-
3331
if (Context.GetHttpContext()?.ContainsExpiredAccessToken() is true)
3432
throw new HubException(nameof(AppStrings.UnauthorizedException)).WithData("ConnectionId", Context.ConnectionId);
3533

@@ -97,18 +95,4 @@ private async Task ChangeAuthenticationStateImplementation(ClaimsPrincipal? user
9795
await dbContext.UserSessions.Where(us => us.SignalRConnectionId == Context.ConnectionId).ExecuteUpdateAsync(us => us.SetProperty(x => x.SignalRConnectionId, (string?)null));
9896
}
9997
}
100-
101-
private void CheckClientAppVersion()
102-
{
103-
if (Context.GetHttpContext()?.Request?.Headers?.TryGetValue("X-App-Version", out var appVersionHeaderValue) is true && appVersionHeaderValue.Any())
104-
{
105-
var appVersion = appVersionHeaderValue.Single()!;
106-
var appPlatformType = Enum.Parse<AppPlatformType>(Context.GetHttpContext()!.Request.Headers["X-App-Platform"].Single()!);
107-
var minimumSupportedVersion = settings.SupportedAppVersions!.GetMinimumSupportedAppVersion(appPlatformType);
108-
if (minimumSupportedVersion != null && Version.Parse(appVersion) < minimumSupportedVersion)
109-
throw new HubException(nameof(AppStrings.ForceUpdateTitle))
110-
.WithData("ClientAppVersion", appVersion)
111-
.WithData("ConnectionId", Context.ConnectionId);
112-
}
113-
}
11498
}

0 commit comments

Comments
 (0)