Skip to content

Commit

Permalink
feat: update to bitplatform 8.8.0 #49 (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi authored Apr 2, 2024
1 parent a7b3311 commit b75dd1c
Show file tree
Hide file tree
Showing 87 changed files with 1,886 additions and 463 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"hostRequirements": {
"cpus": 4
},
"onCreateCommand": "wget https://download.visualstudio.microsoft.com/download/pr/85bcc525-4e9c-471e-9c1d-96259aa1a315/930833ef34f66fe9ee2643b0ba21621a/dotnet-sdk-8.0.201-linux-x64.tar.gz -O $HOME/dotnet.tar.gz && export DOTNET_ROOT=$HOME/.dotnet && mkdir -p \"$DOTNET_ROOT\" && tar zxf $HOME/dotnet.tar.gz -C \"$DOTNET_ROOT\" && export PATH=$DOTNET_ROOT:$DOTNET_ROOT/tools:$PATH && dotnet dev-certs https --trust && sudo dotnet workload install wasm-tools wasm-experimental && dotnet tool install --global dotnet-ef --version 8.0.1 && dotnet ef database update --project src/Bit.TemplatePlayground.Server/Bit.TemplatePlayground.Server.csproj && dotnet build src/Client/Bit.TemplatePlayground.Client.Core/Bit.TemplatePlayground.Client.Core.csproj -t:BeforeBuildTasks --no-restore",
"onCreateCommand": "wget https://download.visualstudio.microsoft.com/download/pr/656a3402-6889-400f-927f-7f956856e58b/93750973d6eedd17c6d963658e7ec214/dotnet-sdk-8.0.203-linux-x64.tar.gz -O $HOME/dotnet.tar.gz && export DOTNET_ROOT=$HOME/.dotnet && mkdir -p \"$DOTNET_ROOT\" && tar zxf $HOME/dotnet.tar.gz -C \"$DOTNET_ROOT\" && export PATH=$DOTNET_ROOT:$DOTNET_ROOT/tools:$PATH && dotnet dev-certs https --trust && sudo dotnet workload install wasm-tools wasm-experimental && dotnet tool install --global dotnet-ef --version 8.0.3 && dotnet ef database update --project src/Bit.TemplatePlayground.Server/Bit.TemplatePlayground.Server.csproj && dotnet build src/Client/Bit.TemplatePlayground.Client.Core/Bit.TemplatePlayground.Client.Core.csproj -t:BeforeBuildTasks --no-restore",
"waitFor": "onCreateCommand",
"customizations": {
"codespaces": {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
node-version: 18

- name: Build
run: dotnet build Bit.TemplatePlayground.sln -c Release -p:EnableWindowsTargeting=true
run: dotnet build Bit.TemplatePlayground.sln -c Release
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.201",
"rollForward": "disable"
"version": "8.0.203",
"rollForward": "disable"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pulumi.AzureNative" Version="2.29.0" />
<PackageReference Include="Pulumi.AzureNative" Version="2.34.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.2",
"version": "8.0.3",
"commands": [
"dotnet-ef"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<UserSecretsId>66B6DE78-12F7-4F5B-A1EC-180DBDEC4183</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bit.CodeAnalyzers" Version="8.7.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Bit.SourceGenerators" Version="8.7.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.2" />
<PackageReference Include="Bit.CodeAnalyzers" Version="8.8.0" PrivateAssets="all" />
<PackageReference Include="Bit.SourceGenerators" Version="8.8.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.3" />
</ItemGroup>

<ItemGroup>
Expand All @@ -25,23 +20,16 @@
<ItemGroup>
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.6.0" />
<PackageReference Include="FluentEmail.Smtp" Version="3.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.2" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="8.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.2" />
<PackageReference Include="Microsoft.AspNetCore.OData" Version="8.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.2" />
<PackageReference Include="MimeTypeMapOfficial" Version="1.0.17" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.OData" Version="8.2.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="AspNetCore.HealthChecks.System" Version="8.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="8.0.0" />
Expand Down Expand Up @@ -87,8 +75,7 @@
<!-- https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container -->
<PropertyGroup>
<RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
<EnableSdkContainerDebugging>True</EnableSdkContainerDebugging>
<UserSecretsId>44373297-7155-4EFA-9BEB-BB3FA5F85FE9</UserSecretsId>
<EnableSdkContainerDebugging Condition="'$(Configuration)' == 'Debug'">True</EnableSdkContainerDebugging>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Bit.TemplatePlayground.Server/Components/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
{
<LoadingComponent />
}

<Routes @rendermode=renderMode />

@if (HttpContext.Request.IsCrawlerClient() is false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<meta http-equiv="Content-TypeEntity" content="text/html; charset=UTF-8" />
<title>@EmailLocalizer[nameof(EmailStrings.ConfirmationEmailSubject)]</title>
</head>
<body style="width:100%; height:100%; margin:0; padding:0; background-color:#FCFCFC; font-family:Arial,sans-serif;">
<body dir="@(CultureInfo.CurrentCulture.TextInfo.IsRightToLeft ? "rtl" : null)" style="width:100%; height:100%; margin:0; padding:0; background-color:#FCFCFC; font-family:Arial,sans-serif;">
<main style="padding: 6% 4%;">
<table class="content-table" border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"
style="border:1px solid #EDEBE9; border-radius:2px; padding:50px; text-align:center;">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<meta http-equiv="Content-TypeEntity" content="text/html; charset=UTF-8" />
<title>@EmailLocalizer[nameof(EmailStrings.ResetPasswordEmailSubject)]</title>
</head>
<body style="width:100%; height:100%; margin:0; padding:0; background-color:#FCFCFC; font-family:Arial,sans-serif;">
<body dir="@(CultureInfo.CurrentCulture.TextInfo.IsRightToLeft ? "rtl" : null)" style="width:100%; height:100%; margin:0; padding:0; background-color:#FCFCFC; font-family:Arial,sans-serif;">
<main style="padding: 6% 4%;">
<table class="content-table" border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"
style="border:1px solid #EDEBE9; border-radius:2px; padding:50px; text-align:center;">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Bit.TemplatePlayground.Server.Models.Identity;
using ImageMagick;
using MimeTypes;
using Microsoft.AspNetCore.StaticFiles;
using SystemFile = System.IO.File;

namespace Bit.TemplatePlayground.Server.Controllers;
Expand All @@ -13,6 +13,8 @@ public partial class AttachmentController : AppControllerBase

[AutoInject] private IWebHostEnvironment webHostEnvironment = default!;

[AutoInject] private IContentTypeProvider contentTypeProvider = default!;

[HttpPost]
[RequestSizeLimit(11 * 1024 * 1024 /*11MB*/)]
public async Task UploadProfileImage(IFormFile? file, CancellationToken cancellationToken)
Expand Down Expand Up @@ -134,7 +136,12 @@ public async Task<IActionResult> GetProfileImage()
if (SystemFile.Exists(filePath) is false)
return new EmptyResult();

if (contentTypeProvider.TryGetContentType(filePath, out var contentType) is false)
{
throw new InvalidOperationException();
}

return PhysicalFile(Path.Combine(webHostEnvironment.ContentRootPath, filePath),
MimeTypeMap.GetMimeType(Path.GetExtension(filePath)), enableRangeProcessing: true);
contentType, enableRangeProcessing: true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private async Task SendConfirmationEmail(SendConfirmationEmailRequestDto sendCon

var controller = RouteData.Values["controller"]!.ToString();

var confirmationLink = new Uri(HttpContext.Request.GetBaseUrl(), $"email-confirmation?email={HttpUtility.UrlEncode(user.Email)}&token={HttpUtility.UrlEncode(token)}");
var confirmationLink = new Uri(HttpContext.Request.GetBaseUrl(), $"email-confirmation?email={Uri.EscapeDataString(user.Email!)}&token={Uri.EscapeDataString(token)}");

var body = await htmlRenderer.Dispatcher.InvokeAsync(async () =>
{
Expand Down Expand Up @@ -205,7 +205,7 @@ public async Task SendResetPasswordEmail(SendResetPasswordEmailRequestDto sendRe

var token = await userManager.GeneratePasswordResetTokenAsync(user);

var resetPasswordLink = new Uri(HttpContext.Request.GetBaseUrl(), $"reset-password?email={HttpUtility.UrlEncode(user.Email)}&token={HttpUtility.UrlEncode(token)}");
var resetPasswordLink = new Uri(HttpContext.Request.GetBaseUrl(), $"reset-password?email={Uri.EscapeDataString(user.Email!)}&token={Uri.EscapeDataString(token)}");

var body = await htmlRenderer.Dispatcher.InvokeAsync(async () =>
{
Expand Down
11 changes: 8 additions & 3 deletions src/Bit.TemplatePlayground.Server/Program.Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Microsoft.AspNetCore.OData;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using Microsoft.AspNetCore.StaticFiles;

namespace Bit.TemplatePlayground.Server;

Expand Down Expand Up @@ -64,11 +65,14 @@ private static void ConfigureServices(this WebApplicationBuilder builder)
};
});

services.AddDbContext<AppDbContext>(options =>
services.AddDbContextPool<AppDbContext>(options =>
{
options.EnableSensitiveDataLogging(env.IsDevelopment())
.EnableDetailedErrors(env.IsDevelopment());

options.UseSqlite(configuration.GetConnectionString("SqliteConnectionString"), dbOptions =>
{
dbOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery);

});
});

Expand All @@ -85,6 +89,7 @@ private static void ConfigureServices(this WebApplicationBuilder builder)
AddHealthChecks(builder);

services.TryAddTransient<HtmlRenderer>();
services.TryAddTransient<IContentTypeProvider, FileExtensionContentTypeProvider>();

var fluentEmailServiceBuilder = services.AddFluentEmail(appSettings.EmailSettings.DefaultFromEmail, appSettings.EmailSettings.DefaultFromName);

Expand Down Expand Up @@ -136,7 +141,7 @@ private static void AddBlazor(WebApplicationBuilder builder)
apiServerAddress = new Uri(sp.GetRequiredService<IHttpContextAccessor>().HttpContext!.Request.GetBaseUrl(), apiServerAddress);
}

return new HttpClient(sp.GetRequiredKeyedService<HttpMessageHandler>("DefaultMessageHandler"))
return new HttpClient(sp.GetRequiredKeyedService<DelegatingHandler>("DefaultMessageHandler"))
{
BaseAddress = apiServerAddress
};
Expand Down
Loading

0 comments on commit b75dd1c

Please sign in to comment.